encapsulation of Web control in MDI child windows More...
#include <webchild.h>
Public Types | |
typedef IPCtrlWindow < ChildWindow, SIfacePtr < IWebBrowser2 > > | super |
typedef DWebBrowserEvents2Impl | web_super |
Public Member Functions | |
WebChildWindow (HWND hwnd, const WebChildWndInfo &info) | |
void | BeforeNavigate2 (IDispatch *pDisp, const Variant &url, const Variant &flags, const Variant &targetFrameName, const Variant &postData, const Variant &headers, VARIANT_BOOL &cancel) |
void | NavigateComplete2 (IDispatch *pDisp, const Variant &url) |
void | StatusTextChange (const BStr &text) |
void | ProgressChange (long Progress, long ProgressMax) |
void | WindowMove () |
void | WindowResize () |
void | WindowActivate () |
void | PropertyChange (const BStr &Property) |
void | CommandStateChange (long command, bool enable) |
void | DownloadBegin () |
void | NewWindow2 (IDispatch **ppDisp, VARIANT_BOOL &cancel) |
void | TitleChange (const BStr &text) |
void | TitleIconChange (const BStr &text) |
void | FrameBeforeNavigate (const BStr &url, long flags, const BStr &targetFrameName, VARIANT *postData, const BStr &headers, VARIANT_BOOL &cancel) |
void | FrameNavigateComplete (const BStr &url) |
void | FrameNewWindow (const BStr &url, long flags, const BStr &targetFrameName, VARIANT *postData, const BStr &headers, VARIANT_BOOL &processed) |
void | OnQuit () |
void | OnVisible (bool Visible) |
void | OnToolbar (bool Visible) |
void | OnMenubar (bool Visible) |
void | OnStatusbar (bool Visible) |
void | OnFullscreen (bool Visible) |
void | DocumentComplete () |
void | OnTheatermode (bool Visible) |
void | OnAddressbar (bool Visible) |
void | WindowSetResizable (bool Visible) |
void | WindowClosing (VARIANT_BOOL IsChildWindow, VARIANT_BOOL &cancel) |
void | WindowSetLeft (long Left) |
void | WindowSetTop (long Top) |
void | WindowSetWidth (long Width) |
void | WindowSetHeight (long Height) |
void | ClientToHostWindow (long &CX, long &CY) |
void | SetSecureLockIcon (long SecureLockIcon) |
void | FileDownload (Variant &cancel) |
void | NavigateError (IDispatch *pDisp, const Variant &url, const Variant &Frame, const Variant &StatusCode, VARIANT_BOOL &cancel) |
void | PrivacyImpactedStateChange (bool bImpacted) |
Static Public Member Functions | |
static WebChildWindow * | create (const FileChildWndInfo &info) |
Protected Member Functions | |
LRESULT | WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam) |
virtual String | jump_to_int (LPCTSTR url) |
Protected Attributes | |
BrowserNavigator | _navigator |
auto_ptr< EventConnector > | _connector |
encapsulation of Web control in MDI child windows
Definition at line 834 of file webchild.h.
typedef IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2> > WebChildWindow::super |
Reimplemented from DWebBrowserEvents2Impl.
Definition at line 837 of file webchild.h.
Definition at line 838 of file webchild.h.
WebChildWindow::WebChildWindow | ( | HWND | hwnd, |
const WebChildWndInfo & | info | ||
) |
Definition at line 209 of file webchild.cpp.
References _connector, IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >::_control, _navigator, FileChildWndInfo::_path, BrowserNavigator::attach(), and IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >::create_control().
: super(hwnd, info), web_super(_navigator) { // first try to create a web control with MS IE's CLASSID HRESULT hr = create_control(hwnd, CLSID_WebBrowser, IID_IWebBrowser2); // If this failed, try to use Mozilla's web control if (FAILED(hr)) hr = create_control(hwnd, CLSID_MozillaBrowser, IID_IWebBrowser2); if (SUCCEEDED(hr)) { _navigator.attach(_control); _connector = auto_ptr<EventConnector>(new EventConnector(_control, DIID_DWebBrowserEvents2, this)); _control->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); //browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); } }
void WebChildWindow::BeforeNavigate2 | ( | IDispatch * | pDisp, |
const Variant & | url, | ||
const Variant & | flags, | ||
const Variant & | targetFrameName, | ||
const Variant & | postData, | ||
const Variant & | headers, | ||
VARIANT_BOOL & | cancel | ||
) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2IF.
Definition at line 853 of file webchild.h.
{
//String adr = (BStr)url;
}
void WebChildWindow::ClientToHostWindow | ( | long & | CX, |
long & | CY | ||
) | [inline, virtual] |
void WebChildWindow::CommandStateChange | ( | long | command, |
bool | enable | ||
) | [inline, virtual] |
static WebChildWindow* WebChildWindow::create | ( | const FileChildWndInfo & | info ) | [inline, static] |
Definition at line 842 of file webchild.h.
References FileChildWndInfo::_pos, CLASSNAME_CHILDWND, and WINDOW_CREATOR_INFO.
Referenced by create_webchildwindow().
{ ChildWindow* child = ChildWindow::create(info, info._pos.rcNormalPosition, WINDOW_CREATOR_INFO(WebChildWindow,WebChildWndInfo), CLASSNAME_CHILDWND, NULL, info._pos.showCmd==SW_SHOWMAXIMIZED? WS_MAXIMIZE: 0); return static_cast<WebChildWindow*>(child); }
void WebChildWindow::DocumentComplete | ( | ) | [inline, virtual] |
void WebChildWindow::DownloadBegin | ( | ) | [inline, virtual] |
void WebChildWindow::FileDownload | ( | Variant & | cancel ) | [inline, virtual] |
void WebChildWindow::FrameNavigateComplete | ( | const BStr & | url ) | [inline, virtual] |
Implements ChildWindow.
Definition at line 304 of file webchild.cpp.
References _navigator, and BrowserNavigator::goto_url().
{ _navigator.goto_url(url); return url; }
void WebChildWindow::NavigateComplete2 | ( | IDispatch * | pDisp, |
const Variant & | url | ||
) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2Impl.
Definition at line 860 of file webchild.h.
References DWebBrowserEvents2Impl::NavigateComplete2(), and ChildWindow::set_url().
{ web_super::NavigateComplete2(pDisp, url); set_url(String(BStr(url))); }
void WebChildWindow::NewWindow2 | ( | IDispatch ** | ppDisp, |
VARIANT_BOOL & | cancel | ||
) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2IF.
Definition at line 903 of file webchild.h.
{ //*ppDisp = ; //cancel = TRUE; }
void WebChildWindow::OnAddressbar | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnFullscreen | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnMenubar | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnQuit | ( | ) | [inline, virtual] |
void WebChildWindow::OnStatusbar | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnTheatermode | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnToolbar | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::OnVisible | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::PrivacyImpactedStateChange | ( | bool | bImpacted ) | [inline, virtual] |
void WebChildWindow::ProgressChange | ( | long | Progress, |
long | ProgressMax | ||
) | [inline, virtual] |
void WebChildWindow::PropertyChange | ( | const BStr & | Property ) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2IF.
Definition at line 889 of file webchild.h.
References IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >::_control.
void WebChildWindow::SetSecureLockIcon | ( | long | SecureLockIcon ) | [inline, virtual] |
void WebChildWindow::StatusTextChange | ( | const BStr & | text ) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2IF.
Definition at line 867 of file webchild.h.
References ChildWindow::_hwndFrame, ChildWindow::_statusText, and PM_SETSTATUSTEXT.
{ _statusText = text; SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)_statusText.c_str()); }
void WebChildWindow::TitleChange | ( | const BStr & | text ) | [inline, virtual] |
Reimplemented from DWebBrowserEvents2IF.
Definition at line 909 of file webchild.h.
References WindowHandle::_hwnd.
void WebChildWindow::TitleIconChange | ( | const BStr & | text ) | [inline, virtual] |
void WebChildWindow::WindowActivate | ( | ) | [inline, virtual] |
void WebChildWindow::WindowClosing | ( | VARIANT_BOOL | IsChildWindow, |
VARIANT_BOOL & | cancel | ||
) | [inline, virtual] |
void WebChildWindow::WindowMove | ( | ) | [inline, virtual] |
void WebChildWindow::WindowResize | ( | ) | [inline, virtual] |
void WebChildWindow::WindowSetHeight | ( | long | Height ) | [inline, virtual] |
void WebChildWindow::WindowSetLeft | ( | long | Left ) | [inline, virtual] |
void WebChildWindow::WindowSetResizable | ( | bool | Visible ) | [inline, virtual] |
void WebChildWindow::WindowSetTop | ( | long | Top ) | [inline, virtual] |
void WebChildWindow::WindowSetWidth | ( | long | Width ) | [inline, virtual] |
LRESULT WebChildWindow::WndProc | ( | UINT | nmsg, |
WPARAM | wparam, | ||
LPARAM | lparam | ||
) | [protected, virtual] |
Reimplemented from IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >.
Definition at line 230 of file webchild.cpp.
References IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >::_control, WindowHandle::_hwnd, HandleException(), ID_GO_BACK, ID_GO_FORWARD, ID_GO_HOME, ID_GO_SEARCH, ID_GO_UP, ID_REFRESH, ID_STOP, PM_DISPATCH_COMMAND, TEXT, THROW_EXCEPTION, and IPCtrlWindow< ChildWindow, SIfacePtr< IWebBrowser2 > >::WndProc().
{ try { switch(nmsg) { case WM_ERASEBKGND: if (!_control) { HDC hdc = (HDC)wparam; ClientRect rect(_hwnd); HBRUSH hbrush = CreateSolidBrush(RGB(200,200,235)); BkMode mode(hdc, TRANSPARENT); TextColor color(hdc, RGB(200,40,40)); FillRect(hdc, &rect, hbrush); DrawText(hdc, TEXT("Sorry - no web browser control could be loaded."), -1, &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE); DeleteObject(hbrush); } return TRUE; case PM_DISPATCH_COMMAND: { if (!_control) return FALSE; HRESULT hr = E_FAIL; switch(LOWORD(wparam)) { case ID_GO_BACK: hr = _control->GoBack(); break; case ID_GO_FORWARD: hr = _control->GoForward(); break; case ID_GO_UP: ///@todo break; case ID_GO_HOME: hr = _control->GoHome(); break; case ID_GO_SEARCH: hr = _control->GoSearch(); break; case ID_REFRESH: hr = _control->Refresh(); break; case ID_STOP: hr = _control->Stop(); break; default: return super::WndProc(nmsg, wparam, lparam); } if (FAILED(hr) && hr!=E_FAIL) THROW_EXCEPTION(hr); return TRUE;} default: return super::WndProc(nmsg, wparam, lparam); } } catch(COMException& e) { HandleException(e, _hwnd); } return 0; }
auto_ptr<EventConnector> WebChildWindow::_connector [protected] |
Definition at line 1013 of file webchild.h.
Referenced by WebChildWindow().
BrowserNavigator WebChildWindow::_navigator [protected] |
Reimplemented from DWebBrowserEvents2Impl.
Definition at line 1012 of file webchild.h.
Referenced by jump_to_int(), and WebChildWindow().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |