From 653378d0b2cff7e7183f825fb2a0a6b6062369a6 Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 7 Dec 2010 22:03:14 +0000 Subject: [PATCH] * compatibility with wxWdigets 2.9+: use HandleWindowEvent instead of ProcessEvent * compatibility with wxWdigets 2.9+: Handle MOUSE_CAPTURE_LOST event * use wxBORDER_THEME for custom controls git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1559 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/control/card_editor.cpp | 10 ++++++++-- src/gui/control/card_editor.hpp | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/control/card_editor.cpp b/src/gui/control/card_editor.cpp index 931b84d1..4964a5ef 100644 --- a/src/gui/control/card_editor.cpp +++ b/src/gui/control/card_editor.cpp @@ -342,6 +342,11 @@ RealPoint DataEditor::mousePoint(const wxMouseEvent& ev, const ValueViewer& view return rot.trInv(RealPoint(ev.GetX(), ev.GetY())); } +void DataEditor::onLoseCapture(wxMouseCaptureLostEvent&) { + // We already test for wrong release with HasCapture() + // but stupid wxwidget people decided to throw assertion failures +} + // ----------------------------------------------------------------------------- : Keyboard events void DataEditor::onChar(wxKeyEvent& ev) { @@ -351,14 +356,14 @@ void DataEditor::onChar(wxKeyEvent& ev) { if (selectNext()) return; // send a navigation event to our parent, to select another control wxNavigationKeyEvent evt; - GetParent()->ProcessEvent(evt); + GetParent()->HandleWindowEvent(evt); } else { // try to select the previos editor if (selectPrevious()) return; // send a navigation event to our parent, to select another control wxNavigationKeyEvent evt; evt.SetDirection(false); - GetParent()->ProcessEvent(evt); + GetParent()->HandleWindowEvent(evt); } } else if (current_editor) { current_editor->onChar(ev); @@ -427,4 +432,5 @@ BEGIN_EVENT_TABLE(DataEditor, CardViewer) EVT_CHAR (DataEditor::onChar) EVT_SET_FOCUS (DataEditor::onFocus) EVT_KILL_FOCUS (DataEditor::onLoseFocus) + EVT_MOUSE_CAPTURE_LOST(DataEditor::onLoseCapture) END_EVENT_TABLE () diff --git a/src/gui/control/card_editor.hpp b/src/gui/control/card_editor.hpp index ed5de898..be87d811 100644 --- a/src/gui/control/card_editor.hpp +++ b/src/gui/control/card_editor.hpp @@ -20,7 +20,7 @@ class FindInfo; /// An editor for data values (usually a card) class DataEditor : public CardViewer { public: - DataEditor(Window* parent, int id, long style = 0); + DataEditor(Window* parent, int id, long style = wxBORDER_THEME); // --------------------------------------------------- : Utility for ValueViewers/Editors @@ -108,6 +108,7 @@ class DataEditor : public CardViewer { void onMotion (wxMouseEvent&); void onMouseWheel(wxMouseEvent&); void onMouseLeave(wxMouseEvent&); + void onLoseCapture(wxMouseCaptureLostEvent&); void onChar (wxKeyEvent&);