File:  [mozdev] / chimera / NSBrowserView.h
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Wed Apr 10 07:46:37 2002 UTC (18 years, 2 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Adding context menus to the NIB.

    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: 
   51: // Protocol implemented by anyone interested in progress
   52: // related to a BrowserView. A listener should explicitly
   53: // register itself with the view using the addListener
   54: // method.
   55: @protocol NSBrowserListener
   56: - (void)onLoadingStarted;
   57: - (void)onLoadingCompleted:(BOOL)succeeded;
   58: // Invoked regularly as data associated with a page streams
   59: // in. If the total number of bytes expected is unknown,
   60: // maxBytes is -1.
   61: - (void)onProgressChange:(int)currentBytes outOf:(int)maxBytes;
   62: - (void)onLocationChange:(NSURL*)url;
   63: - (void)onStatusChange:(NSString*)aMessage;
   64: // Called when a context menu should be shown.
   65: - (void)onShowContextMenu:(int)flags domEvent:(nsIDOMEvent*)aEvent domNode:(nsIDOMNode*)aNode;
   66: @end
   67: 
   68: typedef enum {
   69:   NSStatusTypeScript            = 0x0001,
   70:   NSStatusTypeScriptDefault     = 0x0002,
   71:   NSStatusTypeLink              = 0x0003,
   72: } NSStatusType;
   73: 
   74: @protocol NSBrowserContainer
   75: - (void)setStatus:(NSString *)statusString ofType:(NSStatusType)type;
   76: - (NSString *)title;
   77: - (void)setTitle:(NSString *)title;
   78: // Set the dimensions of our NSView. The container might need to do
   79: // some adjustment, so the view doesn't do it directly.
   80: - (void)sizeBrowserTo:(NSSize)dimensions;
   81: // Create a new browser container window and return the contained view. 
   82: - (NSBrowserView*)createBrowserWindow:(unsigned int)mask;
   83: @end
   84: 
   85: enum {
   86:   NSLoadFlagsNone                   = 0x0000,
   87:   NSLoadFlagsDontPutInHistory       = 0x0010,
   88:   NSLoadFlagsReplaceHistoryEntry    = 0x0020,
   89:   NSLoadFlagsBypassCacheAndProxy    = 0x0040
   90: }; 
   91: 
   92: enum {
   93:   NSStopLoadNetwork   = 0x01,
   94:   NSStopLoadContent   = 0x02,
   95:   NSStopLoadAll       = 0x03  
   96: };
   97: 
   98: @interface NSBrowserView : NSView 
   99: {
  100:   nsIWebBrowser* _webBrowser;
  101:   nsCocoaBrowserListener* _listener;
  102: }
  103: 
  104: // NSView overrides
  105: - (id)initWithFrame:(NSRect)frame;
  106: - (void)dealloc;
  107: - (void)setFrame:(NSRect)frameRect;
  108: 
  109: // nsIWebBrowser methods
  110: - (void)addListener:(id <NSBrowserListener>)listener;
  111: - (void)removeListener:(id <NSBrowserListener>)listener;
  112: - (void)setContainer:(id <NSBrowserContainer>)container;
  113: - (nsIDOMWindow*)getContentWindow;
  114: 
  115: // nsIWebNavigation methods
  116: - (void)loadURI:(NSURL *)url flags:(unsigned int)flags;
  117: - (void)reload:(unsigned int)flags;
  118: - (BOOL)canGoBack;
  119: - (BOOL)canGoForward;
  120: - (void)goBack;
  121: - (void)goForward;
  122: - (void)gotoIndex:(int)index;
  123: - (void)stop:(unsigned int)flags;
  124: - (NSURL*)getCurrentURI;
  125: 
  126: - (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList;
  127: - (void)printDocument;
  128: 
  129: - (void)findInPage:(NSString*)inText;
  130: - (void)findAgain;
  131: 
  132: -(IBAction)cut:(id)aSender;
  133: -(IBAction)copy:(id)aSender;
  134: -(IBAction)paste:(id)aSender;
  135: -(IBAction)clear:(id)aSender;
  136: -(IBAction)selectAll:(id)aSender;
  137: -(IBAction)undo:(id)aSender;
  138: 
  139: -(NSString*)getCurrentURLSpec;
  140: 
  141: - (void)setActive: (BOOL)aIsActive;
  142: 
  143: - (void)destroyWebBrowser;
  144: - (nsIWebBrowser*)getWebBrowser;
  145: - (nsCocoaBrowserListener*)getCocoaBrowserListener;
  146: - (void)setWebBrowser:(nsIWebBrowser*)browser;
  147: @end
  148: 
  149: #endif // __nsCocoaBrowserView_h__

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