Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

HtmlFrm.h

Go to the documentation of this file.
00001 /* QuestDesigner - Open Zelda's Project
00002    Copyright (C) 2003 Kronuz
00003    Copyright (C) 2001/2003 Open Zelda's Project
00004  
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00020 
00025 #pragma once
00026 
00027 #ifndef __WTL_TABBED_FRAME_H__
00028     #error HtmlFrame.h requires TabbedFrame.h to be included first
00029 #endif
00030 
00031 #include <ExDispid.h>
00032 
00033 #include "ChildFrm.h"
00034 #include "HtmlView.h"
00035 
00037 // Forward declarations
00038 class CMainFrame;
00039 
00040 static _ATL_FUNC_INFO TitleChangeInfo = {CC_STDCALL, VT_EMPTY, 1, { VT_BSTR } };
00041 static _ATL_FUNC_INFO NavigateComplete2Info = {CC_STDCALL, VT_EMPTY, 2, { VT_DISPATCH, (VT_BYREF | VT_VARIANT)}};
00042 static _ATL_FUNC_INFO DocumentCompleteInfo = {CC_STDCALL, VT_EMPTY, 2, { VT_DISPATCH, (VT_BYREF | VT_VARIANT) } };
00043 
00045 // This class manages the HTML browser frame (for the help files)
00046 class CHtmlFrame :
00047     public CChildFrame,
00048     public IDispEventSimpleImpl<0, CHtmlFrame, &DIID_DWebBrowserEvents2>
00049 {
00050 protected:
00051 public:
00052     DECLARE_FRAME_WND_CLASS(NULL, IDR_MDICHILD)
00053 
00054     // The windows view (the child control)
00055     CHtmlView *m_pHtmlView;
00056 
00057     CComPtr<IUnknown> m_punkBrowser;
00058 
00059     // Construction/Destruction:
00060     CHtmlFrame(CMainFrame *pMainFrame);
00061     virtual void OnFinalMessage(HWND /*hWnd*/);
00062 
00063     void SetCommandBarCtrlForContextMenu(CTabbedMDICommandBarCtrl* pCmdBar);
00064 
00065     BEGIN_MSG_MAP(CHtmlFrame)
00066         MESSAGE_HANDLER(WM_CREATE, OnCreate)
00067         MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
00068         MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg)
00069         MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange)
00070 
00071         MESSAGE_HANDLER(UWM_MDICHILDSHOWTABCONTEXTMENU, OnShowTabContextMenu)
00072 
00073         COMMAND_ID_HANDLER(ID_FILE_SAVE, OnFileSave)
00074         COMMAND_ID_HANDLER(ID_FILE_CLOSE, OnFileClose)
00075 
00076         CHAIN_MSG_MAP(CChildFrame)
00077         // Pass all unhandled WM_COMMAND messages to the client window or 'view'
00078         CHAIN_CLIENT_COMMANDS ()
00079         // Reflect all the WM_NOTIFY messages to the client window
00080         REFLECT_NOTIFICATIONS()
00081 
00082     END_MSG_MAP()
00083 
00084 // Handler prototypes (uncomment arguments if needed):
00085 //  LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
00086 //  LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
00087 //  LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
00088 
00089     LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00090     LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
00091     LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
00092     LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
00093 
00094     // Return the window's child control
00095     CHtmlView* GetView() { return m_pHtmlView; }
00096     // Return the main frame
00097     CMainFrame* GetMainFrame() { return m_pMainFrame; }
00098 
00099     LRESULT OnShowTabContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled);
00100     LRESULT OnFileSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
00101     LRESULT OnFileClose(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
00102 
00103 public:
00104     BEGIN_SINK_MAP(CHtmlFrame)
00105         SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_TITLECHANGE, OnTitleChange, &TitleChangeInfo)
00106         SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, OnNavigateComplete2, &NavigateComplete2Info)
00107         SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete, &DocumentCompleteInfo)
00108     END_SINK_MAP()
00109 
00110     void __stdcall OnTitleChange(BSTR sTitle);
00111     void __stdcall OnNavigateComplete2(IDispatch* pDisp, VARIANT* vtURL);
00112     void __stdcall OnDocumentComplete(IDispatch* pDisp, VARIANT* vtURL);
00113 };

Generated on Wed Apr 16 19:12:22 2003 for QuestDesigner by doxygen1.2.18