]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/xti2.h
Use kCGBlendModeExclusion for wxCOMPOSITION_XOR operation.
[wxWidgets.git] / include / wx / xti2.h
index 24d5cb3203bd7ffc1c41e345c8cc7b0251338b78..eeb31067ea4fc9ae62bc6703a2834d818368cef4 100644 (file)
 
 #if wxUSE_EXTENDED_RTTI
 
+// ----------------------------------------------------------------------------
+// wxDynamicObject class, its instances connect to a 'super class instance'
+// ----------------------------------------------------------------------------
+
 class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
 {
     friend class WXDLLIMPEXP_FWD_BASE wxDynamicClassInfo ;
@@ -57,7 +61,29 @@ private :
     wxDynamicObjectInternal *m_data;
 };
 
+// ----------------------------------------------------------------------------
+// String conversion templates supporting older compilers
+// ----------------------------------------------------------------------------
+
+#if wxUSE_FUNC_TEMPLATE_POINTER
+#  define wxTO_STRING(type) wxToStringConverter<type>
+#  define wxTO_STRING_IMP(type)
+#  define wxFROM_STRING(type) wxFromStringConverter<type>
+#  define wxFROM_STRING_IMP(type)
+#else
+#  define wxTO_STRING(type) ToString##type
+#  define wxTO_STRING_IMP(type) \
+    inline void ToString##type( const wxAny& data, wxString &result ) \
+{ wxToStringConverter<type>(data, result); }
+
+#  define wxFROM_STRING(type) FromString##type
+#  define wxFROM_STRING_IMP(type) \
+    inline void FromString##type( const wxString& data, wxAny &result ) \
+{ wxFromStringConverter<type>(data, result); }
+#endif
+
 #include "wx/xtiprop.h"
+#include "wx/xtictor.h"
 
 // ----------------------------------------------------------------------------
 // wxIMPLEMENT class macros for concrete classes
@@ -98,7 +124,7 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data )        \
     _DEFAULT_CONSTRUCTOR(name)                                                  \
     _DEFAULT_CONVERTERS(name)                                                   \
     void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn )                 \
-{ (*fn)( &wxANY_AS(data, name) ); }                        \
+    { name o = wxANY_AS(data, name); (*fn)( &o ); }                        \
     \
     const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL };  \
     wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit),                \
@@ -223,7 +249,8 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data )        \
     wxT(#basename2), (int) sizeof(name),         \
     (wxObjectConstructorFn) 0);
 
-// templated streaming, every type must have their specialization for these methods
+// templated streaming, every type that can be converted to wxString
+// must have their specialization for these methods
 
 template<typename T>
 void wxStringReadValue( const wxString &s, T &data );
@@ -239,6 +266,29 @@ template<typename T>
 void wxFromStringConverter( const wxString &s, wxAny &v) 
 { T d; wxStringReadValue(s, d); v = wxAny(d); }
 
+// --------------------------------------------------------------------------
+// Collection Support
+// --------------------------------------------------------------------------
+
+template<typename iter, typename collection_t > void wxListCollectionToAnyList( 
+                                                                               const collection_t& coll, wxAnyList &value )
+{
+    for ( iter current = coll.GetFirst(); current; 
+         current = current->GetNext() )
+    {
+        value.Append( new wxAny(current->GetData()) );
+    }
+}
+
+template<typename collection_t> void wxArrayCollectionToVariantArray( 
+                                                                     const collection_t& coll, wxAnyList &value )
+{
+    for( size_t i = 0; i < coll.GetCount(); i++ )
+    {
+        value.Append( new wxAny(coll[i]) );
+    }
+}
+
 #endif
 
 #endif // _WX_XTIH2__