]> git.saurik.com Git - wxWidgets.git/commitdiff
Add middle-item click support.
authorKevin Ollivier <kevino@theolliviers.com>
Tue, 26 Dec 2006 20:44:24 +0000 (20:44 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Tue, 26 Dec 2006 20:44:24 +0000 (20:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/listctrl.h
src/mac/carbon/listctrl_mac.cpp
version-script.in

index 6f34071e490f206bdb298d9d65333f167a1efb31..45c87d0da0b0542d7bc5f860a6b388263b84bac4 100644 (file)
@@ -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 );
index 0ee2e55dc8e6bc28418a729bae395b6e94ba71d1..bee5f011efdb93238f1fa143bb321449efaef9de 100644 (file)
@@ -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)
index bf198515b2a79243a194779ff121e3b630e4bb7c..3f88db131dbb53bbaecb171299ec78e46ae5acca 100644 (file)
@@ -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