X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/557002cf8162a0073dbc7050732cb6d75e184148..80255b7eaf9427daf6fa21a3f27e4475dcc54cf8:/include/wx/msw/ole/activex.h diff --git a/include/wx/msw/ole/activex.h b/include/wx/msw/ole/activex.h index 49bae1ce86..54940e2fac 100644 --- a/include/wx/msw/ole/activex.h +++ b/include/wx/msw/ole/activex.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/activex.h +// Name: wx/msw/ole/activex.h // Purpose: wxActiveXContainer class // Author: Ryan Norton // Modified by: @@ -16,34 +16,19 @@ #ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_ #define _WX_MSW_OLE_ACTIVEXCONTAINER_H_ -//--------------------------------------------------------------------------- -// COM includes -//--------------------------------------------------------------------------- -#include "wx/msw/ole/oleutils.h" //wxBasicString, IID etc. -#include "wx/msw/ole/uuid.h" //IID etc.. +#if wxUSE_ACTIVEX //--------------------------------------------------------------------------- -// COM compatability definitions +// wx includes //--------------------------------------------------------------------------- -#ifndef STDMETHODCALLTYPE -#define STDMETHODCALLTYPE __stdcall -#endif -#ifndef STDMETHOD -#define STDMETHOD(funcname) virtual HRESULT STDMETHODCALLTYPE funcname -#endif -#ifndef PURE -#define PURE = 0 -#endif -#ifndef __RPC_FAR -#define __RPC_FAR FAR -#endif -//--------------------------------------------------------------------------- -// WX includes -//--------------------------------------------------------------------------- +#include "wx/msw/ole/oleutils.h" // wxBasicString &c +#include "wx/msw/ole/uuid.h" #include "wx/window.h" #include "wx/variant.h" +class FrameSite; + //--------------------------------------------------------------------------- // MSW COM includes //--------------------------------------------------------------------------- @@ -56,23 +41,27 @@ #include +#ifndef STDMETHOD + #define STDMETHOD(funcname) virtual HRESULT wxSTDCALL funcname +#endif + // // These defines are from another ole header - but its not in the // latest sdk. Also the ifndef DISPID_READYSTATE is here because at // least on my machine with the latest sdk olectl.h defines these 3 // #ifndef DISPID_READYSTATE - #define DISPID_READYSTATE -525 - #define DISPID_READYSTATECHANGE -609 - #define DISPID_AMBIENT_TRANSFERPRIORITY -728 + #define DISPID_READYSTATE (-525) + #define DISPID_READYSTATECHANGE (-609) + #define DISPID_AMBIENT_TRANSFERPRIORITY (-728) #endif -#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED -5501 -#define DISPID_AMBIENT_SILENT -5502 +#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501) +#define DISPID_AMBIENT_SILENT (-5502) #ifndef DISPID_AMBIENT_CODEPAGE -# define DISPID_AMBIENT_CODEPAGE -725 -# define DISPID_AMBIENT_CHARSET -727 + #define DISPID_AMBIENT_CODEPAGE (-725) + #define DISPID_AMBIENT_CHARSET (-727) #endif @@ -140,7 +129,8 @@ class wxAutoOleInterface \ 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;}\ + inline bool Ok() const { return IsOk(); }\ + inline bool IsOk() const {return m_interface != NULL;}\ }; WX_DECLARE_AUTOOLE(wxAutoIDispatch, IDispatch) @@ -152,7 +142,7 @@ WX_DECLARE_AUTOOLE(wxAutoIOleInPlaceActiveObject, IOleInPlaceActiveObject) WX_DECLARE_AUTOOLE(wxAutoIOleDocumentView, IOleDocumentView) WX_DECLARE_AUTOOLE(wxAutoIViewObject, IViewObject) -class wxActiveXContainer : public wxWindow +class WXDLLIMPEXP_CORE wxActiveXContainer : public wxWindow { public: wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk); @@ -167,6 +157,7 @@ protected: friend class FrameSite; friend class wxActiveXEvents; + FrameSite *m_frameSite; wxAutoIDispatch m_Dispatch; wxAutoIOleClientSite m_clientSite; wxAutoIUnknown m_ActiveX; @@ -183,9 +174,30 @@ protected: void CreateActiveX(REFIID, IUnknown*); }; +///\brief Store native event parameters. +///\detail Store OLE 'Invoke' parameters for event handlers that need to access them. +/// These are the exact values for the event as they are passed to the wxActiveXContainer. +struct wxActiveXEventNativeMSW +{ + DISPID dispIdMember; + REFIID riid; + LCID lcid; + WORD wFlags; + DISPPARAMS *pDispParams; + VARIANT *pVarResult; + EXCEPINFO *pExcepInfo; + unsigned int *puArgErr; + + wxActiveXEventNativeMSW + (DISPID a_dispIdMember, REFIID a_riid, LCID a_lcid, WORD a_wFlags, DISPPARAMS *a_pDispParams, + VARIANT *a_pVarResult, EXCEPINFO *a_pExcepInfo, unsigned int *a_puArgErr) + :dispIdMember(a_dispIdMember), riid(a_riid), lcid(a_lcid), wFlags(a_wFlags), pDispParams(a_pDispParams), + pVarResult(a_pVarResult), pExcepInfo(a_pExcepInfo), puArgErr(a_puArgErr) + { } +}; // Events -class wxActiveXEvent : public wxCommandEvent +class WXDLLIMPEXP_CORE wxActiveXEvent : public wxCommandEvent { private: friend class wxActiveXEvents; @@ -196,37 +208,39 @@ public: virtual wxEvent *Clone() const { return new wxActiveXEvent(*this); } - int ParamCount() const - { return m_params.GetCount(); } + size_t ParamCount() const; - wxString ParamType(int idx) const + wxString ParamType(size_t idx) const { - wxASSERT(idx >= 0 && idx < m_params.GetCount()); + wxASSERT(idx < ParamCount()); return m_params[idx].GetType(); } - wxString ParamName(int idx) const + wxString ParamName(size_t idx) const { - wxASSERT(idx >= 0 && idx < m_params.GetCount()); + wxASSERT(idx < ParamCount()); return m_params[idx].GetName(); } - wxVariant& operator[] (int idx) - { - wxASSERT(idx >= 0 && idx < ParamCount()); - return m_params[idx]; - } + wxVariant& operator[] (size_t idx); DISPID GetDispatchId() const { return m_dispid; } + + wxActiveXEventNativeMSW *GetNativeParameters() const + { return (wxActiveXEventNativeMSW*)GetClientData(); } }; -#define wxACTIVEX_ID 14001 -DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_ACTIVEX, wxACTIVEX_ID) +// #define wxACTIVEX_ID 14001 +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_ACTIVEX, wxActiveXEvent ); + typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); -#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ), + #define wxActiveXEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActiveXEventFunction, &func) + wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func ) -#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_ +#define EVT_ACTIVEX(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), NULL ), +#endif // wxUSE_ACTIVEX + +#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_