1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 14:13:32 +02:00

Implement ComboEditor::Clone, and use override

This commit is contained in:
Paul Licameli
2017-10-20 10:20:33 -04:00
parent 072667e908
commit a9f5c9c929

View File

@@ -587,6 +587,8 @@ class ComboEditor final : public wxGridCellChoiceEditor
public: public:
ComboEditor(const wxArrayString& choices, bool allowOthers = false) ComboEditor(const wxArrayString& choices, bool allowOthers = false)
: wxGridCellChoiceEditor(choices, allowOthers) : wxGridCellChoiceEditor(choices, allowOthers)
, m_choices{ choices }
, m_allowOthers{ allowOthers }
{ {
} }
@@ -595,7 +597,7 @@ public:
// Ignore it (a must on the Mac as the erasure causes problems.) // Ignore it (a must on the Mac as the erasure causes problems.)
} }
void SetParameters(const wxString& params) void SetParameters(const wxString& params) override
{ {
wxGridCellChoiceEditor::SetParameters(params); wxGridCellChoiceEditor::SetParameters(params);
@@ -606,7 +608,7 @@ public:
} }
} }
void SetSize(const wxRect& rectOrig) void SetSize(const wxRect& rectOrig) override
{ {
wxRect rect(rectOrig); wxRect rect(rectOrig);
wxRect r = Combo()->GetRect(); wxRect r = Combo()->GetRect();
@@ -620,7 +622,7 @@ public:
// Fix for Bug 1389 // Fix for Bug 1389
// July 2016: ANSWER-ME: Does this need reporting upstream to wxWidgets? // July 2016: ANSWER-ME: Does this need reporting upstream to wxWidgets?
virtual void StartingKey(wxKeyEvent& event) virtual void StartingKey(wxKeyEvent& event) override
{ {
// Lifted from wxGridCellTextEditor and adapted to combo. // Lifted from wxGridCellTextEditor and adapted to combo.
@@ -670,6 +672,15 @@ public:
} }
} }
// Clone is required by wxwidgets; implemented via copy constructor
wxGridCellEditor *Clone() const override
{
return safenew ComboEditor{ m_choices, m_allowOthers };
}
private:
wxArrayString m_choices;
bool m_allowOthers;
}; };
// //