Move wxVariant support for GDI classes to their
files (and thus away from wxBase). Add export declaration field for variant macros. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e48a305514
commit
6f5d78250c
@ -67,8 +67,6 @@ the shift operator conversion for a few of its drawing related classes:
|
||||
|
||||
\begin{verbatim}
|
||||
IMPLEMENT_VARIANT_OBJECT(wxColour)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxPen)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxBrush)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxImage)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxIcon)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxBitmap)
|
||||
|
@ -30,6 +30,15 @@ class WXDLLEXPORT wxImage;
|
||||
class WXDLLEXPORT wxMask;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxVariant support
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
#include "wx/variant.h"
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMask represents the transparent area of the bitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
|
||||
class WXDLLEXPORT wxColour;
|
||||
|
||||
// the standard wxColour constructors;
|
||||
// this macro avoids to repeat these lines across all colour.h files, since
|
||||
// Set() is a virtual function and thus cannot be called by wxColourBase
|
||||
@ -35,11 +37,18 @@
|
||||
#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax
|
||||
|
||||
|
||||
class WXDLLEXPORT wxColour;
|
||||
|
||||
const unsigned char wxALPHA_TRANSPARENT = 0;
|
||||
const unsigned char wxALPHA_OPAQUE = 0xff;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxVariant support
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
#include "wx/variant.h"
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxColourBase: this class has no data members, just some functions to avoid
|
||||
// code redundancy in all native wxColour implementations
|
||||
|
@ -39,5 +39,15 @@
|
||||
#include "wx/os2/icon.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxVariant support
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
#include "wx/variant.h"
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_ICON_H_BASE_
|
||||
|
@ -65,6 +65,15 @@ class WXDLLEXPORT wxImageHandler;
|
||||
class WXDLLEXPORT wxImage;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxVariant support
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
#include "wx/variant.h"
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxImageHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -316,12 +316,23 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxVariant)
|
||||
};
|
||||
|
||||
/* Fake macro parameter value */
|
||||
#ifdef EMPTY_PARAMETER_VALUE
|
||||
#undef EMPTY_PARAMETER_VALUE
|
||||
#endif
|
||||
#define EMPTY_PARAMETER_VALUE
|
||||
|
||||
#define DECLARE_VARIANT_OBJECT(classname) \
|
||||
classname& operator << ( classname &object, const wxVariant &variant ); \
|
||||
wxVariant& operator << ( wxVariant &variant, const classname &object );
|
||||
DECLARE_VARIANT_OBJECT_EXPORTED(classname,EMPTY_PARAMETER_VALUE)
|
||||
|
||||
#define DECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
|
||||
classname& expdecl operator << ( classname &object, const wxVariant &variant ); \
|
||||
wxVariant& expdecl operator << ( wxVariant &variant, const classname &object );
|
||||
|
||||
#define IMPLEMENT_VARIANT_OBJECT(classname) \
|
||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,EMPTY_PARAMETER_VALUE)
|
||||
|
||||
#define IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
|
||||
class classname##VariantData: public wxVariantData \
|
||||
{ \
|
||||
public:\
|
||||
@ -363,7 +374,7 @@ wxClassInfo* classname##VariantData::GetValueClassInfo()\
|
||||
return m_value.GetClassInfo();\
|
||||
}\
|
||||
\
|
||||
classname& operator << ( classname &value, const wxVariant &variant )\
|
||||
classname& expdecl operator << ( classname &value, const wxVariant &variant )\
|
||||
{\
|
||||
wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\
|
||||
\
|
||||
@ -372,27 +383,13 @@ classname& operator << ( classname &value, const wxVariant &variant )\
|
||||
return value;\
|
||||
}\
|
||||
\
|
||||
wxVariant& operator << ( wxVariant &variant, const classname &value )\
|
||||
wxVariant& expdecl operator << ( wxVariant &variant, const classname &value )\
|
||||
{\
|
||||
classname##VariantData *data = new classname##VariantData( value );\
|
||||
variant.SetData( data );\
|
||||
return variant;\
|
||||
}
|
||||
|
||||
#include "wx/colour.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
DECLARE_VARIANT_OBJECT(wxColour)
|
||||
DECLARE_VARIANT_OBJECT(wxPen)
|
||||
DECLARE_VARIANT_OBJECT(wxBrush)
|
||||
DECLARE_VARIANT_OBJECT(wxImage)
|
||||
DECLARE_VARIANT_OBJECT(wxIcon)
|
||||
DECLARE_VARIANT_OBJECT(wxBitmap)
|
||||
|
||||
// Since we want type safety wxVariant we need to fetch and dynamic_cast
|
||||
// in a seemingly safe way so the compiler can check, so we define
|
||||
// a dynamic_cast /wxDynamicCast analogue.
|
||||
|
@ -36,6 +36,13 @@
|
||||
#include "wx/module.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLEXPORT)
|
||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject)
|
||||
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// wxString <-> wxColour conversions
|
||||
|
@ -51,6 +51,10 @@
|
||||
#endif // wxUSE_FILE/wxUSE_FFILE
|
||||
#endif // HAS_FILE_STREAMS
|
||||
|
||||
#if wxUSE_VARIANT
|
||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxImage
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2026,11 +2026,4 @@ bool wxVariant::Convert(wxDateTime* value) const
|
||||
}
|
||||
#endif // wxUSE_DATETIME
|
||||
|
||||
IMPLEMENT_VARIANT_OBJECT(wxColour)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxPen)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxBrush)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxImage)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxIcon)
|
||||
IMPLEMENT_VARIANT_OBJECT(wxBitmap)
|
||||
|
||||
#endif // wxUSE_VARIANT
|
||||
|
Loading…
Reference in New Issue
Block a user