From 02c331f4e766558bba580d5b7db883357be005d5 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 3 May 2023 12:43:16 -0400 Subject: Changes to make it work better on Windows AreaWindows are now no longer separate controls but are instead just painted onto the TrackerPanel. This lets us avoid the complexity of z-ordering with sibling controls. We can also use the mouse motion event to display and hide the popups, which conveniently doesn't fire when the mouse is over a popup, so the popup won't hide until you mouse off of the window AND popup. --- tracker_panel.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tracker_panel.h') diff --git a/tracker_panel.h b/tracker_panel.h index 20d4f92..a871f90 100644 --- a/tracker_panel.h +++ b/tracker_panel.h @@ -7,7 +7,7 @@ #include #endif -#include "area_window.h" +class AreaPopup; class TrackerPanel : public wxPanel { public: @@ -16,15 +16,24 @@ class TrackerPanel : public wxPanel { void UpdateIndicators(); private: + struct AreaIndicator { + int area_id = -1; + AreaPopup *popup = nullptr; + int real_x1 = 0; + int real_y1 = 0; + int real_x2 = 0; + int real_y2 = 0; + }; + void OnPaint(wxPaintEvent &event); + void OnMouseMove(wxMouseEvent &event); void Redraw(); wxImage map_image_; wxBitmap rendered_; - std::vector area_windows_; - std::vector area_popups_; + std::vector areas_; }; #endif /* end of include guard: TRACKER_PANEL_H_D675A54D */ -- cgit 1.4.1