]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/sampleprops.h
Support using GetTextExtent() with empty string to get descent in wxOSX.
[wxWidgets.git] / samples / propgrid / sampleprops.h
index f363fdfc5157ae8eca3b4ce1d5f2094212abd26b..0fbbf446b7071152962bcefa66de5d34774f3628 100644 (file)
@@ -4,16 +4,17 @@
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2006-03-05
-// RCS-ID:      $Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
 #define _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_
 
+#include "wx/fontdata.h"
 
-WX_PG_DECLARE_WXOBJECT_VARIANT_DATA(wxPGVariantDataFontData, wxFontData, wxEMPTY_PARAMETER_VALUE)
+DECLARE_VARIANT_OBJECT(wxFontData)
 
 
 class wxFontDataProperty : public wxFontProperty
@@ -28,14 +29,17 @@ public:
 
     void OnSetValue();
 
-    // Inorder to have different value type in a derived property
+    // In order to have different value type in a derived property
     // class, we will override GetValue to return custom variant,
     // instead of changing the base m_value. This allows the methods
     // in base class to function properly.
     virtual wxVariant DoGetValue() const;
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
+    virtual wxVariant ChildChanged( wxVariant& thisValue,
+                                    int childIndex,
+                                    wxVariant& childValue ) const;
+    virtual void RefreshChildren();
+    virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
 
 protected:
     // Value must be stored as variant - otherwise it will be
@@ -54,14 +58,17 @@ public:
                     const wxSize& value = wxSize() );
     virtual ~wxSizeProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual wxVariant ChildChanged( wxVariant& thisValue,
+                                    int childIndex,
+                                    wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 
     // I stands for internal
     void SetValueI( const wxSize& value )
     {
-        m_value = wxSizeToVariant(value);
+        m_value = WXVARIANT(value);
     }
 };
 
@@ -76,14 +83,17 @@ public:
                      const wxPoint& value = wxPoint() );
     virtual ~wxPointProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual wxVariant ChildChanged( wxVariant& thisValue,
+                                    int childIndex,
+                                    wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 
     // I stands for internal
     void SetValueI( const wxPoint& value )
     {
-        m_value = wxPointToVariant(value);
+        m_value = WXVARIANT(value);
     }
 };
 
@@ -93,7 +103,7 @@ WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR_WITH_DECL(wxDirsProperty, clas
 
 // -----------------------------------------------------------------------
 
-WX_PG_DECLARE_VARIANT_DATA(wxPGVariantDataArrayDouble, wxArrayDouble, wxEMPTY_PARAMETER_VALUE)
+WX_PG_DECLARE_VARIANT_DATA(wxArrayDouble)
 
 class wxArrayDoubleProperty : public wxPGProperty
 {
@@ -107,9 +117,12 @@ public:
     virtual ~wxArrayDoubleProperty ();
 
     virtual void OnSetValue();
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
+    virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 
     // Generates cache for displayed text
     virtual void GenerateValueAsString ( wxString& target, int prec, bool removeZeroes ) const;