diff options
Diffstat (limited to 'area_popup.cpp')
-rw-r--r-- | area_popup.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/area_popup.cpp b/area_popup.cpp new file mode 100644 index 0000000..62cbe4d --- /dev/null +++ b/area_popup.cpp | |||
@@ -0,0 +1,37 @@ | |||
1 | #include "area_popup.h" | ||
2 | |||
3 | #include "game_data.h" | ||
4 | |||
5 | AreaPopup::AreaPopup(wxWindow* parent, int area_id) | ||
6 | : wxPanel(parent, wxID_ANY), area_id_(area_id) { | ||
7 | const MapArea& map_area = GetGameData().GetMapArea(area_id); | ||
8 | |||
9 | wxBoxSizer* list_sizer = new wxBoxSizer(wxVERTICAL); | ||
10 | |||
11 | wxStaticText* top_label = new wxStaticText(this, -1, map_area.name); | ||
12 | top_label->SetForegroundColour(*wxBLACK); | ||
13 | top_label->SetFont(top_label->GetFont().Bold()); | ||
14 | list_sizer->Add(top_label, wxSizerFlags().Center().DoubleBorder(wxDOWN)); | ||
15 | |||
16 | bool is_first = true; | ||
17 | for (const Location& location : map_area.locations) { | ||
18 | wxSizerFlags sizer_flags = wxSizerFlags().Left(); | ||
19 | if (!is_first) { | ||
20 | sizer_flags = sizer_flags.Border(wxUP); | ||
21 | } | ||
22 | |||
23 | wxStaticText* section_label = new wxStaticText(this, -1, location.name); | ||
24 | section_label->SetForegroundColour(*wxBLACK); | ||
25 | list_sizer->Add(section_label, sizer_flags); | ||
26 | |||
27 | is_first = false; | ||
28 | } | ||
29 | |||
30 | wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); | ||
31 | top_sizer->Add(list_sizer, wxSizerFlags().DoubleBorder(wxALL)); | ||
32 | |||
33 | SetSizerAndFit(top_sizer); | ||
34 | |||
35 | SetBackgroundColour(*wxLIGHT_GREY); | ||
36 | Hide(); | ||
37 | } | ||