File:  [mozdev] / chimera / NSBrowserView.h
Revision 1.9: download - view: text, annotated - select for diffs - revision graph
Sun Feb 10 01:12:05 2002 UTC (18 years, 3 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
The status bar is hooked up now.  Also adding debugging printfs.

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

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