-void wxPGProperty::SetChoiceSelection( int newValue, const wxPGChoiceInfo& choiceInfo )
-{
- // Changes value of a property with choices, but only
- // works if the value type is long or string.
- wxString ts = GetValue().GetType();
-
- wxCHECK_RET( choiceInfo.m_choices, wxT("invalid choiceinfo") );
-
- if ( ts == wxS("long") )
- {
- SetValue( (long) newValue );
- }
- else if ( ts == wxS("string") )
- {
- SetValue( choiceInfo.m_choices->GetLabel(newValue) );
- }
-}
-
-
-wxString wxPGProperty::GetChoiceString( unsigned int index )
-{
- wxPGChoiceInfo ci;
- GetChoiceInfo(&ci);
- wxASSERT(ci.m_choices);
- return ci.m_choices->GetLabel(index);
-}
-
-int wxPGProperty::InsertChoice( const wxString& label, int index, int value )
-{
- wxPropertyGrid* pg = GetGrid();
-
- wxPGChoiceInfo ci;
- ci.m_choices = (wxPGChoices*) NULL;
- int sel = GetChoiceInfo(&ci);
-
- if ( ci.m_choices )
- {
- int newSel = sel;
-
- if ( index < 0 )
- index = ci.m_choices->GetCount();
-
- if ( index <= sel )
- newSel++;
-
- ci.m_choices->Insert(label, index, value);
-
- if ( sel != newSel )
- SetChoiceSelection(newSel, ci);
-
- if ( this == pg->GetSelection() )
- GetEditorClass()->InsertItem(pg->GetEditorControl(),label,index);
-
- return index;
- }
-
- return -1;
-}
-
-
-void wxPGProperty::DeleteChoice( int index )
-{
- wxPropertyGrid* pg = GetGrid();
-
- wxPGChoiceInfo ci;
- ci.m_choices = (wxPGChoices*) NULL;
- int sel = GetChoiceInfo(&ci);
-
- if ( ci.m_choices )
- {
- int newSel = sel;
-
- // Adjust current value
- if ( sel == index )
- {
- SetValueToUnspecified();
- newSel = 0;
- }
- else if ( index < sel )
- {
- newSel--;
- }
-
- ci.m_choices->RemoveAt(index);
-
- if ( sel != newSel )
- SetChoiceSelection(newSel, ci);
-
- if ( this == pg->GetSelection() )
- GetEditorClass()->DeleteItem(pg->GetEditorControl(), index);
- }
-}
-
-int wxPGProperty::GetChoiceInfo( wxPGChoiceInfo* WXUNUSED(info) )
-{
- return -1;
-}
-