| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "SpecifierPanel.h" |
| 4 |
#include "SpecifierPanelFactory.h" |
| 5 |
#include <wx/combobox.h> |
| 6 |
|
| 7 |
namespace objectives |
| 8 |
{ |
| 9 |
|
| 10 |
namespace ce |
| 11 |
{ |
| 12 |
|
| 13 |
/** |
| 14 |
* SpecifierPanel subclass for the SPEC_NAME (name of single entity) specifier |
| 15 |
* type. |
| 16 |
*/ |
| 17 |
class EntityNameSpecifierPanel : |
| 18 |
public wxEvtHandler, |
| 19 |
public SpecifierPanel |
| 20 |
{ |
| 21 |
protected: |
| 22 |
wxComboBox* _editCombo; |
| 23 |
|
| 24 |
// The change callback, invoked when the text changes |
| 25 |
std::function<void()> _valueChanged; |
| 26 |
|
| 27 |
EntityNameSpecifierPanel(); |
| 28 |
|
| 29 |
public: |
| 30 |
EntityNameSpecifierPanel(wxWindow* parent); |
| 31 |
|
| 32 |
virtual ~EntityNameSpecifierPanel(); |
| 33 |
|
| 34 |
/* SpecifierPanel implementation */ |
| 35 |
virtual SpecifierPanelPtr create(wxWindow* parent) const override |
| 36 |
{ |
| 37 |
return std::make_shared<EntityNameSpecifierPanel>(parent); |
| 38 |
} |
| 39 |
|
| 40 |
void setChangedCallback(const std::function<void()>& callback) override |
| 41 |
{ |
| 42 |
_valueChanged = callback; |
| 43 |
} |
| 44 |
|
| 45 |
virtual wxWindow* getWidget() override; |
| 46 |
void setValue(const std::string& value) override; |
| 47 |
std::string getValue() const override; |
| 48 |
|
| 49 |
private: |
| 50 |
void onComboBoxChanged(wxCommandEvent& ev); |
| 51 |
|
| 52 |
// Map registration |
| 53 |
static struct RegHelper |
| 54 |
{ |
| 55 |
RegHelper() |
| 56 |
{ |
| 57 |
SpecifierPanelFactory::registerType( |
| 58 |
SpecifierType::SPEC_NAME().getName(), |
| 59 |
SpecifierPanelPtr(new EntityNameSpecifierPanel()) |
| 60 |
); |
| 61 |
} |
| 62 |
} _regHelper; |
| 63 |
}; |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
} |