| 16 | { |
| 17 | |
| 18 | DifficultyPanel::DifficultyPanel(wxPanel* container) |
| 19 | { |
| 20 | // Create the main widget |
| 21 | _allLevels = new wxCheckBox(container, wxID_ANY, _("All Levels")); |
| 22 | _allLevels->Connect( |
| 23 | wxEVT_CHECKBOX, wxCommandEventHandler(DifficultyPanel::_onCheckBoxToggle), NULL, this); |
| 24 | |
| 25 | // First pack the "All difficulty levels" toggle |
| 26 | container->GetSizer()->Add(_allLevels, 0, wxALIGN_CENTER_VERTICAL); |
| 27 | |
| 28 | // Create the various toggles |
| 29 | // TODO: Connect to optional Difficulty plugin |
| 30 | _toggles.push_back(new wxCheckBox(container, wxID_ANY, _("Level 1: Easy"))); |
| 31 | _toggles.push_back(new wxCheckBox(container, wxID_ANY, _("Level 2: Hard"))); |
| 32 | _toggles.push_back(new wxCheckBox(container, wxID_ANY, _("Level 3: Expert"))); |
| 33 | |
| 34 | // The hbox for the difficulty levels 1..N |
| 35 | wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); |
| 36 | |
| 37 | // Then all the other ones |
| 38 | for (std::size_t i = 0; i < _toggles.size(); i++) |
| 39 | { |
| 40 | hbox->Add(_toggles[i], 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 6); |
| 41 | |
| 42 | // Connect the checkbox |
| 43 | _toggles[i]->Connect( |
| 44 | wxEVT_CHECKBOX, wxCommandEventHandler(DifficultyPanel::_onCheckBoxToggle), NULL, this); |
| 45 | } |
| 46 | |
| 47 | container->GetSizer()->Add(hbox, 1, wxALIGN_CENTER_VERTICAL); |
| 48 | } |
| 49 | |
| 50 | void DifficultyPanel::populateFromObjective(const Objective& obj) |
| 51 | { |