about summary refs log tree commit diff stats
path: root/area_popup.cpp
blob: 62cbe4d8451a1f7ed4bdf0d65ddb2beaf9a26e86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "area_popup.h"

#include "game_data.h"

AreaPopup::AreaPopup(wxWindow* parent, int area_id)
    : wxPanel(parent, wxID_ANY), area_id_(area_id) {
  const MapArea& map_area = GetGameData().GetMapArea(area_id);

  wxBoxSizer* list_sizer = new wxBoxSizer(wxVERTICAL);

  wxStaticText* top_label = new wxStaticText(this, -1, map_area.name);
  top_label->SetForegroundColour(*wxBLACK);
  top_label->SetFont(top_label->GetFont().Bold());
  list_sizer->Add(top_label, wxSizerFlags().Center().DoubleBorder(wxDOWN));

  bool is_first = true;
  for (const Location& location : map_area.locations) {
    wxSizerFlags sizer_flags = wxSizerFlags().Left();
    if (!is_first) {
      sizer_flags = sizer_flags.Border(wxUP);
    }

    wxStaticText* section_label = new wxStaticText(this, -1, location.name);
    section_label->SetForegroundColour(*wxBLACK);
    list_sizer->Add(section_label, sizer_flags);

    is_first = false;
  }

  wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL);
  top_sizer->Add(list_sizer, wxSizerFlags().DoubleBorder(wxALL));

  SetSizerAndFit(top_sizer);

  SetBackgroundColour(*wxLIGHT_GREY);
  Hide();
}