This wrapper prevents the scrollbars from retaining focus after being used. Otherwise, the only way back to the track panel is to click it and that causes your original location to be lost.
| 325 | // used. Otherwise, the only way back to the track panel is to click it |
| 326 | // and that causes your original location to be lost. |
| 327 | class ScrollBar final : public wxScrollBar |
| 328 | { |
| 329 | public: |
| 330 | ScrollBar(wxWindow* parent, wxWindowID id, long style) |
| 331 | : wxScrollBar(parent, id, wxDefaultPosition, wxDefaultSize, style) |
| 332 | { |
| 333 | } |
| 334 | |
| 335 | void OnSetFocus(wxFocusEvent & e) |
| 336 | { |
| 337 | wxWindow *w = e.GetWindow(); |
| 338 | if (w != NULL) { |
| 339 | w->SetFocus(); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | void SetScrollbar(int position, int thumbSize, |
| 344 | int range, int pageSize, |
| 345 | bool refresh = true) override; |
| 346 | |
| 347 | private: |
| 348 | DECLARE_EVENT_TABLE() |
| 349 | }; |
| 350 | |
| 351 | void ScrollBar::SetScrollbar(int position, int thumbSize, |
| 352 | int range, int pageSize, |