mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the last 2.9 release before the 3.0 stable release. Since the full wxWidgets distribution is rather large, I have imported only the parts that we use, on a subdirectory basis: art include/wx/*.* include/wx/aui include/wx/cocoa include/wx/generic include/wx/gtk include/wx/meta include/wx/msw include/wx/osx include/wx/persist include/wx/private include/wx/protocol include/wx/unix src/aui src/common src/generic src/gtk src/msw src/osx src/unix git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
68
Externals/wxWidgets3/include/wx/msw/ole/access.h
vendored
Normal file
68
Externals/wxWidgets3/include/wx/msw/ole/access.h
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/access.h
|
||||
// Purpose: declaration of the wxAccessible class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 2003-02-12
|
||||
// RCS-ID: $Id: access.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 2003 Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_ACCESS_H_
|
||||
#define _WX_ACCESS_H_
|
||||
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxIAccessible;
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAccessible implements accessibility behaviour.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxAccessible : public wxAccessibleBase
|
||||
{
|
||||
public:
|
||||
wxAccessible(wxWindow *win = NULL);
|
||||
virtual ~wxAccessible();
|
||||
|
||||
// Overridables
|
||||
|
||||
// Accessors
|
||||
|
||||
// Returns the wxIAccessible pointer
|
||||
wxIAccessible* GetIAccessible() { return m_pIAccessible; }
|
||||
|
||||
// Returns the IAccessible standard interface pointer
|
||||
void* GetIAccessibleStd() ;
|
||||
|
||||
// Operations
|
||||
|
||||
// Sends an event when something changes in an accessible object.
|
||||
static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType,
|
||||
int objectId);
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
wxIAccessible * m_pIAccessible; // the pointer to COM interface
|
||||
void* m_pIAccessibleStd; // the pointer to the standard COM interface,
|
||||
// for default processing
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxAccessible);
|
||||
};
|
||||
|
||||
#endif //wxUSE_ACCESSIBILITY
|
||||
|
||||
#endif //_WX_ACCESS_H_
|
||||
|
262
Externals/wxWidgets3/include/wx/msw/ole/activex.h
vendored
Normal file
262
Externals/wxWidgets3/include/wx/msw/ole/activex.h
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/activex.h
|
||||
// Purpose: wxActiveXContainer class
|
||||
// Author: Ryan Norton <wxprojects@comcast.net>
|
||||
// Modified by:
|
||||
// Created: 8/18/05
|
||||
// RCS-ID: $Id: activex.h 64533 2010-06-09 14:28:08Z FM $
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// Definitions
|
||||
// ============================================================================
|
||||
|
||||
#ifndef _WX_MSW_OLE_ACTIVEXCONTAINER_H_
|
||||
#define _WX_MSW_OLE_ACTIVEXCONTAINER_H_
|
||||
|
||||
#if wxUSE_ACTIVEX
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// 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
|
||||
//---------------------------------------------------------------------------
|
||||
#include <oleidl.h>
|
||||
#include <olectl.h>
|
||||
|
||||
#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__)
|
||||
#include <exdisp.h>
|
||||
#endif
|
||||
|
||||
#include <docobj.h>
|
||||
|
||||
#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)
|
||||
#endif
|
||||
|
||||
#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED (-5501)
|
||||
#define DISPID_AMBIENT_SILENT (-5502)
|
||||
|
||||
#ifndef DISPID_AMBIENT_CODEPAGE
|
||||
#define DISPID_AMBIENT_CODEPAGE (-725)
|
||||
#define DISPID_AMBIENT_CHARSET (-727)
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// wxActiveXContainer
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
template<typename I>
|
||||
class wxAutoOleInterface
|
||||
{
|
||||
public:
|
||||
typedef I Interface;
|
||||
|
||||
explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface)
|
||||
{}
|
||||
wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL)
|
||||
{ QueryInterface(riid, pUnk); }
|
||||
wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL)
|
||||
{ QueryInterface(riid, pDispatch); }
|
||||
wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)
|
||||
{ CreateInstance(clsid, riid); }
|
||||
wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL)
|
||||
{ operator=(ti); }
|
||||
|
||||
wxAutoOleInterface& operator=(const wxAutoOleInterface& ti)
|
||||
{
|
||||
if ( ti.m_interface )
|
||||
ti.m_interface->AddRef();
|
||||
Free();
|
||||
m_interface = ti.m_interface;
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxAutoOleInterface& operator=(I*& ti)
|
||||
{
|
||||
Free();
|
||||
m_interface = ti;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~wxAutoOleInterface() { Free(); }
|
||||
|
||||
void Free()
|
||||
{
|
||||
if ( m_interface )
|
||||
m_interface->Release();
|
||||
m_interface = NULL;
|
||||
}
|
||||
|
||||
HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)
|
||||
{
|
||||
Free();
|
||||
wxASSERT(pUnk != NULL);
|
||||
return pUnk->QueryInterface(riid, (void **)&m_interface);
|
||||
}
|
||||
|
||||
HRESULT CreateInstance(REFCLSID clsid, REFIID riid)
|
||||
{
|
||||
Free();
|
||||
return CoCreateInstance
|
||||
(
|
||||
clsid,
|
||||
NULL,
|
||||
CLSCTX_ALL,
|
||||
riid,
|
||||
(void **)&m_interface
|
||||
);
|
||||
}
|
||||
|
||||
operator I*() const {return m_interface; }
|
||||
I* operator->() {return m_interface; }
|
||||
I** GetRef() {return &m_interface; }
|
||||
bool Ok() const { return IsOk(); }
|
||||
bool IsOk() const { return m_interface != NULL; }
|
||||
|
||||
protected:
|
||||
I *m_interface;
|
||||
};
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
// this macro is kept for compatibility with older wx versions
|
||||
#define WX_DECLARE_AUTOOLE(wxAutoOleInterfaceType, I) \
|
||||
typedef wxAutoOleInterface<I> wxAutoOleInterfaceType;
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
typedef wxAutoOleInterface<IDispatch> wxAutoIDispatch;
|
||||
typedef wxAutoOleInterface<IOleClientSite> wxAutoIOleClientSite;
|
||||
typedef wxAutoOleInterface<IUnknown> wxAutoIUnknown;
|
||||
typedef wxAutoOleInterface<IOleObject> wxAutoIOleObject;
|
||||
typedef wxAutoOleInterface<IOleInPlaceObject> wxAutoIOleInPlaceObject;
|
||||
typedef wxAutoOleInterface<IOleInPlaceActiveObject> wxAutoIOleInPlaceActiveObject;
|
||||
typedef wxAutoOleInterface<IOleDocumentView> wxAutoIOleDocumentView;
|
||||
typedef wxAutoOleInterface<IViewObject> wxAutoIViewObject;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxActiveXContainer : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxActiveXContainer(wxWindow * parent, REFIID iid, IUnknown* pUnk);
|
||||
virtual ~wxActiveXContainer();
|
||||
|
||||
void OnSize(wxSizeEvent&);
|
||||
void OnPaint(wxPaintEvent&);
|
||||
void OnSetFocus(wxFocusEvent&);
|
||||
void OnKillFocus(wxFocusEvent&);
|
||||
|
||||
protected:
|
||||
friend class FrameSite;
|
||||
friend class wxActiveXEvents;
|
||||
|
||||
FrameSite *m_frameSite;
|
||||
wxAutoIDispatch m_Dispatch;
|
||||
wxAutoIOleClientSite m_clientSite;
|
||||
wxAutoIUnknown m_ActiveX;
|
||||
wxAutoIOleObject m_oleObject;
|
||||
wxAutoIOleInPlaceObject m_oleInPlaceObject;
|
||||
wxAutoIOleInPlaceActiveObject m_oleInPlaceActiveObject;
|
||||
wxAutoIOleDocumentView m_docView;
|
||||
wxAutoIViewObject m_viewObject;
|
||||
HWND m_oleObjectHWND;
|
||||
bool m_bAmbientUserMode;
|
||||
DWORD m_docAdviseCookie;
|
||||
wxWindow* m_realparent;
|
||||
|
||||
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 WXDLLIMPEXP_CORE wxActiveXEvent : public wxCommandEvent
|
||||
{
|
||||
private:
|
||||
friend class wxActiveXEvents;
|
||||
wxVariant m_params;
|
||||
DISPID m_dispid;
|
||||
|
||||
public:
|
||||
virtual wxEvent *Clone() const
|
||||
{ return new wxActiveXEvent(*this); }
|
||||
|
||||
size_t ParamCount() const;
|
||||
|
||||
wxString ParamType(size_t idx) const
|
||||
{
|
||||
wxASSERT(idx < ParamCount());
|
||||
return m_params[idx].GetType();
|
||||
}
|
||||
|
||||
wxString ParamName(size_t idx) const
|
||||
{
|
||||
wxASSERT(idx < ParamCount());
|
||||
return m_params[idx].GetName();
|
||||
}
|
||||
|
||||
wxVariant& operator[] (size_t idx);
|
||||
|
||||
DISPID GetDispatchId() const
|
||||
{ return m_dispid; }
|
||||
|
||||
wxActiveXEventNativeMSW *GetNativeParameters() const
|
||||
{ return (wxActiveXEventNativeMSW*)GetClientData(); }
|
||||
};
|
||||
|
||||
// #define wxACTIVEX_ID 14001
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_ACTIVEX, wxActiveXEvent );
|
||||
|
||||
typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
|
||||
|
||||
#define wxActiveXEventHandler(func) \
|
||||
wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func )
|
||||
|
||||
#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), NULL ),
|
||||
|
||||
#endif // wxUSE_ACTIVEX
|
||||
|
||||
#endif // _WX_MSW_OLE_ACTIVEXCONTAINER_H_
|
117
Externals/wxWidgets3/include/wx/msw/ole/automtn.h
vendored
Normal file
117
Externals/wxWidgets3/include/wx/msw/ole/automtn.h
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/automtn.h
|
||||
// Purpose: OLE automation utilities
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 11/6/98
|
||||
// RCS-ID: $Id: automtn.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_AUTOMTN_H_
|
||||
#define _WX_AUTOMTN_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_OLE_AUTOMATION
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/variant.h"
|
||||
|
||||
typedef void WXIDISPATCH;
|
||||
typedef unsigned short* WXBSTR;
|
||||
|
||||
#ifdef GetObject
|
||||
#undef GetObject
|
||||
#endif
|
||||
|
||||
// Flags used with wxAutomationObject::GetInstance()
|
||||
enum wxAutomationInstanceFlags
|
||||
{
|
||||
// Only use the existing instance, never create a new one.
|
||||
wxAutomationInstance_UseExistingOnly = 0,
|
||||
|
||||
// Create a new instance if there are no existing ones.
|
||||
wxAutomationInstance_CreateIfNeeded = 1,
|
||||
|
||||
// Do not log errors if we failed to get the existing instance because none
|
||||
// is available.
|
||||
wxAutomationInstance_SilentIfNone = 2
|
||||
};
|
||||
|
||||
/*
|
||||
* wxAutomationObject
|
||||
* Wraps up an IDispatch pointer and invocation; does variant conversion.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_CORE wxAutomationObject: public wxObject
|
||||
{
|
||||
public:
|
||||
wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL);
|
||||
virtual ~wxAutomationObject();
|
||||
|
||||
// Set/get dispatch pointer
|
||||
void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; }
|
||||
WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; }
|
||||
bool IsOk() const { return m_dispatchPtr != NULL; }
|
||||
|
||||
// Get a dispatch pointer from the current object associated
|
||||
// with a ProgID, such as "Excel.Application"
|
||||
bool GetInstance(const wxString& progId,
|
||||
int flags = wxAutomationInstance_CreateIfNeeded) const;
|
||||
|
||||
// Get a dispatch pointer from a new instance of the class
|
||||
bool CreateInstance(const wxString& progId) const;
|
||||
|
||||
// Low-level invocation function. Pass either an array of variants,
|
||||
// or an array of pointers to variants.
|
||||
bool Invoke(const wxString& member, int action,
|
||||
wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const;
|
||||
|
||||
// Invoke a member function
|
||||
wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]);
|
||||
wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args);
|
||||
|
||||
// Convenience function
|
||||
wxVariant CallMethod(const wxString& method,
|
||||
const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant,
|
||||
const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
|
||||
const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
|
||||
|
||||
// Get/Put property
|
||||
wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const;
|
||||
wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const;
|
||||
wxVariant GetProperty(const wxString& property,
|
||||
const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant,
|
||||
const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
|
||||
const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
|
||||
|
||||
bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args);
|
||||
bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ;
|
||||
bool PutProperty(const wxString& property,
|
||||
const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant,
|
||||
const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
|
||||
const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
|
||||
|
||||
// Uses DISPATCH_PROPERTYGET
|
||||
// and returns a dispatch pointer. The calling code should call Release
|
||||
// on the pointer, though this could be implicit by constructing an wxAutomationObject
|
||||
// with it and letting the destructor call Release.
|
||||
WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const;
|
||||
WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const;
|
||||
|
||||
// A way of initialising another wxAutomationObject with a dispatch object,
|
||||
// without having to deal with nasty IDispatch pointers.
|
||||
bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const;
|
||||
bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const;
|
||||
|
||||
public:
|
||||
WXIDISPATCH* m_dispatchPtr;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxAutomationObject);
|
||||
};
|
||||
|
||||
#endif // wxUSE_OLE_AUTOMATION
|
||||
|
||||
#endif // _WX_AUTOMTN_H_
|
75
Externals/wxWidgets3/include/wx/msw/ole/dataform.h
vendored
Normal file
75
Externals/wxWidgets3/include/wx/msw/ole/dataform.h
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/dataform.h
|
||||
// Purpose: declaration of the wxDataFormat class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.10.99 (extracted from msw/ole/dataobj.h)
|
||||
// RCS-ID: $Id: dataform.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_OLE_DATAFORM_H
|
||||
#define _WX_MSW_OLE_DATAFORM_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat identifies the single format of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under Win32 are WORD's
|
||||
typedef unsigned short NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
|
||||
|
||||
// we need constructors from all string types as implicit conversions to
|
||||
// wxString don't apply when we already rely on implicit conversion of a,
|
||||
// for example, "char *" string to wxDataFormat, and existing code does it
|
||||
wxDataFormat(const wxString& format) { SetId(format); }
|
||||
wxDataFormat(const char *format) { SetId(format); }
|
||||
wxDataFormat(const wchar_t *format) { SetId(format); }
|
||||
wxDataFormat(const wxCStrData& format) { SetId(format); }
|
||||
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ m_format = format; return *this; }
|
||||
wxDataFormat& operator=(const wxDataFormat& format)
|
||||
{ m_format = format.m_format; return *this; }
|
||||
|
||||
// default copy ctor/assignment operators ok
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(wxDataFormatId format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(wxDataFormatId format) const
|
||||
{ return m_format != (NativeFormat)format; }
|
||||
bool operator==(const wxDataFormat& format) const
|
||||
{ return m_format == format.m_format; }
|
||||
bool operator!=(const wxDataFormat& format) const
|
||||
{ return m_format != format.m_format; }
|
||||
|
||||
// explicit and implicit conversions to NativeFormat which is one of
|
||||
// standard data types (implicit conversion is useful for preserving the
|
||||
// compatibility with old code)
|
||||
NativeFormat GetFormatId() const { return m_format; }
|
||||
operator NativeFormat() const { return m_format; }
|
||||
|
||||
// this works with standard as well as custom ids
|
||||
void SetType(NativeFormat format) { m_format = format; }
|
||||
NativeFormat GetType() const { return m_format; }
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId(const wxString& format);
|
||||
|
||||
// returns true if the format is one of those defined in wxDataFormatId
|
||||
bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; }
|
||||
|
||||
private:
|
||||
NativeFormat m_format;
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_OLE_DATAFORM_H
|
||||
|
79
Externals/wxWidgets3/include/wx/msw/ole/dataobj.h
vendored
Normal file
79
Externals/wxWidgets3/include/wx/msw/ole/dataobj.h
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/dataobj.h
|
||||
// Purpose: declaration of the wxDataObject class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 10.05.98
|
||||
// RCS-ID: $Id: dataobj.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_OLE_DATAOBJ_H
|
||||
#define _WX_MSW_OLE_DATAOBJ_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct IDataObject;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataObject is a "smart" and polymorphic piece of data.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxDataObject();
|
||||
virtual ~wxDataObject();
|
||||
|
||||
// retrieve IDataObject interface (for other OLE related classes)
|
||||
IDataObject *GetInterface() const { return m_pIDataObject; }
|
||||
|
||||
// tell the object that it should be now owned by IDataObject - i.e. when
|
||||
// it is deleted, it should delete us as well
|
||||
void SetAutoDelete();
|
||||
|
||||
// return true if we support this format in "Get" direction
|
||||
bool IsSupportedFormat(const wxDataFormat& format) const
|
||||
{ return wxDataObjectBase::IsSupported(format, Get); }
|
||||
|
||||
// if this method returns false, this wxDataObject will be copied to
|
||||
// the clipboard with its size prepended to it, which is compatible with
|
||||
// older wx versions
|
||||
//
|
||||
// if returns true, then this wxDataObject will be copied to the clipboard
|
||||
// without any additional information and ::HeapSize() function will be used
|
||||
// to get the size of that data
|
||||
virtual bool NeedsVerbatimData(const wxDataFormat& WXUNUSED(format)) const
|
||||
{
|
||||
// return false from here only for compatibility with earlier wx versions
|
||||
return true;
|
||||
}
|
||||
|
||||
// function to return symbolic name of clipboard format (for debug messages)
|
||||
#ifdef __WXDEBUG__
|
||||
static const wxChar *GetFormatName(wxDataFormat format);
|
||||
|
||||
#define wxGetFormatName(format) wxDataObject::GetFormatName(format)
|
||||
#else // !Debug
|
||||
#define wxGetFormatName(format) wxT("")
|
||||
#endif // Debug/!Debug
|
||||
// they need to be accessed from wxIDataObject, so made them public,
|
||||
// or wxIDataObject friend
|
||||
public:
|
||||
virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
|
||||
const wxDataFormat& format );
|
||||
virtual void* SetSizeInBuffer( void* buffer, size_t size,
|
||||
const wxDataFormat& format );
|
||||
virtual size_t GetBufferOffset( const wxDataFormat& format );
|
||||
|
||||
private:
|
||||
IDataObject *m_pIDataObject; // pointer to the COM interface
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxDataObject);
|
||||
};
|
||||
|
||||
#endif //_WX_MSW_OLE_DATAOBJ_H
|
146
Externals/wxWidgets3/include/wx/msw/ole/dataobj2.h
vendored
Normal file
146
Externals/wxWidgets3/include/wx/msw/ole/dataobj2.h
vendored
Normal file
@ -0,0 +1,146 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/dataobj2.h
|
||||
// Purpose: second part of platform specific wxDataObject header -
|
||||
// declarations of predefined wxDataObjectSimple-derived classes
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 21.10.99
|
||||
// RCS-ID: $Id: dataobj2.h 58757 2009-02-08 11:45:59Z VZ $
|
||||
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_OLE_DATAOBJ2_H
|
||||
#define _WX_MSW_OLE_DATAOBJ2_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapDataObject is a specialization of wxDataObject for bitmap data
|
||||
//
|
||||
// NB: in fact, under MSW we support CF_DIB (and not CF_BITMAP) clipboard
|
||||
// format and we also provide wxBitmapDataObject2 for CF_BITMAP (which is
|
||||
// rarely used). This is ugly, but I haven't found a solution for it yet.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap)
|
||||
: wxBitmapDataObjectBase(bitmap)
|
||||
{
|
||||
SetFormat(wxDF_DIB);
|
||||
|
||||
m_data = NULL;
|
||||
}
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
|
||||
{ return GetDataSize(); }
|
||||
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
|
||||
void *buf) const
|
||||
{ return GetDataHere(buf); }
|
||||
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
|
||||
size_t len, const void *buf)
|
||||
{ return SetData(len, buf); }
|
||||
|
||||
private:
|
||||
// the DIB data
|
||||
void /* BITMAPINFO */ *m_data;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapDataObject2 - a data object for CF_BITMAP
|
||||
//
|
||||
// FIXME did I already mention it was ugly?
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapDataObject2 : public wxBitmapDataObjectBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxBitmapDataObject2(const wxBitmap& bitmap = wxNullBitmap)
|
||||
: wxBitmapDataObjectBase(bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
|
||||
{ return GetDataSize(); }
|
||||
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
|
||||
void *buf) const
|
||||
{ return GetDataHere(buf); }
|
||||
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
|
||||
size_t len, const void *buf)
|
||||
{ return SetData(len, buf); }
|
||||
|
||||
private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxBitmapDataObject2);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDataObject - data object for CF_HDROP
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxFileDataObject() { }
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *pData) const;
|
||||
virtual void AddFile(const wxString& file);
|
||||
|
||||
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
|
||||
{ return GetDataSize(); }
|
||||
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
|
||||
void *buf) const
|
||||
{ return GetDataHere(buf); }
|
||||
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
|
||||
size_t len, const void *buf)
|
||||
{ return SetData(len, buf); }
|
||||
|
||||
private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxFileDataObject);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxURLDataObject: data object for URLs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite
|
||||
{
|
||||
public:
|
||||
// initialize with URL in ctor or use SetURL later
|
||||
wxURLDataObject(const wxString& url = wxEmptyString);
|
||||
|
||||
// return the URL as string
|
||||
wxString GetURL() const;
|
||||
|
||||
// Set a string as the URL in the data object
|
||||
void SetURL(const wxString& url);
|
||||
|
||||
// override to set m_textFormat
|
||||
virtual bool SetData(const wxDataFormat& format,
|
||||
size_t len,
|
||||
const void *buf);
|
||||
|
||||
private:
|
||||
// last data object we got data in
|
||||
wxDataObjectSimple *m_dataObjectLast;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxURLDataObject);
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_OLE_DATAOBJ2_H
|
79
Externals/wxWidgets3/include/wx/msw/ole/dropsrc.h
vendored
Normal file
79
Externals/wxWidgets3/include/wx/msw/ole/dropsrc.h
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/dropsrc.h
|
||||
// Purpose: declaration of the wxDropSource class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.03.98
|
||||
// RCS-ID: $Id: dropsrc.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OLEDROPSRC_H
|
||||
#define _WX_OLEDROPSRC_H
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxIDropSource;
|
||||
class WXDLLIMPEXP_FWD_CORE wxDataObject;
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this macro may be used instead for wxDropSource ctor arguments: it will use
|
||||
// the cursor 'name' from the resources under MSW, but will expand to
|
||||
// something else under GTK. If you don't use it, you will have to use #ifdef
|
||||
// in the application code.
|
||||
#define wxDROP_ICON(name) wxCursor(wxT(#name))
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDropSource is used to start the drag-&-drop operation on associated
|
||||
// wxDataObject object. It's responsible for giving UI feedback while dragging.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropSource : public wxDropSourceBase
|
||||
{
|
||||
public:
|
||||
// ctors: if you use default ctor you must call SetData() later!
|
||||
//
|
||||
// NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
|
||||
// compatibility, as well as both icon parameters
|
||||
wxDropSource(wxWindow *win = NULL,
|
||||
const wxCursor &cursorCopy = wxNullCursor,
|
||||
const wxCursor &cursorMove = wxNullCursor,
|
||||
const wxCursor &cursorStop = wxNullCursor);
|
||||
wxDropSource(wxDataObject& data,
|
||||
wxWindow *win = NULL,
|
||||
const wxCursor &cursorCopy = wxNullCursor,
|
||||
const wxCursor &cursorMove = wxNullCursor,
|
||||
const wxCursor &cursorStop = wxNullCursor);
|
||||
|
||||
virtual ~wxDropSource();
|
||||
|
||||
// do it (call this in response to a mouse button press, for example)
|
||||
// params: if bAllowMove is false, data can be only copied
|
||||
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
||||
|
||||
// overridable: you may give some custom UI feedback during d&d operation
|
||||
// in this function (it's called on each mouse move, so it shouldn't be
|
||||
// too slow). Just return false if you want default feedback.
|
||||
virtual bool GiveFeedback(wxDragResult effect);
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
wxIDropSource *m_pIDropSource; // the pointer to COM interface
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxDropSource);
|
||||
};
|
||||
|
||||
#endif //wxUSE_DRAG_AND_DROP
|
||||
|
||||
#endif //_WX_OLEDROPSRC_H
|
75
Externals/wxWidgets3/include/wx/msw/ole/droptgt.h
vendored
Normal file
75
Externals/wxWidgets3/include/wx/msw/ole/droptgt.h
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/droptgt.h
|
||||
// Purpose: declaration of the wxDropTarget class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 06.03.98
|
||||
// RCS-ID: $Id: droptgt.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OLEDROPTGT_H
|
||||
#define _WX_OLEDROPTGT_H
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxIDropTarget;
|
||||
struct IDataObject;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// An instance of the class wxDropTarget may be associated with any wxWindow
|
||||
// derived object via SetDropTarget() function. If this is done, the virtual
|
||||
// methods of wxDropTarget are called when something is dropped on the window.
|
||||
//
|
||||
// Note that wxDropTarget is an abstract base class (ABC) and you should derive
|
||||
// your own class from it implementing pure virtual function in order to use it
|
||||
// (all of them, including protected ones which are called by the class itself)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxDropTarget(wxDataObject *dataObject = NULL);
|
||||
virtual ~wxDropTarget();
|
||||
|
||||
// normally called by wxWindow on window creation/destruction, but might be
|
||||
// called `manually' as well. Register() returns true on success.
|
||||
bool Register(WXHWND hwnd);
|
||||
void Revoke(WXHWND hwnd);
|
||||
|
||||
// provide default implementation for base class pure virtuals
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||
virtual bool GetData();
|
||||
|
||||
// Can only be called during OnXXX methods.
|
||||
wxDataFormat GetMatchingPair();
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// do we accept this kind of data?
|
||||
bool MSWIsAcceptedData(IDataObject *pIDataSource) const;
|
||||
|
||||
// give us the data source from IDropTarget::Drop() - this is later used by
|
||||
// GetData() when it's called from inside OnData()
|
||||
void MSWSetDataSource(IDataObject *pIDataSource);
|
||||
|
||||
private:
|
||||
// helper used by IsAcceptedData() and GetData()
|
||||
wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const;
|
||||
|
||||
wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface
|
||||
IDataObject *m_pIDataSource; // the pointer to the source data object
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxDropTarget);
|
||||
};
|
||||
|
||||
#endif //wxUSE_DRAG_AND_DROP
|
||||
|
||||
#endif //_WX_OLEDROPTGT_H
|
260
Externals/wxWidgets3/include/wx/msw/ole/oleutils.h
vendored
Normal file
260
Externals/wxWidgets3/include/wx/msw/ole/oleutils.h
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/oleutils.h
|
||||
// Purpose: OLE helper routines, OLE debugging support &c
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.02.1998
|
||||
// RCS-ID: $Id: oleutils.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OLEUTILS_H
|
||||
#define _WX_OLEUTILS_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_OLE
|
||||
|
||||
// ole2.h includes windows.h, so include wrapwin.h first
|
||||
#include "wx/msw/wrapwin.h"
|
||||
// get IUnknown, REFIID &c
|
||||
#include <ole2.h>
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
// ============================================================================
|
||||
// General purpose functions and macros
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// initialize/cleanup OLE
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// call OleInitialize() or CoInitialize[Ex]() depending on the platform
|
||||
//
|
||||
// return true if ok, false otherwise
|
||||
inline bool wxOleInitialize()
|
||||
{
|
||||
HRESULT
|
||||
#ifdef __WXWINCE__
|
||||
hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
#else
|
||||
hr = ::OleInitialize(NULL);
|
||||
#endif
|
||||
|
||||
// RPC_E_CHANGED_MODE indicates that OLE had been already initialized
|
||||
// before, albeit with different mode. Don't consider it to be an error as
|
||||
// we don't actually care ourselves about the mode used so this allows the
|
||||
// main application to call OleInitialize() on its own before we do if it
|
||||
// needs non-default mode.
|
||||
if ( hr != RPC_E_CHANGED_MODE && FAILED(hr) )
|
||||
{
|
||||
wxLogError(_("Cannot initialize OLE"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void wxOleUninitialize()
|
||||
{
|
||||
#ifdef __WXWINCE__
|
||||
::CoUninitialize();
|
||||
#else
|
||||
::OleUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// misc helper functions/macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// release the interface pointer (if !NULL)
|
||||
inline void ReleaseInterface(IUnknown *pIUnk)
|
||||
{
|
||||
if ( pIUnk != NULL )
|
||||
pIUnk->Release();
|
||||
}
|
||||
|
||||
// release the interface pointer (if !NULL) and make it NULL
|
||||
#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; };
|
||||
|
||||
// return true if the iid is in the array
|
||||
extern bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount);
|
||||
|
||||
// ============================================================================
|
||||
// IUnknown implementation helpers
|
||||
// ============================================================================
|
||||
|
||||
/*
|
||||
The most dumb implementation of IUnknown methods. We don't support
|
||||
aggregation nor containment, but for 99% of cases this simple
|
||||
implementation is quite enough.
|
||||
|
||||
Usage is trivial: here is all you should have
|
||||
1) DECLARE_IUNKNOWN_METHODS in your (IUnknown derived!) class declaration
|
||||
2) BEGIN/END_IID_TABLE with ADD_IID in between for all interfaces you
|
||||
support (at least all for which you intent to return 'this' from QI,
|
||||
i.e. you should derive from IFoo if you have ADD_IID(Foo)) somewhere else
|
||||
3) IMPLEMENT_IUNKNOWN_METHODS somewhere also
|
||||
|
||||
These macros are quite simple: AddRef and Release are trivial and QI does
|
||||
lookup in a static member array of IIDs and returns 'this' if it founds
|
||||
the requested interface in it or E_NOINTERFACE if not.
|
||||
*/
|
||||
|
||||
/*
|
||||
wxAutoULong: this class is used for automatically initalising m_cRef to 0
|
||||
*/
|
||||
class wxAutoULong
|
||||
{
|
||||
public:
|
||||
wxAutoULong(ULONG value = 0) : m_Value(value) { }
|
||||
|
||||
operator ULONG&() { return m_Value; }
|
||||
ULONG& operator=(ULONG value) { m_Value = value; return m_Value; }
|
||||
|
||||
wxAutoULong& operator++() { ++m_Value; return *this; }
|
||||
const wxAutoULong operator++( int ) { wxAutoULong temp = *this; ++m_Value; return temp; }
|
||||
|
||||
wxAutoULong& operator--() { --m_Value; return *this; }
|
||||
const wxAutoULong operator--( int ) { wxAutoULong temp = *this; --m_Value; return temp; }
|
||||
|
||||
private:
|
||||
ULONG m_Value;
|
||||
};
|
||||
|
||||
// declare the methods and the member variable containing reference count
|
||||
// you must also define the ms_aIids array somewhere with BEGIN_IID_TABLE
|
||||
// and friends (see below)
|
||||
|
||||
#define DECLARE_IUNKNOWN_METHODS \
|
||||
public: \
|
||||
STDMETHODIMP QueryInterface(REFIID, void **); \
|
||||
STDMETHODIMP_(ULONG) AddRef(); \
|
||||
STDMETHODIMP_(ULONG) Release(); \
|
||||
private: \
|
||||
static const IID *ms_aIids[]; \
|
||||
wxAutoULong m_cRef
|
||||
|
||||
// macros for declaring supported interfaces
|
||||
// NB: you should write ADD_INTERFACE(Foo) and not ADD_INTERFACE(IID_IFoo)!
|
||||
#define BEGIN_IID_TABLE(cname) const IID *cname::ms_aIids[] = {
|
||||
#define ADD_IID(iid) &IID_I##iid,
|
||||
#define END_IID_TABLE }
|
||||
|
||||
// implementation is as straightforward as possible
|
||||
// Parameter: classname - the name of the class
|
||||
#define IMPLEMENT_IUNKNOWN_METHODS(classname) \
|
||||
STDMETHODIMP classname::QueryInterface(REFIID riid, void **ppv) \
|
||||
{ \
|
||||
wxLogQueryInterface(wxT(#classname), riid); \
|
||||
\
|
||||
if ( IsIidFromList(riid, ms_aIids, WXSIZEOF(ms_aIids)) ) { \
|
||||
*ppv = this; \
|
||||
AddRef(); \
|
||||
\
|
||||
return S_OK; \
|
||||
} \
|
||||
else { \
|
||||
*ppv = NULL; \
|
||||
\
|
||||
return (HRESULT) E_NOINTERFACE; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
STDMETHODIMP_(ULONG) classname::AddRef() \
|
||||
{ \
|
||||
wxLogAddRef(wxT(#classname), m_cRef); \
|
||||
\
|
||||
return ++m_cRef; \
|
||||
} \
|
||||
\
|
||||
STDMETHODIMP_(ULONG) classname::Release() \
|
||||
{ \
|
||||
wxLogRelease(wxT(#classname), m_cRef); \
|
||||
\
|
||||
if ( --m_cRef == wxAutoULong(0) ) { \
|
||||
delete this; \
|
||||
return 0; \
|
||||
} \
|
||||
else \
|
||||
return m_cRef; \
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Debugging support
|
||||
// ============================================================================
|
||||
|
||||
// VZ: I don't know it's not done for compilers other than VC++ but I leave it
|
||||
// as is. Please note, though, that tracing OLE interface calls may be
|
||||
// incredibly useful when debugging OLE programs.
|
||||
#if defined(__WXDEBUG__) && ( ( defined(__VISUALC__) && (__VISUALC__ >= 1000) ) || defined(__MWERKS__) )
|
||||
// ----------------------------------------------------------------------------
|
||||
// All OLE specific log functions have DebugTrace level (as LogTrace)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// tries to translate riid into a symbolic name, if possible
|
||||
void wxLogQueryInterface(const wxChar *szInterface, REFIID riid);
|
||||
|
||||
// these functions print out the new value of reference counter
|
||||
void wxLogAddRef (const wxChar *szInterface, ULONG cRef);
|
||||
void wxLogRelease(const wxChar *szInterface, ULONG cRef);
|
||||
|
||||
#else //!__WXDEBUG__
|
||||
#define wxLogQueryInterface(szInterface, riid)
|
||||
#define wxLogAddRef(szInterface, cRef)
|
||||
#define wxLogRelease(szInterface, cRef)
|
||||
#endif //__WXDEBUG__
|
||||
|
||||
// wrapper around BSTR type (by Vadim Zeitlin)
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBasicString
|
||||
{
|
||||
public:
|
||||
// ctors & dtor
|
||||
wxBasicString(const wxString& str);
|
||||
wxBasicString(const wxBasicString& bstr);
|
||||
~wxBasicString();
|
||||
|
||||
wxBasicString& operator=(const wxBasicString& bstr);
|
||||
|
||||
// accessors
|
||||
// just get the string
|
||||
operator BSTR() const { return m_bstrBuf; }
|
||||
// retrieve a copy of our string - caller must SysFreeString() it later!
|
||||
BSTR Get() const { return SysAllocString(m_bstrBuf); }
|
||||
|
||||
private:
|
||||
// actual string
|
||||
BSTR m_bstrBuf;
|
||||
};
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
// Convert variants
|
||||
class WXDLLIMPEXP_FWD_BASE wxVariant;
|
||||
|
||||
WXDLLIMPEXP_CORE bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant);
|
||||
WXDLLIMPEXP_CORE bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant);
|
||||
#endif // wxUSE_VARIANT
|
||||
|
||||
// Convert string to Unicode
|
||||
WXDLLIMPEXP_CORE BSTR wxConvertStringToOle(const wxString& str);
|
||||
|
||||
// Convert string from BSTR to wxString
|
||||
WXDLLIMPEXP_CORE wxString wxConvertStringFromOle(BSTR bStr);
|
||||
|
||||
#else // !wxUSE_OLE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// stub functions to avoid #if wxUSE_OLE in the main code
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
inline bool wxOleInitialize() { return false; }
|
||||
inline void wxOleUninitialize() { }
|
||||
|
||||
#endif // wxUSE_OLE/!wxUSE_OLE
|
||||
|
||||
#endif //_WX_OLEUTILS_H
|
90
Externals/wxWidgets3/include/wx/msw/ole/uuid.h
vendored
Normal file
90
Externals/wxWidgets3/include/wx/msw/ole/uuid.h
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/ole/uuid.h
|
||||
// Purpose: encapsulates an UUID with some added helper functions
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 11.07.97
|
||||
// RCS-ID: $Id: uuid.h 67254 2011-03-20 00:14:35Z DS $
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
//
|
||||
// Notes: you should link your project with RPCRT4.LIB!
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OLEUUID_H
|
||||
#define _WX_OLEUUID_H
|
||||
|
||||
#include "wx/chartype.h"
|
||||
// ------------------------------------------------------------------
|
||||
// UUID (Universally Unique IDentifier) definition
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
// ----- taken from RPC.H
|
||||
#ifndef UUID_DEFINED // in some cases RPC.H will be already
|
||||
#ifdef __WIN32__ // included, so avoid redefinition
|
||||
typedef struct
|
||||
{
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} UUID; // UUID = GUID = CLSID = LIBID = IID
|
||||
#endif // WIN32
|
||||
#endif // UUID_DEFINED
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
typedef UUID GUID;
|
||||
#define UUID_DEFINED // prevent redefinition
|
||||
#endif // GUID_DEFINED
|
||||
|
||||
typedef unsigned char uchar;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// a class to store UUID and it's string representation
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
// uses RPC functions to create/convert Universally Unique Identifiers
|
||||
class WXDLLIMPEXP_CORE Uuid
|
||||
{
|
||||
private:
|
||||
UUID m_uuid;
|
||||
wxUChar *m_pszUuid; // this string is alloc'd and freed by RPC
|
||||
wxChar *m_pszCForm; // this string is allocated in Set/Create
|
||||
|
||||
void UuidToCForm();
|
||||
|
||||
// function used to set initial state by all ctors
|
||||
void Init() { m_pszUuid = NULL; m_pszCForm = NULL; }
|
||||
|
||||
public:
|
||||
// ctors & dtor
|
||||
Uuid() { Init(); }
|
||||
Uuid(const wxChar *pc) { Init(); Set(pc); }
|
||||
Uuid(const UUID &uuid) { Init(); Set(uuid); }
|
||||
~Uuid();
|
||||
|
||||
// copy ctor and assignment operator needed for this class
|
||||
Uuid(const Uuid& uuid);
|
||||
Uuid& operator=(const Uuid& uuid);
|
||||
|
||||
// create a brand new UUID
|
||||
void Create();
|
||||
|
||||
// set value of UUID
|
||||
bool Set(const wxChar *pc); // from a string, returns true if ok
|
||||
void Set(const UUID& uuid); // from another UUID (never fails)
|
||||
|
||||
// comparison operators
|
||||
bool operator==(const Uuid& uuid) const;
|
||||
bool operator!=(const Uuid& uuid) const { return !(*this == uuid); }
|
||||
|
||||
// accessors
|
||||
operator const UUID*() const { return &m_uuid; }
|
||||
operator const wxChar*() const { return (wxChar *)(m_pszUuid); }
|
||||
|
||||
// return string representation of the UUID in the C form
|
||||
// (as in DEFINE_GUID macro)
|
||||
const wxChar *CForm() const { return m_pszCForm; }
|
||||
};
|
||||
|
||||
#endif //_WX_OLEUUID_H
|
Reference in New Issue
Block a user