From: Robert Roebling Date: Sat, 30 Sep 2006 20:45:15 +0000 (+0000) Subject: Move wxVariant support for GDI classes to their X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6f5d78250c6dd003e8d06fea9e04b710bffdb41f 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 --- diff --git a/docs/latex/wx/variant.tex b/docs/latex/wx/variant.tex index 11c574c389..8205ca19bd 100644 --- a/docs/latex/wx/variant.tex +++ b/docs/latex/wx/variant.tex @@ -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) diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index e2431b9e53..b12e30dbea 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -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 // ---------------------------------------------------------------------------- diff --git a/include/wx/colour.h b/include/wx/colour.h index 7bba397dc2..18101e11de 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -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 diff --git a/include/wx/icon.h b/include/wx/icon.h index 34993fdb40..f4f92e7451 100644 --- a/include/wx/icon.h +++ b/include/wx/icon.h @@ -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_ diff --git a/include/wx/image.h b/include/wx/image.h index 3e3e8d46f5..8718380516 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -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 //----------------------------------------------------------------------------- diff --git a/include/wx/variant.h b/include/wx/variant.h index 8f36485474..43edc77ccb 100644 --- a/include/wx/variant.h +++ b/include/wx/variant.h @@ -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. diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp index d8c879f146..17324c3760 100644 --- a/src/common/bmpbase.cpp +++ b/src/common/bmpbase.cpp @@ -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) diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp index a20851c767..a77017922f 100644 --- a/src/common/colourcmn.cpp +++ b/src/common/colourcmn.cpp @@ -25,6 +25,9 @@ #include "wx/gdicmn.h" #endif +#if wxUSE_VARIANT +IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) +#endif // ============================================================================ // wxString <-> wxColour conversions diff --git a/src/common/image.cpp b/src/common/image.cpp index 652d2c905d..8e65698989 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -51,6 +51,10 @@ #endif // wxUSE_FILE/wxUSE_FFILE #endif // HAS_FILE_STREAMS +#if wxUSE_VARIANT +IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLEXPORT) +#endif + //----------------------------------------------------------------------------- // wxImage //----------------------------------------------------------------------------- diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 308965606b..b2cca822ac 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -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