diff options
Diffstat (limited to 'src/tracker_frame.h')
-rw-r--r-- | src/tracker_frame.h | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/src/tracker_frame.h b/src/tracker_frame.h index e9fec17..00bbe70 100644 --- a/src/tracker_frame.h +++ b/src/tracker_frame.h | |||
@@ -7,11 +7,24 @@ | |||
7 | #include <wx/wx.h> | 7 | #include <wx/wx.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #include <memory> | ||
11 | #include <set> | ||
12 | |||
13 | #include "ap_state.h" | ||
14 | #include "icons.h" | ||
15 | #include "updater.h" | ||
16 | |||
10 | class AchievementsPane; | 17 | class AchievementsPane; |
18 | class ItemsPane; | ||
19 | class LogDialog; | ||
20 | class OptionsPane; | ||
21 | class PaintingsPane; | ||
11 | class SubwayMap; | 22 | class SubwayMap; |
12 | class TrackerPanel; | 23 | class TrackerPanel; |
13 | class wxBookCtrlEvent; | 24 | class wxBookCtrlEvent; |
14 | class wxNotebook; | 25 | class wxNotebook; |
26 | class wxSplitterEvent; | ||
27 | class wxSplitterWindow; | ||
15 | 28 | ||
16 | class ApConnectEvent : public wxEvent { | 29 | class ApConnectEvent : public wxEvent { |
17 | public: | 30 | public: |
@@ -36,17 +49,34 @@ class ApConnectEvent : public wxEvent { | |||
36 | std::string ap_pass_; | 49 | std::string ap_pass_; |
37 | }; | 50 | }; |
38 | 51 | ||
52 | struct StateUpdate { | ||
53 | std::vector<ItemState> items; | ||
54 | bool progression_items = false; | ||
55 | std::vector<std::string> paintings; | ||
56 | bool cleared_locations = false; | ||
57 | std::set<int> panels; | ||
58 | bool player_position = false; | ||
59 | bool changed_settings = false; | ||
60 | }; | ||
61 | |||
62 | class StateChangedEvent : public wxEvent { | ||
63 | public: | ||
64 | StateChangedEvent(wxEventType eventType, int winid, StateUpdate state) | ||
65 | : wxEvent(winid, eventType), state_(std::move(state)) {} | ||
66 | |||
67 | const StateUpdate &GetState() const { return state_; } | ||
68 | |||
69 | virtual wxEvent *Clone() const { return new StateChangedEvent(*this); } | ||
70 | |||
71 | private: | ||
72 | StateUpdate state_; | ||
73 | }; | ||
74 | |||
39 | wxDECLARE_EVENT(STATE_RESET, wxCommandEvent); | 75 | wxDECLARE_EVENT(STATE_RESET, wxCommandEvent); |
40 | wxDECLARE_EVENT(STATE_CHANGED, wxCommandEvent); | 76 | wxDECLARE_EVENT(STATE_CHANGED, StateChangedEvent); |
41 | wxDECLARE_EVENT(STATUS_CHANGED, wxCommandEvent); | 77 | wxDECLARE_EVENT(STATUS_CHANGED, wxCommandEvent); |
42 | wxDECLARE_EVENT(REDRAW_POSITION, wxCommandEvent); | ||
43 | wxDECLARE_EVENT(CONNECT_TO_AP, ApConnectEvent); | 78 | wxDECLARE_EVENT(CONNECT_TO_AP, ApConnectEvent); |
44 | 79 | ||
45 | enum UpdateIndicatorsMode { | ||
46 | kUPDATE_ALL_INDICATORS = 0, | ||
47 | kUPDATE_ONLY_PANELS = 1, | ||
48 | }; | ||
49 | |||
50 | class TrackerFrame : public wxFrame { | 80 | class TrackerFrame : public wxFrame { |
51 | public: | 81 | public: |
52 | TrackerFrame(); | 82 | TrackerFrame(); |
@@ -55,8 +85,7 @@ class TrackerFrame : public wxFrame { | |||
55 | void UpdateStatusMessage(); | 85 | void UpdateStatusMessage(); |
56 | 86 | ||
57 | void ResetIndicators(); | 87 | void ResetIndicators(); |
58 | void UpdateIndicators(UpdateIndicatorsMode mode = kUPDATE_ALL_INDICATORS); | 88 | void UpdateIndicators(StateUpdate state); |
59 | void RedrawPosition(); | ||
60 | 89 | ||
61 | private: | 90 | private: |
62 | void OnExit(wxCommandEvent &event); | 91 | void OnExit(wxCommandEvent &event); |
@@ -67,25 +96,32 @@ class TrackerFrame : public wxFrame { | |||
67 | void OnCheckForUpdates(wxCommandEvent &event); | 96 | void OnCheckForUpdates(wxCommandEvent &event); |
68 | void OnZoomIn(wxCommandEvent &event); | 97 | void OnZoomIn(wxCommandEvent &event); |
69 | void OnZoomOut(wxCommandEvent &event); | 98 | void OnZoomOut(wxCommandEvent &event); |
99 | void OnOpenLogWindow(wxCommandEvent &event); | ||
100 | void OnCloseLogWindow(wxCloseEvent &event); | ||
70 | void OnChangePage(wxBookCtrlEvent &event); | 101 | void OnChangePage(wxBookCtrlEvent &event); |
71 | void OnOpenFile(wxCommandEvent &event); | 102 | void OnSashPositionChanged(wxSplitterEvent &event); |
72 | 103 | ||
73 | void OnStateReset(wxCommandEvent &event); | 104 | void OnStateReset(wxCommandEvent &event); |
74 | void OnStateChanged(wxCommandEvent &event); | 105 | void OnStateChanged(StateChangedEvent &event); |
75 | void OnStatusChanged(wxCommandEvent &event); | 106 | void OnStatusChanged(wxCommandEvent &event); |
76 | void OnRedrawPosition(wxCommandEvent &event); | ||
77 | void OnConnectToAp(ApConnectEvent &event); | 107 | void OnConnectToAp(ApConnectEvent &event); |
108 | |||
109 | std::unique_ptr<Updater> updater_; | ||
78 | 110 | ||
79 | void CheckForUpdates(bool manual); | 111 | wxSplitterWindow *splitter_window_; |
80 | |||
81 | wxNotebook *notebook_; | 112 | wxNotebook *notebook_; |
82 | TrackerPanel *tracker_panel_; | 113 | TrackerPanel *tracker_panel_; |
83 | AchievementsPane *achievements_pane_; | 114 | AchievementsPane *achievements_pane_; |
115 | ItemsPane *items_pane_; | ||
116 | OptionsPane *options_pane_; | ||
117 | PaintingsPane *paintings_pane_; | ||
84 | SubwayMap *subway_map_; | 118 | SubwayMap *subway_map_; |
85 | TrackerPanel *panels_panel_ = nullptr; | 119 | LogDialog *log_dialog_ = nullptr; |
86 | 120 | ||
87 | wxMenuItem *zoom_in_menu_item_; | 121 | wxMenuItem *zoom_in_menu_item_; |
88 | wxMenuItem *zoom_out_menu_item_; | 122 | wxMenuItem *zoom_out_menu_item_; |
123 | |||
124 | IconCache icons_; | ||
89 | }; | 125 | }; |
90 | 126 | ||
91 | #endif /* end of include guard: TRACKER_FRAME_H_86BD8DFB */ | 127 | #endif /* end of include guard: TRACKER_FRAME_H_86BD8DFB */ |