From da87911d658e7dd7f08936b3f52fed9ab17a5712 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 25 Jul 2006 00:09:49 +0000 Subject: [PATCH] generate middle click events (patch 1521314) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/treectlg.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 8dfff8deb1..d31637b9e5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -166,6 +166,7 @@ All (GUI): - Added wxTopLevelWindow::SetTransparent and CanSetTransparent, with implementations (so far) for wxMSW and wxMac. - Allow customizing individual grid lines appearance (Søren Lassen) +- Fixed middle click events generation in generic wxTreeCtrl (Olly Betts) wxMSW: diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 584ecdc293..66822423d0 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3016,11 +3016,12 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) } #endif - // we process left mouse up event (enables in-place edit), right down + // we process left mouse up event (enables in-place edit), middle/right down // (pass to the user code), left dbl click (activate item) and // dragging/moving events for items drag-and-drop if ( !(event.LeftDown() || event.LeftUp() || + event.MiddleDown() || event.RightDown() || event.LeftDClick() || event.Dragging() || @@ -3171,6 +3172,12 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) nevent2.m_pointDrag = CalcScrolledPosition(pt); GetEventHandler()->ProcessEvent(nevent2); } + else if ( event.MiddleDown() ) + { + wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, this, item); + nevent.m_pointDrag = CalcScrolledPosition(pt); + event.Skip(!GetEventHandler()->ProcessEvent(nevent)); + } else if ( event.LeftUp() ) { // this facilitates multiple-item drag-and-drop @@ -3210,7 +3217,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_lastOnSame = false; } } - else // !RightDown() && !LeftUp() ==> LeftDown() || LeftDClick() + else // !RightDown() && !MiddleDown() && !LeftUp() ==> LeftDown() || LeftDClick() { if ( event.LeftDown() ) {