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:
@@ -67,8 +67,6 @@ the shift operator conversion for a few of its drawing related classes:
|
|||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxColour)
|
IMPLEMENT_VARIANT_OBJECT(wxColour)
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxPen)
|
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxBrush)
|
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxImage)
|
IMPLEMENT_VARIANT_OBJECT(wxImage)
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxIcon)
|
IMPLEMENT_VARIANT_OBJECT(wxIcon)
|
||||||
IMPLEMENT_VARIANT_OBJECT(wxBitmap)
|
IMPLEMENT_VARIANT_OBJECT(wxBitmap)
|
||||||
|
@@ -30,6 +30,15 @@ class WXDLLEXPORT wxImage;
|
|||||||
class WXDLLEXPORT wxMask;
|
class WXDLLEXPORT wxMask;
|
||||||
class WXDLLEXPORT wxPalette;
|
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
|
// wxMask represents the transparent area of the bitmap
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
#include "wx/gdiobj.h"
|
#include "wx/gdiobj.h"
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxColour;
|
||||||
|
|
||||||
// the standard wxColour constructors;
|
// the standard wxColour constructors;
|
||||||
// this macro avoids to repeat these lines across all colour.h files, since
|
// 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
|
// 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
|
#define wxC2S_HTML_SYNTAX 4 // return colour in #rrggbb syntax
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxColour;
|
|
||||||
|
|
||||||
const unsigned char wxALPHA_TRANSPARENT = 0;
|
const unsigned char wxALPHA_TRANSPARENT = 0;
|
||||||
const unsigned char wxALPHA_OPAQUE = 0xff;
|
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
|
// wxColourBase: this class has no data members, just some functions to avoid
|
||||||
// code redundancy in all native wxColour implementations
|
// code redundancy in all native wxColour implementations
|
||||||
|
@@ -39,5 +39,15 @@
|
|||||||
#include "wx/os2/icon.h"
|
#include "wx/os2/icon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxVariant support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_VARIANT
|
||||||
|
#include "wx/variant.h"
|
||||||
|
DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLEXPORT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_ICON_H_BASE_
|
// _WX_ICON_H_BASE_
|
||||||
|
@@ -65,6 +65,15 @@ class WXDLLEXPORT wxImageHandler;
|
|||||||
class WXDLLEXPORT wxImage;
|
class WXDLLEXPORT wxImage;
|
||||||
class WXDLLEXPORT wxPalette;
|
class WXDLLEXPORT wxPalette;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxVariant support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_VARIANT
|
||||||
|
#include "wx/variant.h"
|
||||||
|
DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT)
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxImageHandler
|
// wxImageHandler
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -316,12 +316,23 @@ private:
|
|||||||
DECLARE_DYNAMIC_CLASS(wxVariant)
|
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) \
|
#define DECLARE_VARIANT_OBJECT(classname) \
|
||||||
classname& operator << ( classname &object, const wxVariant &variant ); \
|
DECLARE_VARIANT_OBJECT_EXPORTED(classname,EMPTY_PARAMETER_VALUE)
|
||||||
wxVariant& operator << ( wxVariant &variant, const classname &object );
|
|
||||||
|
#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) \
|
#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 \
|
class classname##VariantData: public wxVariantData \
|
||||||
{ \
|
{ \
|
||||||
public:\
|
public:\
|
||||||
@@ -363,7 +374,7 @@ wxClassInfo* classname##VariantData::GetValueClassInfo()\
|
|||||||
return m_value.GetClassInfo();\
|
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 ) );\
|
wxASSERT( wxIsKindOf( variant.GetData(), classname##VariantData ) );\
|
||||||
\
|
\
|
||||||
@@ -372,27 +383,13 @@ classname& operator << ( classname &value, const wxVariant &variant )\
|
|||||||
return value;\
|
return value;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
wxVariant& operator << ( wxVariant &variant, const classname &value )\
|
wxVariant& expdecl operator << ( wxVariant &variant, const classname &value )\
|
||||||
{\
|
{\
|
||||||
classname##VariantData *data = new classname##VariantData( value );\
|
classname##VariantData *data = new classname##VariantData( value );\
|
||||||
variant.SetData( data );\
|
variant.SetData( data );\
|
||||||
return variant;\
|
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
|
// 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
|
// in a seemingly safe way so the compiler can check, so we define
|
||||||
// a dynamic_cast /wxDynamicCast analogue.
|
// a dynamic_cast /wxDynamicCast analogue.
|
||||||
|
@@ -36,6 +36,13 @@
|
|||||||
#include "wx/module.h"
|
#include "wx/module.h"
|
||||||
#endif // WX_PRECOMP
|
#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(wxBitmapBase, wxGDIObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject)
|
||||||
|
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_VARIANT
|
||||||
|
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxString <-> wxColour conversions
|
// wxString <-> wxColour conversions
|
||||||
|
@@ -51,6 +51,10 @@
|
|||||||
#endif // wxUSE_FILE/wxUSE_FFILE
|
#endif // wxUSE_FILE/wxUSE_FFILE
|
||||||
#endif // HAS_FILE_STREAMS
|
#endif // HAS_FILE_STREAMS
|
||||||
|
|
||||||
|
#if wxUSE_VARIANT
|
||||||
|
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT)
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxImage
|
// wxImage
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -2026,11 +2026,4 @@ bool wxVariant::Convert(wxDateTime* value) const
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_DATETIME
|
#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
|
#endif // wxUSE_VARIANT
|
||||||
|
Reference in New Issue
Block a user