Added wxIEHtmlWin wrappers to wxPython.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -134,6 +134,8 @@ Fixed a boatload of reference leaks.
|
|||||||
Added a demo of using a sizer in a wxScrolledWindow, in effect
|
Added a demo of using a sizer in a wxScrolledWindow, in effect
|
||||||
creating a ScrolledPanel.
|
creating a ScrolledPanel.
|
||||||
|
|
||||||
|
Added wxIEHtmlWin.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -186,6 +186,13 @@ include contrib/gizmos/contrib/src/gizmos/*.cpp
|
|||||||
include contrib/gizmos/contrib/src/gizmos/*.xpm
|
include contrib/gizmos/contrib/src/gizmos/*.xpm
|
||||||
include contrib/gizmos/contrib/src/gizmos/*.txt
|
include contrib/gizmos/contrib/src/gizmos/*.txt
|
||||||
|
|
||||||
|
include contrib/iewin/*.txt
|
||||||
|
include contrib/iewin/*.i
|
||||||
|
include contrib/iewin/*.py
|
||||||
|
include contrib/iewin/*.cpp
|
||||||
|
include contrib/iewin/*.c
|
||||||
|
include contrib/iewin/*.h
|
||||||
|
|
||||||
include contrib/dllwidget/*.txt
|
include contrib/dllwidget/*.txt
|
||||||
include contrib/dllwidget/*.i
|
include contrib/dllwidget/*.i
|
||||||
include contrib/dllwidget/*.py
|
include contrib/dllwidget/*.py
|
||||||
|
515
wxPython/contrib/iewin/IEHtmlWin.cpp
Normal file
515
wxPython/contrib/iewin/IEHtmlWin.cpp
Normal file
@@ -0,0 +1,515 @@
|
|||||||
|
#include "IEHtmlWin.h"
|
||||||
|
#include <wx/strconv.h>
|
||||||
|
#include <wx/event.h>
|
||||||
|
#include <wx/listctrl.h>
|
||||||
|
#include <oleidl.h>
|
||||||
|
#include <winerror.h>
|
||||||
|
#include <exdispid.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <olectl.h>
|
||||||
|
#include <Mshtml.h>
|
||||||
|
#include <sstream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_NEWWINDOW2);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_TITLECHANGE);
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxMSHTMLEvent, wxNotifyEvent);
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
BEGIN_EVENT_TABLE(wxIEHtmlWin, wxActiveX)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
class FS_DWebBrowserEvents2 : public IDispatch
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
DECLARE_OLE_UNKNOWN(FS_DWebBrowserEvents2);
|
||||||
|
|
||||||
|
|
||||||
|
wxIEHtmlWin *m_iewin;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
|
||||||
|
~FS_DWebBrowserEvents2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//IDispatch
|
||||||
|
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Post(WXTYPE etype, wxString text, long l1 = 0, long l2 = 0)
|
||||||
|
{
|
||||||
|
if (! m_iewin || ! m_iewin->GetParent())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxMSHTMLEvent event;
|
||||||
|
event.SetId(m_iewin->GetId());
|
||||||
|
event.SetEventType(etype);
|
||||||
|
event.m_text1 = text;
|
||||||
|
event.m_long1 = l1;
|
||||||
|
event.m_long2 = l2;
|
||||||
|
|
||||||
|
m_iewin->GetParent()->AddPendingEvent(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Process(WXTYPE etype, wxString text = "", long l1 = 0, long l2 = 0)
|
||||||
|
{
|
||||||
|
if (! m_iewin || ! m_iewin->GetParent())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
wxMSHTMLEvent event;
|
||||||
|
event.SetId(m_iewin->GetId());
|
||||||
|
event.SetEventType(etype);
|
||||||
|
event.m_text1 = text;
|
||||||
|
event.m_long1 = l1;
|
||||||
|
event.m_long2 = l2;
|
||||||
|
|
||||||
|
m_iewin->GetParent()->ProcessEvent(event);
|
||||||
|
|
||||||
|
return event.IsAllowed();
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString GetStrArg(VARIANT& v)
|
||||||
|
{
|
||||||
|
VARTYPE vt = v.vt & ~VT_BYREF;
|
||||||
|
|
||||||
|
if (vt == VT_VARIANT)
|
||||||
|
return GetStrArg(*v.pvarVal);
|
||||||
|
else if (vt == VT_BSTR)
|
||||||
|
{
|
||||||
|
if (v.vt & VT_BYREF)
|
||||||
|
return (v.pbstrVal ? *v.pbstrVal : L"");
|
||||||
|
else
|
||||||
|
return v.bstrVal;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
#define STR_ARG(arg) GetStrArg(pDispParams->rgvarg[arg])
|
||||||
|
|
||||||
|
#define LONG_ARG(arg)\
|
||||||
|
(pDispParams->rgvarg[arg].lVal)
|
||||||
|
|
||||||
|
|
||||||
|
STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||||
|
WORD wFlags, DISPPARAMS * pDispParams,
|
||||||
|
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
||||||
|
unsigned int * puArgErr)
|
||||||
|
{
|
||||||
|
if (wFlags & DISPATCH_PROPERTYGET)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
|
switch (dispIdMember)
|
||||||
|
{
|
||||||
|
case DISPID_BEFORENAVIGATE2:
|
||||||
|
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
|
||||||
|
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||||
|
else
|
||||||
|
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISPID_NEWWINDOW2:
|
||||||
|
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
|
||||||
|
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||||
|
else
|
||||||
|
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISPID_PROGRESSCHANGE:
|
||||||
|
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, "", LONG_ARG(1), LONG_ARG(0));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISPID_DOCUMENTCOMPLETE:
|
||||||
|
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISPID_STATUSTEXTCHANGE:
|
||||||
|
Post(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, STR_ARG(0));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DISPID_TITLECHANGE:
|
||||||
|
Post(wxEVT_COMMAND_MSHTML_TITLECHANGE, STR_ARG(0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef STR_ARG
|
||||||
|
|
||||||
|
DEFINE_OLE_TABLE(FS_DWebBrowserEvents2)
|
||||||
|
OLE_IINTERFACE(IUnknown)
|
||||||
|
OLE_INTERFACE(DIID_DWebBrowserEvents2, DWebBrowserEvents2)
|
||||||
|
END_OLE_TABLE;
|
||||||
|
|
||||||
|
|
||||||
|
static const CLSID CLSID_MozillaBrowser =
|
||||||
|
{ 0x1339B54C, 0x3453, 0x11D2,
|
||||||
|
{ 0x93, 0xB9, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00 } };
|
||||||
|
|
||||||
|
|
||||||
|
//#define PROGID L"Shell.Explorer"
|
||||||
|
#define PROGID CLSID_WebBrowser
|
||||||
|
//#define PROGID CLSID_HTMLDocument
|
||||||
|
//#define PROGID L"MSCAL.Calendar"
|
||||||
|
//#define PROGID L"WordPad.Document.1"
|
||||||
|
//#define PROGID L"SoftwareFX.ChartFX.20"
|
||||||
|
|
||||||
|
|
||||||
|
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id)
|
||||||
|
: wxActiveX(parent, PROGID, id)
|
||||||
|
{
|
||||||
|
SetupBrowser();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxIEHtmlWin::~wxIEHtmlWin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxIEHtmlWin::SetupBrowser()
|
||||||
|
{
|
||||||
|
HRESULT hret;
|
||||||
|
|
||||||
|
// Get IWebBrowser2 Interface
|
||||||
|
hret = m_webBrowser.QueryInterface(IID_IWebBrowser2, m_ActiveX);
|
||||||
|
assert(SUCCEEDED(hret));
|
||||||
|
|
||||||
|
// Web Browser Events
|
||||||
|
FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(this);
|
||||||
|
hret = ConnectAdvise(DIID_DWebBrowserEvents2, events);
|
||||||
|
if (! SUCCEEDED(hret))
|
||||||
|
delete events;
|
||||||
|
|
||||||
|
// web browser setup
|
||||||
|
m_webBrowser->put_MenuBar(VARIANT_FALSE);
|
||||||
|
m_webBrowser->put_AddressBar(VARIANT_FALSE);
|
||||||
|
m_webBrowser->put_StatusBar(VARIANT_FALSE);
|
||||||
|
m_webBrowser->put_ToolBar(VARIANT_FALSE);
|
||||||
|
|
||||||
|
m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
|
||||||
|
m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
|
||||||
|
|
||||||
|
m_webBrowser->Navigate( L"about:blank", NULL, NULL, NULL, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxIEHtmlWin::SetEditMode(bool seton)
|
||||||
|
{
|
||||||
|
m_bAmbientUserMode = ! seton;
|
||||||
|
AmbientPropertyChanged(DISPID_AMBIENT_USERMODE);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GetEditMode()
|
||||||
|
{
|
||||||
|
return ! m_bAmbientUserMode;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void wxIEHtmlWin::SetCharset(wxString charset)
|
||||||
|
{
|
||||||
|
// HTML Document ?
|
||||||
|
IDispatch *pDisp = NULL;
|
||||||
|
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||||
|
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||||
|
|
||||||
|
if (disp.Ok())
|
||||||
|
{
|
||||||
|
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
|
||||||
|
if (doc.Ok())
|
||||||
|
doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class IStreamAdaptorBase : public IStream
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
DECLARE_OLE_UNKNOWN(IStreamAdaptorBase);
|
||||||
|
|
||||||
|
public:
|
||||||
|
IStreamAdaptorBase() {}
|
||||||
|
virtual ~IStreamAdaptorBase() {}
|
||||||
|
|
||||||
|
// ISequentialStream
|
||||||
|
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead) = 0;
|
||||||
|
HRESULT STDMETHODCALLTYPE Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||||
|
|
||||||
|
// IStream
|
||||||
|
HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE Revert(void) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag) {return E_NOTIMPL;}
|
||||||
|
HRESULT STDMETHODCALLTYPE Clone(IStream __RPC_FAR *__RPC_FAR *ppstm) {return E_NOTIMPL;}
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_OLE_TABLE(IStreamAdaptorBase)
|
||||||
|
OLE_IINTERFACE(IUnknown)
|
||||||
|
OLE_IINTERFACE(ISequentialStream)
|
||||||
|
OLE_IINTERFACE(IStream)
|
||||||
|
END_OLE_TABLE;
|
||||||
|
|
||||||
|
class IStreamAdaptor : public IStreamAdaptorBase
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
istream *m_is;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
|
||||||
|
{
|
||||||
|
wxASSERT(m_is != NULL);
|
||||||
|
}
|
||||||
|
~IStreamAdaptor()
|
||||||
|
{
|
||||||
|
delete m_is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISequentialStream
|
||||||
|
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
|
||||||
|
{
|
||||||
|
m_is->read((char *) pv, cb);
|
||||||
|
if (pcbRead)
|
||||||
|
*pcbRead = m_is->gcount();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void wxIEHtmlWin::LoadUrl(const wxString& url)
|
||||||
|
{
|
||||||
|
VARIANTARG navFlag, targetFrame, postData, headers;
|
||||||
|
navFlag.vt = VT_EMPTY;
|
||||||
|
navFlag.vt = VT_I2;
|
||||||
|
navFlag.iVal = navNoReadFromCache;
|
||||||
|
targetFrame.vt = VT_EMPTY;
|
||||||
|
postData.vt = VT_EMPTY;
|
||||||
|
headers.vt = VT_EMPTY;
|
||||||
|
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->Navigate((BSTR) wxConvUTF8.cMB2WC(url).data(),
|
||||||
|
&navFlag, &targetFrame, &postData, &headers);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadString(wxString html)
|
||||||
|
{
|
||||||
|
string s = html.c_str();
|
||||||
|
istringstream *is = new istringstream(s);
|
||||||
|
return LoadStream(is);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadStream(istream *is)
|
||||||
|
{
|
||||||
|
// wrap refernce around stream
|
||||||
|
IStreamAdaptor *pstrm = new IStreamAdaptor(is);
|
||||||
|
pstrm->AddRef();
|
||||||
|
|
||||||
|
wxAutoOleInterface<IStream> strm(pstrm);
|
||||||
|
|
||||||
|
// Document Interface
|
||||||
|
IDispatch *pDisp = NULL;
|
||||||
|
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||||
|
if (! pDisp)
|
||||||
|
return false;
|
||||||
|
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||||
|
|
||||||
|
|
||||||
|
// get IPersistStreamInit
|
||||||
|
wxAutoOleInterface<IPersistStreamInit>
|
||||||
|
pPersistStreamInit(IID_IPersistStreamInit, disp);
|
||||||
|
|
||||||
|
if (pPersistStreamInit.Ok())
|
||||||
|
{
|
||||||
|
HRESULT hr = pPersistStreamInit->InitNew();
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = pPersistStreamInit->Load(strm);
|
||||||
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GoBack()
|
||||||
|
{
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->GoBack();
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GoForward()
|
||||||
|
{
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->GoForward();
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GoHome()
|
||||||
|
{
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->GoHome();
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GoSearch()
|
||||||
|
{
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->GoSearch();
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::Refresh(wxIEHtmlRefreshLevel level)
|
||||||
|
{
|
||||||
|
VARIANTARG levelArg;
|
||||||
|
HRESULT hret = 0;
|
||||||
|
|
||||||
|
levelArg.vt = VT_I2;
|
||||||
|
levelArg.iVal = level;
|
||||||
|
hret = m_webBrowser->Refresh2(&levelArg);
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::Stop()
|
||||||
|
{
|
||||||
|
HRESULT hret = 0;
|
||||||
|
hret = m_webBrowser->Stop();
|
||||||
|
return hret == S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static wxAutoOleInterface<IHTMLSelectionObject> GetSelObject(IOleObject *oleObject)
|
||||||
|
{
|
||||||
|
// Query for IWebBrowser interface
|
||||||
|
wxAutoOleInterface<IWebBrowser2> wb(IID_IWebBrowser2, oleObject);
|
||||||
|
if (! wb.Ok())
|
||||||
|
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||||
|
|
||||||
|
IDispatch *iDisp = NULL;
|
||||||
|
HRESULT hr = wb->get_Document(&iDisp);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||||
|
|
||||||
|
// Query for Document Interface
|
||||||
|
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||||
|
iDisp->Release();
|
||||||
|
|
||||||
|
if (! hd.Ok())
|
||||||
|
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||||
|
|
||||||
|
IHTMLSelectionObject *_so = NULL;
|
||||||
|
hr = hd->get_selection(&_so);
|
||||||
|
|
||||||
|
// take ownership of selection object
|
||||||
|
wxAutoOleInterface<IHTMLSelectionObject> so(_so);
|
||||||
|
|
||||||
|
return so;
|
||||||
|
};
|
||||||
|
|
||||||
|
static wxAutoOleInterface<IHTMLTxtRange> GetSelRange(IOleObject *oleObject)
|
||||||
|
{
|
||||||
|
wxAutoOleInterface<IHTMLTxtRange> tr;
|
||||||
|
|
||||||
|
wxAutoOleInterface<IHTMLSelectionObject> so(GetSelObject(oleObject));
|
||||||
|
if (! so)
|
||||||
|
return tr;
|
||||||
|
|
||||||
|
IDispatch *iDisp = NULL;
|
||||||
|
HRESULT hr = so->createRange(&iDisp);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return tr;
|
||||||
|
|
||||||
|
// Query for IHTMLTxtRange interface
|
||||||
|
tr.QueryInterface(IID_IHTMLTxtRange, iDisp);
|
||||||
|
iDisp->Release();
|
||||||
|
return tr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
|
||||||
|
{
|
||||||
|
wxAutoOleInterface<IHTMLTxtRange> tr(GetSelRange(m_oleObject));
|
||||||
|
if (! tr)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
BSTR text = NULL;
|
||||||
|
HRESULT hr = E_FAIL;
|
||||||
|
|
||||||
|
if (asHTML)
|
||||||
|
hr = tr->get_htmlText(&text);
|
||||||
|
else
|
||||||
|
hr = tr->get_text(&text);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
wxString s = text;
|
||||||
|
SysFreeString(text);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString wxIEHtmlWin::GetText(bool asHTML)
|
||||||
|
{
|
||||||
|
if (! m_webBrowser.Ok())
|
||||||
|
return "";
|
||||||
|
|
||||||
|
// get document dispatch interface
|
||||||
|
IDispatch *iDisp = NULL;
|
||||||
|
HRESULT hr = m_webBrowser->get_Document(&iDisp);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
// Query for Document Interface
|
||||||
|
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||||
|
iDisp->Release();
|
||||||
|
|
||||||
|
if (! hd.Ok())
|
||||||
|
return "";
|
||||||
|
|
||||||
|
// get body element
|
||||||
|
IHTMLElement *_body = NULL;
|
||||||
|
hd->get_body(&_body);
|
||||||
|
if (! _body)
|
||||||
|
return "";
|
||||||
|
wxAutoOleInterface<IHTMLElement> body(_body);
|
||||||
|
|
||||||
|
// get inner text
|
||||||
|
BSTR text = NULL;
|
||||||
|
hr = E_FAIL;
|
||||||
|
|
||||||
|
if (asHTML)
|
||||||
|
hr = body->get_innerHTML(&text);
|
||||||
|
else
|
||||||
|
hr = body->get_innerText(&text);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
wxString s = text;
|
||||||
|
SysFreeString(text);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
};
|
93
wxPython/contrib/iewin/IEHtmlWin.h
Normal file
93
wxPython/contrib/iewin/IEHtmlWin.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#ifndef _IEHTMLWIN_H_
|
||||||
|
#define _IEHTMLWIN_H_
|
||||||
|
#pragma warning( disable : 4101 4786)
|
||||||
|
#pragma warning( disable : 4786)
|
||||||
|
|
||||||
|
|
||||||
|
#include <wx/setup.h>
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <exdisp.h>
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "wxactivex.h"
|
||||||
|
|
||||||
|
class wxMSHTMLEvent : public wxNotifyEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxMSHTMLEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
|
||||||
|
: wxNotifyEvent(commandType, id)
|
||||||
|
{}
|
||||||
|
|
||||||
|
wxString GetText() { return m_text1; }
|
||||||
|
long GetLong1() { return m_long1; }
|
||||||
|
long GetLong2() { return m_long2; }
|
||||||
|
|
||||||
|
wxString m_text1;
|
||||||
|
long m_long1, m_long2;
|
||||||
|
|
||||||
|
virtual wxEvent *Clone() const { return new wxMSHTMLEvent(*this); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMSHTMLEvent)
|
||||||
|
};
|
||||||
|
|
||||||
|
BEGIN_DECLARE_EVENT_TYPES()
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 0)
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 0)
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 0)
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 0)
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 0)
|
||||||
|
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_TITLECHANGE, 0)
|
||||||
|
END_DECLARE_EVENT_TYPES()
|
||||||
|
|
||||||
|
typedef void (wxEvtHandler::*wxMSHTMLEventFunction)(wxMSHTMLEvent&);
|
||||||
|
|
||||||
|
#define EVT_MSHTML_BEFORENAVIGATE2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
#define EVT_MSHTML_NEWWINDOW2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_NEWWINDOW2, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
#define EVT_MSHTML_DOCUMENTCOMPLETE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
#define EVT_MSHTML_PROGRESSCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
#define EVT_MSHTML_STATUSTEXTCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
#define EVT_MSHTML_TITLECHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_TITLECHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMSHTMLEventFunction) & fn, NULL ),
|
||||||
|
|
||||||
|
|
||||||
|
enum wxIEHtmlRefreshLevel {
|
||||||
|
wxIEHTML_REFRESH_NORMAL = 0,
|
||||||
|
wxIEHTML_REFRESH_IFEXPIRED = 1,
|
||||||
|
wxIEHTML_REFRESH_CONTINUE = 2,
|
||||||
|
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxIEHtmlWin : public wxActiveX
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
|
||||||
|
virtual ~wxIEHtmlWin();
|
||||||
|
|
||||||
|
void LoadUrl(const wxString&);
|
||||||
|
bool LoadString(wxString html);
|
||||||
|
bool LoadStream(istream *strm);
|
||||||
|
|
||||||
|
void SetCharset(wxString charset);
|
||||||
|
void SetEditMode(bool seton);
|
||||||
|
bool GetEditMode();
|
||||||
|
wxString GetStringSelection(bool asHTML = false);
|
||||||
|
wxString GetText(bool asHTML = false);
|
||||||
|
|
||||||
|
bool GoBack();
|
||||||
|
bool GoForward();
|
||||||
|
bool GoHome();
|
||||||
|
bool GoSearch();
|
||||||
|
bool Refresh(wxIEHtmlRefreshLevel level);
|
||||||
|
bool Stop();
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetupBrowser();
|
||||||
|
|
||||||
|
wxAutoOleInterface<IWebBrowser2> m_webBrowser;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _IEHTMLWIN_H_ */
|
4
wxPython/contrib/iewin/_iewinextras.py
Normal file
4
wxPython/contrib/iewin/_iewinextras.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||||
|
|
||||||
|
wx.wxMSHTMLEventPtr = wxMSHTMLEventPtr
|
||||||
|
wx.wxIEHtmlWinPtr = wxIEHtmlWinPtr
|
894
wxPython/contrib/iewin/iewin.cpp
Normal file
894
wxPython/contrib/iewin/iewin.cpp
Normal file
@@ -0,0 +1,894 @@
|
|||||||
|
/*
|
||||||
|
* FILE : contrib/iewin/iewin.cpp
|
||||||
|
*
|
||||||
|
* This file was automatically generated by :
|
||||||
|
* Simplified Wrapper and Interface Generator (SWIG)
|
||||||
|
* Version 1.1 (Build 883)
|
||||||
|
*
|
||||||
|
* Portions Copyright (c) 1995-1998
|
||||||
|
* The University of Utah and The Regents of the University of California.
|
||||||
|
* Permission is granted to distribute this file in any manner provided
|
||||||
|
* this notice remains intact.
|
||||||
|
*
|
||||||
|
* Do not make changes to this file--changes will be lost!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SWIGCODE
|
||||||
|
/* Implementation : PYTHON */
|
||||||
|
|
||||||
|
#define SWIGPYTHON
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
/* Definitions for Windows/Unix exporting */
|
||||||
|
#if defined(__WIN32__)
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||||
|
# else
|
||||||
|
# if defined(__BORLANDC__)
|
||||||
|
# define SWIGEXPORT(a) a _export
|
||||||
|
# else
|
||||||
|
# define SWIGEXPORT(a) a
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define SWIGEXPORT(a) a
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Python.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void SWIG_MakePtr(char *, void *, char *);
|
||||||
|
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||||
|
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||||
|
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||||
|
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||||
|
extern PyObject *SWIG_newvarlink(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#define SWIG_init initiewinc
|
||||||
|
|
||||||
|
#define SWIG_name "iewinc"
|
||||||
|
|
||||||
|
#include "wxPython.h"
|
||||||
|
#include "IEHtmlWin.h"
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||||
|
PyObject* o2;
|
||||||
|
PyObject* o3;
|
||||||
|
|
||||||
|
if (!target) {
|
||||||
|
target = o;
|
||||||
|
} else if (target == Py_None) {
|
||||||
|
Py_DECREF(Py_None);
|
||||||
|
target = o;
|
||||||
|
} else {
|
||||||
|
if (!PyTuple_Check(target)) {
|
||||||
|
o2 = target;
|
||||||
|
target = PyTuple_New(1);
|
||||||
|
PyTuple_SetItem(target, 0, o2);
|
||||||
|
}
|
||||||
|
o3 = PyTuple_New(1);
|
||||||
|
PyTuple_SetItem(o3, 0, o);
|
||||||
|
|
||||||
|
o2 = target;
|
||||||
|
target = PySequence_Concat(o2, o3);
|
||||||
|
Py_DECREF(o2);
|
||||||
|
Py_DECREF(o3);
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
static void *SwigwxMSHTMLEventTowxNotifyEvent(void *ptr) {
|
||||||
|
wxMSHTMLEvent *src;
|
||||||
|
wxNotifyEvent *dest;
|
||||||
|
src = (wxMSHTMLEvent *) ptr;
|
||||||
|
dest = (wxNotifyEvent *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxMSHTMLEventTowxCommandEvent(void *ptr) {
|
||||||
|
wxMSHTMLEvent *src;
|
||||||
|
wxCommandEvent *dest;
|
||||||
|
src = (wxMSHTMLEvent *) ptr;
|
||||||
|
dest = (wxCommandEvent *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxMSHTMLEventTowxEvent(void *ptr) {
|
||||||
|
wxMSHTMLEvent *src;
|
||||||
|
wxEvent *dest;
|
||||||
|
src = (wxMSHTMLEvent *) ptr;
|
||||||
|
dest = (wxEvent *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxMSHTMLEventTowxObject(void *ptr) {
|
||||||
|
wxMSHTMLEvent *src;
|
||||||
|
wxObject *dest;
|
||||||
|
src = (wxMSHTMLEvent *) ptr;
|
||||||
|
dest = (wxObject *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define new_wxMSHTMLEvent(_swigarg0,_swigarg1) (new wxMSHTMLEvent(_swigarg0,_swigarg1))
|
||||||
|
static PyObject *_wrap_new_wxMSHTMLEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxMSHTMLEvent * _result;
|
||||||
|
wxEventType _arg0 = (wxEventType ) wxEVT_NULL;
|
||||||
|
int _arg1 = (int ) 0;
|
||||||
|
char *_kwnames[] = { "commandType","id", NULL };
|
||||||
|
char _ptemp[128];
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|ii:new_wxMSHTMLEvent",_kwnames,&_arg0,&_arg1))
|
||||||
|
return NULL;
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (wxMSHTMLEvent *)new_wxMSHTMLEvent(_arg0,_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} if (_result) {
|
||||||
|
SWIG_MakePtr(_ptemp, (char *) _result,"_wxMSHTMLEvent_p");
|
||||||
|
_resultobj = Py_BuildValue("s",_ptemp);
|
||||||
|
} else {
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxMSHTMLEvent_GetText(_swigobj) (_swigobj->GetText())
|
||||||
|
static PyObject *_wrap_wxMSHTMLEvent_GetText(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxString * _result;
|
||||||
|
wxMSHTMLEvent * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMSHTMLEvent_GetText",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMSHTMLEvent_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMSHTMLEvent_GetText. Expected _wxMSHTMLEvent_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = new wxString (wxMSHTMLEvent_GetText(_arg0));
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
}{
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||||
|
#else
|
||||||
|
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
{
|
||||||
|
delete _result;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxMSHTMLEvent_GetLong1(_swigobj) (_swigobj->GetLong1())
|
||||||
|
static PyObject *_wrap_wxMSHTMLEvent_GetLong1(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
long _result;
|
||||||
|
wxMSHTMLEvent * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMSHTMLEvent_GetLong1",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMSHTMLEvent_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMSHTMLEvent_GetLong1. Expected _wxMSHTMLEvent_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (long )wxMSHTMLEvent_GetLong1(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("l",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxMSHTMLEvent_GetLong2(_swigobj) (_swigobj->GetLong2())
|
||||||
|
static PyObject *_wrap_wxMSHTMLEvent_GetLong2(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
long _result;
|
||||||
|
wxMSHTMLEvent * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMSHTMLEvent_GetLong2",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMSHTMLEvent_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMSHTMLEvent_GetLong2. Expected _wxMSHTMLEvent_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (long )wxMSHTMLEvent_GetLong2(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("l",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxIEHtmlWinTowxWindow(void *ptr) {
|
||||||
|
wxIEHtmlWin *src;
|
||||||
|
wxWindow *dest;
|
||||||
|
src = (wxIEHtmlWin *) ptr;
|
||||||
|
dest = (wxWindow *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxIEHtmlWinTowxEvtHandler(void *ptr) {
|
||||||
|
wxIEHtmlWin *src;
|
||||||
|
wxEvtHandler *dest;
|
||||||
|
src = (wxIEHtmlWin *) ptr;
|
||||||
|
dest = (wxEvtHandler *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *SwigwxIEHtmlWinTowxObject(void *ptr) {
|
||||||
|
wxIEHtmlWin *src;
|
||||||
|
wxObject *dest;
|
||||||
|
src = (wxIEHtmlWin *) ptr;
|
||||||
|
dest = (wxObject *) src;
|
||||||
|
return (void *) dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define new_wxIEHtmlWin(_swigarg0,_swigarg1) (new wxIEHtmlWin(_swigarg0,_swigarg1))
|
||||||
|
static PyObject *_wrap_new_wxIEHtmlWin(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxIEHtmlWin * _result;
|
||||||
|
wxWindow * _arg0;
|
||||||
|
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "parent","id", NULL };
|
||||||
|
char _ptemp[128];
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:new_wxIEHtmlWin",_kwnames,&_argo0,&_arg1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxIEHtmlWin. Expected _wxWindow_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (wxIEHtmlWin *)new_wxIEHtmlWin(_arg0,_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} if (_result) {
|
||||||
|
SWIG_MakePtr(_ptemp, (char *) _result,"_wxIEHtmlWin_p");
|
||||||
|
_resultobj = Py_BuildValue("s",_ptemp);
|
||||||
|
} else {
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_LoadUrl(_swigobj,_swigarg0) (_swigobj->LoadUrl(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_LoadUrl(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
wxString * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","arg2", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIEHtmlWin_LoadUrl",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_LoadUrl. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
_arg1 = wxString_in_helper(_obj1);
|
||||||
|
if (_arg1 == NULL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
wxIEHtmlWin_LoadUrl(_arg0,*_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
{
|
||||||
|
if (_obj1)
|
||||||
|
delete _arg1;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_LoadString(_swigobj,_swigarg0) (_swigobj->LoadString(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_LoadString(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
wxString * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","html", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIEHtmlWin_LoadString",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_LoadString. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
_arg1 = wxString_in_helper(_obj1);
|
||||||
|
if (_arg1 == NULL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_LoadString(_arg0,*_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
{
|
||||||
|
if (_obj1)
|
||||||
|
delete _arg1;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_SetCharset(_swigobj,_swigarg0) (_swigobj->SetCharset(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_SetCharset(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
wxString * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","charset", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIEHtmlWin_SetCharset",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_SetCharset. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
_arg1 = wxString_in_helper(_obj1);
|
||||||
|
if (_arg1 == NULL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
wxIEHtmlWin_SetCharset(_arg0,*_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
{
|
||||||
|
if (_obj1)
|
||||||
|
delete _arg1;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_SetEditMode(_swigobj,_swigarg0) (_swigobj->SetEditMode(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_SetEditMode(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
bool _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
int tempbool1;
|
||||||
|
char *_kwnames[] = { "self","seton", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_SetEditMode",_kwnames,&_argo0,&tempbool1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_SetEditMode. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_arg1 = (bool ) tempbool1;
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
wxIEHtmlWin_SetEditMode(_arg0,_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} Py_INCREF(Py_None);
|
||||||
|
_resultobj = Py_None;
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GetEditMode(_swigobj) (_swigobj->GetEditMode())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GetEditMode(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_GetEditMode",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GetEditMode. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_GetEditMode(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GetStringSelection(_swigobj,_swigarg0) (_swigobj->GetStringSelection(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GetStringSelection(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxString * _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
bool _arg1 = (bool ) FALSE;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
int tempbool1 = (int) FALSE;
|
||||||
|
char *_kwnames[] = { "self","asHTML", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxIEHtmlWin_GetStringSelection",_kwnames,&_argo0,&tempbool1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GetStringSelection. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_arg1 = (bool ) tempbool1;
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = new wxString (wxIEHtmlWin_GetStringSelection(_arg0,_arg1));
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
}{
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||||
|
#else
|
||||||
|
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
{
|
||||||
|
delete _result;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GetText(_swigobj,_swigarg0) (_swigobj->GetText(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GetText(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
wxString * _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
bool _arg1 = (bool ) FALSE;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
int tempbool1 = (int) FALSE;
|
||||||
|
char *_kwnames[] = { "self","asHTML", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxIEHtmlWin_GetText",_kwnames,&_argo0,&tempbool1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GetText. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_arg1 = (bool ) tempbool1;
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = new wxString (wxIEHtmlWin_GetText(_arg0,_arg1));
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
}{
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
_resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len());
|
||||||
|
#else
|
||||||
|
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
{
|
||||||
|
delete _result;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GoBack(_swigobj) (_swigobj->GoBack())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GoBack(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_GoBack",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GoBack. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_GoBack(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GoForward(_swigobj) (_swigobj->GoForward())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GoForward(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_GoForward",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GoForward. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_GoForward(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GoHome(_swigobj) (_swigobj->GoHome())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GoHome(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_GoHome",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GoHome. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_GoHome(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_GoSearch(_swigobj) (_swigobj->GoSearch())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_GoSearch(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_GoSearch",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_GoSearch. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_GoSearch(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_Refresh(_swigobj,_swigarg0) (_swigobj->Refresh(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_Refresh(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
wxIEHtmlRefreshLevel _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self","level", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxIEHtmlWin_Refresh",_kwnames,&_argo0,&_arg1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_Refresh. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_Refresh(_arg0,_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_Stop(_swigobj) (_swigobj->Stop())
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_Stop(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
char *_kwnames[] = { "self", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxIEHtmlWin_Stop",_kwnames,&_argo0))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_Stop. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_Stop(_arg0);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyMethodDef iewincMethods[] = {
|
||||||
|
{ "wxIEHtmlWin_Stop", (PyCFunction) _wrap_wxIEHtmlWin_Stop, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_Refresh", (PyCFunction) _wrap_wxIEHtmlWin_Refresh, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GoSearch", (PyCFunction) _wrap_wxIEHtmlWin_GoSearch, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GoHome", (PyCFunction) _wrap_wxIEHtmlWin_GoHome, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GoForward", (PyCFunction) _wrap_wxIEHtmlWin_GoForward, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GoBack", (PyCFunction) _wrap_wxIEHtmlWin_GoBack, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GetText", (PyCFunction) _wrap_wxIEHtmlWin_GetText, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GetStringSelection", (PyCFunction) _wrap_wxIEHtmlWin_GetStringSelection, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_GetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_GetEditMode, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_SetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_SetEditMode, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_SetCharset", (PyCFunction) _wrap_wxIEHtmlWin_SetCharset, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_LoadString", (PyCFunction) _wrap_wxIEHtmlWin_LoadString, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_LoadUrl", (PyCFunction) _wrap_wxIEHtmlWin_LoadUrl, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "new_wxIEHtmlWin", (PyCFunction) _wrap_new_wxIEHtmlWin, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxMSHTMLEvent_GetLong2", (PyCFunction) _wrap_wxMSHTMLEvent_GetLong2, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxMSHTMLEvent_GetLong1", (PyCFunction) _wrap_wxMSHTMLEvent_GetLong1, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxMSHTMLEvent_GetText", (PyCFunction) _wrap_wxMSHTMLEvent_GetText, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "new_wxMSHTMLEvent", (PyCFunction) _wrap_new_wxMSHTMLEvent, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* This table is used by the pointer type-checker
|
||||||
|
*/
|
||||||
|
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||||
|
{ "_wxEvent","_wxMSHTMLEvent",SwigwxMSHTMLEventTowxEvent},
|
||||||
|
{ "_signed_long","_long",0},
|
||||||
|
{ "_wxPrintQuality","_wxCoord",0},
|
||||||
|
{ "_wxPrintQuality","_int",0},
|
||||||
|
{ "_wxPrintQuality","_signed_int",0},
|
||||||
|
{ "_wxPrintQuality","_unsigned_int",0},
|
||||||
|
{ "_wxPrintQuality","_wxWindowID",0},
|
||||||
|
{ "_wxPrintQuality","_uint",0},
|
||||||
|
{ "_wxPrintQuality","_EBool",0},
|
||||||
|
{ "_wxPrintQuality","_size_t",0},
|
||||||
|
{ "_wxPrintQuality","_time_t",0},
|
||||||
|
{ "_wxNotifyEvent","_wxMSHTMLEvent",SwigwxMSHTMLEventTowxNotifyEvent},
|
||||||
|
{ "_byte","_unsigned_char",0},
|
||||||
|
{ "_long","_unsigned_long",0},
|
||||||
|
{ "_long","_signed_long",0},
|
||||||
|
{ "_size_t","_wxCoord",0},
|
||||||
|
{ "_size_t","_wxPrintQuality",0},
|
||||||
|
{ "_size_t","_time_t",0},
|
||||||
|
{ "_size_t","_unsigned_int",0},
|
||||||
|
{ "_size_t","_int",0},
|
||||||
|
{ "_size_t","_wxWindowID",0},
|
||||||
|
{ "_size_t","_uint",0},
|
||||||
|
{ "_uint","_wxCoord",0},
|
||||||
|
{ "_uint","_wxPrintQuality",0},
|
||||||
|
{ "_uint","_time_t",0},
|
||||||
|
{ "_uint","_size_t",0},
|
||||||
|
{ "_uint","_unsigned_int",0},
|
||||||
|
{ "_uint","_int",0},
|
||||||
|
{ "_uint","_wxWindowID",0},
|
||||||
|
{ "_wxChar","_char",0},
|
||||||
|
{ "_wxCommandEvent","_wxMSHTMLEvent",SwigwxMSHTMLEventTowxCommandEvent},
|
||||||
|
{ "_char","_wxChar",0},
|
||||||
|
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||||
|
{ "_EBool","_wxCoord",0},
|
||||||
|
{ "_EBool","_wxPrintQuality",0},
|
||||||
|
{ "_EBool","_signed_int",0},
|
||||||
|
{ "_EBool","_int",0},
|
||||||
|
{ "_EBool","_wxWindowID",0},
|
||||||
|
{ "_unsigned_long","_long",0},
|
||||||
|
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||||
|
{ "_signed_int","_wxCoord",0},
|
||||||
|
{ "_signed_int","_wxPrintQuality",0},
|
||||||
|
{ "_signed_int","_EBool",0},
|
||||||
|
{ "_signed_int","_wxWindowID",0},
|
||||||
|
{ "_signed_int","_int",0},
|
||||||
|
{ "_WXTYPE","_wxDateTime_t",0},
|
||||||
|
{ "_WXTYPE","_short",0},
|
||||||
|
{ "_WXTYPE","_signed_short",0},
|
||||||
|
{ "_WXTYPE","_unsigned_short",0},
|
||||||
|
{ "_unsigned_short","_wxDateTime_t",0},
|
||||||
|
{ "_unsigned_short","_WXTYPE",0},
|
||||||
|
{ "_unsigned_short","_short",0},
|
||||||
|
{ "_wxObject","_wxIEHtmlWin",SwigwxIEHtmlWinTowxObject},
|
||||||
|
{ "_wxObject","_wxMSHTMLEvent",SwigwxMSHTMLEventTowxObject},
|
||||||
|
{ "_signed_short","_WXTYPE",0},
|
||||||
|
{ "_signed_short","_short",0},
|
||||||
|
{ "_unsigned_char","_byte",0},
|
||||||
|
{ "_unsigned_int","_wxCoord",0},
|
||||||
|
{ "_unsigned_int","_wxPrintQuality",0},
|
||||||
|
{ "_unsigned_int","_time_t",0},
|
||||||
|
{ "_unsigned_int","_size_t",0},
|
||||||
|
{ "_unsigned_int","_uint",0},
|
||||||
|
{ "_unsigned_int","_wxWindowID",0},
|
||||||
|
{ "_unsigned_int","_int",0},
|
||||||
|
{ "_short","_wxDateTime_t",0},
|
||||||
|
{ "_short","_WXTYPE",0},
|
||||||
|
{ "_short","_unsigned_short",0},
|
||||||
|
{ "_short","_signed_short",0},
|
||||||
|
{ "_wxWindowID","_wxCoord",0},
|
||||||
|
{ "_wxWindowID","_wxPrintQuality",0},
|
||||||
|
{ "_wxWindowID","_time_t",0},
|
||||||
|
{ "_wxWindowID","_size_t",0},
|
||||||
|
{ "_wxWindowID","_EBool",0},
|
||||||
|
{ "_wxWindowID","_uint",0},
|
||||||
|
{ "_wxWindowID","_int",0},
|
||||||
|
{ "_wxWindowID","_signed_int",0},
|
||||||
|
{ "_wxWindowID","_unsigned_int",0},
|
||||||
|
{ "_int","_wxCoord",0},
|
||||||
|
{ "_int","_wxPrintQuality",0},
|
||||||
|
{ "_int","_time_t",0},
|
||||||
|
{ "_int","_size_t",0},
|
||||||
|
{ "_int","_EBool",0},
|
||||||
|
{ "_int","_uint",0},
|
||||||
|
{ "_int","_wxWindowID",0},
|
||||||
|
{ "_int","_unsigned_int",0},
|
||||||
|
{ "_int","_signed_int",0},
|
||||||
|
{ "_wxDateTime_t","_unsigned_short",0},
|
||||||
|
{ "_wxDateTime_t","_short",0},
|
||||||
|
{ "_wxDateTime_t","_WXTYPE",0},
|
||||||
|
{ "_time_t","_wxCoord",0},
|
||||||
|
{ "_time_t","_wxPrintQuality",0},
|
||||||
|
{ "_time_t","_unsigned_int",0},
|
||||||
|
{ "_time_t","_int",0},
|
||||||
|
{ "_time_t","_wxWindowID",0},
|
||||||
|
{ "_time_t","_uint",0},
|
||||||
|
{ "_time_t","_size_t",0},
|
||||||
|
{ "_wxCoord","_int",0},
|
||||||
|
{ "_wxCoord","_signed_int",0},
|
||||||
|
{ "_wxCoord","_unsigned_int",0},
|
||||||
|
{ "_wxCoord","_wxWindowID",0},
|
||||||
|
{ "_wxCoord","_uint",0},
|
||||||
|
{ "_wxCoord","_EBool",0},
|
||||||
|
{ "_wxCoord","_size_t",0},
|
||||||
|
{ "_wxCoord","_time_t",0},
|
||||||
|
{ "_wxCoord","_wxPrintQuality",0},
|
||||||
|
{ "_wxEvtHandler","_wxIEHtmlWin",SwigwxIEHtmlWinTowxEvtHandler},
|
||||||
|
{ "_wxWindow","_wxIEHtmlWin",SwigwxIEHtmlWinTowxWindow},
|
||||||
|
{0,0,0}};
|
||||||
|
|
||||||
|
static PyObject *SWIG_globals;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
SWIGEXPORT(void) initiewinc() {
|
||||||
|
PyObject *m, *d;
|
||||||
|
SWIG_globals = SWIG_newvarlink();
|
||||||
|
m = Py_InitModule("iewinc", iewincMethods);
|
||||||
|
d = PyModule_GetDict(m);
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2));
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_NEWWINDOW2", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_NEWWINDOW2));
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE));
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_PROGRESSCHANGE", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_PROGRESSCHANGE));
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE));
|
||||||
|
PyDict_SetItemString(d,"wxEVT_COMMAND_MSHTML_TITLECHANGE", PyInt_FromLong((long) wxEVT_COMMAND_MSHTML_TITLECHANGE));
|
||||||
|
PyDict_SetItemString(d,"wxIEHTML_REFRESH_NORMAL", PyInt_FromLong((long) wxIEHTML_REFRESH_NORMAL));
|
||||||
|
PyDict_SetItemString(d,"wxIEHTML_REFRESH_IFEXPIRED", PyInt_FromLong((long) wxIEHTML_REFRESH_IFEXPIRED));
|
||||||
|
PyDict_SetItemString(d,"wxIEHTML_REFRESH_CONTINUE", PyInt_FromLong((long) wxIEHTML_REFRESH_CONTINUE));
|
||||||
|
PyDict_SetItemString(d,"wxIEHTML_REFRESH_COMPLETELY", PyInt_FromLong((long) wxIEHTML_REFRESH_COMPLETELY));
|
||||||
|
|
||||||
|
|
||||||
|
wxClassInfo::CleanUpClasses();
|
||||||
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; _swig_mapping[i].n1; i++)
|
||||||
|
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||||
|
}
|
||||||
|
}
|
124
wxPython/contrib/iewin/iewin.i
Normal file
124
wxPython/contrib/iewin/iewin.i
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: iewin.i
|
||||||
|
// Purpose: Internet Explorer in a wxWindow
|
||||||
|
//
|
||||||
|
// Author: Robin Dunn
|
||||||
|
//
|
||||||
|
// Created: 20-Apr-2001
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2001 by Total Control Software
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
%module iewin
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include "wxPython.h"
|
||||||
|
#include "IEHtmlWin.h"
|
||||||
|
%}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%include typemaps.i
|
||||||
|
%include my_typemaps.i
|
||||||
|
|
||||||
|
%extern wx.i
|
||||||
|
%extern windows.i
|
||||||
|
%extern _defs.i
|
||||||
|
%extern misc.i
|
||||||
|
%extern events.i
|
||||||
|
|
||||||
|
%pragma(python) code = "import wx"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxMSHTMLEvent : public wxNotifyEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxMSHTMLEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||||
|
wxString GetText();
|
||||||
|
long GetLong1();
|
||||||
|
long GetLong2();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2,
|
||||||
|
wxEVT_COMMAND_MSHTML_NEWWINDOW2,
|
||||||
|
wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE,
|
||||||
|
wxEVT_COMMAND_MSHTML_PROGRESSCHANGE,
|
||||||
|
wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE,
|
||||||
|
wxEVT_COMMAND_MSHTML_TITLECHANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
%pragma(python) code = "
|
||||||
|
def EVT_MSHTML_BEFORENAVIGATE2(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_NEWWINDOW2(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_NEWWINDOW2, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_DOCUMENTCOMPLETE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_PROGRESSCHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_STATUSTEXTCHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_TITLECHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_TITLECHANGE, func)
|
||||||
|
"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
enum wxIEHtmlRefreshLevel {
|
||||||
|
wxIEHTML_REFRESH_NORMAL = 0,
|
||||||
|
wxIEHTML_REFRESH_IFEXPIRED = 1,
|
||||||
|
wxIEHTML_REFRESH_CONTINUE = 2,
|
||||||
|
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxIEHtmlWin : public wxWindow /* wxActiveX */
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
|
||||||
|
|
||||||
|
void LoadUrl(const wxString&);
|
||||||
|
bool LoadString(wxString html);
|
||||||
|
/* bool LoadStream(istream *strm); */
|
||||||
|
|
||||||
|
void SetCharset(wxString charset);
|
||||||
|
void SetEditMode(bool seton);
|
||||||
|
bool GetEditMode();
|
||||||
|
wxString GetStringSelection(bool asHTML = FALSE);
|
||||||
|
wxString GetText(bool asHTML = FALSE);
|
||||||
|
|
||||||
|
bool GoBack();
|
||||||
|
bool GoForward();
|
||||||
|
bool GoHome();
|
||||||
|
bool GoSearch();
|
||||||
|
bool Refresh(wxIEHtmlRefreshLevel level);
|
||||||
|
bool Stop();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%init %{
|
||||||
|
|
||||||
|
wxClassInfo::CleanUpClasses();
|
||||||
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
%pragma(python) include="_iewinextras.py";
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
166
wxPython/contrib/iewin/iewin.py
Normal file
166
wxPython/contrib/iewin/iewin.py
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
# This file was created automatically by SWIG.
|
||||||
|
import iewinc
|
||||||
|
|
||||||
|
from misc import *
|
||||||
|
|
||||||
|
from misc2 import *
|
||||||
|
|
||||||
|
from windows import *
|
||||||
|
|
||||||
|
from gdi import *
|
||||||
|
|
||||||
|
from fonts import *
|
||||||
|
|
||||||
|
from clip_dnd import *
|
||||||
|
|
||||||
|
from events import *
|
||||||
|
|
||||||
|
from streams import *
|
||||||
|
|
||||||
|
from utils import *
|
||||||
|
|
||||||
|
from mdi import *
|
||||||
|
|
||||||
|
from frames import *
|
||||||
|
|
||||||
|
from stattool import *
|
||||||
|
|
||||||
|
from controls import *
|
||||||
|
|
||||||
|
from controls2 import *
|
||||||
|
|
||||||
|
from windows2 import *
|
||||||
|
|
||||||
|
from cmndlgs import *
|
||||||
|
|
||||||
|
from windows3 import *
|
||||||
|
|
||||||
|
from image import *
|
||||||
|
|
||||||
|
from printfw import *
|
||||||
|
|
||||||
|
from sizers import *
|
||||||
|
|
||||||
|
from filesys import *
|
||||||
|
import wx
|
||||||
|
|
||||||
|
def EVT_MSHTML_BEFORENAVIGATE2(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_NEWWINDOW2(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_NEWWINDOW2, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_DOCUMENTCOMPLETE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_PROGRESSCHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_STATUSTEXTCHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, func)
|
||||||
|
|
||||||
|
def EVT_MSHTML_TITLECHANGE(win, id, func):
|
||||||
|
win.Connect(id, -1, wxEVT_COMMAND_MSHTML_TITLECHANGE, func)
|
||||||
|
|
||||||
|
class wxMSHTMLEventPtr(wxNotifyEventPtr):
|
||||||
|
def __init__(self,this):
|
||||||
|
self.this = this
|
||||||
|
self.thisown = 0
|
||||||
|
def GetText(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxMSHTMLEvent_GetText,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GetLong1(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxMSHTMLEvent_GetLong1,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GetLong2(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxMSHTMLEvent_GetLong2,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def __repr__(self):
|
||||||
|
return "<C wxMSHTMLEvent instance at %s>" % (self.this,)
|
||||||
|
class wxMSHTMLEvent(wxMSHTMLEventPtr):
|
||||||
|
def __init__(self,*_args,**_kwargs):
|
||||||
|
self.this = apply(iewinc.new_wxMSHTMLEvent,_args,_kwargs)
|
||||||
|
self.thisown = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class wxIEHtmlWinPtr(wxWindowPtr):
|
||||||
|
def __init__(self,this):
|
||||||
|
self.this = this
|
||||||
|
self.thisown = 0
|
||||||
|
def LoadUrl(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_LoadUrl,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def LoadString(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_LoadString,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def SetCharset(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_SetCharset,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def SetEditMode(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_SetEditMode,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GetEditMode(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GetEditMode,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GetStringSelection(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GetStringSelection,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GetText(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GetText,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GoBack(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GoBack,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GoForward(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GoForward,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GoHome(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GoHome,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def GoSearch(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_GoSearch,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def Refresh(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_Refresh,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def Stop(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_Stop,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
|
def __repr__(self):
|
||||||
|
return "<C wxIEHtmlWin instance at %s>" % (self.this,)
|
||||||
|
class wxIEHtmlWin(wxIEHtmlWinPtr):
|
||||||
|
def __init__(self,*_args,**_kwargs):
|
||||||
|
self.this = apply(iewinc.new_wxIEHtmlWin,_args,_kwargs)
|
||||||
|
self.thisown = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-------------- FUNCTION WRAPPERS ------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-------------- VARIABLE WRAPPERS ------------------
|
||||||
|
|
||||||
|
wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2 = iewinc.wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2
|
||||||
|
wxEVT_COMMAND_MSHTML_NEWWINDOW2 = iewinc.wxEVT_COMMAND_MSHTML_NEWWINDOW2
|
||||||
|
wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE = iewinc.wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE
|
||||||
|
wxEVT_COMMAND_MSHTML_PROGRESSCHANGE = iewinc.wxEVT_COMMAND_MSHTML_PROGRESSCHANGE
|
||||||
|
wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE = iewinc.wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE
|
||||||
|
wxEVT_COMMAND_MSHTML_TITLECHANGE = iewinc.wxEVT_COMMAND_MSHTML_TITLECHANGE
|
||||||
|
wxIEHTML_REFRESH_NORMAL = iewinc.wxIEHTML_REFRESH_NORMAL
|
||||||
|
wxIEHTML_REFRESH_IFEXPIRED = iewinc.wxIEHTML_REFRESH_IFEXPIRED
|
||||||
|
wxIEHTML_REFRESH_CONTINUE = iewinc.wxIEHTML_REFRESH_CONTINUE
|
||||||
|
wxIEHTML_REFRESH_COMPLETELY = iewinc.wxIEHTML_REFRESH_COMPLETELY
|
||||||
|
|
||||||
|
|
||||||
|
#-------------- USER INCLUDE -----------------------
|
||||||
|
|
||||||
|
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||||
|
|
||||||
|
wx.wxMSHTMLEventPtr = wxMSHTMLEventPtr
|
||||||
|
wx.wxIEHtmlWinPtr = wxIEHtmlWinPtr
|
138
wxPython/contrib/iewin/readme.txt
Normal file
138
wxPython/contrib/iewin/readme.txt
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
Lindsay Mathieson
|
||||||
|
Email : <lmathieson@optusnet.com.au>
|
||||||
|
|
||||||
|
This is prelimanary stuff - the controls need extra methods and events etc,
|
||||||
|
feel free to email with suggestions &/or patches.
|
||||||
|
|
||||||
|
Tested with wxWindows 2.3.2.
|
||||||
|
Built with MS Visual C++ 6.0 & DevStudio
|
||||||
|
Minor use of templates and STL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
This sample illustrates using wxActiveX and wxIEHtmlWin too:
|
||||||
|
1. Host an arbitrary ActiveX control
|
||||||
|
2. Specifically host the MSHTML Control
|
||||||
|
|
||||||
|
|
||||||
|
wxActiveX:
|
||||||
|
==========
|
||||||
|
wxActiveX is used to host and siplay any activeX control, all the wxWindows developer
|
||||||
|
needs to know is either the ProgID or CLSID of the control in question.
|
||||||
|
|
||||||
|
Derived From:
|
||||||
|
- wxWindow
|
||||||
|
|
||||||
|
Include Files:
|
||||||
|
- wxactivex.h
|
||||||
|
|
||||||
|
Source Files:
|
||||||
|
- wxactivex.cpp
|
||||||
|
|
||||||
|
Event Handling:
|
||||||
|
---------------
|
||||||
|
- None currently
|
||||||
|
|
||||||
|
Members:
|
||||||
|
--------
|
||||||
|
wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
|
||||||
|
- Creates a activeX control identified by clsid
|
||||||
|
e.g
|
||||||
|
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||||
|
wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser);
|
||||||
|
|
||||||
|
wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
|
||||||
|
- Creates a activeX control identified by progId
|
||||||
|
e.g.
|
||||||
|
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||||
|
wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar");
|
||||||
|
|
||||||
|
|
||||||
|
wxActiveX::~wxActiveX();
|
||||||
|
- Destroys the control
|
||||||
|
- disconnects all connection points
|
||||||
|
|
||||||
|
HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink);
|
||||||
|
- Connects a event sink. Connections are automaticlly diconnected in the destructor
|
||||||
|
e.g.
|
||||||
|
FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol);
|
||||||
|
hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events);
|
||||||
|
if (! SUCCEEDED(hret))
|
||||||
|
delete events;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
wxIEHtmlWin:
|
||||||
|
============
|
||||||
|
wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control.
|
||||||
|
|
||||||
|
Derived From:
|
||||||
|
- wxActiveX
|
||||||
|
- wxWindow
|
||||||
|
|
||||||
|
Event Handling:
|
||||||
|
---------------
|
||||||
|
- class wxMSHTMLEvent
|
||||||
|
|
||||||
|
- EVT_MSHTML_BEFORENAVIGATE2
|
||||||
|
* url = event.m_text1
|
||||||
|
* event.Veto() to cancel
|
||||||
|
Generated before an attempt to browse a new url
|
||||||
|
|
||||||
|
- EVT_MSHTML_NEWWINDOW2
|
||||||
|
* event.Veto() to cancel
|
||||||
|
Generated when the control is asked create a new window (e.g a popup)
|
||||||
|
|
||||||
|
- EVT_MSHTML_DOCUMENTCOMPLETE
|
||||||
|
* url = event.m_text1
|
||||||
|
Generated after the document has finished loading
|
||||||
|
|
||||||
|
- EVT_MSHTML_PROGRESSCHANGE
|
||||||
|
* event.m_long1 = progress so far
|
||||||
|
* event.m_long2 = max range of progress
|
||||||
|
|
||||||
|
- EVT_MSHTML_STATUSTEXTCHANGE
|
||||||
|
* status = event.m_text1
|
||||||
|
|
||||||
|
- EVT_MSHTML_TITLECHANGE
|
||||||
|
* title = event.m_text1
|
||||||
|
|
||||||
|
Members:
|
||||||
|
--------
|
||||||
|
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
|
||||||
|
- Constructs and initialises the MSHTML control
|
||||||
|
- LoadUrl("about:blank") is called
|
||||||
|
|
||||||
|
wxIEHtmlWin::~wxIEHtmlWin();
|
||||||
|
- destroys the control
|
||||||
|
|
||||||
|
void wxIEHtmlWin::LoadUrl(const wxString&);
|
||||||
|
- Attempts to browse to the url, the control uses its internal (MS)
|
||||||
|
network streams
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadString(wxString html);
|
||||||
|
- Load the passed HTML string
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadStream(istream *strm);
|
||||||
|
- load the passed HTML stream. The control takes ownership of
|
||||||
|
the pointer, deleting when finished.
|
||||||
|
|
||||||
|
void wxIEHtmlWin::SetCharset(wxString charset);
|
||||||
|
- Sets the charset of the loaded document
|
||||||
|
|
||||||
|
void wxIEHtmlWin::SetEditMode(bool seton);
|
||||||
|
- Sets edit mode.
|
||||||
|
NOTE: This does work, but is bare bones - we need more events exposed before
|
||||||
|
this is usable as an HTML editor.
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::GetEditMode();
|
||||||
|
- Returns the edit mode setting
|
||||||
|
|
||||||
|
wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false);
|
||||||
|
- Returns the currently selected text (plain or HTML text)
|
||||||
|
|
||||||
|
wxString GetText(bool asHTML = false);
|
||||||
|
- Returns the body text (plain or HTML text)
|
||||||
|
|
||||||
|
Lindsay Mathieson
|
||||||
|
Email : <lmathieson@optusnet.com.au>
|
1247
wxPython/contrib/iewin/wxactivex.cpp
Normal file
1247
wxPython/contrib/iewin/wxactivex.cpp
Normal file
File diff suppressed because it is too large
Load Diff
300
wxPython/contrib/iewin/wxactivex.h
Normal file
300
wxPython/contrib/iewin/wxactivex.h
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
#ifndef WX_ACTIVE_X
|
||||||
|
#define WX_ACTIVE_X
|
||||||
|
#pragma warning( disable : 4101 4786)
|
||||||
|
#pragma warning( disable : 4786)
|
||||||
|
|
||||||
|
|
||||||
|
#include <wx/setup.h>
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <oleidl.h>
|
||||||
|
#include <docobj.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// wxAutoOleInterface<Interface>
|
||||||
|
// Template class for smart interface handling
|
||||||
|
// - Automatically dereferences ole interfaces
|
||||||
|
// - Smart Copy Semantics
|
||||||
|
// - Can Create Interfaces
|
||||||
|
// - Can query for other interfaces
|
||||||
|
template <class I> class wxAutoOleInterface
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
I *m_interface;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// takes ownership of an existing interface
|
||||||
|
// Assumed to already have a AddRef() applied
|
||||||
|
explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {}
|
||||||
|
|
||||||
|
// queries for an interface
|
||||||
|
wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL)
|
||||||
|
{
|
||||||
|
QueryInterface(riid, pUnk);
|
||||||
|
};
|
||||||
|
// queries for an interface
|
||||||
|
wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL)
|
||||||
|
{
|
||||||
|
QueryInterface(riid, pDispatch);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Creates an Interface
|
||||||
|
wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)
|
||||||
|
{
|
||||||
|
CreateInstance(clsid, riid);
|
||||||
|
};
|
||||||
|
|
||||||
|
// copy constructor
|
||||||
|
explicit wxAutoOleInterface(const wxAutoOleInterface<I>& ti) : m_interface(NULL)
|
||||||
|
{
|
||||||
|
operator = (ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignment operator
|
||||||
|
wxAutoOleInterface<I>& operator = (const wxAutoOleInterface<I>& ti)
|
||||||
|
{
|
||||||
|
if (ti.m_interface)
|
||||||
|
ti.m_interface->AddRef();
|
||||||
|
Free();
|
||||||
|
m_interface = ti.m_interface;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// takes ownership of an existing interface
|
||||||
|
// Assumed to already have a AddRef() applied
|
||||||
|
wxAutoOleInterface<I>& operator = (I *&ti)
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
m_interface = ti;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~wxAutoOleInterface()
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline void Free()
|
||||||
|
{
|
||||||
|
if (m_interface)
|
||||||
|
m_interface->Release();
|
||||||
|
m_interface = NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
// queries for an interface
|
||||||
|
HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
wxASSERT(pUnk != NULL);
|
||||||
|
return pUnk->QueryInterface(riid, (void **) &m_interface);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a Interface instance
|
||||||
|
HRESULT CreateInstance(REFCLSID clsid, REFIID riid)
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inline operator I *() const {return m_interface;}
|
||||||
|
inline I* operator ->() {return m_interface;}
|
||||||
|
inline I** GetRef() {return &m_interface;}
|
||||||
|
|
||||||
|
inline bool Ok() const {return m_interface != NULL;}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxString OLEHResultToString(HRESULT hr);
|
||||||
|
wxString GetIIDName(REFIID riid);
|
||||||
|
|
||||||
|
//#define __WXOLEDEBUG
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __WXOLEDEBUG
|
||||||
|
#define WXOLE_TRACE(str) {OutputDebugString(str);OutputDebugString("\r\n");}
|
||||||
|
#define WXOLE_TRACEOUT(stuff)\
|
||||||
|
{\
|
||||||
|
ostringstream os;\
|
||||||
|
os << stuff << ends;\
|
||||||
|
WXOLE_TRACE(os.str().c_str());\
|
||||||
|
}
|
||||||
|
|
||||||
|
#define WXOLE_WARN(__hr,msg)\
|
||||||
|
{\
|
||||||
|
if (__hr != S_OK)\
|
||||||
|
{\
|
||||||
|
wxString s = "*** ";\
|
||||||
|
s += msg;\
|
||||||
|
s += " : "+ OLEHResultToString(__hr);\
|
||||||
|
WXOLE_TRACE(s.c_str());\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define WXOLE_TRACE(str)
|
||||||
|
#define WXOLE_TRACEOUT(stuff)
|
||||||
|
#define WXOLE_WARN(_proc,msg) {_proc;}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Auto Initialisation
|
||||||
|
class wxOleInit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static IMalloc *GetIMalloc();
|
||||||
|
|
||||||
|
wxOleInit();
|
||||||
|
~wxOleInit();
|
||||||
|
};
|
||||||
|
|
||||||
|
#define DECLARE_OLE_UNKNOWN(cls)\
|
||||||
|
private:\
|
||||||
|
class TAutoInitInt\
|
||||||
|
{\
|
||||||
|
public:\
|
||||||
|
LONG l;\
|
||||||
|
TAutoInitInt() : l(0) {}\
|
||||||
|
};\
|
||||||
|
TAutoInitInt refCount, lockCount;\
|
||||||
|
wxOleInit oleInit;\
|
||||||
|
static void _GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc);\
|
||||||
|
public:\
|
||||||
|
LONG GetRefCount();\
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject);\
|
||||||
|
ULONG STDMETHODCALLTYPE AddRef();\
|
||||||
|
ULONG STDMETHODCALLTYPE Release();\
|
||||||
|
ULONG STDMETHODCALLTYPE AddLock();\
|
||||||
|
ULONG STDMETHODCALLTYPE ReleaseLock()
|
||||||
|
|
||||||
|
#define DEFINE_OLE_TABLE(cls)\
|
||||||
|
LONG cls::GetRefCount() {return refCount.l;}\
|
||||||
|
HRESULT STDMETHODCALLTYPE cls::QueryInterface(REFIID iid, void ** ppvObject)\
|
||||||
|
{\
|
||||||
|
if (! ppvObject)\
|
||||||
|
{\
|
||||||
|
WXOLE_TRACE("*** NULL POINTER ***");\
|
||||||
|
return E_FAIL;\
|
||||||
|
};\
|
||||||
|
const char *desc = NULL;\
|
||||||
|
cls::_GetInterface(this, iid, ppvObject, desc);\
|
||||||
|
if (! *ppvObject)\
|
||||||
|
{\
|
||||||
|
WXOLE_TRACEOUT("<" << GetIIDName(iid).c_str() << "> Not Found");\
|
||||||
|
return E_NOINTERFACE;\
|
||||||
|
};\
|
||||||
|
WXOLE_TRACEOUT("QI : <" << desc <<">");\
|
||||||
|
((IUnknown * )(*ppvObject))->AddRef();\
|
||||||
|
return S_OK;\
|
||||||
|
};\
|
||||||
|
ULONG STDMETHODCALLTYPE cls::AddRef()\
|
||||||
|
{\
|
||||||
|
WXOLE_TRACEOUT(# cls << "::Add ref(" << refCount.l << ")");\
|
||||||
|
InterlockedIncrement(&refCount.l);\
|
||||||
|
return refCount.l;\
|
||||||
|
};\
|
||||||
|
ULONG STDMETHODCALLTYPE cls::Release()\
|
||||||
|
{\
|
||||||
|
if (refCount.l > 0)\
|
||||||
|
{\
|
||||||
|
InterlockedDecrement(&refCount.l);\
|
||||||
|
WXOLE_TRACEOUT(# cls << "::Del ref(" << refCount.l << ")");\
|
||||||
|
if (refCount.l == 0)\
|
||||||
|
{\
|
||||||
|
delete this;\
|
||||||
|
return 0;\
|
||||||
|
};\
|
||||||
|
return refCount.l;\
|
||||||
|
}\
|
||||||
|
else\
|
||||||
|
return 0;\
|
||||||
|
}\
|
||||||
|
ULONG STDMETHODCALLTYPE cls::AddLock()\
|
||||||
|
{\
|
||||||
|
WXOLE_TRACEOUT(# cls << "::Add Lock(" << lockCount.l << ")");\
|
||||||
|
InterlockedIncrement(&lockCount.l);\
|
||||||
|
return lockCount.l;\
|
||||||
|
};\
|
||||||
|
ULONG STDMETHODCALLTYPE cls::ReleaseLock()\
|
||||||
|
{\
|
||||||
|
if (lockCount.l > 0)\
|
||||||
|
{\
|
||||||
|
InterlockedDecrement(&lockCount.l);\
|
||||||
|
WXOLE_TRACEOUT(# cls << "::Del Lock(" << lockCount.l << ")");\
|
||||||
|
return lockCount.l;\
|
||||||
|
}\
|
||||||
|
else\
|
||||||
|
return 0;\
|
||||||
|
}\
|
||||||
|
DEFINE_OLE_BASE(cls)
|
||||||
|
|
||||||
|
#define DEFINE_OLE_BASE(cls)\
|
||||||
|
void cls::_GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc)\
|
||||||
|
{\
|
||||||
|
*_interface = NULL;\
|
||||||
|
desc = NULL;
|
||||||
|
|
||||||
|
#define OLE_INTERFACE(_iid, _type)\
|
||||||
|
if (IsEqualIID(iid, _iid))\
|
||||||
|
{\
|
||||||
|
WXOLE_TRACE("Found Interface <" # _type ">");\
|
||||||
|
*_interface = (IUnknown *) (_type *) self;\
|
||||||
|
desc = # _iid;\
|
||||||
|
return;\
|
||||||
|
}
|
||||||
|
|
||||||
|
#define OLE_IINTERFACE(_face) OLE_INTERFACE(IID_##_face, _face)
|
||||||
|
|
||||||
|
#define OLE_INTERFACE_CUSTOM(func)\
|
||||||
|
if (func(self, iid, _interface, desc))\
|
||||||
|
return
|
||||||
|
|
||||||
|
#define END_OLE_TABLE\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class wxActiveX : public wxWindow {
|
||||||
|
public:
|
||||||
|
wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
|
||||||
|
wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
|
||||||
|
virtual ~wxActiveX();
|
||||||
|
|
||||||
|
void CreateActiveX(REFCLSID clsid);
|
||||||
|
void CreateActiveX(LPOLESTR progId);
|
||||||
|
|
||||||
|
HRESULT ConnectAdvise(REFIID riid, IUnknown *eventSink);
|
||||||
|
|
||||||
|
void OnSize(wxSizeEvent&);
|
||||||
|
void OnSetFocus(wxFocusEvent&);
|
||||||
|
void OnKillFocus(wxFocusEvent&);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class FrameSite;
|
||||||
|
|
||||||
|
typedef wxAutoOleInterface<IConnectionPoint> wxOleConnectionPoint;
|
||||||
|
typedef pair<wxOleConnectionPoint, DWORD> wxOleConnection;
|
||||||
|
typedef vector<wxOleConnection> wxOleConnectionArray;
|
||||||
|
|
||||||
|
wxAutoOleInterface<IOleClientSite> m_clientSite;
|
||||||
|
wxAutoOleInterface<IUnknown> m_ActiveX;
|
||||||
|
wxAutoOleInterface<IOleObject> m_oleObject;
|
||||||
|
wxAutoOleInterface<IOleInPlaceObject> m_oleInPlaceObject;
|
||||||
|
wxAutoOleInterface<IOleInPlaceActiveObject>
|
||||||
|
|
||||||
|
m_oleInPlaceActiveObject;
|
||||||
|
wxAutoOleInterface<IOleDocumentView> m_docView;
|
||||||
|
HWND m_oleObjectHWND;
|
||||||
|
bool m_bAmbientUserMode;
|
||||||
|
DWORD m_docAdviseCookie;
|
||||||
|
wxOleConnectionArray m_connections;
|
||||||
|
|
||||||
|
HRESULT AmbientPropertyChanged(DISPID dispid);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _IEHTMLWIN_H_ */
|
@@ -33,6 +33,7 @@ _treeList = [
|
|||||||
'wxArtProvider',
|
'wxArtProvider',
|
||||||
'ScrolledPanel',
|
'ScrolledPanel',
|
||||||
'wxMenu',
|
'wxMenu',
|
||||||
|
'wxIEHtmlWin',
|
||||||
]),
|
]),
|
||||||
|
|
||||||
# managed windows == things with a caption you can close
|
# managed windows == things with a caption you can close
|
||||||
@@ -117,6 +118,7 @@ _treeList = [
|
|||||||
'wxEditor',
|
'wxEditor',
|
||||||
'wxFloatBar',
|
'wxFloatBar',
|
||||||
'wxHtmlWindow',
|
'wxHtmlWindow',
|
||||||
|
'wxIEHtmlWin',
|
||||||
'wxLEDNumberCtrl',
|
'wxLEDNumberCtrl',
|
||||||
'wxMimeTypesManager',
|
'wxMimeTypesManager',
|
||||||
'wxMVCTree',
|
'wxMVCTree',
|
||||||
|
198
wxPython/demo/wxIEHtmlWin.py
Normal file
198
wxPython/demo/wxIEHtmlWin.py
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
|
||||||
|
from wxPython.wx import *
|
||||||
|
|
||||||
|
if wxPlatform == '__WXMSW__':
|
||||||
|
from wxPython.iewin import *
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestPanel(wxWindow):
|
||||||
|
def __init__(self, parent, log, frame=None):
|
||||||
|
wxWindow.__init__(self, parent, -1, style=wxCLIP_CHILDREN)
|
||||||
|
self.log = log
|
||||||
|
self.current = "http://wxPython.org/"
|
||||||
|
self.frame = frame
|
||||||
|
if frame:
|
||||||
|
self.titleBase = frame.GetTitle()
|
||||||
|
|
||||||
|
|
||||||
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
btnSizer = wxBoxSizer(wxHORIZONTAL)
|
||||||
|
|
||||||
|
self.ie = wxIEHtmlWin(self, -1) ##, style=wxSUNKEN_BORDER)
|
||||||
|
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "Open", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnOpenButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "Home", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnHomeButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "<--", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnPrevPageButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "-->", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnNextPageButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "Stop", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnStopButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "Search", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnSearchPageButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
btn = wxButton(self, wxNewId(), "Refresh", style=wxBU_EXACTFIT)
|
||||||
|
EVT_BUTTON(self, btn.GetId(), self.OnRefreshPageButton)
|
||||||
|
btnSizer.Add(btn, 0, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
txt = wxStaticText(self, -1, "Location:")
|
||||||
|
btnSizer.Add(txt, 0, wxCENTER|wxALL, 2)
|
||||||
|
|
||||||
|
self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN)
|
||||||
|
EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect)
|
||||||
|
EVT_KEY_UP(self.location, self.OnLocationKey)
|
||||||
|
EVT_CHAR(self.location, self.IgnoreReturn)
|
||||||
|
btnSizer.Add(self.location, 1, wxEXPAND|wxALL, 2)
|
||||||
|
|
||||||
|
sizer.Add(btnSizer, 0, wxEXPAND)
|
||||||
|
sizer.Add(self.ie, 1, wxEXPAND)
|
||||||
|
|
||||||
|
self.ie.LoadUrl(self.current)
|
||||||
|
self.location.Append(self.current)
|
||||||
|
|
||||||
|
self.SetSizer(sizer)
|
||||||
|
self.SetAutoLayout(true)
|
||||||
|
EVT_SIZE(self, self.OnSize)
|
||||||
|
|
||||||
|
# Hook up the event handlers for the IE window
|
||||||
|
EVT_MSHTML_BEFORENAVIGATE2(self, -1, self.OnBeforeNavigate2)
|
||||||
|
EVT_MSHTML_NEWWINDOW2(self, -1, self.OnNewWindow2)
|
||||||
|
EVT_MSHTML_DOCUMENTCOMPLETE(self, -1, self.OnDocumentComplete)
|
||||||
|
#EVT_MSHTML_PROGRESSCHANGE(self, -1, self.OnProgressChange)
|
||||||
|
EVT_MSHTML_STATUSTEXTCHANGE(self, -1, self.OnStatusTextChange)
|
||||||
|
EVT_MSHTML_TITLECHANGE(self, -1, self.OnTitleChange)
|
||||||
|
|
||||||
|
|
||||||
|
def OnSize(self, evt):
|
||||||
|
self.Layout()
|
||||||
|
|
||||||
|
def OnLocationSelect(self, evt):
|
||||||
|
url = self.location.GetStringSelection()
|
||||||
|
self.log.write('OnLocationSelect: %s\n' % url)
|
||||||
|
self.ie.LoadUrl(url)
|
||||||
|
|
||||||
|
def OnLocationKey(self, evt):
|
||||||
|
if evt.KeyCode() == WXK_RETURN:
|
||||||
|
URL = self.location.GetValue()
|
||||||
|
self.location.Append(URL)
|
||||||
|
self.ie.LoadUrl(URL)
|
||||||
|
else:
|
||||||
|
evt.Skip()
|
||||||
|
|
||||||
|
def IgnoreReturn(self, evt):
|
||||||
|
print 'IgnoreReturn'
|
||||||
|
if evt.KeyCode() != WXK_RETURN:
|
||||||
|
evt.Skip()
|
||||||
|
|
||||||
|
def OnOpenButton(self, event):
|
||||||
|
dlg = wxTextEntryDialog(self, "Open Location",
|
||||||
|
"Enter a full URL or local path",
|
||||||
|
self.current, wxOK|wxCANCEL)
|
||||||
|
dlg.CentreOnParent()
|
||||||
|
if dlg.ShowModal() == wxID_OK:
|
||||||
|
self.current = dlg.GetValue()
|
||||||
|
self.ie.LoadUrl(self.current)
|
||||||
|
dlg.Destroy()
|
||||||
|
|
||||||
|
def OnHomeButton(self, event):
|
||||||
|
self.ie.GoHome() ## ET Phone Home!
|
||||||
|
|
||||||
|
def OnPrevPageButton(self, event):
|
||||||
|
self.ie.GoBack()
|
||||||
|
|
||||||
|
def OnNextPageButton(self, event):
|
||||||
|
self.ie.GoForward()
|
||||||
|
|
||||||
|
def OnStopButton(self, evt):
|
||||||
|
self.ie.Stop()
|
||||||
|
|
||||||
|
def OnSearchPageButton(self, evt):
|
||||||
|
self.ie.GoSearch()
|
||||||
|
|
||||||
|
def OnRefreshPageButton(self, evt):
|
||||||
|
self.ie.Refresh(wxIEHTML_REFRESH_COMPLETELY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def logEvt(self, name, event):
|
||||||
|
self.log.write('%s: %s\n' %
|
||||||
|
(name, (event.GetLong1(), event.GetLong2(), event.GetText())))
|
||||||
|
|
||||||
|
def OnBeforeNavigate2(self, evt):
|
||||||
|
self.logEvt('OnBeforeNavigate2', evt)
|
||||||
|
|
||||||
|
def OnNewWindow2(self, evt):
|
||||||
|
self.logEvt('OnNewWindow2', evt)
|
||||||
|
evt.Veto() # don't allow it
|
||||||
|
|
||||||
|
def OnDocumentComplete(self, evt):
|
||||||
|
self.logEvt('OnDocumentComplete', evt)
|
||||||
|
self.current = evt.GetText()
|
||||||
|
self.location.SetValue(self.current)
|
||||||
|
|
||||||
|
def OnTitleChange(self, evt):
|
||||||
|
self.logEvt('OnTitleChange', evt)
|
||||||
|
if self.frame:
|
||||||
|
self.frame.SetTitle(self.titleBase + ' -- ' + evt.GetText())
|
||||||
|
|
||||||
|
def OnStatusTextChange(self, evt):
|
||||||
|
self.logEvt('OnStatusTextChange', evt)
|
||||||
|
if self.frame:
|
||||||
|
self.frame.SetStatusText(evt.GetText())
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# for the demo framework...
|
||||||
|
|
||||||
|
def runTest(frame, nb, log):
|
||||||
|
if wxPlatform == '__WXMSW__':
|
||||||
|
win = TestPanel(nb, log, frame)
|
||||||
|
return win
|
||||||
|
else:
|
||||||
|
dlg = wxMessageDialog(frame, 'This demo only works on MSW.',
|
||||||
|
'Sorry', wxOK | wxICON_INFORMATION)
|
||||||
|
dlg.ShowModal()
|
||||||
|
dlg.Destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overview = """\
|
||||||
|
<html><body>
|
||||||
|
<h2>wxIEHtmlWin</h2>
|
||||||
|
|
||||||
|
The wxIEHtmlWin class is the first example of using a contributed
|
||||||
|
wxActiveX class in wxWindows C++. It is still experimental, but
|
||||||
|
I think it is useful.
|
||||||
|
|
||||||
|
<p> Using this class is simpler than ActiveXWrapper, doesn't rely on
|
||||||
|
the win32all extensions, and is more "wx\'ish", meaning that it uses
|
||||||
|
events and etc. as would be expected from any other wx window.
|
||||||
|
|
||||||
|
</body></html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys,os
|
||||||
|
import run
|
||||||
|
run.main(['', os.path.basename(sys.argv[0])])
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
@@ -81,6 +81,7 @@ Source: "wxPython\oglc.pyd"; DestDir: "{app}\wxPython"; Component
|
|||||||
Source: "wxPython\stc_c.pyd"; DestDir: "{app}\wxPython"; Components: core
|
Source: "wxPython\stc_c.pyd"; DestDir: "{app}\wxPython"; Components: core
|
||||||
Source: "wxPython\xrcc.pyd"; DestDir: "{app}\wxPython"; Components: core
|
Source: "wxPython\xrcc.pyd"; DestDir: "{app}\wxPython"; Components: core
|
||||||
Source: "wxPython\gizmosc.pyd"; DestDir: "{app}\wxPython"; Components: core
|
Source: "wxPython\gizmosc.pyd"; DestDir: "{app}\wxPython"; Components: core
|
||||||
|
Source: "wxPython\iewinc.pyd"; DestDir: "{app}\wxPython"; Components: core
|
||||||
Source: "wxPython\dllwidget_c.pyd"; DestDir: "{app}\wxPython"; Components: core
|
Source: "wxPython\dllwidget_c.pyd"; DestDir: "{app}\wxPython"; Components: core
|
||||||
|
|
||||||
Source: "wxPython\*.py"; DestDir: "{app}\wxPython"; Components: core
|
Source: "wxPython\*.py"; DestDir: "{app}\wxPython"; Components: core
|
||||||
|
@@ -36,7 +36,8 @@ BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library
|
|||||||
BUILD_DLLWIDGET = 1# Build a module that enables unknown wx widgets
|
BUILD_DLLWIDGET = 1# Build a module that enables unknown wx widgets
|
||||||
# to be loaded from a DLL and to be used from Python.
|
# to be loaded from a DLL and to be used from Python.
|
||||||
|
|
||||||
BUILD_IEWIN = 0 # Internet Explorer wrapper (experimental)
|
# Internet Explorer wrapper (experimental)
|
||||||
|
BUILD_IEWIN = (os.name == 'nt')
|
||||||
|
|
||||||
CORE_ONLY = 0 # if true, don't build any of the above
|
CORE_ONLY = 0 # if true, don't build any of the above
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ if bcpp_compiling:
|
|||||||
|
|
||||||
# Boolean (int) flags
|
# Boolean (int) flags
|
||||||
for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
|
for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
|
||||||
'BUILD_GIZMOS', 'BUILD_DLLWIDGET',
|
'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
|
||||||
'CORE_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE', 'UNDEF_NDEBUG',
|
'CORE_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE', 'UNDEF_NDEBUG',
|
||||||
'FINAL', 'HYBRID', ]:
|
'FINAL', 'HYBRID', ]:
|
||||||
for x in range(len(sys.argv)):
|
for x in range(len(sys.argv)):
|
||||||
@@ -169,6 +170,7 @@ if CORE_ONLY:
|
|||||||
BUILD_XRC = 0
|
BUILD_XRC = 0
|
||||||
BUILD_GIZMOS = 0
|
BUILD_GIZMOS = 0
|
||||||
BUILD_DLLWIDGET = 0
|
BUILD_DLLWIDGET = 0
|
||||||
|
BUILD_IEWIN = 0
|
||||||
|
|
||||||
|
|
||||||
if UNICODE and os.name != 'nt':
|
if UNICODE and os.name != 'nt':
|
||||||
@@ -685,6 +687,7 @@ if not GL_ONLY and BUILD_IEWIN:
|
|||||||
|
|
||||||
|
|
||||||
ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
|
ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
|
||||||
|
'%s/wxactivex.cpp' % location,
|
||||||
] + swig_sources,
|
] + swig_sources,
|
||||||
|
|
||||||
include_dirs = includes,
|
include_dirs = includes,
|
||||||
|
Reference in New Issue
Block a user