about summary refs log tree commit diff stats
path: root/src/area_popup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/area_popup.cpp')
-rw-r--r--src/area_popup.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/area_popup.cpp b/src/area_popup.cpp new file mode 100644 index 0000000..a8ff612 --- /dev/null +++ b/src/area_popup.cpp
@@ -0,0 +1,54 @@
1#include "area_popup.h"
2
3#include "ap_state.h"
4#include "game_data.h"
5#include "tracker_state.h"
6
7AreaPopup::AreaPopup(wxWindow* parent, int area_id)
8 : wxPanel(parent, wxID_ANY), area_id_(area_id) {
9 const MapArea& map_area = GetGameData().GetMapArea(area_id);
10
11 wxFlexGridSizer* section_sizer = new wxFlexGridSizer(2, 10, 10);
12
13 for (const Location& location : map_area.locations) {
14 EyeIndicator* eye_indicator = new EyeIndicator(this);
15 section_sizer->Add(eye_indicator, wxSizerFlags().Expand());
16 eye_indicators_.push_back(eye_indicator);
17
18 wxStaticText* section_label = new wxStaticText(this, -1, location.name);
19 section_label->SetForegroundColour(*wxWHITE);
20 section_sizer->Add(
21 section_label,
22 wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
23 section_labels_.push_back(section_label);
24 }
25
26 wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL);
27
28 wxStaticText* top_label = new wxStaticText(this, -1, map_area.name);
29 top_label->SetForegroundColour(*wxWHITE);
30 top_label->SetFont(top_label->GetFont().Bold());
31 top_sizer->Add(top_label,
32 wxSizerFlags().Center().DoubleBorder(wxUP | wxLEFT | wxRIGHT));
33
34 top_sizer->Add(section_sizer, wxSizerFlags().DoubleBorder(wxALL).Expand());
35
36 SetSizerAndFit(top_sizer);
37
38 SetBackgroundColour(*wxBLACK);
39 Hide();
40}
41
42void AreaPopup::UpdateIndicators() {
43 const MapArea& map_area = GetGameData().GetMapArea(area_id_);
44 for (int section_id = 0; section_id < map_area.locations.size();
45 section_id++) {
46 bool checked = AP_HasCheckedGameLocation(area_id_, section_id);
47 bool reachable =
48 GetTrackerState().IsLocationReachable(area_id_, section_id);
49 const wxColour* text_color = reachable ? wxWHITE : wxRED;
50
51 section_labels_[section_id]->SetForegroundColour(*text_color);
52 eye_indicators_[section_id]->SetChecked(checked);
53 }
54}