diff options
Diffstat (limited to 'src/tracker_frame.h')
| -rw-r--r-- | src/tracker_frame.h | 96 |
1 files changed, 89 insertions, 7 deletions
| diff --git a/src/tracker_frame.h b/src/tracker_frame.h index f1d7171..00bbe70 100644 --- a/src/tracker_frame.h +++ b/src/tracker_frame.h | |||
| @@ -7,39 +7,121 @@ | |||
| 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; |
| 24 | class wxBookCtrlEvent; | ||
| 25 | class wxNotebook; | ||
| 26 | class wxSplitterEvent; | ||
| 27 | class wxSplitterWindow; | ||
| 28 | |||
| 29 | class ApConnectEvent : public wxEvent { | ||
| 30 | public: | ||
| 31 | ApConnectEvent(wxEventType eventType, int winid, std::string server, | ||
| 32 | std::string user, std::string pass) | ||
| 33 | : wxEvent(winid, eventType), | ||
| 34 | ap_server_(std::move(server)), | ||
| 35 | ap_user_(std::move(user)), | ||
| 36 | ap_pass_(std::move(pass)) {} | ||
| 37 | |||
| 38 | const std::string &GetServer() const { return ap_server_; } | ||
| 39 | |||
| 40 | const std::string &GetUser() const { return ap_user_; } | ||
| 41 | |||
| 42 | const std::string &GetPass() const { return ap_pass_; } | ||
| 43 | |||
| 44 | virtual wxEvent *Clone() const { return new ApConnectEvent(*this); } | ||
| 45 | |||
| 46 | private: | ||
| 47 | std::string ap_server_; | ||
| 48 | std::string ap_user_; | ||
| 49 | std::string ap_pass_; | ||
| 50 | }; | ||
| 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 | }; | ||
| 13 | 74 | ||
| 14 | wxDECLARE_EVENT(STATE_RESET, wxCommandEvent); | 75 | wxDECLARE_EVENT(STATE_RESET, wxCommandEvent); |
| 15 | wxDECLARE_EVENT(STATE_CHANGED, wxCommandEvent); | 76 | wxDECLARE_EVENT(STATE_CHANGED, StateChangedEvent); |
| 16 | wxDECLARE_EVENT(STATUS_CHANGED, wxCommandEvent); | 77 | wxDECLARE_EVENT(STATUS_CHANGED, wxCommandEvent); |
| 78 | wxDECLARE_EVENT(CONNECT_TO_AP, ApConnectEvent); | ||
| 17 | 79 | ||
| 18 | class TrackerFrame : public wxFrame { | 80 | class TrackerFrame : public wxFrame { |
| 19 | public: | 81 | public: |
| 20 | TrackerFrame(); | 82 | TrackerFrame(); |
| 21 | 83 | ||
| 22 | void SetStatusMessage(std::string message); | 84 | void ConnectToAp(std::string server, std::string user, std::string pass); |
| 85 | void UpdateStatusMessage(); | ||
| 23 | 86 | ||
| 24 | void ResetIndicators(); | 87 | void ResetIndicators(); |
| 25 | void UpdateIndicators(); | 88 | void UpdateIndicators(StateUpdate state); |
| 26 | 89 | ||
| 27 | private: | 90 | private: |
| 28 | void OnExit(wxCommandEvent &event); | 91 | void OnExit(wxCommandEvent &event); |
| 29 | void OnAbout(wxCommandEvent &event); | 92 | void OnAbout(wxCommandEvent &event); |
| 30 | void OnConnect(wxCommandEvent &event); | 93 | void OnApConnect(wxCommandEvent &event); |
| 94 | void OnIpcConnect(wxCommandEvent &event); | ||
| 31 | void OnSettings(wxCommandEvent &event); | 95 | void OnSettings(wxCommandEvent &event); |
| 32 | void OnCheckForUpdates(wxCommandEvent &event); | 96 | void OnCheckForUpdates(wxCommandEvent &event); |
| 97 | void OnZoomIn(wxCommandEvent &event); | ||
| 98 | void OnZoomOut(wxCommandEvent &event); | ||
| 99 | void OnOpenLogWindow(wxCommandEvent &event); | ||
| 100 | void OnCloseLogWindow(wxCloseEvent &event); | ||
| 101 | void OnChangePage(wxBookCtrlEvent &event); | ||
| 102 | void OnSashPositionChanged(wxSplitterEvent &event); | ||
| 33 | 103 | ||
| 34 | void OnStateReset(wxCommandEvent &event); | 104 | void OnStateReset(wxCommandEvent &event); |
| 35 | void OnStateChanged(wxCommandEvent &event); | 105 | void OnStateChanged(StateChangedEvent &event); |
| 36 | void OnStatusChanged(wxCommandEvent &event); | 106 | void OnStatusChanged(wxCommandEvent &event); |
| 107 | void OnConnectToAp(ApConnectEvent &event); | ||
| 108 | |||
| 109 | std::unique_ptr<Updater> updater_; | ||
| 37 | 110 | ||
| 38 | void CheckForUpdates(bool manual); | 111 | wxSplitterWindow *splitter_window_; |
| 39 | 112 | wxNotebook *notebook_; | |
| 40 | TrackerPanel *tracker_panel_; | 113 | TrackerPanel *tracker_panel_; |
| 41 | AchievementsPane *achievements_pane_; | 114 | AchievementsPane *achievements_pane_; |
| 115 | ItemsPane *items_pane_; | ||
| 116 | OptionsPane *options_pane_; | ||
| 117 | PaintingsPane *paintings_pane_; | ||
| 42 | SubwayMap *subway_map_; | 118 | SubwayMap *subway_map_; |
| 119 | LogDialog *log_dialog_ = nullptr; | ||
| 120 | |||
| 121 | wxMenuItem *zoom_in_menu_item_; | ||
| 122 | wxMenuItem *zoom_out_menu_item_; | ||
| 123 | |||
| 124 | IconCache icons_; | ||
| 43 | }; | 125 | }; |
| 44 | 126 | ||
| 45 | #endif /* end of include guard: TRACKER_FRAME_H_86BD8DFB */ | 127 | #endif /* end of include guard: TRACKER_FRAME_H_86BD8DFB */ |
