#include "wx/msw/missing.h"
#include "wx/filesys.h"
#include "wx/dynlib.h"
+#include <initguid.h>
+
+/* These GUID definitions are our own implementation to support interfaces
+ * normally in urlmon.h. See include/wx/msw/webview_ie.h
+ */
+
+namespace {
+
+DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
+DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
+
+}
wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE, wxWebView);
m_container = new wxActiveXContainer(this, IID_IWebBrowser2, m_webBrowser);
- SetBackgroundStyle(wxBG_STYLE_PAINT);
- SetDoubleBuffered(true);
LoadURL(url);
return true;
}
}
bool wxWebViewIE::IsBusy() const
-{
+{
if (m_isBusy) return true;
wxVariant out = m_ie.GetProperty("Busy");
VARIANT level;
VariantInit(&level);
V_VT(&level) = VT_EMPTY;
- window->execScript(SysAllocString(javascript), SysAllocString(language), &level);
+ window->execScript(SysAllocString(javascript.wc_str()),
+ SysAllocString(language.wc_str()),
+ &level);
}
document->Release();
}
wxDynamicLibrary urlMon(wxT("urlmon.dll"));
if(urlMon.HasSymbol(wxT("CoInternetGetSession")))
{
- typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD, IInternetSession**, DWORD);
+ typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD, wxIInternetSession**, DWORD);
wxDYNLIB_FUNCTION(CoInternetGetSession_t, CoInternetGetSession, urlMon);
ClassFactory* cf = new ClassFactory(handler);
- IInternetSession* session;
+ wxIInternetSession* session;
HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0);
if(FAILED(res))
{
wxFAIL_MSG("Could not retrive internet session");
}
- HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, handler->GetName(), 0, NULL, 0);
+ HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol,
+ handler->GetName().wc_str(),
+ 0, NULL, 0);
if(FAILED(hr))
{
wxFAIL_MSG("Could not register protocol");
//As we are complete we also add to the history list, but not if the
//page is not the main page, ie it is a subframe
- //We also have to check if we are loading a file:// url, if so we
+ //We also have to check if we are loading a file:// url, if so we
//need to change the comparison as ie passes back a different style
//of url
- if(m_historyEnabled && !m_historyLoadingFromList &&
- (url == GetCurrentURL() ||
- (GetCurrentURL().substr(0, 4) == "file" &&
+ if(m_historyEnabled && !m_historyLoadingFromList &&
+ (url == GetCurrentURL() ||
+ (GetCurrentURL().substr(0, 4) == "file" &&
wxFileSystem::URLToFileName(GetCurrentURL()).GetFullPath() == url)))
{
//If we are not at the end of the list, then erase everything
HRESULT VirtualProtocol::QueryInterface(REFIID riid, void **ppvObject)
{
- if(riid == IID_IUnknown || riid == IID_IInternetProtocolRoot ||
- riid == IID_IInternetProtocol)
+ if(riid == IID_IUnknown || riid == wxIID_IInternetProtocolRoot ||
+ riid == wxIID_IInternetProtocol)
{
- *ppvObject = (IInternetProtocol*)this;
+ *ppvObject = (wxIInternetProtocol*)this;
AddRef();
return S_OK;
}
}
}
-HRESULT VirtualProtocol::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
- IInternetBindInfo *pOIBindInfo, DWORD grfPI,
+HRESULT VirtualProtocol::Start(LPCWSTR szUrl, wxIInternetProtocolSink *pOIProtSink,
+ wxIInternetBindInfo *pOIBindInfo, DWORD grfPI,
HANDLE_PTR dwReserved)
{
wxUnusedVar(szUrl);
wxUnusedVar(grfPI);
wxUnusedVar(dwReserved);
m_protocolSink = pOIProtSink;
-
+
//We get the file itself from the protocol handler
m_file = m_handler->GetFile(szUrl);
//We return the stream length for current and total size as we can always
//read the whole file from the stream
wxFileOffset length = m_file->GetStream()->GetLength();
- m_protocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION |
- BSCF_DATAFULLYAVAILABLE |
- BSCF_LASTDATANOTIFICATION,
+ m_protocolSink->ReportData(wxBSCF_FIRSTDATANOTIFICATION |
+ wxBSCF_DATAFULLYAVAILABLE |
+ wxBSCF_LASTDATANOTIFICATION,
length, length);
- return S_OK;
+ return S_OK;
}
HRESULT VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
//If the file is null we return false to indicte it is finished
- if(!m_file)
+ if(!m_file)
return S_FALSE;
wxStreamError err = m_file->GetStream()->Read(pv, cb).GetLastError();
HRESULT ClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid,
void ** ppvObject)
{
- if (pUnkOuter)
+ if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
VirtualProtocol* vp = new VirtualProtocol(m_handler);
vp->AddRef();
vp->Release();
return hr;
-}
+}
STDMETHODIMP ClassFactory::LockServer(BOOL fLock)
{
return 0;
}
-}
+}
#endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE