Back to index

lightning-sunbird  0.9+nobinonly
WebBrowserChrome.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: Mozilla-sample-code 1.0
00003  *
00004  * Copyright (c) 2002 Netscape Communications Corporation and
00005  * other contributors
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this Mozilla sample software and associated documentation files
00009  * (the "Software"), to deal in the Software without restriction, including
00010  * without limitation the rights to use, copy, modify, merge, publish,
00011  * distribute, sublicense, and/or sell copies of the Software, and to permit
00012  * persons to whom the Software is furnished to do so, subject to the
00013  * following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included
00016  * in all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00021  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00022  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00023  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00024  * DEALINGS IN THE SOFTWARE.
00025  *
00026  * Contributor(s):
00027  *
00028  * ***** END LICENSE BLOCK ***** */
00029 
00030 #ifndef __WebBrowserChrome__
00031 #define __WebBrowserChrome__
00032 
00033 #include "nsCOMPtr.h"
00034 #include "nsIGenericFactory.h"
00035 #include "nsString.h"
00036 #include "nsIWebBrowserChrome.h"
00037 #include "nsIWebBrowserChromeFocus.h"
00038 
00039 #include "nsIDocShell.h"
00040 #include "nsIContentViewer.h"
00041 #include "nsIContentViewerFile.h"
00042 #include "nsIBaseWindow.h"
00043 #include "nsIEmbeddingSiteWindow.h"
00044 #include "nsIWebNavigation.h"
00045 #include "nsIWebProgressListener.h"
00046 #include "nsIInterfaceRequestor.h"
00047 #include "nsIInterfaceRequestorUtils.h"
00048 #include "nsIWebBrowser.h"
00049 #include "nsIObserver.h"
00050 #include "nsWeakReference.h"
00051 #include "nsISHistoryListener.h"
00052 #include "nsIContextMenuListener.h"
00053 #include "nsITooltipListener.h"
00054 
00055 class WebBrowserChromeUI
00056 {
00057 public:
00058     static nativeWindow CreateNativeWindow(nsIWebBrowserChrome* chrome);
00059     static void Destroy(nsIWebBrowserChrome* chrome);
00060     static void Destroyed(nsIWebBrowserChrome* chrome);
00061     static void SetFocus(nsIWebBrowserChrome *chrome);
00062     static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText);
00063     static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome);
00064     static void UpdateBusyState(nsIWebBrowserChrome *aChrome, PRBool aBusy);
00065     static void UpdateProgress(nsIWebBrowserChrome *aChrome, PRInt32 aCurrent, PRInt32 aMax);
00066     static void GetResourceStringById(PRInt32 aID, char ** aReturn);
00067     static void ShowContextMenu(nsIWebBrowserChrome *aChrome, PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
00068     static void ShowTooltip(nsIWebBrowserChrome *aChrome, PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText);
00069     static void HideTooltip(nsIWebBrowserChrome *aChrome);
00070     static void ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow);
00071     static void SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight);
00072 };
00073 
00074 class WebBrowserChrome   : public nsIWebBrowserChrome,
00075                            public nsIWebBrowserChromeFocus,
00076                            public nsIWebProgressListener,
00077                            public nsIEmbeddingSiteWindow,
00078                            public nsIInterfaceRequestor,
00079                            public nsISHistoryListener,
00080                            public nsIObserver,
00081                            public nsIContextMenuListener,
00082                            public nsITooltipListener,
00083                            public nsSupportsWeakReference
00084 
00085 {
00086 public:
00087     WebBrowserChrome();
00088     virtual ~WebBrowserChrome();
00089 
00090     NS_DECL_ISUPPORTS
00091     NS_DECL_NSIWEBBROWSERCHROME
00092     NS_DECL_NSIWEBBROWSERCHROMEFOCUS
00093     NS_DECL_NSIWEBPROGRESSLISTENER
00094     NS_DECL_NSIEMBEDDINGSITEWINDOW
00095     NS_DECL_NSIINTERFACEREQUESTOR
00096     NS_DECL_NSISHISTORYLISTENER
00097     NS_DECL_NSIOBSERVER
00098     NS_DECL_NSICONTEXTMENULISTENER
00099     NS_DECL_NSITOOLTIPLISTENER
00100 
00101     nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY,
00102                            nsIWebBrowser **aBrowser);
00103 
00104     void     SetParent(nsIWebBrowserChrome *aParent)
00105                { mDependentParent = aParent; }
00106    
00107 protected:
00108     nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1=0, PRUint32 info2=0);
00109 
00110     void ContentFinishedLoading();
00111 
00112     nativeWindow mNativeWindow;
00113     PRUint32     mChromeFlags;
00114     PRBool       mContinueModalLoop;
00115     PRBool       mSizeSet;
00116 
00117     nsCOMPtr<nsIWebBrowser> mWebBrowser;
00118     nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
00119 };
00120 
00121 #endif /* __WebBrowserChrome__ */