diff --git a/include/wx/propgrid/editors.h b/include/wx/propgrid/editors.h index aa07e4c4c8..f5b1df3302 100644 --- a/include/wx/propgrid/editors.h +++ b/include/wx/propgrid/editors.h @@ -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 diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 2f0504095e..bab48a32ad 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -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 {