-// -----------------------------------------------------------------------
-// wxEnumProperty
-// -----------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxEnumProperty, wxPGProperty)
-
-WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(wxEnumProperty,long,Choice)
-
-wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name, const wxChar** labels,
- const long* values, int value ) : wxBaseEnumProperty(label,name)
-{
- SetIndex(0);
-
- if ( labels )
- {
- m_choices.Add(labels,values);
-
- if ( GetItemCount() )
- SetValue( (long)value );
- }
-}
-
-wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name, const wxChar** labels,
- const long* values, wxPGChoices* choicesCache, int value )
- : wxBaseEnumProperty(label,name)
-{
- SetIndex(0);
-
- wxASSERT( choicesCache );
-
- if ( choicesCache->IsOk() )
- {
- m_choices.Assign( *choicesCache );
- m_value = wxPGVariant_Zero;
- }
- else if ( labels )
- {
- m_choices.Add(labels,values);
-
- if ( GetItemCount() )
- SetValue( (long)value );
- }
-}
-
-wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name,
- const wxArrayString& labels, const wxArrayInt& values, int value ) : wxBaseEnumProperty(label,name)
-{
- SetIndex(0);
-
- if ( &labels && labels.size() )
- {
- m_choices.Set(labels, values);
-
- if ( GetItemCount() )
- SetValue( (long)value );
- }
-}
-
-wxEnumProperty::wxEnumProperty( const wxString& label, const wxString& name,
- wxPGChoices& choices, int value )
- : wxBaseEnumProperty(label,name)
-{
- m_choices.Assign( choices );
-
- if ( GetItemCount() )
- SetValue( (long)value );
-}
-
-int wxEnumProperty::GetIndexForValue( int value ) const
-{
- if ( !m_choices.IsOk() )
- return -1;
-
- if ( m_choices.HasValues() )
- {
- int intVal = m_choices.Index(value);
- if ( intVal >= 0 )
- return intVal;
- }
-
- return value;
-}
-
-wxEnumProperty::~wxEnumProperty ()
-{
-}
-
-const wxString* wxEnumProperty::GetEntry( size_t index, int* pvalue ) const
-{
- if ( m_choices.IsOk() && index < m_choices.GetCount() )
- {
- int value = (int)index;
- if ( m_choices.HasValue(index) )
- value = m_choices.GetValue(index);
-
- if ( pvalue )
- *pvalue = value;
-
- return &m_choices.GetLabel(index);
- }
- return (const wxString*) NULL;
-}
-