From: Kevin Ollivier Date: Mon, 25 Dec 2006 00:21:05 +0000 (+0000) Subject: Implement LIST_KEY_DOWN support, and move new functions into wxABI_VERSION. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b3ff5a475bd437b639278afe6005e9e462d4989f Implement LIST_KEY_DOWN support, and move new functions into wxABI_VERSION. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h index 5f28a5a278..6f34071e49 100644 --- a/include/wx/mac/carbon/listctrl.h +++ b/include/wx/mac/carbon/listctrl.h @@ -331,7 +331,6 @@ class WXDLLEXPORT wxListCtrl: public wxControl bool HasCurrent() const { return m_current != (long)-1; } void OnLeftDown(wxMouseEvent& event); - void OnRightDown(wxMouseEvent& event); void OnDblClick(wxMouseEvent& event); void FinishEditing(wxTextCtrl *text) @@ -344,6 +343,8 @@ class WXDLLEXPORT wxListCtrl: public wxControl virtual int GetScrollPos(int orient) const; #if wxABI_VERSION >= 20801 + void OnRightDown(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); virtual void SetFocus(); #endif diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index f855a233ee..e761dc6e48 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -508,6 +508,7 @@ BEGIN_EVENT_TABLE(wxListCtrl, wxControl) EVT_LEFT_DOWN(wxListCtrl::OnLeftDown) EVT_LEFT_DCLICK(wxListCtrl::OnDblClick) EVT_RIGHT_DOWN(wxListCtrl::OnRightDown) + EVT_CHAR(wxListCtrl::OnChar) END_EVENT_TABLE() // ============================================================================ @@ -611,6 +612,13 @@ void wxListCtrl::OnLeftDown(wxMouseEvent& event) event.Skip(); } +void wxListCtrl::OnDblClick(wxMouseEvent& event) +{ + m_current = -1; + event.Skip(); +} + +#if wxABI_VERSION >= 20801 void wxListCtrl::OnRightDown(wxMouseEvent& event) { wxListEvent le( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, GetId() ); @@ -629,17 +637,31 @@ void wxListCtrl::OnRightDown(wxMouseEvent& event) le.m_item.m_itemId = item; GetItem(le.m_item); } + GetEventHandler()->ProcessEvent(le); } - - GetEventHandler()->ProcessEvent(le); + event.Skip(); } -void wxListCtrl::OnDblClick(wxMouseEvent& event) +void wxListCtrl::OnChar(wxKeyEvent& event) { - m_current = -1; - event.Skip(); + wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetId() ); + le.SetEventObject(this); + le.m_code = event.GetKeyCode(); + le.m_itemIndex = -1; + + if (m_current != -1) + { + le.m_itemIndex = m_current; + if (!IsVirtual()) + { + le.m_item.m_itemId = m_current; + GetItem(le.m_item); + } + GetEventHandler()->ProcessEvent(le); + } } +#endif bool wxListCtrl::Create(wxWindow *parent, wxWindowID id,