]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/propgrid/advprops.h
Fixed wxPropertyGridPage::DoSetSplitterPosition() infinite recursion
[wxWidgets.git] / include / wx / propgrid / advprops.h
index 98c47c0193a422924bb2e19ba774791a16d96e16..22ae110b34074c65785be6dc564d3cbcddc9bf59 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2004-09-25
-// RCS-ID:      $Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
@@ -12,6 +12,8 @@
 #ifndef _WX_PROPGRID_ADVPROPS_H_
 #define _WX_PROPGRID_ADVPROPS_H_
 
+#if wxUSE_PROPGRID
+
 #include "wx/propgrid/props.h"
 
 // -----------------------------------------------------------------------
@@ -21,8 +23,6 @@
 // Additional Value Type Handlers
 //
 #ifndef SWIG
-bool WXDLLIMPEXP_PROPGRID operator==(const wxFont&, const wxFont&);
-
 bool WXDLLIMPEXP_PROPGRID
 operator==(const wxArrayInt& array1, const wxArrayInt& array2);
 #endif
@@ -82,6 +82,7 @@ public:
     wxColour    m_colour;
 
     wxColourPropertyValue()
+        : wxObject()
     {
         m_type = 0;
     }
@@ -91,6 +92,7 @@ public:
     }
 
     wxColourPropertyValue( const wxColourPropertyValue& v )
+        : wxObject()
     {
         m_type = v.m_type;
         m_colour = v.m_colour;
@@ -103,17 +105,20 @@ public:
     }
 
     wxColourPropertyValue( const wxColour& colour )
+        : wxObject()
     {
         m_type = wxPG_COLOUR_CUSTOM;
         m_colour = colour;
     }
 
     wxColourPropertyValue( wxUint32 type )
+        : wxObject()
     {
         m_type = type;
     }
 
     wxColourPropertyValue( wxUint32 type, const wxColour& colour )
+        : wxObject()
     {
         Init( type, colour );
     }
@@ -134,8 +139,8 @@ private:
 bool WXDLLIMPEXP_PROPGRID
 operator==(const wxColourPropertyValue&, const wxColourPropertyValue&);
 
-WX_PG_DECLARE_WXOBJECT_VARIANT_DATA(wxPGVariantDataColourPropertyValue,
-                                    wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
+DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
+
 #endif
 
 #ifndef SWIG
@@ -173,11 +178,12 @@ public:
                    const wxFont& value = wxFont());
     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 wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+    virtual bool OnEvent( wxPropertyGrid* propgrid,
+                          wxWindow* primary, wxEvent& event );
+    virtual void ChildChanged( wxVariant& thisValue,
+                               int childIndex, wxVariant& childValue ) const;
+    virtual void RefreshChildren();
 
 protected:
 };
@@ -223,13 +229,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 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 );
+    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;
@@ -271,14 +280,29 @@ protected:
 
 // -----------------------------------------------------------------------
 
-WX_PG_DECLARE_CUSTOM_COLOUR_PROPERTY_USES_WXCOLOUR_WITH_DECL(
-    wxColourProperty, class WXDLLIMPEXP_PROPGRID)
+class WXDLLIMPEXP_PROPGRID wxColourProperty : public wxSystemColourProperty
+{
+    WX_PG_DECLARE_PROPERTY_CLASS(wxColourProperty)
+public:
+    wxColourProperty( const wxString& label = wxPG_LABEL,
+                      const wxString& name = wxPG_LABEL,
+                      const wxColour& value = *wxWHITE );
+    virtual ~wxColourProperty();
 
-// Exclude classes from wxPython bindings
-#ifndef SWIG
+protected:
+    virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+    virtual wxColour GetColour( int index ) const;
+    virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
+
+private:
+    void Init( wxColour colour );
+};
 
 // -----------------------------------------------------------------------
 
+// Exclude classes from wxPython bindings
+#ifndef SWIG
+
 /** @class wxCursorProperty
     @ingroup classes
     Property representing wxCursor.
@@ -292,9 +316,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 );
 };
 
 // -----------------------------------------------------------------------
@@ -319,7 +343,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
@@ -364,13 +390,12 @@ public:
     virtual ~wxMultiChoiceProperty();
 
     virtual void OnSetValue();
-    virtual wxString GetValueAsString( int flags = 0 ) const;
+    virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
     virtual bool StringToValue(wxVariant& variant,
                                const wxString& text,
                                int argFlags = 0) const;
-    WX_PG_DECLARE_EVENT_METHODS()
-
-    virtual int GetChoiceInfo( wxPGChoiceInfo* choiceinfo );
+    virtual bool OnEvent( wxPropertyGrid* propgrid,
+                          wxWindow* primary, wxEvent& event );
 
     wxArrayInt GetValueAsArrayInt() const
     {
@@ -379,15 +404,13 @@ public:
 
 protected:
 
-    void GenerateValueAsString();
+    void GenerateValueAsString( wxVariant& value, wxString* target ) const;
 
     // Returns translation of values into string indices.
     wxArrayInt GetValueAsIndices() const;
 
     wxArrayString       m_valueAsStrings;  // Value as array of strings
 
-    wxPGChoices         m_choices;
-
     // Cache displayed text since generating it is relatively complicated.
     wxString            m_display;
 };
@@ -417,12 +440,12 @@ public:
                     const wxDateTime& value = wxDateTime() );
     virtual ~wxDateProperty();
 
-    virtual wxString GetValueAsString( int flags = 0 ) const;
+    virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
     virtual bool StringToValue(wxVariant& variant,
                                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 )
     {
@@ -489,13 +512,15 @@ protected:
 //   used for event handling here.
 class WXDLLIMPEXP_PROPGRID wxPGSpinCtrlEditor : public wxPGTextCtrlEditor
 {
-    WX_PG_DECLARE_EDITOR_CLASS(wxPGSpinCtrlEditor)
+    DECLARE_DYNAMIC_CLASS(wxPGSpinCtrlEditor)
 public:
     virtual ~wxPGSpinCtrlEditor();
 
-    // See below for short explanations of what these are suppposed to do.
-    wxPG_DECLARE_CREATECONTROLS
-
+    wxString GetName() const;
+    virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
+                                          wxPGProperty* property,
+                                          const wxPoint& pos,
+                                          const wxSize& size) const;
     virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
         wxWindow* wnd, wxEvent& event ) const;
 
@@ -507,4 +532,6 @@ private:
 
 // -----------------------------------------------------------------------
 
+#endif // wxUSE_PROPGRID
+
 #endif // _WX_PROPGRID_ADVPROPS_H_