]> git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/activex/wxie/wxactivex.h
Lindsay Mathieson's newest wxActiveX class has been wrapped into a new
[wxWidgets.git] / wxPython / contrib / activex / wxie / wxactivex.h
1 /*
2 wxActiveX Library Licence, Version 3
3 ====================================
4
5 Copyright (C) 2003 Lindsay Mathieson [, ...]
6
7 Everyone is permitted to copy and distribute verbatim copies
8 of this licence document, but changing it is not allowed.
9
10 wxActiveX LIBRARY LICENCE
11 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
13 This library is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Library General Public Licence as published by
15 the Free Software Foundation; either version 2 of the Licence, or (at
16 your option) any later version.
17
18 This library is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
21 General Public Licence for more details.
22
23 You should have received a copy of the GNU Library General Public Licence
24 along with this software, usually in a file named COPYING.LIB. If not,
25 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
26 Boston, MA 02111-1307 USA.
27
28 EXCEPTION NOTICE
29
30 1. As a special exception, the copyright holders of this library give
31 permission for additional uses of the text contained in this release of
32 the library as licenced under the wxActiveX Library Licence, applying
33 either version 3 of the Licence, or (at your option) any later version of
34 the Licence as published by the copyright holders of version 3 of the
35 Licence document.
36
37 2. The exception is that you may use, copy, link, modify and distribute
38 under the user's own terms, binary object code versions of works based
39 on the Library.
40
41 3. If you copy code from files distributed under the terms of the GNU
42 General Public Licence or the GNU Library General Public Licence into a
43 copy of this library, as this licence permits, the exception does not
44 apply to the code that you add in this way. To avoid misleading anyone as
45 to the status of such modified files, you must delete this exception
46 notice from such code and/or adjust the licensing conditions notice
47 accordingly.
48
49 4. If you write modifications of your own for this library, it is your
50 choice whether to permit this exception to apply to your modifications.
51 If you do not wish that, you must delete the exception notice from such
52 code and/or adjust the licensing conditions notice accordingly.
53 */
54
55 /*! \file wxactivex.h
56 \brief implements wxActiveX window class and OLE tools
57 */
58
59 #ifndef WX_ACTIVE_X
60 #define WX_ACTIVE_X
61 #pragma warning( disable : 4101 4786)
62 #pragma warning( disable : 4786)
63
64
65 #include <wx/setup.h>
66 #include <wx/wx.h>
67 #include <wx/variant.h>
68 #include <wx/datetime.h>
69 #include <oleidl.h>
70 #include <exdisp.h>
71 #include <docobj.h>
72 #include <iostream>
73 #include <vector>
74 #include <map>
75 using namespace std;
76
77 /// \brief wxActiveX Namespace for stuff I want to keep out of other tools way.
78 namespace NS_wxActiveX
79 {
80 /// STL utilty class.
81 /// specific to wxActiveX, for creating
82 /// case insenstive maps etc
83 struct less_wxStringI
84 {
85 bool operator()(const wxString& x, const wxString& y) const
86 {
87 return x.CmpNoCase(y) < 0;
88 };
89 };
90 };
91
92
93 //////////////////////////////////////////
94 /// Template class for smart interface handling.
95 /// - Automatically dereferences ole interfaces
96 /// - Smart Copy Semantics
97 /// - Can Create Interfaces
98 /// - Can query for other interfaces
99 template <class I> class wxAutoOleInterface
100 {
101 protected:
102 I *m_interface;
103
104 public:
105 /// takes ownership of an existing interface
106 /// Assumed to already have a AddRef() applied
107 explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {}
108
109 /// queries for an interface
110 wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL)
111 {
112 QueryInterface(riid, pUnk);
113 };
114 /// queries for an interface
115 wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL)
116 {
117 QueryInterface(riid, pDispatch);
118 };
119
120 /// Creates an Interface
121 wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)
122 {
123 CreateInstance(clsid, riid);
124 };
125
126 /// copy constructor
127 wxAutoOleInterface(const wxAutoOleInterface<I>& ti) : m_interface(NULL)
128 {
129 operator = (ti);
130 }
131
132 /// assignment operator
133 wxAutoOleInterface<I>& operator = (const wxAutoOleInterface<I>& ti)
134 {
135 if (ti.m_interface)
136 ti.m_interface->AddRef();
137 Free();
138 m_interface = ti.m_interface;
139 return *this;
140 }
141
142 /// takes ownership of an existing interface
143 /// Assumed to already have a AddRef() applied
144 wxAutoOleInterface<I>& operator = (I *&ti)
145 {
146 Free();
147 m_interface = ti;
148 return *this;
149 }
150
151 /// invokes Free()
152 ~wxAutoOleInterface()
153 {
154 Free();
155 };
156
157
158 /// Releases interface (i.e decrements refCount)
159 inline void Free()
160 {
161 if (m_interface)
162 m_interface->Release();
163 m_interface = NULL;
164 };
165
166 /// queries for an interface
167 HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)
168 {
169 Free();
170 wxCHECK(pUnk != NULL, -1);
171 return pUnk->QueryInterface(riid, (void **) &m_interface);
172 };
173
174 /// Create a Interface instance
175 HRESULT CreateInstance(REFCLSID clsid, REFIID riid)
176 {
177 Free();
178 return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);
179 };
180
181
182 /// returns the interface pointer
183 inline operator I *() const {return m_interface;}
184
185 /// returns the dereferenced interface pointer
186 inline I* operator ->() {return m_interface;}
187 /// returns a pointer to the interface pointer
188 inline I** GetRef() {return &m_interface;}
189 /// returns true if we have a valid interface pointer
190 inline bool Ok() const {return m_interface != NULL;}
191 };
192
193
194 /// \brief Converts a std HRESULT to its error code.
195 /// Hardcoded, by no means a definitive list.
196 wxString OLEHResultToString(HRESULT hr);
197 /// \brief Returns the string description of a IID.
198 /// Hardcoded, by no means a definitive list.
199 wxString GetIIDName(REFIID riid);
200
201 //#define __WXOLEDEBUG
202
203
204 #ifdef __WXOLEDEBUG
205 #define WXOLE_TRACE(str) {OutputDebugString(str);OutputDebugString("\r\n");}
206 #define WXOLE_TRACEOUT(stuff)\
207 {\
208 wxString os;\
209 os << stuff << "\r\n";\
210 WXOLE_TRACE(os.mb_str());\
211 }
212
213 #define WXOLE_WARN(__hr,msg)\
214 {\
215 if (__hr != S_OK)\
216 {\
217 wxString s = "*** ";\
218 s += msg;\
219 s += " : "+ OLEHResultToString(__hr);\
220 WXOLE_TRACE(s.c_str());\
221 }\
222 }
223 #else
224 #define WXOLE_TRACE(str)
225 #define WXOLE_TRACEOUT(stuff)
226 #define WXOLE_WARN(_proc,msg) {_proc;}
227 #endif
228
229 class wxOleInit
230 {
231 public:
232 static IMalloc *GetIMalloc();
233
234 wxOleInit();
235 ~wxOleInit();
236 };
237
238 #define DECLARE_OLE_UNKNOWN(cls)\
239 private:\
240 class TAutoInitInt\
241 {\
242 public:\
243 LONG l;\
244 TAutoInitInt() : l(0) {}\
245 };\
246 TAutoInitInt refCount, lockCount;\
247 wxOleInit oleInit;\
248 static void _GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc);\
249 public:\
250 LONG GetRefCount();\
251 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject);\
252 ULONG STDMETHODCALLTYPE AddRef();\
253 ULONG STDMETHODCALLTYPE Release();\
254 ULONG STDMETHODCALLTYPE AddLock();\
255 ULONG STDMETHODCALLTYPE ReleaseLock()
256
257 #define DEFINE_OLE_TABLE(cls)\
258 LONG cls::GetRefCount() {return refCount.l;}\
259 HRESULT STDMETHODCALLTYPE cls::QueryInterface(REFIID iid, void ** ppvObject)\
260 {\
261 if (! ppvObject)\
262 {\
263 WXOLE_TRACE("*** NULL POINTER ***");\
264 return E_FAIL;\
265 };\
266 const char *desc = NULL;\
267 cls::_GetInterface(this, iid, ppvObject, desc);\
268 if (! *ppvObject)\
269 {\
270 WXOLE_TRACEOUT("<" << GetIIDName(iid).c_str() << "> Not Found");\
271 return E_NOINTERFACE;\
272 };\
273 WXOLE_TRACEOUT("QI : <" << desc <<">");\
274 ((IUnknown * )(*ppvObject))->AddRef();\
275 return S_OK;\
276 };\
277 ULONG STDMETHODCALLTYPE cls::AddRef()\
278 {\
279 WXOLE_TRACEOUT(# cls << "::Add ref(" << refCount.l << ")");\
280 InterlockedIncrement(&refCount.l);\
281 return refCount.l;\
282 };\
283 ULONG STDMETHODCALLTYPE cls::Release()\
284 {\
285 if (refCount.l > 0)\
286 {\
287 InterlockedDecrement(&refCount.l);\
288 WXOLE_TRACEOUT(# cls << "::Del ref(" << refCount.l << ")");\
289 if (refCount.l == 0)\
290 {\
291 delete this;\
292 return 0;\
293 };\
294 return refCount.l;\
295 }\
296 else\
297 return 0;\
298 }\
299 ULONG STDMETHODCALLTYPE cls::AddLock()\
300 {\
301 WXOLE_TRACEOUT(# cls << "::Add Lock(" << lockCount.l << ")");\
302 InterlockedIncrement(&lockCount.l);\
303 return lockCount.l;\
304 };\
305 ULONG STDMETHODCALLTYPE cls::ReleaseLock()\
306 {\
307 if (lockCount.l > 0)\
308 {\
309 InterlockedDecrement(&lockCount.l);\
310 WXOLE_TRACEOUT(# cls << "::Del Lock(" << lockCount.l << ")");\
311 return lockCount.l;\
312 }\
313 else\
314 return 0;\
315 }\
316 DEFINE_OLE_BASE(cls)
317
318 #define DEFINE_OLE_BASE(cls)\
319 void cls::_GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc)\
320 {\
321 *_interface = NULL;\
322 desc = NULL;
323
324 #define OLE_INTERFACE(_iid, _type)\
325 if (IsEqualIID(iid, _iid))\
326 {\
327 WXOLE_TRACE("Found Interface <" # _type ">");\
328 *_interface = (IUnknown *) (_type *) self;\
329 desc = # _iid;\
330 return;\
331 }
332
333 #define OLE_IINTERFACE(_face) OLE_INTERFACE(IID_##_face, _face)
334
335 #define OLE_INTERFACE_CUSTOM(func)\
336 if (func(self, iid, _interface, desc))\
337 {\
338 return;\
339 }
340
341 #define END_OLE_TABLE\
342 }
343
344
345 /// Main class for embedding a ActiveX control.
346 /// Use by itself or derive from it
347 /// \note The utility program (wxie) can generate a list of events, methods & properties
348 /// for a control.
349 /// First display the control (File|Display),
350 /// then get the type info (ActiveX|Get Type Info) - these are copied to the clipboard.
351 /// Eventually this will be expanded to autogenerate
352 /// wxWindows source files for a control with all methods etc encapsulated.
353 /// \par Usage:
354 /// construct using a ProgId or class id
355 /// \code new wxActiveX(parent, CLSID_WebBrowser, id, pos, size, style, name)\endcode
356 /// \code new wxActiveX(parent, "ShockwaveFlash.ShockwaveFlash", id, pos, size, style, name)\endcode
357 /// \par Properties
358 /// Properties can be set using \c SetProp() and set/retrieved using \c Prop()
359 /// \code SetProp(name, wxVariant(x)) \endcode or
360 /// \code wxString Prop("<name>") = x\endcode
361 /// \code wxString result = Prop("<name>")\endcode
362 /// \code flash_ctl.Prop("movie") = "file:///movies/test.swf";\endcode
363 /// \code flash_ctl.Prop("Playing") = false;\endcode
364 /// \code wxString current_movie = flash_ctl.Prop("movie");\endcode
365 /// \par Methods
366 /// Methods are invoked with \c CallMethod()
367 /// \code wxVariant result = CallMethod("<name>", args, nargs = -1)\endcode
368 /// \code wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
369 /// wxVariant result = X->CallMethod("LoadMovie", args);\endcode
370 /// \par events
371 /// respond to events with the
372 /// \c EVT_ACTIVEX(controlId, eventName, handler) &
373 /// \c EVT_ACTIVEX_DISPID(controlId, eventDispId, handler) macros
374 /// \code
375 /// BEGIN_EVENT_TABLE(wxIEFrame, wxFrame)
376 /// EVT_ACTIVEX_DISPID(ID_MSHTML, DISPID_STATUSTEXTCHANGE, OnMSHTMLStatusTextChangeX)
377 /// EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
378 /// EVT_ACTIVEX(ID_MSHTML, "TitleChange", OnMSHTMLTitleChangeX)
379 /// EVT_ACTIVEX(ID_MSHTML, "NewWindow2", OnMSHTMLNewWindow2X)
380 /// EVT_ACTIVEX(ID_MSHTML, "ProgressChange", OnMSHTMLProgressChangeX)
381 /// END_EVENT_TABLE()\endcode
382 class wxActiveX : public wxWindow {
383 public:
384 /// General parameter and return type infoformation for Events, Properties and Methods.
385 /// refer to ELEMDESC, IDLDESC in MSDN
386 class ParamX
387 {
388 public:
389 USHORT flags;
390 bool isPtr;
391 bool isSafeArray;
392 bool isOptional;
393 VARTYPE vt;
394 wxString name;
395
396 ParamX() : isOptional(false), vt(VT_EMPTY) {}
397 inline bool IsIn() const {return (flags & IDLFLAG_FIN) != 0;}
398 inline bool IsOut() const {return (flags & IDLFLAG_FOUT) != 0;}
399 inline bool IsRetVal() const {return (flags & IDLFLAG_FRETVAL) != 0;}
400 };
401 typedef vector<ParamX> ParamXArray;
402
403
404 /// Type & Parameter info for Events and Methods.
405 /// refer to FUNCDESC in MSDN
406 class FuncX
407 {
408 public:
409 wxString name;
410 MEMBERID memid;
411 bool hasOut;
412
413 ParamX retType;
414 ParamXArray params;
415 };
416 typedef vector<FuncX> FuncXArray;
417
418
419 /// Type info for properties.
420 class PropX
421 {
422 public:
423 wxString name;
424 MEMBERID memid;
425 ParamX type;
426 ParamX arg;
427 bool putByRef;
428
429 PropX() : putByRef (false) {}
430 inline bool CanGet() const {return type.vt != VT_EMPTY;}
431 inline bool CanSet() const {return arg.vt != VT_EMPTY;}
432 };
433 typedef vector<PropX> PropXArray;
434
435
436 /// Create using clsid.
437 wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1,
438 const wxPoint& pos = wxDefaultPosition,
439 const wxSize& size = wxDefaultSize,
440 long style = 0,
441 const wxString& name = wxPanelNameStr);
442 /// create using progid.
443 wxActiveX(wxWindow * parent, const wxString& progId, wxWindowID id = -1,
444 const wxPoint& pos = wxDefaultPosition,
445 const wxSize& size = wxDefaultSize,
446 long style = 0,
447 const wxString& name = wxPanelNameStr);
448 virtual ~wxActiveX();
449
450 /// Number of events defined for this control.
451 inline int GetEventCount() const {return m_events.size();}
452 /// returns event description by index.
453 /// throws exception for invalid index
454 const FuncX& GetEventDesc(int idx) const;
455
456 /// Number of properties defined for this control.
457 inline int GetPropCount() const {return m_props.size();}
458 /// returns property description by index.
459 /// throws exception for invalid index
460 const PropX& GetPropDesc(int idx) const;
461 /// returns property description by name.
462 /// throws exception for invalid name
463 const PropX& GetPropDesc(const wxString& name) const;
464
465 /// Number of methods defined for this control.
466 inline int GetMethodCount() const {return m_methods.size();}
467 /// returns method description by name.
468 /// throws exception for invalid index
469 const FuncX& GetMethodDesc(int idx) const;
470 /// returns method description by name.
471 /// throws exception for invalid name
472 const FuncX& GetMethodDesc(const wxString& name) const;
473
474 /// Set property VARIANTARG value by MEMBERID.
475 void SetProp(MEMBERID name, VARIANTARG& value);
476 /// Set property using wxVariant by name.
477 void SetProp(const wxString &name, const wxVariant &value);
478
479 class wxPropertySetter
480 {
481 public:
482 wxActiveX *m_ctl;
483 wxString m_propName;
484
485 wxPropertySetter(wxActiveX *ctl, const wxString& propName) :
486 m_ctl(ctl), m_propName(propName) {}
487
488 inline const wxPropertySetter& operator = (wxVariant v) const
489 {
490 m_ctl->SetProp(m_propName, v);
491 return *this;
492 };
493
494 inline operator wxVariant() const {return m_ctl->GetPropAsWxVariant(m_propName);};
495 inline operator wxString() const {return m_ctl->GetPropAsString(m_propName);};
496 inline operator char() const {return m_ctl->GetPropAsChar(m_propName);};
497 inline operator long() const {return m_ctl->GetPropAsLong(m_propName);};
498 inline operator bool() const {return m_ctl->GetPropAsBool(m_propName);};
499 inline operator double() const {return m_ctl->GetPropAsDouble(m_propName);};
500 inline operator wxDateTime() const {return m_ctl->GetPropAsDateTime(m_propName);};
501 inline operator void *() const {return m_ctl->GetPropAsPointer(m_propName);};
502 };
503
504 /// \fn inline wxPropertySetter Prop(wxString name) {return wxPropertySetter(this, name);}
505 /// \param name Property name to read/set
506 /// \return wxPropertySetter, which has overloads for setting/getting the property
507 /// \brief Generic Get/Set Property by name.
508 /// Automatically handles most types
509 /// \par Usage:
510 /// - Prop("\<name\>") = \<value\>
511 /// - var = Prop("\<name\>")
512 /// - e.g:
513 /// - \code flash_ctl.Prop("movie") = "file:///movies/test.swf";\endcode
514 /// - \code flash_ctl.Prop("Playing") = false;\endcode
515 /// - \code wxString current_movie = flash_ctl.Prop("movie");\endcode
516 /// \exception raises exception if \<name\> is invalid
517 /// \note Have to add a few more type conversions yet ...
518 inline wxPropertySetter Prop(wxString name) {return wxPropertySetter(this, name);}
519
520 VARIANT GetPropAsVariant(MEMBERID name);
521 VARIANT GetPropAsVariant(const wxString& name);
522 wxVariant GetPropAsWxVariant(const wxString& name);
523 wxString GetPropAsString(const wxString& name);
524 char GetPropAsChar(const wxString& name);
525 long GetPropAsLong(const wxString& name);
526 bool GetPropAsBool(const wxString& name);
527 double GetPropAsDouble(const wxString& name);
528 wxDateTime GetPropAsDateTime(const wxString& name);
529 void *GetPropAsPointer(const wxString& name);
530
531 // methods
532 // VARIANTARG form is passed straight to Invoke,
533 // so args in *REVERSE* order
534 VARIANT CallMethod(MEMBERID name, VARIANTARG args[], int argc);
535 VARIANT CallMethod(const wxString& name, VARIANTARG args[] = NULL, int argc = -1);
536 // args are in *NORMAL* order
537 // args can be a single wxVariant or an array
538 /// \fn wxVariant CallMethod(wxString name, wxVariant args[], int nargs = -1);
539 /// \param name name of method to call
540 /// \param args array of wxVariant's, defaults to NULL (no args)
541 /// \param nargs number of arguments passed via args. Defaults to actual number of args for the method
542 /// \return wxVariant
543 /// \brief Call a method of the ActiveX control.
544 /// Automatically handles most types
545 /// \par Usage:
546 /// - result = CallMethod("\<name\>", args, nargs)
547 /// - e.g.
548 /// - \code
549 /// wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
550 /// wxVariant result = X->CallMethod("LoadMovie", args);\endcode
551 /// \exception raises exception if \<name\> is invalid
552 /// \note Since wxVariant has built in type conversion, most the std types can be passed easily
553 wxVariant CallMethod(const wxString& name, wxVariant args[], int nargs = -1);
554
555 HRESULT ConnectAdvise(REFIID riid, IUnknown *eventSink);
556
557 void OnSize(wxSizeEvent&);
558 void OnPaint(wxPaintEvent& event);
559 void OnMouse(wxMouseEvent& event);
560 void OnSetFocus(wxFocusEvent&);
561 void OnKillFocus(wxFocusEvent&);
562
563 DECLARE_EVENT_TABLE();
564
565 protected:
566 friend class FrameSite;
567 friend class wxActiveXEvents;
568
569
570 typedef map<MEMBERID, int> MemberIdMap;
571 typedef map<wxString, int, NS_wxActiveX::less_wxStringI> NameMap;
572
573 typedef wxAutoOleInterface<IConnectionPoint> wxOleConnectionPoint;
574 typedef pair<wxOleConnectionPoint, DWORD> wxOleConnection;
575 typedef vector<wxOleConnection> wxOleConnectionArray;
576
577 wxAutoOleInterface<IDispatch> m_Dispatch;
578 wxAutoOleInterface<IOleClientSite> m_clientSite;
579 wxAutoOleInterface<IUnknown> m_ActiveX;
580 wxAutoOleInterface<IOleObject> m_oleObject;
581 wxAutoOleInterface<IOleInPlaceObject> m_oleInPlaceObject;
582 wxAutoOleInterface<IOleInPlaceActiveObject>
583
584 m_oleInPlaceActiveObject;
585 wxAutoOleInterface<IOleDocumentView> m_docView;
586 wxAutoOleInterface<IViewObject> m_viewObject;
587 HWND m_oleObjectHWND;
588 bool m_bAmbientUserMode;
589 DWORD m_docAdviseCookie;
590 wxOleConnectionArray m_connections;
591
592 void CreateActiveX(REFCLSID clsid);
593 void CreateActiveX(LPOLESTR progId);
594 HRESULT AmbientPropertyChanged(DISPID dispid);
595
596 void GetTypeInfo();
597 void GetTypeInfo(ITypeInfo *ti, bool defInterface, bool defEventSink);
598
599
600 // events
601 FuncXArray m_events;
602 MemberIdMap m_eventMemberIds;
603
604 // properties
605 PropXArray m_props;
606 NameMap m_propNames;
607
608 // Methods
609 FuncXArray m_methods;
610 NameMap m_methodNames;
611
612 long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
613 };
614
615 // events
616 class wxActiveXEvent : public wxCommandEvent
617 {
618 private:
619 friend class wxActiveXEvents;
620
621 wxVariant m_params;
622
623 public:
624
625 virtual wxEvent *Clone() const { return new wxActiveXEvent(*this); }
626
627 wxString EventName();
628 int ParamCount() const;
629 wxString ParamType(int idx);
630 wxString ParamName(int idx);
631 wxVariant& operator[] (int idx);
632 wxVariant& operator[] (wxString name);
633
634 private:
635 DECLARE_CLASS(wxActiveXEvent)
636 };
637
638 const wxEventType& RegisterActiveXEvent(const wxChar *eventName);
639 const wxEventType& RegisterActiveXEvent(DISPID event);
640
641 typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
642
643 /// \def EVT_ACTIVEX(id, eventName, fn)
644 /// \brief Event handle for events by name
645 #define EVT_ACTIVEX(id, eventName, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(wxT(eventName)), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
646 /// \def EVT_ACTIVEX_DISPID(id, eventDispId, fn)
647 /// \brief Event handle for events by DISPID (dispath id)
648 #define EVT_ACTIVEX_DISPID(id, eventDispId, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(eventDispId), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
649
650 //util
651 bool wxDateTimeToVariant(wxDateTime dt, VARIANTARG& va);
652 bool VariantToWxDateTime(VARIANTARG va, wxDateTime& dt);
653 /// \relates wxActiveX
654 /// \fn bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
655 /// \param va VARAIANTARG to convert from
656 /// \param vx Destination wxVariant
657 /// \return success/failure (true/false)
658 /// \brief Convert MSW VARIANTARG to wxVariant.
659 /// Handles basic types, need to add:
660 /// - VT_ARRAY | VT_*
661 /// - better support for VT_UNKNOWN (currently treated as void *)
662 /// - better support for VT_DISPATCH (currently treated as void *)
663 bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
664 /// \relates wxActiveX
665 /// \fn bool VariantToMSWVariant(const wxVariant& vx, VARIANTARG& va);
666 /// \param vx wxVariant to convert from
667 /// \param va Destination VARIANTARG
668 /// \return success/failure (true/false)
669 /// \brief Convert wxVariant to MSW VARIANTARG.
670 /// Handles basic types, need to add:
671 /// - VT_ARRAY | VT_*
672 /// - better support for VT_UNKNOWN (currently treated as void *)
673 /// - better support for VT_DISPATCH (currently treated as void *)
674 bool VariantToMSWVariant(const wxVariant& vx, VARIANTARG& va);
675
676 #endif /* _IEHTMLWIN_H_ */