]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/propgrid/property.h
Use wxGetInstance() instead of wxhInstance in wxMSW code.
[wxWidgets.git] / include / wx / propgrid / property.h
index 94d8b500657fcb3ad7a7f8cb82696bfa34643076..0e34bcf2ed0702cea156c237bfc880cbc8014067 100644 (file)
@@ -47,9 +47,6 @@ struct wxPGPaintData
 };
 
 
-#ifndef SWIG
-
-
 // space between vertical sides of a custom image
 #define wxPG_CUSTOM_IMAGE_SPACINGY      1
 
@@ -98,7 +95,11 @@ public:
                               DontUseCellBgCol
     };
 
-    virtual void Render( wxDC& dc,
+    /**
+        Returns @true if rendered something in the foreground (text or
+        bitmap.
+    */
+    virtual bool Render( wxDC& dc,
                          const wxRect& rect,
                          const wxPropertyGrid* propertyGrid,
                          wxPGProperty* property,
@@ -171,7 +172,7 @@ public:
 class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer
 {
 public:
-    virtual void Render( wxDC& dc,
+    virtual bool Render( wxDC& dc,
                          const wxRect& rect,
                          const wxPropertyGrid* propertyGrid,
                          wxPGProperty* property,
@@ -216,7 +217,6 @@ protected:
     bool        m_hasValidText;
 };
 
-#endif  // !SWIG
 
 /**
     @class wxPGCell
@@ -254,6 +254,11 @@ public:
         return (m_refData && GetData()->m_hasValidText);
     }
 
+    /**
+        Sets empty but valid data to this cell object.
+    */
+    void SetEmptyData();
+
     /**
         Merges valid data from srcCell into this.
     */
@@ -308,8 +313,6 @@ private:
 
 // -----------------------------------------------------------------------
 
-#ifndef SWIG
-
 /** @class wxPGAttributeStorage
 
     wxPGAttributeStorage is somewhat optimized storage for
@@ -357,7 +360,6 @@ protected:
     wxPGHashMapS2P  m_map;
 };
 
-#endif  // !SWIG
 
 // -----------------------------------------------------------------------
 
@@ -442,7 +444,9 @@ wxPG_PROP_CATEGORY                  = 0x2000,
 */
 wxPG_PROP_MISC_PARENT               = 0x4000,
 
-/** Property is read-only. Editor is still created.
+/** Property is read-only. Editor is still created for wxTextCtrl-based
+    property editors. For others, editor is not usually created because
+    they do implement wxTE_READONLY style or equivalent.
 */
 wxPG_PROP_READONLY                  = 0x8000,
 
@@ -506,8 +510,6 @@ wxPG_PROP_BEING_DELETED             = 0x00200000
 
 // -----------------------------------------------------------------------
 
-#ifndef SWIG
-
 /**
     @section propgrid_property_attributes wxPropertyGrid Property Attribute
     Identifiers.
@@ -541,10 +543,17 @@ wxPG_PROP_BEING_DELETED             = 0x00200000
 */
 #define wxPG_ATTR_UNITS                     wxS("Units")
 
-/** Universal, string. When set, will be shown in property's value cell
-    when displayed value string is empty, or value is unspecified.
+/** When set, will be shown as 'greyed' text in property's value cell when
+    the actual displayed value is blank.
+*/
+#define wxPG_ATTR_HINT                      wxS("Hint")
+
+#if wxPG_COMPATIBILITY_1_4
+/**
+    @deprecated Use "Hint" (wxPG_ATTR_HINT) instead.
 */
 #define wxPG_ATTR_INLINE_HELP               wxS("InlineHelp")
+#endif
 
 /** Universal, wxArrayString. Set to enable auto-completion in any
     wxTextCtrl-based property editor.
@@ -678,15 +687,15 @@ wxPG_PROP_BEING_DELETED             = 0x00200000
 #define wxPG_ATTR_MAX                     wxPGGlobalVars->m_strMax
 #undef wxPG_ATTR_UNITS
 #define wxPG_ATTR_UNITS                   wxPGGlobalVars->m_strUnits
+#undef wxPG_ATTR_HINT
+#define wxPG_ATTR_HINT                    wxPGGlobalVars->m_strHint
+#if wxPG_COMPATIBILITY_1_4
 #undef wxPG_ATTR_INLINE_HELP
 #define wxPG_ATTR_INLINE_HELP             wxPGGlobalVars->m_strInlineHelp
-
-#endif  // !SWIG
+#endif
 
 // -----------------------------------------------------------------------
 
-#ifndef SWIG
-
 /** @class wxPGChoiceEntry
     Data of a single wxPGChoices choice.
 */
@@ -767,7 +776,6 @@ private:
 
 #define wxPGChoicesEmptyData    ((wxPGChoicesData*)NULL)
 
-#endif // SWIG
 
 /** @class wxPGChoices
 
@@ -818,7 +826,7 @@ public:
         @param values
             Values for choices. If NULL, indexes are used.
     */
-    wxPGChoices( const wxChar** labels, const long* values = NULL )
+    wxPGChoices( const wxChar* const* labels, const long* values = NULL )
     {
         Init();
         Set(labels,values);
@@ -866,7 +874,7 @@ public:
         @param values
             Values for added choices. If empty, relevant entry indexes are used.
     */
-    void Add( const wxChar** labels, const ValArrItem* values = NULL );
+    void Add( const wxChar* const* labels, const ValArrItem* values = NULL );
 
     /** Version that works with wxArrayString and wxArrayInt. */
     void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() );
@@ -992,14 +1000,14 @@ public:
     /** Removes count items starting at position nIndex. */
     void RemoveAt(size_t nIndex, size_t count = 1);
 
-#ifndef SWIG
-    /** Does not create copies for itself. */
-    void Set( const wxChar** labels, const long* values = NULL )
+    /** Does not create copies for itself.
+        TODO: Deprecate.
+    */
+    void Set( const wxChar* const* labels, const long* values = NULL )
     {
         Free();
         Add(labels,values);
     }
-#endif // SWIG
 
     /** Version that works with wxArrayString and wxArrayInt. */
     void Set( const wxArrayString& labels,
@@ -1036,7 +1044,6 @@ public:
 
     wxArrayString GetLabels() const;
 
-#ifndef SWIG
     void operator= (const wxPGChoices& a)
     {
         if (this != &a)
@@ -1058,7 +1065,6 @@ protected:
 
     void Init();
     void Free();
-#endif  // !SWIG
 };
 
 // -----------------------------------------------------------------------
@@ -1121,7 +1127,6 @@ public:
     */
     virtual wxVariant DoGetValue() const { return m_value; }
 
-#if !defined(SWIG) || defined(CREATE_VCW)
     /** Implement this function in derived class to check the value.
         Return true if it is ok. Returning false prevents property change events
         from occurring.
@@ -1193,7 +1198,7 @@ public:
     virtual bool IntToValue( wxVariant& value,
                              int number,
                              int argFlags = 0 ) const;
-#endif  // !defined(SWIG) || defined(CREATE_VCW)
+
     /**
         Converts property value into a text representation.
 
@@ -1436,12 +1441,16 @@ public:
     */
     virtual void RefreshChildren();
 
-    /** Special handling for attributes of this property.
+    /**
+        Reimplement this member function to add special handling for
+        attributes of this property.
 
-        If returns false, then the attribute will be automatically stored in
-        m_attributes.
+        @return Return @false to have the attribute automatically stored in
+                m_attributes. Default implementation simply does that and
+                nothing else.
 
-        Default implementation simply returns false.
+        @remarks To actually set property attribute values from the
+                 application, use wxPGProperty::SetAttribute() instead.
     */
     virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
 
@@ -1633,6 +1642,11 @@ public:
         return GetValueAsString(0);
     }
 
+    /**
+        Returns property's hint text (shown in empty value cell).
+    */
+    inline wxString GetHintText() const;
+
     /** Returns property grid where property lies. */
     wxPropertyGrid* GetGrid() const;
 
@@ -1900,7 +1914,6 @@ public:
     */
     void SetDefaultValue( wxVariant& value );
 
-#ifndef SWIG
     /** Sets editor for a property.
 
         @param editor
@@ -1915,7 +1928,6 @@ public:
     {
         m_customEditor = editor;
     }
-#endif
 
     /** Sets editor for a property.
     */
@@ -2043,7 +2055,7 @@ public:
     void SetValueToUnspecified()
     {
         wxVariant val;  // Create NULL variant
-        SetValue(val);
+        SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR);
     }
 
     // Helper function (for wxPython bindings and such) for settings protected
@@ -2067,9 +2079,8 @@ public:
             return m_validator;
         return DoGetValidator();
     }
-#endif // #if wxUSE_VALIDATORS
+#endif // wxUSE_VALIDATORS
 
-#ifndef SWIG
     /** Returns client data (void*) of a property.
     */
     void* GetClientData() const
@@ -2097,7 +2108,6 @@ public:
     /** Sets managed client object of a property.
     */
     wxClientData *GetClientObject() const { return m_clientObject; }
-#endif
 
     /** Sets new set of choices for property.
 
@@ -2195,16 +2205,12 @@ public:
     */
     int GetImageOffset( int imageWidth ) const;
 
-#ifndef SWIG
     // Returns wxPropertyGridPageState in which this property resides.
     wxPropertyGridPageState* GetParentState() const { return m_parentState; }
-#endif
 
-#ifndef SWIG
     wxPGProperty* GetItemAtY( unsigned int y,
                               unsigned int lh,
                               unsigned int* nextItemY ) const;
-#endif
 
     /** Returns property at given virtual y coordinate.
     */
@@ -2214,8 +2220,6 @@ public:
     */
     wxPGProperty* GetPropertyByName( const wxString& name ) const;
 
-#ifndef SWIG
-
     // Returns various display-related information for given column
     void GetDisplayInfo( unsigned int column,
                          int choiceIndex,
@@ -2383,7 +2387,6 @@ private:
     // Called in constructors.
     void Init();
     void Init( const wxString& label, const wxString& name );
-#endif // #ifndef SWIG
 };
 
 // -----------------------------------------------------------------------
@@ -2396,14 +2399,12 @@ private:
 #define WX_PG_DECLARE_DOGETEDITORCLASS \
     virtual const wxPGEditor* DoGetEditorClass() const;
 
-#ifndef SWIG
+#ifndef WX_PG_DECLARE_PROPERTY_CLASS
     #define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \
         public: \
             DECLARE_DYNAMIC_CLASS(CLASSNAME) \
             WX_PG_DECLARE_DOGETEDITORCLASS \
         private:
-#else
-    #define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME)
 #endif
 
 // Implements sans constructor function. Also, first arg is class name, not
@@ -2416,8 +2417,6 @@ const wxPGEditor* PROPNAME::DoGetEditorClass() const \
 
 // -----------------------------------------------------------------------
 
-#ifndef SWIG
-
 /** @class wxPGRootProperty
     @ingroup classes
     Root parent property.
@@ -2463,6 +2462,7 @@ public:
     int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
 
     virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
+    virtual wxString GetValueAsString( int argFlags = 0 ) const;
 
 protected:
     void SetTextColIndex( unsigned int colInd )
@@ -2479,8 +2479,6 @@ private:
     void Init();
 };
 
-#endif  // !SWIG
-
 // -----------------------------------------------------------------------
 
 #endif // wxUSE_PROPGRID