Commit f18846ef authored by twanvl's avatar twanvl

compatibility with wxWdigets 2.9+: Handle MOUSE_CAPTURE_LOST event

parent f1832a5a
...@@ -100,6 +100,10 @@ void HoverButtonBase::onLeftUp(wxMouseEvent&) { ...@@ -100,6 +100,10 @@ void HoverButtonBase::onLeftUp(wxMouseEvent&) {
onClick(); onClick();
} }
} }
void HoverButtonBase::onLoseCapture(wxMouseCaptureLostEvent&) {
// We already test for wrong release with HasCapture()
// but stupid wxWidget people decided to throw assertion failures
}
void HoverButtonBase::onKeyDown(wxKeyEvent& ev) { void HoverButtonBase::onKeyDown(wxKeyEvent& ev) {
int code = ev.GetKeyCode(); int code = ev.GetKeyCode();
if (code == WXK_RETURN || code == WXK_SPACE) { if (code == WXK_RETURN || code == WXK_SPACE) {
...@@ -147,6 +151,7 @@ BEGIN_EVENT_TABLE(HoverButtonBase, wxControl) ...@@ -147,6 +151,7 @@ BEGIN_EVENT_TABLE(HoverButtonBase, wxControl)
EVT_LEFT_UP (HoverButtonBase::onLeftUp) EVT_LEFT_UP (HoverButtonBase::onLeftUp)
EVT_KEY_DOWN (HoverButtonBase::onKeyDown) EVT_KEY_DOWN (HoverButtonBase::onKeyDown)
EVT_KEY_UP (HoverButtonBase::onKeyUp) EVT_KEY_UP (HoverButtonBase::onKeyUp)
EVT_MOUSE_CAPTURE_LOST(HoverButtonBase::onLoseCapture)
END_EVENT_TABLE () END_EVENT_TABLE ()
// ----------------------------------------------------------------------------- : Button with image and hover effect // ----------------------------------------------------------------------------- : Button with image and hover effect
......
...@@ -50,6 +50,7 @@ class HoverButtonBase : public wxControl { ...@@ -50,6 +50,7 @@ class HoverButtonBase : public wxControl {
void onKillFocus (wxFocusEvent& ev); void onKillFocus (wxFocusEvent& ev);
void onLeftUp (wxMouseEvent&); void onLeftUp (wxMouseEvent&);
void onLeftDown (wxMouseEvent&); void onLeftDown (wxMouseEvent&);
void onLoseCapture(wxMouseCaptureLostEvent&);
void onKeyDown (wxKeyEvent&); void onKeyDown (wxKeyEvent&);
void onKeyUp (wxKeyEvent&); void onKeyUp (wxKeyEvent&);
void onPaint (wxPaintEvent&); void onPaint (wxPaintEvent&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment