Implement method to set items of wxPGChoiceEditor
In addition to the current methods to add/delete one item to the control we would need a method to replace all existing control items with new ones at once.
This commit is contained in:
@@ -167,6 +167,10 @@ public:
|
||||
// Default implementation does nothing.
|
||||
virtual void DeleteItem( wxWindow* ctrl, int index ) const;
|
||||
|
||||
// Sets items of existing control.
|
||||
// Default implementation does nothing.
|
||||
virtual void SetItems(wxWindow* ctrl, const wxArrayString& labels) const;
|
||||
|
||||
// Extra processing when control gains focus. For example, wxTextCtrl
|
||||
// based controls should select all text.
|
||||
virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
|
||||
@@ -273,6 +277,8 @@ public:
|
||||
const wxString& label,
|
||||
int index ) const wxOVERRIDE;
|
||||
virtual void DeleteItem( wxWindow* ctrl, int index ) const wxOVERRIDE;
|
||||
virtual void SetItems(wxWindow* ctrl, const wxArrayString& labels) const wxOVERRIDE;
|
||||
|
||||
virtual bool CanContainCustomImage() const wxOVERRIDE;
|
||||
|
||||
// CreateControls calls this with CB_READONLY in extraStyle
|
||||
|
@@ -164,6 +164,9 @@ void wxPGEditor::DeleteItem( wxWindow*, int ) const
|
||||
return;
|
||||
}
|
||||
|
||||
void wxPGEditor::SetItems(wxWindow* WXUNUSED(ctrl), const wxArrayString& WXUNUSED(labels)) const
|
||||
{
|
||||
}
|
||||
|
||||
void wxPGEditor::OnFocus( wxPGProperty*, wxWindow* ) const
|
||||
{
|
||||
@@ -1091,6 +1094,15 @@ void wxPGChoiceEditor::DeleteItem( wxWindow* ctrl, int index ) const
|
||||
cb->Delete(index);
|
||||
}
|
||||
|
||||
void wxPGChoiceEditor::SetItems(wxWindow* ctrl, const wxArrayString& labels) const
|
||||
{
|
||||
wxASSERT( ctrl );
|
||||
wxOwnerDrawnComboBox* cb = wxDynamicCast(ctrl, wxOwnerDrawnComboBox);
|
||||
wxASSERT( cb );
|
||||
|
||||
cb->Set(labels);
|
||||
}
|
||||
|
||||
bool wxPGChoiceEditor::OnEvent( wxPropertyGrid* propGrid, wxPGProperty* property,
|
||||
wxWindow* ctrl, wxEvent& event ) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user