Back to index

lightning-sunbird  0.9+nobinonly
NSBrowserView.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef __nsCocoaBrowserView_h__
00039 #define __nsCocoaBrowserView_h__
00040 
00041 #import <Cocoa/Cocoa.h>
00042 
00043 @class NSBrowserView;
00044 class nsCocoaBrowserListener;
00045 class nsIDOMWindow;
00046 class nsIWebBrowser;
00047 
00048 // Protocol implemented by anyone interested in progress
00049 // related to a BrowserView. A listener should explicitly
00050 // register itself with the view using the addListener
00051 // method.
00052 @protocol NSBrowserListener
00053 - (void)onLoadingStarted;
00054 - (void)onLoadingCompleted:(BOOL)succeeded;
00055 // Invoked regularly as data associated with a page streams
00056 // in. If the total number of bytes expected is unknown,
00057 // maxBytes is -1.
00058 - (void)onProgressChange:(int)currentBytes outOf:(int)maxBytes;
00059 - (void)onLocationChange:(NSURL*)url;
00060 @end
00061 
00062 typedef enum {
00063   NSStatusTypeScript            = 0x0001,
00064   NSStatusTypeScriptDefault     = 0x0002,
00065   NSStatusTypeLink              = 0x0003,
00066 } NSStatusType;
00067 
00068 @protocol NSBrowserContainer
00069 - (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
00070 - (NSString *)title;
00071 - (void)setTitle:(NSString *)title;
00072 // Set the dimensions of our NSView. The container might need to do
00073 // some adjustment, so the view doesn't do it directly.
00074 - (void)sizeBrowserTo:(NSSize)dimensions;
00075 // Create a new browser container window and return the contained view. 
00076 - (NSBrowserView*)createBrowserWindow:(unsigned int)mask;
00077 @end
00078 
00079 enum {
00080   NSLoadFlagsNone                   = 0x0000,
00081   NSLoadFlagsDontPutInHistory       = 0x0010,
00082   NSLoadFlagsReplaceHistoryEntry    = 0x0020,
00083   NSLoadFlagsBypassCacheAndProxy    = 0x0040
00084 }; 
00085 
00086 enum {
00087   NSStopLoadNetwork   = 0x01,
00088   NSStopLoadContent   = 0x02,
00089   NSStopLoadAll       = 0x03  
00090 };
00091 
00092 @interface NSBrowserView : NSView 
00093 {
00094   nsIWebBrowser* _webBrowser;
00095   nsCocoaBrowserListener* _listener;
00096 }
00097 
00098 // NSView overrides
00099 - (id)initWithFrame:(NSRect)frame;
00100 - (void)dealloc;
00101 - (void)setFrame:(NSRect)frameRect;
00102 
00103 // nsIWebBrowser methods
00104 - (void)addListener:(id <NSBrowserListener>)listener;
00105 - (void)removeListener:(id <NSBrowserListener>)listener;
00106 - (void)setContainer:(id <NSBrowserContainer>)container;
00107 - (nsIDOMWindow*)getContentWindow;
00108 
00109 // nsIWebNavigation methods
00110 - (void)loadURI:(NSURL *)url flags:(unsigned int)flags;
00111 - (void)reload:(unsigned int)flags;
00112 - (BOOL)canGoBack;
00113 - (BOOL)canGoForward;
00114 - (void)goBack;
00115 - (void)goForward;
00116 - (void)gotoIndex:(int)index;
00117 - (void)stop:(unsigned int)flags;
00118 - (NSURL*)getCurrentURI;
00119 
00120 - (nsIWebBrowser*)getWebBrowser;
00121 - (void)setWebBrowser:(nsIWebBrowser*)browser;
00122 @end
00123 
00124 #endif // __nsCocoaBrowserView_h__