]> git.saurik.com Git - wxWidgets.git/commitdiff
Connect to events only if using native implementation instead of using event table...
authorTim Kosse <tim.kosse@gmx.de>
Sat, 2 Oct 2010 09:39:58 +0000 (09:39 +0000)
committerTim Kosse <tim.kosse@gmx.de>
Sat, 2 Oct 2010 09:39:58 +0000 (09:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/listctrl.h
src/osx/carbon/listctrl_mac.cpp

index 9e00dd47bf6c434e3779e18cff6b00b5bc06a4b1..de0ef9217538bddb52ec386ee1de7bd527a7dc40 100644 (file)
@@ -420,7 +420,6 @@ protected:
 private:
   int CalcColumnAutoWidth(int col) const;
 
-  DECLARE_EVENT_TABLE()
 };
 
 #endif
index badf111d160b4346f2197b411593f63e6e58a080..b9161b086efd82ce8a27e8ac5349c92e73c7685f 100644 (file)
@@ -519,14 +519,6 @@ void wxListCtrlTextCtrlWrapper::OnKillFocus( wxFocusEvent &event )
     event.Skip();
 }
 
-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()
-
 // ============================================================================
 // implementation
 // ============================================================================
@@ -561,7 +553,7 @@ void wxListCtrl::Init()
     m_bgColor = wxNullColour;
     m_textctrlWrapper = NULL;
     m_current = -1;
-    m_renameTimer = new wxListCtrlRenameTimer( this );
+    m_renameTimer = NULL;
 }
 
 class wxGenericListCtrlHook : public wxGenericListCtrl
@@ -618,7 +610,8 @@ void wxListCtrl::OnLeftDown(wxMouseEvent& event)
         (hitResult & wxLIST_HITTEST_ONITEMLABEL) &&
         HasFlag(wxLC_EDIT_LABELS) )
     {
-        m_renameTimer->Start( 100, true );
+        if ( m_renameTimer )
+            m_renameTimer->Start( 250, true );
     }
     else
     {
@@ -629,7 +622,7 @@ void wxListCtrl::OnLeftDown(wxMouseEvent& event)
 
 void wxListCtrl::OnDblClick(wxMouseEvent& event)
 {
-    if ( m_renameTimer->IsRunning() )
+    if ( m_renameTimer && m_renameTimer->IsRunning() )
         m_renameTimer->Stop();
     event.Skip();
 }
@@ -754,7 +747,7 @@ bool wxListCtrl::Create(wxWindow *parent,
 
     else
     {
-         m_macIsUserPane = false;
+        m_macIsUserPane = false;
         if ( !wxWindow::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), name) )
             return false;
         m_dbImpl = new wxMacDataBrowserListCtrlControl( this, pos, size, style );
@@ -765,6 +758,14 @@ bool wxListCtrl::Create(wxWindow *parent,
         InstallControlEventHandler( m_peer->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(),
             GetEventTypeCount(eventList), eventList, this,
             (EventHandlerRef *)&m_macListCtrlEventHandler);
+
+        m_renameTimer = new wxListCtrlRenameTimer( this );
+        
+        Connect( wxID_ANY, wxEVT_CHAR, wxCharEventHandler(wxListCtrl::OnChar), NULL, this );
+        Connect( wxID_ANY, wxEVT_LEFT_DOWN, wxMouseEventHandler(wxListCtrl::OnLeftDown), NULL, this );
+        Connect( wxID_ANY, wxEVT_LEFT_DCLICK, wxMouseEventHandler(wxListCtrl::OnDblClick), NULL, this );
+        Connect( wxID_ANY, wxEVT_MIDDLE_DOWN, wxMouseEventHandler(wxListCtrl::OnMiddleDown), NULL, this );
+        Connect( wxID_ANY, wxEVT_RIGHT_DOWN, wxMouseEventHandler(wxListCtrl::OnRightDown), NULL, this );
     }
 
     return true;