diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-02 12:05:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-02 12:05:05 -0400 |
commit | 22014b967d0d9651b72bffbe02aba75dc98180a4 (patch) | |
tree | ffab7ffdc21463eb6cd7160fbce6f91e050f8c3e /area_popup.cpp | |
parent | 4ec5bf36218ad715657bba7649598410feae2794 (diff) | |
download | lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.gz lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.bz2 lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.zip |
Show locations popup when hovering over area
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 | } | ||