| 1 |
#include "ReadableClosedComponentEditor.h" |
| 2 |
#include "../SpecifierType.h" |
| 3 |
#include "../Component.h" |
| 4 |
|
| 5 |
#include "i18n.h" |
| 6 |
#include "string/string.h" |
| 7 |
#include <wx/stattext.h> |
| 8 |
|
| 9 |
namespace objectives { |
| 10 |
|
| 11 |
namespace ce { |
| 12 |
|
| 13 |
// Registration helper, will register this editor in the factory |
| 14 |
ReadableClosedComponentEditor::RegHelper ReadableClosedComponentEditor::regHelper; |
| 15 |
|
| 16 |
// Constructor |
| 17 |
ReadableClosedComponentEditor::ReadableClosedComponentEditor(wxWindow* parent, Component& component) : |
| 18 |
ComponentEditorBase(parent), |
| 19 |
_component(&component), |
| 20 |
_readableSpec(new SpecifierEditCombo(_panel, getChangeCallback(), SpecifierType::SET_READABLE())) |
| 21 |
{ |
| 22 |
wxStaticText* label = new wxStaticText(_panel, wxID_ANY, _("Readable:")); |
| 23 |
label->SetFont(label->GetFont().Bold()); |
| 24 |
|
| 25 |
_panel->GetSizer()->Add(label, 0, wxBOTTOM | wxEXPAND, 6); |
| 26 |
_panel->GetSizer()->Add(_readableSpec, 0, wxBOTTOM | wxEXPAND, 6); |
| 27 |
|
| 28 |
// Populate the SpecifierEditCombo with the first specifier |
| 29 |
_readableSpec->setSpecifier( |
| 30 |
component.getSpecifier(Specifier::FIRST_SPECIFIER) |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
// Write to component |
| 35 |
void ReadableClosedComponentEditor::writeToComponent() const |
| 36 |
{ |
| 37 |
if (!_active) return; // still under construction |
| 38 |
|
| 39 |
assert(_component); |
| 40 |
|
| 41 |
_component->setSpecifier( |
| 42 |
Specifier::FIRST_SPECIFIER, _readableSpec->getSpecifier() |
| 43 |
); |
| 44 |
|
| 45 |
_component->clearArguments(); |
| 46 |
} |
| 47 |
|
| 48 |
} // namespace ce |
| 49 |
|
| 50 |
} // namespace objectives |