Added wxPGProperty::SetDefaultValue(v), as a shortcut for SetAttribute(DefaultValue, v)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-05-31 08:58:38 +00:00
parent e1983cad7c
commit 0ce8e27f68
5 changed files with 26 additions and 1 deletions

View File

@@ -639,6 +639,8 @@ wxPG_PROP_CLASS_SPECIFIC_2 = 0x00100000
*/ */
// Redefine attribute macros to use cached strings // Redefine attribute macros to use cached strings
#undef wxPG_ATTR_DEFAULT_VALUE
#define wxPG_ATTR_DEFAULT_VALUE wxPGGlobalVars->m_strDefaultValue
#undef wxPG_ATTR_MIN #undef wxPG_ATTR_MIN
#define wxPG_ATTR_MIN wxPGGlobalVars->m_strMin #define wxPG_ATTR_MIN wxPGGlobalVars->m_strMin
#undef wxPG_ATTR_MAX #undef wxPG_ATTR_MAX
@@ -1854,6 +1856,14 @@ public:
void SetTextColour( const wxColour& colour, void SetTextColour( const wxColour& colour,
bool recursively = false ); bool recursively = false );
/** Set default value of a property. Synonymous to
@code
SetAttribute("DefaultValue", value);
@endcode
*/
void SetDefaultValue( wxVariant& value );
#ifndef SWIG #ifndef SWIG
/** Sets editor for a property. /** Sets editor for a property.

View File

@@ -74,6 +74,7 @@ public:
wxPGCachedString m_strbool; wxPGCachedString m_strbool;
wxPGCachedString m_strlist; wxPGCachedString m_strlist;
wxPGCachedString m_strDefaultValue;
wxPGCachedString m_strMin; wxPGCachedString m_strMin;
wxPGCachedString m_strMax; wxPGCachedString m_strMax;
wxPGCachedString m_strUnits; wxPGCachedString m_strUnits;
@@ -1849,6 +1850,11 @@ inline int wxPGProperty::GetDisplayedCommonValueCount() const
return 0; return 0;
} }
inline void wxPGProperty::SetDefaultValue( wxVariant& value )
{
SetAttribute(wxPG_ATTR_DEFAULT_VALUE, value);
}
inline void wxPGProperty::SetEditor( const wxString& editorName ) inline void wxPGProperty::SetEditor( const wxString& editorName )
{ {
m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName); m_customEditor = wxPropertyGridInterface::GetEditorByName(editorName);

View File

@@ -1341,6 +1341,14 @@ public:
*/ */
void SetChoiceSelection( int newValue ); 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 Sets property's help string, which is shown, for example, in
wxPropertyGridManager's description text box. wxPropertyGridManager's description text box.

View File

@@ -1372,7 +1372,7 @@ void wxPGProperty::RefreshEditor()
wxVariant wxPGProperty::GetDefaultValue() const wxVariant wxPGProperty::GetDefaultValue() const
{ {
wxVariant defVal = GetAttribute(wxS("DefaultValue")); wxVariant defVal = GetAttribute(wxPG_ATTR_DEFAULT_VALUE);
if ( !defVal.IsNull() ) if ( !defVal.IsNull() )
return defVal; return defVal;

View File

@@ -195,6 +195,7 @@ wxPGGlobalVarsClass::wxPGGlobalVarsClass()
m_strlong = wxS("long"); m_strlong = wxS("long");
m_strbool = wxS("bool"); m_strbool = wxS("bool");
m_strlist = wxS("list"); m_strlist = wxS("list");
m_strDefaultValue = wxS("DefaultValue");
m_strMin = wxS("Min"); m_strMin = wxS("Min");
m_strMax = wxS("Max"); m_strMax = wxS("Max");
m_strUnits = wxS("Units"); m_strUnits = wxS("Units");