]> git.saurik.com Git - wxWidgets.git/commitdiff
Eliminated WX_PG_DECLARE_X_METHODS macros
authorJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 19 Sep 2008 17:13:51 +0000 (17:13 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 19 Sep 2008 17:13:51 +0000 (17:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/advprops.h
include/wx/propgrid/props.h
samples/propgrid/propgrid.h
samples/propgrid/sampleprops.h

index a73c0d3c7656b36d5dabef32019970b3f8342f21..cd879699d0a5abe00f1938f4026327cf2edca5be 100644 (file)
@@ -176,10 +176,11 @@ public:
     virtual ~wxFontProperty();
     virtual void OnSetValue();
     virtual wxString GetValueAsString( int argFlags = 0 ) const;
-
-    WX_PG_DECLARE_EVENT_METHODS()
-    WX_PG_DECLARE_PARENTAL_METHODS()
-    //WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
+    virtual bool OnEvent( wxPropertyGrid* propgrid,
+                          wxWindow* primary, wxEvent& event );
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 };
@@ -225,13 +226,16 @@ public:
     */
     virtual int GetCustomColourIndex() const;
 
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
-
-    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
-    //virtual wxSize GetImageSize( int item ) const;
-    //virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
+    virtual wxString GetValueAsString( 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 );
+    virtual wxSize OnMeasureImage( int item ) const;
+    virtual void OnCustomPaint( wxDC& dc,
+                                const wxRect& rect, wxPGPaintData& paintdata );
 
     // Helper function to show the colour dialog
     bool QueryColourFromUser( wxVariant& variant ) const;
@@ -294,9 +298,9 @@ class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty
                       int value = 0 );
     virtual ~wxCursorProperty();
 
-    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
-    //virtual wxSize GetImageSize( int item ) const;
-    //virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
+    virtual wxSize OnMeasureImage( int item ) const;
+    virtual void OnCustomPaint( wxDC& dc,
+                                const wxRect& rect, wxPGPaintData& paintdata );
 };
 
 // -----------------------------------------------------------------------
@@ -321,7 +325,9 @@ public:
 
     virtual void OnSetValue();
 
-    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
+    virtual wxSize OnMeasureImage( int item ) const;
+    virtual void OnCustomPaint( wxDC& dc,
+                                const wxRect& rect, wxPGPaintData& paintdata );
 
 protected:
     wxBitmap*   m_pBitmap; // final thumbnail area
@@ -370,7 +376,8 @@ public:
     virtual bool StringToValue(wxVariant& variant,
                                const wxString& text,
                                int argFlags = 0) const;
-    WX_PG_DECLARE_EVENT_METHODS()
+    virtual bool OnEvent( wxPropertyGrid* propgrid,
+                          wxWindow* primary, wxEvent& event );
 
     wxArrayInt GetValueAsArrayInt() const
     {
@@ -420,7 +427,7 @@ public:
                                const wxString& text,
                                int argFlags = 0) const;
 
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 
     void SetFormat( const wxString& format )
     {
index 6e42c2813a473cb84a5519e2ee87a5bd5347d270..08c1d9228feb76abd773774776b8168766ba28f6 100644 (file)
@@ -22,44 +22,10 @@ class wxArrayEditorDialog;
 
 // -----------------------------------------------------------------------
 
-//
-// Additional property class declaration helper macros
-//
-
 //
 // Property class implementation helper macros.
 //
 
-#define WX_PG_DECLARE_BASIC_TYPE_METHODS() \
-    virtual wxString GetValueAsString( int argFlags = 0 ) const; \
-    virtual bool StringToValue( wxVariant& variant, \
-                                const wxString& text, \
-                                int argFlags = 0 ) const;
-
-#define WX_PG_DECLARE_CHOICE_METHODS() \
-    virtual bool IntToValue( wxVariant& variant, \
-                             int number, int argFlags = 0 ) const; \
-
-#define WX_PG_DECLARE_EVENT_METHODS() \
-    virtual bool OnEvent( wxPropertyGrid* propgrid, \
-                          wxWindow* primary, wxEvent& event );
-
-#define WX_PG_DECLARE_PARENTAL_METHODS() \
-    virtual void ChildChanged( wxVariant& thisValue, \
-                               int childIndex, wxVariant& childValue ) const; \
-    virtual void RefreshChildren();
-
-#define WX_PG_DECLARE_CUSTOM_PAINT_METHODS() \
-    virtual wxSize OnMeasureImage( int item ) const; \
-    virtual void OnCustomPaint( wxDC& dc, \
-                                const wxRect& rect, wxPGPaintData& paintdata );
-
-#define WX_PG_DECLARE_ATTRIBUTE_METHODS() \
-    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
-
-#define WX_PG_DECLARE_VALIDATOR_METHODS() \
-    virtual wxValidator* DoGetValidator() const;
-
 // Adds constructor function as well.
 #define WX_PG_IMPLEMENT_PROPERTY_CLASS2(NAME,CLASSNAME,\
                                         UPCLASS,T,T_AS_ARG,EDITOR) \
@@ -93,7 +59,7 @@ public: \
           const wxString& value = wxEmptyString); \
     virtual ~NAME(); \
     virtual bool OnButtonClick( wxPropertyGrid* propgrid, wxString& value ); \
