From: Kevin Ollivier Date: Tue, 26 Dec 2006 20:44:24 +0000 (+0000) Subject: Add middle-item click support. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7e2ee0bf41cd3e221ddca0288881db6377dca971?ds=inline Add middle-item click support. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index 6f34071e49..45c87d0da0 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -344,8 +344,10 @@ class WXDLLEXPORT wxListCtrl: public wxControl #if wxABI_VERSION >= 20801 void OnRightDown(wxMouseEvent& event); + void OnMiddleDown(wxMouseEvent& event); void OnChar(wxKeyEvent& event); virtual void SetFocus(); + void FireMouseEvent(wxEventType eventType, wxPoint position); #endif virtual void SetDropTarget( wxDropTarget *dropTarget ); diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index 0ee2e55dc8..bee5f011ef 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -507,6 +507,7 @@ void wxListCtrlTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) BEGIN_EVENT_TABLE(wxListCtrl, wxControl) EVT_LEFT_DOWN(wxListCtrl::OnLeftDown) EVT_LEFT_DCLICK(wxListCtrl::OnDblClick) + EVT_MIDDLE_DOWN(wxListCtrl::OnMiddleDown) EVT_RIGHT_DOWN(wxListCtrl::OnRightDown) EVT_CHAR(wxListCtrl::OnChar) END_EVENT_TABLE() @@ -621,13 +622,25 @@ void wxListCtrl::OnDblClick(wxMouseEvent& event) #if wxABI_VERSION >= 20801 void wxListCtrl::OnRightDown(wxMouseEvent& event) { - wxListEvent le( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, GetId() ); + FireMouseEvent(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, event.GetPosition()); + event.Skip(); +} + +void wxListCtrl::OnMiddleDown(wxMouseEvent& event) +{ + FireMouseEvent(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, event.GetPosition()); + event.Skip(); +} + +void wxListCtrl::FireMouseEvent(wxEventType eventType, wxPoint position) +{ + wxListEvent le( eventType, GetId() ); le.SetEventObject(this); - le.m_pointDrag = event.GetPosition(); + le.m_pointDrag = position; le.m_itemIndex = -1; int flags; - long item = HitTest(event.GetPosition(), flags); + long item = HitTest(position, flags); if (flags & wxLIST_HITTEST_ONITEM) { le.m_itemIndex = item; @@ -639,8 +652,6 @@ void wxListCtrl::OnRightDown(wxMouseEvent& event) } GetEventHandler()->ProcessEvent(le); } - - event.Skip(); } void wxListCtrl::OnChar(wxKeyEvent& event) diff --git a/version-script.in b/version-script.in index bf198515b2..3f88db131d 100644 --- a/version-script.in +++ b/version-script.in @@ -34,6 +34,8 @@ *wxListCtrl*SetFocus*; *wxListCtrl*OnChar*; *wxListCtrl*OnRightDown*; + *wxListCtrl*OnMiddleDown*; + *wxListCtrl*FireMouseEvent*; }; # symbols available since the beginning of this branch are only given