#include <webchild.h>
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 |
Definition at line 506 of file webchild.h.
BrowserNavigator::BrowserNavigator | ( | ) |
Definition at line 119 of file webchild.cpp.
: _browser_initialized(false) { }
void BrowserNavigator::attach | ( | IWebBrowser * | browser ) |
Definition at line 124 of file webchild.cpp.
References _browser.
Referenced by WebChildWindow::WebChildWindow().
{ _browser = browser; }
IWebBrowser* BrowserNavigator::get_browser | ( | ) | [inline] |
Definition at line 515 of file webchild.h.
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); } }
void BrowserNavigator::navigated | ( | LPCTSTR | url ) |
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); } } }
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")); }
SIfacePtr<IWebBrowser> BrowserNavigator::_browser [protected] |
Definition at line 518 of file webchild.h.
Referenced by attach(), goto_url(), and navigated().
bool BrowserNavigator::_browser_initialized [protected] |
Definition at line 521 of file webchild.h.
Referenced by goto_url(), and navigated().
String BrowserNavigator::_new_html_txt [protected] |
Definition at line 520 of file webchild.h.
Referenced by navigated(), and set_html_page().
String BrowserNavigator::_new_url [protected] |
Definition at line 519 of file webchild.h.
Referenced by goto_url(), and navigated().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |