Back to index

lightning-sunbird  0.9+nobinonly
IBrowserFrameGlue.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: Mozilla-sample-code 1.0
00004  *
00005  * Copyright (c) 2002 Netscape Communications Corporation and
00006  * other contributors
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a
00009  * copy of this Mozilla sample software and associated documentation files
00010  * (the "Software"), to deal in the Software without restriction, including
00011  * without limitation the rights to use, copy, modify, merge, publish,
00012  * distribute, sublicense, and/or sell copies of the Software, and to permit
00013  * persons to whom the Software is furnished to do so, subject to the
00014  * following conditions:
00015  *
00016  * The above copyright notice and this permission notice shall be included
00017  * in all copies or substantial portions of the Software.
00018  *
00019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00020  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00022  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00024  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00025  * DEALINGS IN THE SOFTWARE.
00026  *
00027  * Contributor(s):
00028  *   Chak Nanga <chak@netscape.com>
00029  *
00030  * ***** END LICENSE BLOCK ***** */
00031 
00032 // This interface acts as a glue between the required/optional 
00033 // Gecko embedding interfaces and the actual platform specific
00034 // way of doing things - such as updating a statusbar etc.
00035 //
00036 // For ex, in the mfcembed sample the required interfaces such as 
00037 // IWebBrowserChrome etc. are implemented in a XP way in the
00038 // BrowserImp*.cpp files. However, when they get called to update the
00039 // statusbar etc. they call on this interface to get the actual job
00040 // done. During the BrowserFrame creation some object must implement
00041 // this interface and pass the pointer to it via the Init() member of
00042 // the CBrowserImpl class
00043 
00044 #ifndef _IBROWSERFRAMEGLUE_H
00045 #define _IBROWSERFRAMEGLUE_H
00046 
00047 struct IBrowserFrameGlue {
00048     // Progress Related Methods
00049     virtual void UpdateStatusBarText(const PRUnichar *aMessage) = 0;
00050     virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax) = 0;
00051     virtual void UpdateBusyState(PRBool aBusy) = 0;
00052     virtual void UpdateCurrentURI(nsIURI *aLocation) = 0;
00053     virtual void UpdateSecurityStatus(PRInt32 aState) = 0;
00054 
00055     // BrowserFrame Related Methods
00056     virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask, 
00057                             PRInt32 x, PRInt32 y, 
00058                             PRInt32 cx, PRInt32 cy,
00059                             nsIWebBrowser ** aWebBrowser) = 0;
00060     virtual void DestroyBrowserFrame() = 0;
00061     virtual void GetBrowserFrameTitle(PRUnichar **aTitle) = 0;
00062     virtual void SetBrowserFrameTitle(const PRUnichar *aTitle) = 0;
00063     virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY) = 0;
00064     virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY) = 0;
00065     virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY) = 0;
00066     virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY) = 0;
00067     virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY) = 0;
00068     virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint) = 0;
00069     virtual void ShowBrowserFrame(PRBool aShow) = 0;
00070     virtual void SetFocus() = 0;
00071     virtual void FocusAvailable(PRBool *aFocusAvail) = 0;
00072     virtual void GetBrowserFrameVisibility(PRBool *aVisible) = 0;
00073 
00074     // ContextMenu Related Methods
00075     virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo) = 0;
00076 
00077     // Tooltip methods
00078     virtual void ShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) = 0;
00079     virtual void HideTooltip() = 0;
00080 
00081     virtual HWND GetBrowserFrameNativeWnd() = 0;
00082 };
00083 
00084 #define    NS_DECL_BROWSERFRAMEGLUE    \
00085     public:    \
00086         virtual void UpdateStatusBarText(const PRUnichar *aMessage);    \
00087         virtual void UpdateProgress(PRInt32 aCurrent, PRInt32 aMax);    \
00088         virtual void UpdateBusyState(PRBool aBusy);                        \
00089         virtual void UpdateCurrentURI(nsIURI *aLocation);                \
00090         virtual void UpdateSecurityStatus(PRInt32 aState);              \
00091         virtual PRBool CreateNewBrowserFrame(PRUint32 chromeMask, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, nsIWebBrowser** aWebBrowser);    \
00092         virtual void DestroyBrowserFrame();                            \
00093         virtual void GetBrowserFrameTitle(PRUnichar **aTitle);    \
00094         virtual void SetBrowserFrameTitle(const PRUnichar *aTitle);    \
00095         virtual void GetBrowserFramePosition(PRInt32 *aX, PRInt32 *aY);    \
00096         virtual void SetBrowserFramePosition(PRInt32 aX, PRInt32 aY);    \
00097         virtual void GetBrowserFrameSize(PRInt32 *aCX, PRInt32 *aCY);    \
00098         virtual void SetBrowserFrameSize(PRInt32 aCX, PRInt32 aCY);        \
00099         virtual void GetBrowserFramePositionAndSize(PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY);    \
00100         virtual void SetBrowserFramePositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, PRBool fRepaint);    \
00101         virtual void ShowBrowserFrame(PRBool aShow);                    \
00102         virtual void SetFocus();                                        \
00103         virtual void FocusAvailable(PRBool *aFocusAvail);                \
00104         virtual void GetBrowserFrameVisibility(PRBool *aVisible);        \
00105         virtual void ShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo *aInfo); \
00106         virtual void ShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText); \
00107         virtual void HideTooltip(); \
00108         virtual HWND GetBrowserFrameNativeWnd();
00109         
00110 typedef IBrowserFrameGlue *PBROWSERFRAMEGLUE;
00111 
00112 #endif //_IBROWSERFRAMEGLUE_H