Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

WebChildWindow Struct Reference

encapsulation of Web control in MDI child windows More...

#include <webchild.h>

Inheritance diagram for WebChildWindow:
Inheritance graph
[legend]
Collaboration diagram for WebChildWindow:
Collaboration graph
[legend]

List of all members.

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 WebChildWindowcreate (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

Detailed Description

encapsulation of Web control in MDI child windows

Definition at line 834 of file webchild.h.


Member Typedef Documentation

Reimplemented from DWebBrowserEvents2Impl.

Definition at line 837 of file webchild.h.

Definition at line 838 of file webchild.h.


Constructor & Destructor Documentation

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);
    }
}

Here is the call graph for this function:


Member Function Documentation

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]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 990 of file webchild.h.

    {
    }
void WebChildWindow::CommandStateChange ( long  command,
bool  enable 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 895 of file webchild.h.

    {
    }
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);
    }

Here is the caller graph for this function:

void WebChildWindow::DocumentComplete (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 954 of file webchild.h.

    {
    }
void WebChildWindow::DownloadBegin (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 899 of file webchild.h.

    {
    }
void WebChildWindow::FileDownload ( Variant cancel ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 998 of file webchild.h.

    {
    }
void WebChildWindow::FrameBeforeNavigate ( const BStr url,
long  flags,
const BStr targetFrameName,
VARIANT postData,
const BStr headers,
VARIANT_BOOL &  cancel 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 918 of file webchild.h.

    {
    }
void WebChildWindow::FrameNavigateComplete ( const BStr url ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 922 of file webchild.h.

    {
    }
void WebChildWindow::FrameNewWindow ( const BStr url,
long  flags,
const BStr targetFrameName,
VARIANT postData,
const BStr headers,
VARIANT_BOOL &  processed 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 926 of file webchild.h.

    {
    }
String WebChildWindow::jump_to_int ( LPCTSTR  url ) [protected, virtual]

Implements ChildWindow.

Definition at line 304 of file webchild.cpp.

References _navigator, and BrowserNavigator::goto_url().

{
    _navigator.goto_url(url);

    return url;
}

Here is the call graph for this function:

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)));
    }

Here is the call graph for this function:

void WebChildWindow::NavigateError ( IDispatch *  pDisp,
const Variant url,
const Variant Frame,
const Variant StatusCode,
VARIANT_BOOL &  cancel 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 1002 of file webchild.h.

    {
    }
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]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 962 of file webchild.h.

    {
    }
void WebChildWindow::OnFullscreen ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 950 of file webchild.h.

    {
    }
void WebChildWindow::OnMenubar ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 942 of file webchild.h.

    {
    }
void WebChildWindow::OnQuit (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 930 of file webchild.h.

    {
    }
void WebChildWindow::OnStatusbar ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 946 of file webchild.h.

    {
    }
void WebChildWindow::OnTheatermode ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 958 of file webchild.h.

    {
    }
void WebChildWindow::OnToolbar ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 938 of file webchild.h.

    {
    }
void WebChildWindow::OnVisible ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 934 of file webchild.h.

    {
    }
void WebChildWindow::PrivacyImpactedStateChange ( bool  bImpacted ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 1006 of file webchild.h.

    {
    }
void WebChildWindow::ProgressChange ( long  Progress,
long  ProgressMax 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 873 of file webchild.h.

    {
    }
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.

    {
        Variant value;
        _control->GetProperty(Property, &value);
    }
void WebChildWindow::SetSecureLockIcon ( long  SecureLockIcon ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 994 of file webchild.h.

    {
    }
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.

    {
        SetWindowText(_hwnd, String(text));
    }
void WebChildWindow::TitleIconChange ( const BStr text ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 914 of file webchild.h.

    {
    }
void WebChildWindow::WindowActivate (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 885 of file webchild.h.

    {
    }
void WebChildWindow::WindowClosing ( VARIANT_BOOL  IsChildWindow,
VARIANT_BOOL &  cancel 
) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 970 of file webchild.h.

    {
    }
void WebChildWindow::WindowMove (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 877 of file webchild.h.

    {
    }
void WebChildWindow::WindowResize (  ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 881 of file webchild.h.

    {
    }
void WebChildWindow::WindowSetHeight ( long  Height ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 986 of file webchild.h.

    {
    }
void WebChildWindow::WindowSetLeft ( long  Left ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 974 of file webchild.h.

    {
    }
void WebChildWindow::WindowSetResizable ( bool  Visible ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 966 of file webchild.h.

    {
    }
void WebChildWindow::WindowSetTop ( long  Top ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 978 of file webchild.h.

    {
    }
void WebChildWindow::WindowSetWidth ( long  Width ) [inline, virtual]

Reimplemented from DWebBrowserEvents2IF.

Definition at line 982 of file webchild.h.

    {
    }
LRESULT WebChildWindow::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Todo:

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;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 1013 of file webchild.h.

Referenced by WebChildWindow().

Reimplemented from DWebBrowserEvents2Impl.

Definition at line 1012 of file webchild.h.

Referenced by jump_to_int(), and WebChildWindow().


The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage