MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / DifficultyPanel

Method DifficultyPanel

plugins/dm.objectives/DifficultyPanel.cpp:18–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18DifficultyPanel::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
50void DifficultyPanel::populateFromObjective(const Objective& obj)
51{

Callers

nothing calls this directly

Calls 4

AddMethod · 0.80
_Function · 0.50
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected