File:  [mozdev] / chimera / NSBrowserView.h
Revision 1.20: download - view: text, annotated - select for diffs - revision graph
Sat Apr 20 00:02:55 2002 UTC (17 years, 7 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Make hidden tabs actually able to work with Gecko (for background tab loading and bookmark groups).  Requires an update of the Mozilla tree.

    1: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    2: /* ***** BEGIN LICENSE BLOCK *****
    3:  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
    4:  *
    5:  * The contents of this file are subject to the Netscape Public License
    6:  * Version 1.1 (the "License"); you may not use this file except in
    7:  * compliance with the License. You may obtain a copy of the License at
    8:  * http://www.mozilla.org/NPL/
    9:  *
   10:  * Software distributed under the License is distributed on an "AS IS" basis,
   11:  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   12:  * for the specific language governing rights and limitations under the
   13:  * License.
   14:  *
   15:  * The Original Code is mozilla.org code.
   16:  *
   17:  * The Initial Developer of the Original Code is 
   18:  * Netscape Communications Corporation.
   19:  * Portions created by the Initial Developer are Copyright (C) 1998
   20:  * the Initial Developer. All Rights Reserved.
   21:  *
   22:  * Contributor(s):
   23:  *
   24:  * Alternatively, the contents of this file may be used under the terms of
   25:  * either the GNU General Public License Version 2 or later (the "GPL"), or 
   26:  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   27:  * in which case the provisions of the GPL or the LGPL are applicable instead
   28:  * of those above. If you wish to allow use of your version of this file only
   29:  * under the terms of either the GPL or the LGPL, and not to allow others to
   30:  * use your version of this file under the terms of the NPL, indicate your
   31:  * decision by deleting the provisions above and replace them with the notice
   32:  * and other provisions required by the GPL or the LGPL. If you do not delete
   33:  * the provisions above, a recipient may use your version of this file under
   34:  * the terms of any one of the NPL, the GPL or the LGPL.
   35:  *
   36:  * ***** END LICENSE BLOCK ***** */
   37: 
   38: #ifndef __nsCocoaBrowserView_h__
   39: #define __nsCocoaBrowserView_h__
   40: 
   41: #undef DARWIN
   42: #import <Cocoa/Cocoa.h>
   43: 
   44: @class NSBrowserView;
   45: class nsCocoaBrowserListener;
   46: class nsIDOMWindow;
   47: class nsIWebBrowser;
   48: class nsIDOMNode;
   49: class nsIDOMEvent;
   50: class nsIWebBrowserFind;
   51: 
   52: // Protocol implemented by anyone interested in progress
   53: // related to a BrowserView. A listener should explicitly
   54: // register itself with the view using the addListener
   55: // method.
   56: @protocol NSBrowserListener
   57: - (void)onLoadingStarted;
   58: - (void)onLoadingCompleted:(BOOL)succeeded;
   59: // Invoked regularly as data associated with a page streams
   60: // in. If the total number of bytes expected is unknown,
   61: // maxBytes is -1.
   62: - (void)onProgressChange:(int)currentBytes outOf:(int)maxBytes;
   63: - (void)onLocationChange:(NSURL*)url;
   64: - (void)onStatusChange:(NSString*)aMessage;
   65: // Called when a context menu should be shown.
   66: - (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
   67: @end
   68: 
   69: typedef enum {
   70:   NSStatusTypeScript            = 0x0001,
   71:   NSStatusTypeScriptDefault     = 0x0002,
   72:   NSStatusTypeLink              = 0x0003,
   73: } NSStatusType;
   74: 
   75: @protocol NSBrowserContainer
   76: - (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
   77: - (NSString *)title;
   78: - (void)setTitle:(NSString *)title;
   79: // Set the dimensions of our NSView. The container might need to do
   80: // some adjustment, so the view doesn't do it directly.
   81: - (void)sizeBrowserTo:(NSSize)dimensions;
   82: // Create a new browser container window and return the contained view. 
   83: - (NSBrowserView*)createBrowserWindow:(unsigned int)mask;
   84: @end
   85: 
   86: enum {
   87:   NSLoadFlagsNone                   = 0x0000,
   88:   NSLoadFlagsDontPutInHistory       = 0x0010,
   89:   NSLoadFlagsReplaceHistoryEntry    = 0x0020,
   90:   NSLoadFlagsBypassCacheAndProxy    = 0x0040
   91: }; 
   92: 
   93: enum {
   94:   NSStopLoadNetwork   = 0x01,
   95:   NSStopLoadContent   = 0x02,
   96:   NSStopLoadAll       = 0x03  
   97: };
   98: 
   99: @interface NSBrowserView : NSView 
  100: {
  101:   nsIWebBrowser* _webBrowser;
  102:   nsCocoaBrowserListener* _listener;
  103:   NSWindow* mWindow;
  104: }
  105: 
  106: // NSView overrides
  107: - (id)initWithFrame:(NSRect)frame;
  108: - (id)initWithFrame:(NSRect)frame andWindow:(NSWindow*)aWindow;
  109: 
  110: - (void)dealloc;
  111: - (void)setFrame:(NSRect)frameRect;
  112: 
  113: // nsIWebBrowser methods
  114: - (void)addListener:(id <NSBrowserListener>)listener;
  115: - (void)removeListener:(id <NSBrowserListener>)listener;
  116: - (void)setContainer:(id <NSBrowserContainer>)container;
  117: - (nsIDOMWindow*)getContentWindow;
  118: 
  119: // nsIWebNavigation methods
  120: - (void)loadURI:(NSURL *)url flags:(unsigned int)flags;
  121: - (void)reload:(unsigned int)flags;
  122: - (BOOL)canGoBack;
  123: - (BOOL)canGoForward;
  124: - (void)goBack;
  125: - (void)goForward;
  126: - (void)gotoIndex:(int)index;
  127: - (void)stop:(unsigned int)flags;
  128: - (NSURL*)getCurrentURI;
  129: 
  130: - (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
  131: - (void)saveURL: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
  132:             url: (NSURL*)aURL suggestedFilename: (NSString*)aFilename;
  133: 
  134: - (void)printDocument;
  135: 
  136: - (BOOL)findInPage:(NSString*)inText;
  137: 
  138: -(IBAction)cut:(id)aSender;
  139: -(IBAction)copy:(id)aSender;
  140: -(IBAction)paste:(id)aSender;
  141: -(IBAction)clear:(id)aSender;
  142: -(IBAction)selectAll:(id)aSender;
  143: -(IBAction)undo:(id)aSender;
  144: 
  145: -(NSString*)getCurrentURLSpec;
  146: 
  147: - (void)setActive: (BOOL)aIsActive;
  148: 
  149: - (NSMenu*)getContextMenu;
  150: - (NSWindow*)getNativeWindow;
  151: 
  152: - (void)destroyWebBrowser;
  153: - (nsIWebBrowser*)getWebBrowser;
  154: - (nsCocoaBrowserListener*)getCocoaBrowserListener;
  155: - (void)setWebBrowser:(nsIWebBrowser*)browser;
  156: @end
  157: 
  158: #endif // __nsCocoaBrowserView_h__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>