]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxPGProperty::SetDefaultValue(v), as a shortcut for SetAttribute(DefaultValue, v)
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 31 May 2009 08:58:38 +0000 (08:58 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 31 May 2009 08:58:38 +0000 (08:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/property.h
include/wx/propgrid/propgrid.h
interface/wx/propgrid/property.h
src/propgrid/property.cpp
src/propgrid/propgrid.cpp

index 8f2da0c73022c5f9477137429d7d024cb1db959a..864227349de2df97c5ff7229e3e9dedff064023e 100644 (file)
@@ -639,6 +639,8 @@ wxPG_PROP_CLASS_SPECIFIC_2          = 0x00100000
 */
 
 // Redefine attribute macros to use cached strings
+#undef wxPG_ATTR_DEFAULT_VALUE
+#define wxPG_ATTR_DEFAULT_VALUE           wxPGGlobalVars->m_strDefaultValue
 #undef wxPG_ATTR_MIN
 #define wxPG_ATTR_MIN                     wxPGGlobalVars->m_strMin
 #undef wxPG_ATTR_MAX
@@ -1854,6 +1856,14 @@ public:
     void SetTextColour( const wxColour& colour,
                         bool recursively = false );
 
+    /** Set default value of a property. Synonymous to
+
+        @code
+            SetAttribute("DefaultValue", value);
+        @endcode
+    */
+    void SetDefaultValue( wxVariant& value );
+
 #ifndef SWIG
     /** Sets editor for a property.
 
index 3c6c604055d14197df56c40f95d8fbb626ffbbc2..b69292b00a30991bc2586b93d23455cd6aa55097 100644 (file)
@@ -74,6 +74,7 @@ public:
     wxPGCachedString    m_strbool;
     wxPGCachedString    m_strlist;
 
+    wxPGCachedString    m_strDefaultValue;
     wxPGCachedString    m_strMin;
     wxPGCachedString    m_strMax;
     wxPGCachedString    m_strUnits;
@@ -1849,6 +1850,11 @@ inline int wxPGProperty::GetDisplayedCommonValueCount() const
     return 0;
 }
 
+inline void wxPGProperty::SetDefaultValue( wxVariant& value )
+{
+    SetAttribute(wxPG_ATTR_DEFAULT_VALUE, value);
+}
+
 inline void wxPGProperty::SetEditor( const wxString& editorName )
 {
     m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName);
index f55d8920889b95a2cddbb893c5a998b3e37f57cb..9bf9531fb83f70c62327751a5b0c7faba7878008 100644 (file)
@@ -1341,6 +1341,14 @@ public:
     */
     void SetChoiceSelection( int newValue );
 
+    /** Set default value of a property. Synonymous to
+
+        @code
+            SetAttribute("DefaultValue", value);
+        @endcode
+    */
+    void SetDefaultValue( wxVariant& value );
+
     /**
         Sets property's help string, which is shown, for example, in
         wxPropertyGridManager's description text box.
index 913c554e5222683d4c3940c6a1ea3ec43f2c0c53..94c98b5f9da6e05347ad0868eea4f30cdbae5989 100644 (file)
@@ -1372,7 +1372,7 @@ void wxPGProperty::RefreshEditor()
 
 wxVariant wxPGProperty::GetDefaultValue() const
 {
-    wxVariant defVal = GetAttribute(wxS("DefaultValue"));
+    wxVariant defVal = GetAttribute(wxPG_ATTR_DEFAULT_VALUE);
     if ( !defVal.IsNull() )
         return defVal;
 
index 5a18f55513412b2c820da7867ec4c30d3a8e969f..8da3ca884cbe68bd606d1be446f61962d27e31eb 100644 (file)
@@ -195,6 +195,7 @@ wxPGGlobalVarsClass::wxPGGlobalVarsClass()
     m_strlong = wxS("long");
     m_strbool = wxS("bool");
     m_strlist = wxS("list");
+    m_strDefaultValue = wxS("DefaultValue");
     m_strMin = wxS("Min");
     m_strMax = wxS("Max");
     m_strUnits = wxS("Units");