-    WX_PG_DECLARE_VALIDATOR_METHODS() \
+    virtual wxValidator* DoGetValidator() const; \
 };
 
 #define WX_PG_DECLARE_STRING_PROPERTY(NAME) \
@@ -378,8 +344,12 @@ public:
                       const wxString& value = wxEmptyString );
     virtual ~wxStringProperty();
 
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
+
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 
     /** This is updated so "<composed>" special value can be handled.
     */
@@ -464,7 +434,10 @@ public:
     wxIntProperty( const wxString& label,
                    const wxString& name,
                    const wxLongLong& value );
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
     virtual bool ValidateValue( wxVariant& value,
                                 wxPGValidationInfo& validationInfo ) const;
     virtual bool IntToValue( wxVariant& variant,
@@ -515,8 +488,11 @@ public:
     wxUIntProperty( const wxString& label,
                     const wxString& name,
                     const wxULongLong& value );
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
     virtual bool ValidateValue( wxVariant& value,
                                 wxPGValidationInfo& validationInfo ) const;
     virtual bool IntToValue( wxVariant& variant,
@@ -549,8 +525,11 @@ public:
                      double value = 0.0 );
     virtual ~wxFloatProperty();
 
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
     virtual bool ValidateValue( wxVariant& value,
                                 wxPGValidationInfo& validationInfo ) const;
 
@@ -589,9 +568,13 @@ public:
                     bool value = false );
     virtual ~wxBoolProperty();
 
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_CHOICE_METHODS()
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
+    virtual bool StringToValue( wxVariant& variant,
+                                const wxString& text,
+                                int argFlags = 0 ) const;
+    virtual bool IntToValue( wxVariant& variant,
+                             int number, int argFlags = 0 ) const;
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 };
 
 #endif  // !SWIG
@@ -891,8 +874,7 @@ public:
                                 const wxString& text,
                                 int argFlags = 0 ) const;
     virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
-
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 
     static wxValidator* GetClassValidator();
     virtual wxValidator* DoGetValidator() const;
@@ -942,8 +924,8 @@ public:
     virtual bool StringToValue( wxVariant& variant,
                                 const wxString& text,
                                 int argFlags = 0 ) const;
-
-    WX_PG_DECLARE_EVENT_METHODS()
+    virtual bool OnEvent( wxPropertyGrid* propgrid,
+                          wxWindow* primary, wxEvent& event );
 
     // Shows string editor dialog. Value to be edited should be read from
     // value, and if dialog is not cancelled, it should be stored back and true
@@ -981,8 +963,8 @@ public:
                    const wxString& value = wxEmptyString );
     virtual ~wxDirProperty();
 
-    WX_PG_DECLARE_ATTRIBUTE_METHODS()
-    WX_PG_DECLARE_VALIDATOR_METHODS()
+    virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+    virtual wxValidator* DoGetValidator() const;
 
     virtual bool OnButtonClick ( wxPropertyGrid* propGrid, wxString& value );
 
@@ -1017,8 +999,12 @@ public:
     virtual ~wxArrayStringProperty();
 
     virtual void OnSetValue();
-    WX_PG_DECLARE_BASIC_TYPE_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
+    virtual wxString GetValueAsString( 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 void GenerateValueAsString();
 
@@ -1059,7 +1045,7 @@ public: \
     virtual bool OnEvent( wxPropertyGrid* propgrid, \
                           wxWindow* primary, wxEvent& event ); \
     virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value ); \
-    WX_PG_DECLARE_VALIDATOR_METHODS() \
+    virtual wxValidator* DoGetValidator() const; \
 };
 
 #define WX_PG_DECLARE_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAM) \
index ffe6c04808f78a2ab7addb2afa0ae56e09f4edab..e0e44a09936d528a6708d7426e5830b0d0e561dd 100644 (file)
@@ -26,9 +26,11 @@ public:
 
     virtual void OnSetValue();  // Override to allow image loading.
 
-    WX_PG_DECLARE_CHOICE_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
-    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
+    virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;
+    virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
+    virtual wxSize OnMeasureImage( int item ) const;
+    virtual void OnCustomPaint( wxDC& dc,
+                                const wxRect& rect, wxPGPaintData& paintdata );
 
     void LoadThumbnails( size_t n );
 
@@ -74,7 +76,9 @@ public:
                       const wxVector3f& value = wxVector3f() );
     virtual ~wxVectorProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 };
@@ -104,7 +108,9 @@ public:
                         const wxTriangle& value = wxTriangle() );
     virtual ~wxTriangleProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 };
index 6d7166901a17be6a32ab7de0b441b4e9b868379d..28244dd7c5be8da60c19e055ef5040eee75ec28c 100644 (file)
@@ -34,8 +34,10 @@ public:
     // in base class to function properly.
     virtual wxVariant DoGetValue() const;
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
-    WX_PG_DECLARE_EVENT_METHODS()
+    virtual void 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,7 +56,9 @@ public:
                     const wxSize& value = wxSize() );
     virtual ~wxSizeProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 
@@ -76,7 +80,9 @@ public:
                      const wxPoint& value = wxPoint() );
     virtual ~wxPointProperty();
 
-    WX_PG_DECLARE_PARENTAL_METHODS()
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 
@@ -107,9 +113,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 GetValueAsString( 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;