diff options
Diffstat (limited to 'tracker_frame.cpp')
-rw-r--r-- | tracker_frame.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/tracker_frame.cpp b/tracker_frame.cpp index cd2060c..237433a 100644 --- a/tracker_frame.cpp +++ b/tracker_frame.cpp | |||
@@ -6,6 +6,9 @@ | |||
6 | 6 | ||
7 | enum TrackerFrameIds { ID_CONNECT = 1 }; | 7 | enum TrackerFrameIds { ID_CONNECT = 1 }; |
8 | 8 | ||
9 | wxDEFINE_EVENT(STATE_CHANGED, wxCommandEvent); | ||
10 | wxDEFINE_EVENT(STATUS_CHANGED, wxCommandEvent); | ||
11 | |||
9 | TrackerFrame::TrackerFrame() | 12 | TrackerFrame::TrackerFrame() |
10 | : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { | 13 | : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { |
11 | ::wxInitAllImageHandlers(); | 14 | ::wxInitAllImageHandlers(); |
@@ -33,17 +36,21 @@ TrackerFrame::TrackerFrame() | |||
33 | Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); | 36 | Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); |
34 | Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); | 37 | Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); |
35 | Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT); | 38 | Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT); |
39 | Bind(STATE_CHANGED, &TrackerFrame::OnStateChanged, this); | ||
40 | Bind(STATUS_CHANGED, &TrackerFrame::OnStatusChanged, this); | ||
36 | 41 | ||
37 | tracker_panel_ = new TrackerPanel(this); | 42 | tracker_panel_ = new TrackerPanel(this); |
38 | } | 43 | } |
39 | 44 | ||
40 | void TrackerFrame::SetStatusMessage(std::string message) { | 45 | void TrackerFrame::SetStatusMessage(std::string message) { |
41 | SetStatusText(message); | 46 | wxCommandEvent *event = new wxCommandEvent(STATUS_CHANGED); |
47 | event->SetString(message.c_str()); | ||
48 | |||
49 | QueueEvent(event); | ||
42 | } | 50 | } |
43 | 51 | ||
44 | void TrackerFrame::UpdateIndicators() { | 52 | void TrackerFrame::UpdateIndicators() { |
45 | tracker_panel_->UpdateIndicators(); | 53 | QueueEvent(new wxCommandEvent(STATE_CHANGED)); |
46 | Refresh(); | ||
47 | } | 54 | } |
48 | 55 | ||
49 | void TrackerFrame::OnAbout(wxCommandEvent &event) { | 56 | void TrackerFrame::OnAbout(wxCommandEvent &event) { |
@@ -61,3 +68,12 @@ void TrackerFrame::OnConnect(wxCommandEvent &event) { | |||
61 | dlg.GetPasswordValue()); | 68 | dlg.GetPasswordValue()); |
62 | } | 69 | } |
63 | } | 70 | } |
71 | |||
72 | void TrackerFrame::OnStateChanged(wxCommandEvent &event) { | ||
73 | tracker_panel_->UpdateIndicators(); | ||
74 | Refresh(); | ||
75 | } | ||
76 | |||
77 | void TrackerFrame::OnStatusChanged(wxCommandEvent &event) { | ||
78 | SetStatusText(event.GetString()); | ||
79 | } | ||