From 864186dd39b1e4f2686fcd01754b2da2ee5c98fb Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Sat, 2 Oct 2010 09:39:58 +0000 Subject: [PATCH] Connect to events only if using native implementation instead of using event table. Closes #12469 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/listctrl.h | 1 - src/osx/carbon/listctrl_mac.cpp | 25 +++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/wx/osx/listctrl.h b/include/wx/osx/listctrl.h index 9e00dd47bf..de0ef92175 100644 --- a/include/wx/osx/listctrl.h +++ b/include/wx/osx/listctrl.h @@ -420,7 +420,6 @@ protected: private: int CalcColumnAutoWidth(int col) const; - DECLARE_EVENT_TABLE() }; #endif diff --git a/src/osx/carbon/listctrl_mac.cpp b/src/osx/carbon/listctrl_mac.cpp index badf111d16..b9161b086e 100644 --- a/src/osx/carbon/listctrl_mac.cpp +++ b/src/osx/carbon/listctrl_mac.cpp @@ -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; -- 2.45.2