about summary refs log tree commit diff stats
path: root/src/tracker_panel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tracker_panel.cpp')
-rw-r--r--src/tracker_panel.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/tracker_panel.cpp b/src/tracker_panel.cpp index 3f51cd5..81b58cc 100644 --- a/src/tracker_panel.cpp +++ b/src/tracker_panel.cpp
@@ -66,9 +66,9 @@ void TrackerPanel::SetPanelsMode() { panels_mode_ = true; }
66 66
67void TrackerPanel::SetSavedataPath(std::string savedata_path) { 67void TrackerPanel::SetSavedataPath(std::string savedata_path) {
68 if (!savedata_path_) { 68 if (!savedata_path_) {
69 wxButton *refresh_button = 69 refresh_button_ = new wxButton(this, wxID_ANY, "Refresh");
70 new wxButton(this, wxID_ANY, "Refresh", {15, 15}); 70 refresh_button_->Bind(wxEVT_BUTTON, &TrackerPanel::OnRefreshSavedata, this);
71 refresh_button->Bind(wxEVT_BUTTON, &TrackerPanel::OnRefreshSavedata, this); 71 SetUpRefreshButton();
72 } 72 }
73 73
74 savedata_path_ = savedata_path; 74 savedata_path_ = savedata_path;
@@ -97,6 +97,10 @@ void TrackerPanel::RefreshSavedata() {
97void TrackerPanel::OnPaint(wxPaintEvent &event) { 97void TrackerPanel::OnPaint(wxPaintEvent &event) {
98 if (GetSize() != rendered_.GetSize()) { 98 if (GetSize() != rendered_.GetSize()) {
99 Redraw(); 99 Redraw();
100
101 if (refresh_button_ != nullptr) {
102 SetUpRefreshButton();
103 }
100 } 104 }
101 105
102 wxBufferedPaintDC dc(this); 106 wxBufferedPaintDC dc(this);
@@ -316,3 +320,8 @@ void TrackerPanel::Redraw() {
316 area.popup->SetPosition({popup_x, popup_y}); 320 area.popup->SetPosition({popup_x, popup_y});
317 } 321 }
318} 322}
323
324void TrackerPanel::SetUpRefreshButton() {
325 refresh_button_->SetSize(FromDIP(15), FromDIP(15), wxDefaultCoord,
326 wxDefaultCoord, wxSIZE_AUTO);
327}