about summary refs log tree commit diff stats
path: root/tracker_panel.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-03 12:43:16 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-03 12:43:16 -0400
commit02c331f4e766558bba580d5b7db883357be005d5 (patch)
tree16e8fd4a48c1951e0dd7785295fcbe62b9669880 /tracker_panel.h
parent47e59ea969c775bea316b1a910c845a7c8482091 (diff)
downloadlingo-ap-tracker-02c331f4e766558bba580d5b7db883357be005d5.tar.gz
lingo-ap-tracker-02c331f4e766558bba580d5b7db883357be005d5.tar.bz2
lingo-ap-tracker-02c331f4e766558bba580d5b7db883357be005d5.zip
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.
Diffstat (limited to 'tracker_panel.h')
-rw-r--r--tracker_panel.h15
1 files changed, 12 insertions, 3 deletions
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 @@
7#include <wx/wx.h> 7#include <wx/wx.h>
8#endif 8#endif
9 9
10#include "area_window.h" 10class AreaPopup;
11 11
12class TrackerPanel : public wxPanel { 12class TrackerPanel : public wxPanel {
13 public: 13 public:
@@ -16,15 +16,24 @@ class TrackerPanel : public wxPanel {
16 void UpdateIndicators(); 16 void UpdateIndicators();
17 17
18 private: 18 private:
19 struct AreaIndicator {
20 int area_id = -1;
21 AreaPopup *popup = nullptr;
22 int real_x1 = 0;
23 int real_y1 = 0;
24 int real_x2 = 0;
25 int real_y2 = 0;
26 };
27
19 void OnPaint(wxPaintEvent &event); 28 void OnPaint(wxPaintEvent &event);
29 void OnMouseMove(wxMouseEvent &event);
20 30
21 void Redraw(); 31 void Redraw();
22 32
23 wxImage map_image_; 33 wxImage map_image_;
24 wxBitmap rendered_; 34 wxBitmap rendered_;
25 35
26 std::vector<AreaWindow *> area_windows_; 36 std::vector<AreaIndicator> areas_;
27 std::vector<AreaPopup *> area_popups_;
28}; 37};
29 38
30#endif /* end of include guard: TRACKER_PANEL_H_D675A54D */ 39#endif /* end of include guard: TRACKER_PANEL_H_D675A54D */