From 70f1c629a6e08e0f9c58707f0470e08c6ffeca34 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 2 May 2023 20:14:43 -0400 Subject: Added reachability checking (only no doors rn) --- tracker_frame.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'tracker_frame.cpp') 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 @@ enum TrackerFrameIds { ID_CONNECT = 1 }; +wxDEFINE_EVENT(STATE_CHANGED, wxCommandEvent); +wxDEFINE_EVENT(STATUS_CHANGED, wxCommandEvent); + TrackerFrame::TrackerFrame() : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { ::wxInitAllImageHandlers(); @@ -33,17 +36,21 @@ TrackerFrame::TrackerFrame() Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT); + Bind(STATE_CHANGED, &TrackerFrame::OnStateChanged, this); + Bind(STATUS_CHANGED, &TrackerFrame::OnStatusChanged, this); tracker_panel_ = new TrackerPanel(this); } void TrackerFrame::SetStatusMessage(std::string message) { - SetStatusText(message); + wxCommandEvent *event = new wxCommandEvent(STATUS_CHANGED); + event->SetString(message.c_str()); + + QueueEvent(event); } void TrackerFrame::UpdateIndicators() { - tracker_panel_->UpdateIndicators(); - Refresh(); + QueueEvent(new wxCommandEvent(STATE_CHANGED)); } void TrackerFrame::OnAbout(wxCommandEvent &event) { @@ -61,3 +68,12 @@ void TrackerFrame::OnConnect(wxCommandEvent &event) { dlg.GetPasswordValue()); } } + +void TrackerFrame::OnStateChanged(wxCommandEvent &event) { + tracker_panel_->UpdateIndicators(); + Refresh(); +} + +void TrackerFrame::OnStatusChanged(wxCommandEvent &event) { + SetStatusText(event.GetString()); +} -- cgit 1.4.1