about summary refs log tree commit diff stats
path: root/tracker_frame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker_frame.cpp')
-rw-r--r--tracker_frame.cpp22
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
7enum TrackerFrameIds { ID_CONNECT = 1 }; 7enum TrackerFrameIds { ID_CONNECT = 1 };
8 8
9wxDEFINE_EVENT(STATE_CHANGED, wxCommandEvent);
10wxDEFINE_EVENT(STATUS_CHANGED, wxCommandEvent);
11
9TrackerFrame::TrackerFrame() 12TrackerFrame::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
40void TrackerFrame::SetStatusMessage(std::string message) { 45void 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
44void TrackerFrame::UpdateIndicators() { 52void TrackerFrame::UpdateIndicators() {
45 tracker_panel_->UpdateIndicators(); 53 QueueEvent(new wxCommandEvent(STATE_CHANGED));
46 Refresh();
47} 54}
48 55
49void TrackerFrame::OnAbout(wxCommandEvent &event) { 56void TrackerFrame::OnAbout(wxCommandEvent &event) {
@@ -61,3 +68,12 @@ void TrackerFrame::OnConnect(wxCommandEvent &event) {
61 dlg.GetPasswordValue()); 68 dlg.GetPasswordValue());
62 } 69 }
63} 70}
71
72void TrackerFrame::OnStateChanged(wxCommandEvent &event) {
73 tracker_panel_->UpdateIndicators();
74 Refresh();
75}
76
77void TrackerFrame::OnStatusChanged(wxCommandEvent &event) {
78 SetStatusText(event.GetString());
79}