Moved wxPGChoices m_choices member from various property classes to base wxPGProperty. This allows any property to have choices without subclassing and therefore work with Choice and ComboBox editors. Also removed redundant choice manipulation functions from wxPropertyGridinterface (ie. now use ones in wxPGProperty).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-09-19 16:57:33 +00:00
parent 57306cd4fd
commit 939d936402
15 changed files with 643 additions and 934 deletions

View File

@@ -748,6 +748,8 @@ const wxPGEditor* wxBoolProperty::DoGetEditorClass() const
wxBoolProperty::wxBoolProperty( const wxString& label, const wxString& name, bool value ) :
wxPGProperty(label,name)
{
m_choices.Assign(wxPGGlobalVars->m_boolChoices);
SetValue(wxPGVariant_Bool(value));
m_flags |= wxPG_PROP_USE_DCC;
@@ -795,16 +797,6 @@ wxString wxBoolProperty::GetValueAsString( int argFlags ) const
return text;
}
int wxBoolProperty::GetChoiceInfo( wxPGChoiceInfo* choiceinfo )
{
if ( IsValueUnspecified() )
return -1;
if ( choiceinfo )
choiceinfo->m_choices = &wxPGGlobalVars->m_boolChoices;
return m_value.GetBool()?1:0;
}
bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, int WXUNUSED(argFlags) ) const
{
int value = 0;
@@ -1161,17 +1153,6 @@ const wxString* wxEnumProperty::GetEntry( size_t index, int* pvalue ) const
return (const wxString*) NULL;
}
int wxEnumProperty::GetChoiceInfo( wxPGChoiceInfo* choiceinfo )
{
if ( choiceinfo )
choiceinfo->m_choices = &m_choices;
if ( !m_choices.IsOk() )
return -1;
return GetIndex();
}
// -----------------------------------------------------------------------
// wxEditEnumProperty
// -----------------------------------------------------------------------
@@ -1549,13 +1530,6 @@ void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVari
thisValue = (long)(oldValue & ~(vi));
}
int wxFlagsProperty::GetChoiceInfo( wxPGChoiceInfo* choiceinfo )
{
if ( choiceinfo )
choiceinfo->m_choices = &m_choices;
return -1;
}
// -----------------------------------------------------------------------
// wxDirProperty
// -----------------------------------------------------------------------