Public Member Functions | Protected Attributes

BrowserNavigator Struct Reference

#include <webchild.h>

Collaboration diagram for BrowserNavigator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BrowserNavigator ()
void attach (IWebBrowser *browser)
void goto_url (LPCTSTR url)
void set_html_page (const String &html_txt)
void navigated (LPCTSTR url)
IWebBrowser * get_browser ()

Protected Attributes

SIfacePtr< IWebBrowser > _browser
String _new_url
String _new_html_txt
bool _browser_initialized

Detailed Description

Definition at line 506 of file webchild.h.


Constructor & Destructor Documentation

BrowserNavigator::BrowserNavigator (  )

Definition at line 119 of file webchild.cpp.

 :  _browser_initialized(false)
{
}

Member Function Documentation

void BrowserNavigator::attach ( IWebBrowser *  browser )

Definition at line 124 of file webchild.cpp.

References _browser.

Referenced by WebChildWindow::WebChildWindow().

{
    _browser = browser;
}

Here is the caller graph for this function:

IWebBrowser* BrowserNavigator::get_browser (  ) [inline]

Definition at line 515 of file webchild.h.

{return _browser.get();}
void BrowserNavigator::goto_url ( LPCTSTR  url )

Definition at line 129 of file webchild.cpp.

References _browser, _browser_initialized, and _new_url.

Referenced by WebChildWindow::jump_to_int(), and set_html_page().

{
    if (_browser_initialized)
        _browser->Navigate(BStr(url), NULL, NULL, NULL, NULL);
    else {
        _new_url = url;

        _browser->Navigate(BStr(L"about:blank"), NULL, NULL, NULL, NULL);
    }
}

Here is the caller graph for this function:

void BrowserNavigator::navigated ( LPCTSTR  url )

Todo:
move this into DocumentComplete() ?

Definition at line 153 of file webchild.cpp.

References _browser, _browser_initialized, _new_html_txt, _new_url, SIfacePtr< T >::QueryInterface(), T2nA_binary(), and TEXT.

{
    _browser_initialized = true;

    bool nav = false;

    if (!_new_url.empty()) {
        if (!_tcscmp(url,TEXT("about:blank")) && _new_url!=TEXT("about:blank")) {
            _browser->Navigate(BStr(_new_url), NULL, NULL, NULL, NULL);
            ++nav;
        }

        _new_url.erase();
    }

    if (!nav && !_new_html_txt.empty()) {   ///@todo move this into DocumentComplete() ?
        int len = _new_html_txt.length();
        HGLOBAL hHtmlText = GlobalAlloc(GPTR, len);

        if (!hHtmlText) {
            T2nA_binary(_new_html_txt, (char*)hHtmlText, len);
            _new_html_txt.erase();

            SIfacePtr<IStream> pStream;
            HRESULT hr = CreateStreamOnHGlobal(hHtmlText, TRUE, &pStream);

            if (SUCCEEDED(hr)) {
                SIfacePtr<IDispatch> pHtmlDoc;
                CheckError(_browser->get_Document(&pHtmlDoc));

                SIfacePtr<IPersistStreamInit> pPersistStreamInit;
                pHtmlDoc.QueryInterface(IID_IPersistStreamInit, &pPersistStreamInit);

                CheckError(pPersistStreamInit->InitNew());
                CheckError(pPersistStreamInit->Load(pStream));
            } else
                GlobalFree(hHtmlText);
        }
    }
}

Here is the call graph for this function:

void BrowserNavigator::set_html_page ( const String html_txt )

Definition at line 140 of file webchild.cpp.

References _new_html_txt, goto_url(), and TEXT.

{
    _new_html_txt = html_txt;

    goto_url(TEXT("about:blank"));
}

Here is the call graph for this function:


Member Data Documentation

SIfacePtr<IWebBrowser> BrowserNavigator::_browser [protected]

Definition at line 518 of file webchild.h.

Referenced by attach(), goto_url(), and navigated().

Definition at line 521 of file webchild.h.

Referenced by goto_url(), and navigated().

Definition at line 520 of file webchild.h.

Referenced by navigated(), and set_html_page().

Definition at line 519 of file webchild.h.

Referenced by goto_url(), and navigated().


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