Back to index

lightning-sunbird  0.9+nobinonly
MfcEmbed.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 // mozembed.h : main header file for the MOZEMBED application
00033 //
00034 
00035 #ifndef _MFCEMBED_H
00036 #define _MFCEMBED_H
00037 
00038 #if _MSC_VER > 1000
00039 #pragma once
00040 #endif // _MSC_VER > 1000
00041 
00042 #ifndef __AFXWIN_H__
00043     #error include 'stdafx.h' before including this file for PCH
00044 #endif
00045 
00046 #include "resource.h"       // main symbols
00047 
00049 // CMfcEmbedApp:
00050 // See mozembed.cpp for the implementation of this class
00051 //
00052 
00053 class CBrowserFrame;
00054 class CProfileMgr;
00055 class nsProfileDirServiceProvider;
00056 
00057 class CMfcEmbedApp : public CWinApp,
00058                      public nsIObserver,
00059                      public nsIWindowCreator,
00060                      public nsSupportsWeakReference
00061 {
00062 public:
00063     CMfcEmbedApp();
00064     
00065     NS_DECL_ISUPPORTS
00066     NS_DECL_NSIOBSERVER
00067     NS_DECL_NSIWINDOWCREATOR
00068 
00069     CBrowserFrame* CreateNewBrowserFrame(PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL, 
00070                             PRInt32 x = -1, PRInt32 y = -1, 
00071                             PRInt32 cx = -1, PRInt32 cy = -1, PRBool bShowWindow = PR_TRUE,
00072                             PRBool bIsEditor=PR_FALSE);
00073     void RemoveFrameFromList(CBrowserFrame* pFrm, BOOL bCloseAppOnLastFrame = TRUE);
00074 
00075     void ShowDebugConsole();
00076     nsresult OverrideComponents();
00077 
00078     // Overrides
00079     // ClassWizard generated virtual function overrides
00080     //{{AFX_VIRTUAL(CMfcEmbedApp)
00081     public:
00082     virtual BOOL InitInstance();
00083     virtual int ExitInstance();
00084     virtual BOOL OnIdle(LONG lCount);
00085     //}}AFX_VIRTUAL
00086 
00087     CObList m_FrameWndLst;
00088 
00089     BOOL m_bChrome;
00090     CString m_strHomePage;
00091     inline BOOL GetHomePage(CString& strHomePage) {
00092         strHomePage = m_strHomePage;
00093         return TRUE;
00094     }
00095 
00096     int m_iStartupPage; //0 = BlankPage, 1 = HomePage
00097     inline int GetStartupPageMode() {
00098         return m_iStartupPage;
00099     }
00100 
00101 // Implementation
00102 
00103 public:
00104     //{{AFX_MSG(CMfcEmbedApp)
00105     afx_msg void OnAppAbout();
00106     afx_msg void OnNewBrowser();
00107     afx_msg void OnNewEditor();
00108     afx_msg void OnManageProfiles();
00109     afx_msg void OnEditPreferences();
00110         // NOTE - the ClassWizard will add and remove member functions here.
00111         //    DO NOT EDIT what you see in these blocks of generated code !
00112     //}}AFX_MSG
00113     DECLARE_MESSAGE_MAP()
00114 
00115 private:
00116     BOOL            InitializeProfiles();
00117     BOOL            CreateHiddenWindow();
00118     nsresult        InitializePrefs();
00119     nsresult        InitializeWindowCreator();
00120     
00121 private:
00122 
00123 #ifdef USE_PROFILES
00124     CProfileMgr     *m_ProfileMgr;
00125 #else
00126     nsProfileDirServiceProvider *m_ProfileDirServiceProvider;
00127 #endif
00128 };
00129 
00130 
00132 
00133 //{{AFX_INSERT_LOCATION}}
00134 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00135 
00136 #endif // _MFCEMBED_H