1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: ActiveX controls (such as Internet Explorer) in a wxWindow
7 // Created: 18-Mar-2004
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/wxPython/wxPython.h"
18 #include "wx/wxPython/pyclasses.h"
19 #include "wx/wxPython/pyistream.h"
21 #include "wxactivex.h"
24 //---------------------------------------------------------------------------
27 %pythoncode { wx = core }
29 MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
31 %include _activex_rename.i
34 //---------------------------------------------------------------------------
36 typedef unsigned short USHORT;
38 typedef long MEMBERID;
39 typedef unsigned short VARTYPE;
43 // Since SWIG doesn't support nested classes, we need to fool it a bit
44 // and make them look like global classes. These defines make the C++ code
45 // know what we are doing.
46 #define wxParamX wxActiveX::ParamX
47 #define wxFuncX wxActiveX::FuncX
48 #define wxPropX wxActiveX::PropX
49 #define wxParamXArray wxActiveX::ParamXArray
50 #define wxFuncXArray wxActiveX::FuncXArray
51 #define wxPropXArray wxActiveX::PropXArray
56 // Some conversion helpers
57 static wxVariant _PyObj2Variant(PyObject* value);
58 static PyObject* _Variant2PyObj(wxVariant& value, bool useNone=False);
59 static wxString _VARTYPEname(VARTYPE vt);
61 // Check if an exception has been raised (blocking threads)
62 inline bool wxPyErr_Occurred()
65 wxPyBeginBlockThreads();
66 rval = PyErr_Occurred() != NULL;
67 wxPyEndBlockThreads();
73 //---------------------------------------------------------------------------
77 "This class wraps the Windows CLSID structure and is used to
78 specify the class of the ActiveX object that is to be created. A
79 CLSID can be constructed from either a ProgID string, (such as
80 'WordPad.Document.1') or a classID string, (such as
81 '{CA8A9783-280D-11CF-A24D-444553540000}').");
86 CLSID(const wxString& id)
89 CLSID* self = new CLSID;
90 memset(self, 0, sizeof(CLSID));
92 if (id[0] == _T('{')) {
93 // Looks like a classID string
96 (LPOLESTR)(const wchar_t *)id.wc_str(wxConvUTF8),
102 (LPOLESTR)(const wchar_t *)id.wc_str(wxConvUTF8),
105 if (result != NOERROR) {
106 wxPyErr_SetString(PyExc_ValueError, "Not a recognized classID or progID");
113 ~CLSID() { delete self; }
115 wxString GetCLSIDString()
119 if (StringFromCLSID(*self, &s) == S_OK) {
124 str = _T("Error!"); // TODO: raise exception?
128 wxString GetProgIDString()
132 if (ProgIDFromCLSID(*self, &s) == S_OK) {
137 str = _T("Error!"); // TODO: raise exception?
142 %pythoncode { def __str__(self): return self.GetCLSIDString() }
146 //---------------------------------------------------------------------------
149 %define MAKE_ARRAY_WRAPPER(basetype, arrayname)
154 bool __nonzero__() { return self->size() > 0; }
155 int __len__() { return self->size(); }
157 const basetype& __getitem__(int idx) {
158 if ( idx >= 0 && idx < self->size() )
161 static basetype BadVal;
162 wxPyErr_SetString(PyExc_IndexError, "Index out of range");
171 //---------------------------------------------------------------------------
185 %feature("shadow") vt_type_get "vt_type = property(_activex.ParamX_vt_type_get)";
186 %extend { wxString vt_type_get() { return _VARTYPEname(self->vt); } }
188 %feature("shadow") IsIn "isIn = property(_activex.ParamX_IsIn)";
189 %feature("shadow") IsOut "isOut = property(_activex.ParamX_IsOut)";
190 %feature("shadow") IsRetVal "isRetVal = property(_activex.ParamX_IsRetVal)";
193 bool IsRetVal() const;
206 wxParamXArray params;
219 %feature("shadow") CanGet "canGet = property(_activex.PropX_CanGet)";
220 %feature("shadow") CanSet "canSet = property(_activex.PropX_CanSet)";
227 MAKE_ARRAY_WRAPPER(wxParamX, wxParamXArray);
228 MAKE_ARRAY_WRAPPER(wxFuncX, wxFuncXArray);
229 MAKE_ARRAY_WRAPPER(wxPropX, wxPropXArray);
232 //---------------------------------------------------------------------------
236 // C++ version of a Python-aware wxActiveX
237 class wxActiveXWindow : public wxActiveX
242 wxActiveXWindow( wxWindow* parent, const CLSID& clsId, wxWindowID id = -1,
243 const wxPoint& pos = wxDefaultPosition,
244 const wxSize& size = wxDefaultSize,
246 const wxString& name = wxPyPanelNameStr)
247 : wxActiveX(parent, clsId, id, pos, size, style, name)
252 const CLSID& GetCLSID() const { return m_CLSID; }
255 // Renamed versions of some base class methods that delegate
256 // to the base where appropriate, and raise Python exceptions
258 int GetAXEventCount() const { return wxActiveX::GetEventCount(); }
259 int GetAXPropCount() const { return wxActiveX::GetPropCount(); }
260 int GetAXMethodCount() const { return wxActiveX::GetMethodCount(); }
262 const wxFuncX& GetAXEventDesc(int idx) const
264 static wxFuncX BadVal;
265 if (idx < 0 || idx >= GetAXEventCount()) {
266 wxPyErr_SetString(PyExc_IndexError, "Index out of range");
269 return m_events[idx];
271 const wxFuncX& GetAXMethodDesc(int idx) const
273 static wxFuncX BadVal;
274 if (idx < 0 || idx >= GetAXMethodCount()) {
275 wxPyErr_SetString(PyExc_IndexError, "Index out of range");
278 return m_methods[idx];
280 const wxPropX& GetAXPropDesc(int idx) const
282 static wxPropX BadVal;
283 if (idx < 0 || idx >= GetAXPropCount()) {
284 wxPyErr_SetString(PyExc_IndexError, "Index out of range");
290 const wxFuncX& GetAXMethodDesc(const wxString& name) const
292 NameMap::const_iterator it = m_methodNames.find(name);
293 if (it == m_methodNames.end()) {
295 msg << "method <" << name << "> not found";
296 wxPyErr_SetString(PyExc_KeyError, msg.mb_str());
297 static wxFuncX BadVal;
300 return GetAXMethodDesc(it->second);
302 const wxPropX& GetAXPropDesc(const wxString& name) const
304 NameMap::const_iterator it = m_propNames.find(name);
305 if (it == m_propNames.end()) {
307 msg << "property <" << name << "> not found";
308 wxPyErr_SetString(PyExc_KeyError, msg.mb_str());
309 static wxPropX BadVal;
312 return GetAXPropDesc(it->second);
315 // Accessors for the internal vectors of events, methods and
316 // proprties. Can be used as sequence like objects from
318 const wxFuncXArray& GetAXEvents() { return m_events; }
319 const wxFuncXArray& GetAXMethods() { return m_methods; }
320 const wxPropXArray& GetAXProperties() { return m_props; }
323 // Set a property from a Python object
324 void SetAXProp(const wxString& name, PyObject* value)
326 const wxPropX& prop = GetAXPropDesc(name);
327 wxPyBeginBlockThreads();
328 if (! PyErr_Occurred() ) {
329 if (! prop.CanSet()) {
331 msg << "property <" << name << "> is readonly";
332 PyErr_SetString(PyExc_TypeError, msg.mb_str());
335 wxVariant wxV = _PyObj2Variant(value);
336 if (PyErr_Occurred())
338 VARIANT v = {prop.arg.vt};
339 if (!VariantToMSWVariant(wxV, v) || PyErr_Occurred()) {
341 msg << "Unable to convert value to expected type: ("
342 << _VARTYPEname(prop.arg.vt) << ") for property <"
344 PyErr_SetString(PyExc_TypeError, msg.mb_str());
347 PyThreadState* tstate = wxPyBeginAllowThreads();
348 SetProp(prop.memid, v);
350 wxPyEndAllowThreads(tstate);
354 wxPyEndBlockThreads();
358 // Get a property and convert it to a Python object
359 PyObject* GetAXProp(const wxString& name)
361 PyObject* rval = NULL;
362 const wxPropX& prop = GetAXPropDesc(name);
363 wxPyBeginBlockThreads();
364 if (! PyErr_Occurred() ) {
365 if (! prop.CanGet()) {
367 msg << "property <" << name << "> is writeonly";
368 PyErr_SetString(PyExc_TypeError, msg.mb_str());
371 PyThreadState* tstate = wxPyBeginAllowThreads();
372 VARIANT v = GetPropAsVariant(prop.memid);
373 wxPyEndAllowThreads(tstate);
375 if (!MSWVariantToVariant(v, wv) || PyErr_Occurred()) {
377 msg << "Unable to convert value to expected type: ("
378 << _VARTYPEname(prop.arg.vt) << ") for property <"
380 PyErr_SetString(PyExc_TypeError, msg.mb_str());
383 rval = _Variant2PyObj(wv);
388 wxPyEndBlockThreads();
393 // If both IsIn and isOut are false, assume it is actually an
395 bool paramIsIn(const wxParamX& p)
397 return p.IsIn() || (!p.IsIn() && !p.IsOut());
401 // Call a method of the ActiveX object
402 PyObject* _CallAXMethod(const wxString& name, PyObject* args)
404 VARIANTARG *vargs = NULL;
406 PyObject* rval = NULL;
407 const wxFuncX& func = GetAXMethodDesc(name);
409 wxPyBeginBlockThreads();
410 if (! PyErr_Occurred() ) {
411 nargs = func.params.size();
413 vargs = new VARIANTARG[nargs];
416 // init type of vargs, in reverse order
418 for (i = 0; i < nargs; i++)
419 vargs[nargs - i - 1].vt = func.params[i].vt;
421 // Map the args coming from Python to the input parameters in vargs
424 while ( i<nargs && pi<PyTuple_Size(args) ) {
425 // Move to the next input param.
426 if (! paramIsIn(func.params[i])) {
430 // convert the python object
431 PyObject* obj = PyTuple_GetItem(args, pi);
432 if (obj == Py_None) // special-case None?
433 vargs[nargs - i - 1].vt = VT_EMPTY;
435 wxVariant wxV = _PyObj2Variant(obj);
436 if (PyErr_Occurred())
438 if (!VariantToMSWVariant(wxV, vargs[nargs - i - 1]) || PyErr_Occurred()) {
440 msg << "Unable to convert value to expected type: ("
441 << _VARTYPEname(vargs[nargs - i - 1].vt)
442 << ") for parameter " << i;
443 PyErr_SetString(PyExc_TypeError, msg.mb_str());
453 PyThreadState* tstate = wxPyBeginAllowThreads();
454 VARIANT rv = CallMethod(func.memid, vargs, nargs);
455 wxPyEndAllowThreads(tstate);
457 // Convert the return value and any out-params, ignoring
458 // conversion errors for now
460 MSWVariantToVariant(rv, wv);
461 rval = _Variant2PyObj(wv, True);
465 // make a list and put the rval in it if it is not None
466 PyObject* lst = PyList_New(0);
468 PyList_Append(lst, rval);
472 // find the out params and convert them
473 for (int i = 0; i < nargs; i++) {
474 VARIANTARG& va = vargs[nargs - i - 1];
475 const wxParamX &px = func.params[i];
477 MSWVariantToVariant(va, wv);
478 PyObject* obj = _Variant2PyObj(wv, True);
479 PyList_Append(lst, obj);
482 rval = PyList_AsTuple(lst);
485 if (PyErr_Occurred())
489 wxPyEndBlockThreads();
491 for (int i = 0; i < nargs; i++)
492 VariantClear(&vargs[i]);
502 // Now tell SWIG about this new class that is implemented above.
504 DocStr(wxActiveXWindow,
505 "ActiveXWindow derives from wxWindow and the constructor accepts a
506 CLSID for the ActiveX Control that should be created. The
507 ActiveXWindow class simply adds methods that allow you to query
508 some of the TypeInfo exposed by the ActiveX object, and also to
509 get/set properties or call methods by name. The Python
510 implementation automatically handles converting parameters and
511 return values to/from the types expected by the ActiveX code as
512 specified by the TypeInfo.
516 class wxActiveXWindow : public wxWindow
519 %pythonAppend wxActiveXWindow "self._setOORInfo(self)"
522 wxActiveXWindow( wxWindow* parent, const CLSID& clsId, wxWindowID id = -1,
523 const wxPoint& pos = wxDefaultPosition,
524 const wxSize& size = wxDefaultSize,
526 const wxString& name = wxPyPanelNameStr),
527 "Creates an ActiveX control from the clsID given and makes it act
528 as much like a regular wx.Window as possible.");
531 const CLSID& , GetCLSID() const,
532 "Return the CLSID used to construct this ActiveX window");
536 int , GetAXEventCount() const,
537 "Number of events defined for this control");
540 const wxFuncX& , GetAXEventDesc(int idx) const,
541 "Returns event description by index");
545 int , GetAXPropCount() const,
546 "Number of properties defined for this control");
548 %nokwargs GetAXPropDesc;
549 DocStr(GetPropDesc, "Returns property description by index or by name");
550 const wxPropX& GetAXPropDesc(int idx) const;
551 const wxPropX& GetAXPropDesc(const wxString& name) const;
556 int , GetAXMethodCount() const,
557 "Number of methods defined for this control");
559 %nokwargs GetAXMethodDesc;
560 DocStr(GetMethodDesc, "Returns method description by index or name");
561 const wxFuncX& GetAXMethodDesc(int idx) const;
562 const wxFuncX& GetAXMethodDesc(const wxString& name) const;
566 const wxFuncXArray& , GetAXEvents(),
567 "Returns a sequence of FuncX objects describing the events
568 available for this ActiveX object.");
571 const wxFuncXArray& , GetAXMethods(),
572 "Returns a sequence of FuncX objects describing the methods
573 available for this ActiveX object.");
576 const wxPropXArray& , GetAXProperties(),
577 "Returns a sequence of PropX objects describing the properties
578 available for this ActiveX object.");
583 void , SetAXProp(const wxString& name, PyObject* value),
584 "Set a property of the ActiveX object by name.");
588 PyObject* , GetAXProp(const wxString& name),
589 "Get the value of an ActiveX property by name.");
592 %nokwargs _CallAXMethod;
594 PyObject* , _CallAXMethod(const wxString& name, PyObject* args),
595 "The implementation for CallMethod. Calls an ActiveX method, by
596 name passing the parameters given in args.");
598 def CallAXMethod(self, name, *args):
600 Front-end for _CallMethod. Simply passes all positional args
601 after the name as a single tuple to _CallMethod.
603 return self._CallAXMethod(name, args)
607 //---------------------------------------------------------------------------
611 wxEventType , RegisterActiveXEvent(const wxString& eventName),
612 "Creates a standard wx event ID for the given eventName.");
616 DocStr(wxActiveXEvent,
617 "An instance of ActiveXEvent is sent to the handler for all bound
618 ActiveX events. Any event parameters from the ActiveX cntrol are
619 turned into attributes of the Python proxy for this event object.
620 Additionally, there is a property called eventName that will
621 return (suprizingly <wink>) the name of the ActiveX event.");
623 class wxActiveXEvent : public wxCommandEvent
626 %feature("shadow") EventName "eventName = property(_activex.ActiveXEvent_EventName)";
627 wxString EventName();
631 "This is called by the EventThunker before calling the handler.
632 We'll convert and load the ActiveX event parameters into
633 attributes of the Python event object.");
634 void _preInit(PyObject* pyself) {
635 wxPyBeginBlockThreads();
636 PyObject* pList = PyList_New(0);
637 PyObject_SetAttrString(pyself, "paramList", pList);
639 for (int i=0; i<self->ParamCount(); i+=1) {
640 PyObject* name = PyString_FromString((char*)self->ParamName(i).mb_str());
641 PyObject* val = _Variant2PyObj((*self)[i], True);
642 PyObject_SetAttr(pyself, name, val);
643 PyList_Append(pList, name);
647 wxPyEndBlockThreads();
652 //---------------------------------------------------------------------------
656 // Caller should already have the GIL!
657 wxVariant _PyObj2Variant(PyObject* value)
661 if (value == Py_None)
664 else if (PyBool_Check(value))
665 rval = (value == Py_True) ? true : false;
667 else if (PyInt_Check(value))
668 rval = PyInt_AS_LONG(value);
670 else if (PyFloat_Check(value))
671 rval = PyFloat_AS_DOUBLE(value);
673 else if (PyString_Check(value) || PyUnicode_Check(value))
674 rval = Py2wxString(value);
676 // TODO: PyList of strings --> wxArrayString
681 PyErr_SetString(PyExc_TypeError, "Unsupported object type in _PyObj2Variant");
689 // Caller should already have the GIL!
690 PyObject* _Variant2PyObj(wxVariant& value, bool useNone)
692 PyObject* rval = NULL;
694 if (value.IsNull()) {
699 // should "char" be treated as an int or as a string?
700 else if (value.IsType(_T("char")) || value.IsType(_T("long")))
701 rval = PyInt_FromLong(value);
703 else if (value.IsType(_T("double")))
704 rval = PyFloat_FromDouble(value);
706 else if (value.IsType(_T("bool")))
707 rval = PyBool_FromLong((bool)value);
709 else if (value.IsType(_T("string")))
710 rval = wx2PyString(value);
718 PyErr_SetString(PyExc_TypeError, "Unsupported object type in _Variant2PyObj");
725 wxString _VARTYPEname(VARTYPE vt)
732 return _T("VT_VARIANT");
752 // decimals are converted from doubles too
760 return _T("wx.DateTime");
766 return _T("VT_UNKNOWN");
769 return _T("VT_DISPATCH");
772 return _T("VT_EMPTY");
775 return _T("VT_NULL");
778 return _T("VT_VOID");
782 msg << _T("unsupported type ") << vt;
789 //---------------------------------------------------------------------------
790 //---------------------------------------------------------------------------
795 // A class derived from out wxActiveXWindow for the IE WebBrowser
796 // control that will serve as a base class for a Python
797 // implementation. This is done so we can "eat our own dog food"
798 // and use a class at least mostly generated by genaxmodule, but
799 // also get some of the extra stuff like loading a document from
800 // a string or a stream, getting text contents, etc. that
801 // Lindsay's version gives us.
804 #include <wx/mstream.h>
806 #include <winerror.h>
807 #include <exdispid.h>
813 #include "IEHtmlStream.h"
815 class wxIEHtmlWindowBase : public wxActiveXWindow {
817 wxAutoOleInterface<IWebBrowser2> m_webBrowser;
821 wxIEHtmlWindowBase ( wxWindow* parent, const CLSID& clsId, wxWindowID id = -1,
822 const wxPoint& pos = wxDefaultPosition,
823 const wxSize& size = wxDefaultSize,
825 const wxString& name = wxPyPanelNameStr)
826 : wxActiveXWindow(parent, clsId, id, pos, size, style, name)
830 // Get IWebBrowser2 Interface
831 hret = m_webBrowser.QueryInterface(IID_IWebBrowser2, m_ActiveX);
832 wxASSERT(SUCCEEDED(hret));
835 m_webBrowser->put_MenuBar(VARIANT_FALSE);
836 m_webBrowser->put_AddressBar(VARIANT_FALSE);
837 m_webBrowser->put_StatusBar(VARIANT_FALSE);
838 m_webBrowser->put_ToolBar(VARIANT_FALSE);
840 m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
841 m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
843 m_webBrowser->Navigate( L"about:blank", NULL, NULL, NULL, NULL );
847 void SetCharset(const wxString& charset)
852 IDispatch *pDisp = NULL;
853 hret = m_webBrowser->get_Document(&pDisp);
854 wxAutoOleInterface<IDispatch> disp(pDisp);
858 wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
860 doc->put_charset((BSTR) (const wchar_t *) charset.wc_str(wxConvUTF8));
861 //doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
866 bool LoadString(const wxString& html)
869 size_t len = html.length();
870 len *= sizeof(wxChar);
871 data = (char *) malloc(len);
872 memcpy(data, html.c_str(), len);
873 return LoadStream(new wxOwnedMemInputStream(data, len));
877 bool LoadStream(IStreamAdaptorBase *pstrm)
879 // need to prepend this as poxy MSHTML will not recognise a HTML comment
880 // as starting a html document and treats it as plain text
881 // Does nayone know how to force it to html mode ?
882 pstrm->prepend = "<html>";
884 // strip leading whitespace as it can confuse MSHTML
885 wxAutoOleInterface<IStream> strm(pstrm);
887 // Document Interface
888 IDispatch *pDisp = NULL;
889 HRESULT hret = m_webBrowser->get_Document(&pDisp);
892 wxAutoOleInterface<IDispatch> disp(pDisp);
895 // get IPersistStreamInit
896 wxAutoOleInterface<IPersistStreamInit>
897 pPersistStreamInit(IID_IPersistStreamInit, disp);
899 if (pPersistStreamInit.Ok())
901 HRESULT hr = pPersistStreamInit->InitNew();
903 hr = pPersistStreamInit->Load(strm);
905 return SUCCEEDED(hr);
911 bool LoadStream(wxInputStream *is)
913 // wrap reference around stream
914 IwxStreamAdaptor *pstrm = new IwxStreamAdaptor(is);
917 return LoadStream(pstrm);
921 wxString GetStringSelection(bool asHTML)
923 wxAutoOleInterface<IHTMLTxtRange> tr(wxieGetSelRange(m_oleObject));
925 return wxEmptyString;
931 hr = tr->get_htmlText(&text);
933 hr = tr->get_text(&text);
935 return wxEmptyString;
943 wxString GetText(bool asHTML)
945 if (! m_webBrowser.Ok())
946 return wxEmptyString;
948 // get document dispatch interface
949 IDispatch *iDisp = NULL;
950 HRESULT hr = m_webBrowser->get_Document(&iDisp);
952 return wxEmptyString;
954 // Query for Document Interface
955 wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
959 return wxEmptyString;
962 IHTMLElement *_body = NULL;
963 hd->get_body(&_body);
965 return wxEmptyString;
966 wxAutoOleInterface<IHTMLElement> body(_body);
973 hr = body->get_innerHTML(&text);
975 hr = body->get_innerText(&text);
977 return wxEmptyString;
986 // void wxIEHtmlWin::SetEditMode(bool seton)
988 // m_bAmbientUserMode = ! seton;
989 // AmbientPropertyChanged(DISPID_AMBIENT_USERMODE);
992 // bool wxIEHtmlWin::GetEditMode()
994 // return ! m_bAmbientUserMode;
1000 // we'll document it in the derived Python class
1001 %feature("noautodoc") wxIEHtmlWindowBase;
1002 %feature("noautodoc") wxIEHtmlWindowBase::SetCharset;
1003 %feature("noautodoc") wxIEHtmlWindowBase::LoadString;
1004 %feature("noautodoc") wxIEHtmlWindowBase::LoadStream;
1005 %feature("noautodoc") wxIEHtmlWindowBase::GetStringSelection;
1006 %feature("noautodoc") wxIEHtmlWindowBase::GetText;
1009 class wxIEHtmlWindowBase : public wxActiveXWindow {
1012 wxIEHtmlWindowBase ( wxWindow* parent, const CLSID& clsId, wxWindowID id = -1,
1013 const wxPoint& pos = wxDefaultPosition,
1014 const wxSize& size = wxDefaultSize,
1016 const wxString& name = wxPyPanelNameStr);
1018 void SetCharset(const wxString& charset);
1019 bool LoadString(const wxString& html);
1020 bool LoadStream(wxInputStream *is);
1021 wxString GetStringSelection(bool asHTML);
1022 wxString GetText(bool asHTML);
1036 enum wxIEHtmlRefreshLevel
1038 wxIEHTML_REFRESH_NORMAL = 0,
1039 wxIEHTML_REFRESH_IFEXPIRED = 1,
1040 wxIEHTML_REFRESH_CONTINUE = 2,
1041 wxIEHTML_REFRESH_COMPLETELY = 3
1046 class wxIEHtmlWin : public wxWindow
1049 %pythonAppend wxIEHtmlWin "self._setOORInfo(self)"
1051 wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
1052 const wxPoint& pos = wxDefaultPosition,
1053 const wxSize& size = wxDefaultSize,
1055 const wxString& name = wxPyPanelNameStr);
1057 void LoadUrl(const wxString& url);
1058 bool LoadString(wxString html);
1059 bool LoadStream(wxInputStream *is);
1061 %pythoncode { Navigate = LoadUrl }
1063 void SetCharset(wxString charset);
1064 void SetEditMode(bool seton);
1066 wxString GetStringSelection(bool asHTML = false);
1067 wxString GetText(bool asHTML = false);
1073 %name(RefreshPage)bool Refresh(wxIEHtmlRefreshLevel level);
1080 wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2 = RegisterActiveXEvent('BeforeNavigate2')
1081 wxEVT_COMMAND_MSHTML_NEWWINDOW2 = RegisterActiveXEvent('NewWindow2')
1082 wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE = RegisterActiveXEvent('DocumentComplete')
1083 wxEVT_COMMAND_MSHTML_PROGRESSCHANGE = RegisterActiveXEvent('ProgressChange')
1084 wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE = RegisterActiveXEvent('StatusTextChange')
1085 wxEVT_COMMAND_MSHTML_TITLECHANGE = RegisterActiveXEvent('TitleChange')
1087 EVT_MSHTML_BEFORENAVIGATE2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 1)
1088 EVT_MSHTML_NEWWINDOW2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 1)
1089 EVT_MSHTML_DOCUMENTCOMPLETE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 1)
1090 EVT_MSHTML_PROGRESSCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 1)
1091 EVT_MSHTML_STATUSTEXTCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 1)
1092 EVT_MSHTML_TITLECHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_TITLECHANGE, 1)
1097 //---------------------------------------------------------------------------
1098 // Include some extra Python code into the proxy module
1100 %pythoncode "_activex_ex.py"
1102 //---------------------------------------------------------------------------