about summary refs log tree commit diff stats
path: root/area_popup.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 17:26:46 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 17:26:46 -0400
commit09d67fbad9df92caf2251d36b4abd7979fd27126 (patch)
tree287be3da3588f1fb991ffd3212fdfd53a703d6ab /area_popup.cpp
parent116ba412079ddf647d19a54d09eb61e67a2f9aac (diff)
downloadlingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.tar.gz
lingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.tar.bz2
lingo-ap-tracker-09d67fbad9df92caf2251d36b4abd7979fd27126.zip
Map + popups reflect checked locations
Diffstat (limited to 'area_popup.cpp')
-rw-r--r--area_popup.cpp48
1 files changed, 31 insertions, 17 deletions
diff --git a/area_popup.cpp b/area_popup.cpp index 62cbe4d..e46e4ec 100644 --- a/area_popup.cpp +++ b/area_popup.cpp
@@ -1,37 +1,51 @@
1#include "area_popup.h" 1#include "area_popup.h"
2 2
3#include "ap_state.h"
3#include "game_data.h" 4#include "game_data.h"
4 5
5AreaPopup::AreaPopup(wxWindow* parent, int area_id) 6AreaPopup::AreaPopup(wxWindow* parent, int area_id)
6 : wxPanel(parent, wxID_ANY), area_id_(area_id) { 7 : wxPanel(parent, wxID_ANY), area_id_(area_id) {
7 const MapArea& map_area = GetGameData().GetMapArea(area_id); 8 const MapArea& map_area = GetGameData().GetMapArea(area_id);
8 9
9 wxBoxSizer* list_sizer = new wxBoxSizer(wxVERTICAL); 10 wxFlexGridSizer* section_sizer = new wxFlexGridSizer(2, 10, 10);
10 11
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) { 12 for (const Location& location : map_area.locations) {
18 wxSizerFlags sizer_flags = wxSizerFlags().Left(); 13 EyeIndicator* eye_indicator = new EyeIndicator(this);
19 if (!is_first) { 14 section_sizer->Add(eye_indicator, wxSizerFlags().Expand());
20 sizer_flags = sizer_flags.Border(wxUP); 15 eye_indicators_.push_back(eye_indicator);
21 }
22 16
23 wxStaticText* section_label = new wxStaticText(this, -1, location.name); 17 wxStaticText* section_label = new wxStaticText(this, -1, location.name);
24 section_label->SetForegroundColour(*wxBLACK); 18 section_label->SetForegroundColour(*wxWHITE);
25 list_sizer->Add(section_label, sizer_flags); 19 section_sizer->Add(
26 20 section_label,
27 is_first = false; 21 wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL));
22 section_labels_.push_back(section_label);
28 } 23 }
29 24
30 wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL); 25 wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL);
31 top_sizer->Add(list_sizer, wxSizerFlags().DoubleBorder(wxALL)); 26
27 wxStaticText* top_label = new wxStaticText(this, -1, map_area.name);
28 top_label->SetForegroundColour(*wxWHITE);
29 top_label->SetFont(top_label->GetFont().Bold());
30 top_sizer->Add(top_label,
31 wxSizerFlags().Center().DoubleBorder(wxUP | wxLEFT | wxRIGHT));
32
33 top_sizer->Add(section_sizer, wxSizerFlags().DoubleBorder(wxALL).Expand());
32 34
33 SetSizerAndFit(top_sizer); 35 SetSizerAndFit(top_sizer);
34 36
35 SetBackgroundColour(*wxLIGHT_GREY); 37 SetBackgroundColour(*wxBLACK);
36 Hide(); 38 Hide();
37} 39}
40
41void AreaPopup::UpdateIndicators() {
42 const MapArea& map_area = GetGameData().GetMapArea(area_id_);
43 for (int section_id = 0; section_id < map_area.locations.size();
44 section_id++) {
45 bool checked = GetAPState().HasCheckedGameLocation(area_id_, section_id);
46 const wxColour* text_color = checked ? wxWHITE : wxGREEN;
47
48 section_labels_[section_id]->SetForegroundColour(*text_color);
49 eye_indicators_[section_id]->SetChecked(checked);
50 }
51}