| 1 |
#include "LogicEditor.h" |
| 2 |
|
| 3 |
#include "i18n.h" |
| 4 |
|
| 5 |
#include <wx/sizer.h> |
| 6 |
#include <wx/textctrl.h> |
| 7 |
#include <wx/stattext.h> |
| 8 |
|
| 9 |
namespace objectives |
| 10 |
{ |
| 11 |
|
| 12 |
LogicEditor::LogicEditor(wxWindow* parent) : |
| 13 |
wxPanel(parent, wxID_ANY) |
| 14 |
{ |
| 15 |
wxFlexGridSizer* table = new wxFlexGridSizer(2, 2, 6, 12); |
| 16 |
table->AddGrowableCol(1); |
| 17 |
SetSizer(table); |
| 18 |
|
| 19 |
// Create the text entry fields |
| 20 |
_successLogic = new wxTextCtrl(this, wxID_ANY); |
| 21 |
_failureLogic = new wxTextCtrl(this, wxID_ANY); |
| 22 |
|
| 23 |
// Create the labels for each text entry field |
| 24 |
wxStaticText* successLogicLabel = new wxStaticText(this, wxID_ANY, _("Success Logic:")); |
| 25 |
wxStaticText* failureLogicLabel = new wxStaticText(this, wxID_ANY, _("Failure Logic:")); |
| 26 |
|
| 27 |
table->Add(successLogicLabel, 0, wxBOTTOM | wxALIGN_CENTER_VERTICAL, 6); |
| 28 |
table->Add(_successLogic, 0, wxBOTTOM | wxEXPAND, 6); |
| 29 |
|
| 30 |
table->Add(failureLogicLabel, 0, wxBOTTOM | wxALIGN_CENTER_VERTICAL, 6); |
| 31 |
table->Add(_failureLogic, 0, wxBOTTOM | wxEXPAND, 6); |
| 32 |
} |
| 33 |
|
| 34 |
std::string LogicEditor::getSuccessLogicStr() |
| 35 |
{ |
| 36 |
return _successLogic->GetValue().ToStdString(); |
| 37 |
} |
| 38 |
|
| 39 |
std::string LogicEditor::getFailureLogicStr() |
| 40 |
{ |
| 41 |
return _failureLogic->GetValue().ToStdString(); |
| 42 |
} |
| 43 |
|
| 44 |
void LogicEditor::setSuccessLogicStr(const std::string& logicStr) |
| 45 |
{ |
| 46 |
_successLogic->SetValue(logicStr); |
| 47 |
} |
| 48 |
|
| 49 |
void LogicEditor::setFailureLogicStr(const std::string& logicStr) |
| 50 |
{ |
| 51 |
_failureLogic->SetValue(logicStr); |
| 52 |
} |
| 53 |
|
| 54 |
} // namespace objectives |