about summary refs log tree commit diff stats
path: root/src/tracker_frame.h
blob: e9fec1717ab308b111157487d5b90562a13ba91a (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef TRACKER_FRAME_H_86BD8DFB
#define TRACKER_FRAME_H_86BD8DFB

#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

class AchievementsPane;
class SubwayMap;
class TrackerPanel;
class wxBookCtrlEvent;
class wxNotebook;

class ApConnectEvent : public wxEvent {
 public:
  ApConnectEvent(wxEventType eventType, int winid, std::string server,
                 std::string user, std::string pass)
      : wxEvent(winid, eventType),
        ap_server_(std::move(server)),
        ap_user_(std::move(user)),
        ap_pass_(std::move(pass)) {}

  const std::string &GetServer() const { return ap_server_; }

  const std::string &GetUser() const { return ap_user_; }

  const std::string &GetPass() const { return ap_pass_; }

  virtual wxEvent *Clone() const { return new ApConnectEvent(*this); }

 private:
  std::string ap_server_;
  std::string ap_user_;
  std::string ap_pass_;
};

wxDECLARE_EVENT(STATE_RESET, wxCommandEvent);
wxDECLARE_EVENT(STATE_CHANGED, wxCommandEvent);
wxDECLARE_EVENT(STATUS_CHANGED, wxCommandEvent);
wxDECLARE_EVENT(REDRAW_POSITION, wxCommandEvent);
wxDECLARE_EVENT(CONNECT_TO_AP, ApConnectEvent);

enum UpdateIndicatorsMode {
  kUPDATE_ALL_INDICATORS = 0,
  kUPDATE_ONLY_PANELS = 1,
};

class TrackerFrame : public wxFrame {
 public:
  TrackerFrame();

  void ConnectToAp(std::string server, std::string user, std::string pass);
  void UpdateStatusMessage();

  void ResetIndicators();
  void UpdateIndicators(UpdateIndicatorsMode mode = kUPDATE_ALL_INDICATORS);
  void RedrawPosition();

 private:
  void OnExit(wxCommandEvent &event);
  void OnAbout(wxCommandEvent &event);
  void OnApConnect(wxCommandEvent &event);
  void OnIpcConnect(wxCommandEvent &event);
  void OnSettings(wxCommandEvent &event);
  void OnCheckForUpdates(wxCommandEvent &event);
  void OnZoomIn(wxCommandEvent &event);
  void OnZoomOut(wxCommandEvent &event);
  void OnChangePage(wxBookCtrlEvent &event);
  void OnOpenFile(wxCommandEvent &event);

  void OnStateReset(wxCommandEvent &event);
  void OnStateChanged(wxCommandEvent &event);
  void OnStatusChanged(wxCommandEvent &event);
  void OnRedrawPosition(wxCommandEvent &event);
  void OnConnectToAp(ApConnectEvent &event);

  void CheckForUpdates(bool manual);

  wxNotebook *notebook_;
  TrackerPanel *tracker_panel_;
  AchievementsPane *achievements_pane_;
  SubwayMap *subway_map_;
  TrackerPanel *panels_panel_ = nullptr;

  wxMenuItem *zoom_in_menu_item_;
  wxMenuItem *zoom_out_menu_item_;
};

#endif /* end of include guard: TRACKER_FRAME_H_86BD8DFB */