X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7abf01706714b3eb7777555ce4d1db00d641e40..42f8298f6f42d5d63bb3caf65682b7d9d9f8b702:/wxPython/contrib/iewin/wxactivex.h diff --git a/wxPython/contrib/iewin/wxactivex.h b/wxPython/contrib/iewin/wxactivex.h index abe779aa0a..4c88a1d3f3 100644 --- a/wxPython/contrib/iewin/wxactivex.h +++ b/wxPython/contrib/iewin/wxactivex.h @@ -6,10 +6,13 @@ #include #include +#include #include +#include #include #include #include +#include using namespace std; ////////////////////////////////////////// @@ -29,12 +32,12 @@ template class wxAutoOleInterface // Assumed to already have a AddRef() applied explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {} - // queries for an interface + // queries for an interface wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) { QueryInterface(riid, pUnk); }; - // queries for an interface + // queries for an interface wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) { QueryInterface(riid, pDispatch); @@ -47,7 +50,7 @@ template class wxAutoOleInterface }; // copy constructor - explicit wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL) + wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL) { operator = (ti); } @@ -84,7 +87,7 @@ template class wxAutoOleInterface m_interface = NULL; }; - // queries for an interface + // queries for an interface HRESULT QueryInterface(REFIID riid, IUnknown *pUnk) { Free(); @@ -258,32 +261,68 @@ class wxOleInit class wxActiveX : public wxWindow { public: + //////////////////////////////////////// + // type stuff + class ParamX // refer to ELEMDESC, IDLDESC in MSDN + { + public: + USHORT flags; + bool isPtr, isSafeArray; + VARTYPE vt; + wxString name; + + inline bool IsIn() const {return (flags & IDLFLAG_FIN) != 0;} + inline bool IsOut() const {return (flags & IDLFLAG_FOUT) != 0;} + inline bool IsRetVal() const {return (flags & IDLFLAG_FRETVAL) != 0;} + }; + + typedef vector ParamXArray; + + class FuncX // refer to FUNCDESC in MSDN + { + public: + wxString name; + MEMBERID memid; + bool hasOut; + + ParamXArray params; + }; + + typedef vector FuncXArray; + typedef map MemberIdList; + wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - virtual ~wxActiveX(); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + virtual ~wxActiveX(); - void CreateActiveX(REFCLSID clsid); + void CreateActiveX(REFCLSID clsid); void CreateActiveX(LPOLESTR progId); - HRESULT ConnectAdvise(REFIID riid, IUnknown *eventSink); + // expose type info + inline int GetEventCount() const {return m_events.size();} + const FuncX& GetEvent(int idx) const; - void OnSize(wxSizeEvent&); - void OnSetFocus(wxFocusEvent&); + HRESULT ConnectAdvise(REFIID riid, IUnknown *eventSink); + + void OnSize(wxSizeEvent&); + void OnPaint(wxPaintEvent& event); + void OnMouse(wxMouseEvent& event); + void OnSetFocus(wxFocusEvent&); void OnKillFocus(wxFocusEvent&); - DECLARE_EVENT_TABLE(); + DECLARE_EVENT_TABLE(); protected: friend class FrameSite; + friend class wxActiveXEvents; typedef wxAutoOleInterface wxOleConnectionPoint; typedef pair wxOleConnection; @@ -297,6 +336,7 @@ protected: m_oleInPlaceActiveObject; wxAutoOleInterface m_docView; + wxAutoOleInterface m_viewObject; HWND m_oleObjectHWND; bool m_bAmbientUserMode; DWORD m_docAdviseCookie; @@ -304,6 +344,49 @@ protected: HRESULT AmbientPropertyChanged(DISPID dispid); + void GetTypeInfo(); + void GetTypeInfo(ITypeInfo *ti, bool defEventSink); + + + // events + FuncXArray m_events; + MemberIdList m_eventsIdx; + + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); }; +// events +class wxActiveXEvent : public wxCommandEvent +{ +private: + friend class wxActiveXEvents; + + wxVariant m_params; + +public: + + virtual wxEvent *Clone() const { return new wxActiveXEvent(*this); } + + wxString EventName(); + int ParamCount() const; + wxString ParamType(int idx); + wxString ParamName(int idx); + wxVariant operator[] (int idx) const; + wxVariant& operator[] (int idx); + wxVariant operator[] (wxString name) const; + wxVariant& operator[] (wxString name); +}; + +const wxEventType& RegisterActiveXEvent(const wxChar *eventName); +const wxEventType& RegisterActiveXEvent(DISPID event); + +typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); + +#define EVT_ACTIVEX(id, eventName, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(wxT(eventName)), id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxActiveXEventFunction, & fn ), (wxObject *) NULL ), +#define EVT_ACTIVEX_DISPID(id, eventDispId, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(eventDispId), id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxActiveXEventFunction, & fn ), (wxObject *) NULL ), + +//util +bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx); +bool VariantToMSWVariant(wxVariant& vx, VARIANTARG& va); + #endif /* _IEHTMLWIN_H_ */