]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/propgrid/propgriddefs.h
moving more things to common API between carbon and cocoa, adapting WidthDefault...
[wxWidgets.git] / include / wx / propgrid / propgriddefs.h
index 97cde0852aa6be97f1138b5e26da39815a9e0dfa..729da9038170df197313dda0e4ae33240f85584e 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2008-08-31
-// RCS-ID:      $Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
@@ -15,6 +15,7 @@
 #if wxUSE_PROPGRID
 
 #include "wx/dynarray.h"
+#include "wx/vector.h"
 #include "wx/hashmap.h"
 #include "wx/variant.h"
 #include "wx/longlong.h"
@@ -269,7 +270,7 @@ class wxPropertyGridManager;
 class wxPGOwnerDrawnComboBox;
 class wxPGCustomComboControl;
 class wxPGEditorDialogAdapter;
-struct wxPGValidationInfo;
+class wxPGValidationInfo;
 
 
 // -----------------------------------------------------------------------
@@ -513,7 +514,9 @@ extern expdecl const char* classname##_VariantType;
 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
     WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
 
-#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ(classname,expdecl) \
+// Add getter (ie. classname << variant) separately to allow
+// custom implementations.
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
 const char* classname##_VariantType = #classname; \
 class classname##VariantData: public wxVariantData \
 { \
@@ -522,16 +525,14 @@ public:\
     classname##VariantData( const classname &value ) { m_value = value; } \
 \
     classname &GetValue() { return m_value; } \
+\
+    const classname &GetValue() const { return m_value; } \
 \
     virtual bool Eq(wxVariantData& data) const; \
 \
     virtual wxString GetType() const; \
 \
     virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
-\
-    classname& GetValueRef() { return m_value; } \
-\
-    const classname& GetValueRef() const { return m_value; } \
 \
 protected:\
     classname m_value; \
@@ -542,15 +543,6 @@ wxString classname##VariantData::GetType() const\
     return wxS(#classname);\
 }\
 \
-expdecl classname& operator << ( classname &value, const wxVariant &variant )\
-{\
-    wxASSERT( variant.GetType() == #classname );\
-    \
-    classname##VariantData *data = (classname##VariantData*) variant.GetData();\
-    value = data->GetValue();\
-    return value;\
-}\
-\
 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
 {\
     classname##VariantData *data = new classname##VariantData( value );\
@@ -561,20 +553,26 @@ expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
 { \
     wxASSERT( variant.GetType() == #classname );\
     classname##VariantData *data = (classname##VariantData*) variant.GetData();\
-    return data->GetValueRef();\
+    return data->GetValue();\
 } \
 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
 { \
     wxASSERT( variant.GetType() == #classname );\
     classname##VariantData *data = (classname##VariantData*) variant.GetData();\
-    return data->GetValueRef();\
+    return data->GetValue();\
 }
 
-// implements a wxVariantData-derived class using for the Eq() method the
-// operator== which must have been provided by "classname"
-#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
-WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
-\
+#define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
+expdecl classname& operator << ( classname &value, const wxVariant &variant )\
+{\
+    wxASSERT( variant.GetType() == #classname );\
+    \
+    classname##VariantData *data = (classname##VariantData*) variant.GetData();\
+    value = data->GetValue();\
+    return value;\
+}
+
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
 bool classname##VariantData::Eq(wxVariantData& data) const \
 {\
     wxASSERT( GetType() == data.GetType() );\
@@ -584,12 +582,20 @@ bool classname##VariantData::Eq(wxVariantData& data) const \
     return otherData.m_value == m_value;\
 }
 
+// implements a wxVariantData-derived class using for the Eq() method the
+// operator== which must have been provided by "classname"
+#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
+
 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
 
 // with Eq() implementation that always returns false
 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
-WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
+WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
 \
 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
 {\
@@ -619,6 +625,27 @@ template<> inline wxVariant WXVARIANT( const wxColour& value )
     return variant;
 }
 
+#if wxUSE_LONGLONG_NATIVE
+
+template<> inline wxVariant WXVARIANT( const wxLongLong_t& value )
+{
+    wxVariant variant;
+    variant << wxLongLong(value);
+    return variant;
+}
+
+template<> inline wxVariant WXVARIANT( const wxULongLong_t& value )
+{
+    wxVariant variant;
+    variant << wxULongLong(value);
+    return variant;
+}
+
+WXDLLIMPEXP_PROPGRID wxLongLong_t& operator << ( wxLongLong_t &value, const wxVariant &variant );
+WXDLLIMPEXP_PROPGRID wxULongLong_t& operator << ( wxULongLong_t &value, const wxVariant &variant );
+
+#endif  // wxUSE_LONGLONG_NATIVE
+
 // Define constants for common wxVariant type strings
 
 #define wxPG_VARIANT_TYPE_STRING        wxPGGlobalVars->m_strstring