Commit 6e47a5fd authored by twanvl's avatar twanvl

* 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
parent 20e38432
...@@ -342,6 +342,11 @@ RealPoint DataEditor::mousePoint(const wxMouseEvent& ev, const ValueViewer& view ...@@ -342,6 +342,11 @@ RealPoint DataEditor::mousePoint(const wxMouseEvent& ev, const ValueViewer& view
return rot.trInv(RealPoint(ev.GetX(), ev.GetY())); 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 // ----------------------------------------------------------------------------- : Keyboard events
void DataEditor::onChar(wxKeyEvent& ev) { void DataEditor::onChar(wxKeyEvent& ev) {
...@@ -351,14 +356,14 @@ void DataEditor::onChar(wxKeyEvent& ev) { ...@@ -351,14 +356,14 @@ void DataEditor::onChar(wxKeyEvent& ev) {
if (selectNext()) return; if (selectNext()) return;
// send a navigation event to our parent, to select another control // send a navigation event to our parent, to select another control
wxNavigationKeyEvent evt; wxNavigationKeyEvent evt;
GetParent()->ProcessEvent(evt); GetParent()->HandleWindowEvent(evt);
} else { } else {
// try to select the previos editor // try to select the previos editor
if (selectPrevious()) return; if (selectPrevious()) return;
// send a navigation event to our parent, to select another control // send a navigation event to our parent, to select another control
wxNavigationKeyEvent evt; wxNavigationKeyEvent evt;
evt.SetDirection(false); evt.SetDirection(false);
GetParent()->ProcessEvent(evt); GetParent()->HandleWindowEvent(evt);
} }
} else if (current_editor) { } else if (current_editor) {
current_editor->onChar(ev); current_editor->onChar(ev);
...@@ -427,4 +432,5 @@ BEGIN_EVENT_TABLE(DataEditor, CardViewer) ...@@ -427,4 +432,5 @@ BEGIN_EVENT_TABLE(DataEditor, CardViewer)
EVT_CHAR (DataEditor::onChar) EVT_CHAR (DataEditor::onChar)
EVT_SET_FOCUS (DataEditor::onFocus) EVT_SET_FOCUS (DataEditor::onFocus)
EVT_KILL_FOCUS (DataEditor::onLoseFocus) EVT_KILL_FOCUS (DataEditor::onLoseFocus)
EVT_MOUSE_CAPTURE_LOST(DataEditor::onLoseCapture)
END_EVENT_TABLE () END_EVENT_TABLE ()
...@@ -20,7 +20,7 @@ class FindInfo; ...@@ -20,7 +20,7 @@ class FindInfo;
/// An editor for data values (usually a card) /// An editor for data values (usually a card)
class DataEditor : public CardViewer { class DataEditor : public CardViewer {
public: public:
DataEditor(Window* parent, int id, long style = 0); DataEditor(Window* parent, int id, long style = wxBORDER_THEME);
// --------------------------------------------------- : Utility for ValueViewers/Editors // --------------------------------------------------- : Utility for ValueViewers/Editors
...@@ -108,6 +108,7 @@ class DataEditor : public CardViewer { ...@@ -108,6 +108,7 @@ class DataEditor : public CardViewer {
void onMotion (wxMouseEvent&); void onMotion (wxMouseEvent&);
void onMouseWheel(wxMouseEvent&); void onMouseWheel(wxMouseEvent&);
void onMouseLeave(wxMouseEvent&); void onMouseLeave(wxMouseEvent&);
void onLoseCapture(wxMouseCaptureLostEvent&);
void onChar (wxKeyEvent&); void onChar (wxKeyEvent&);
......
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