From a44a646b7e4036b55871da474e5277442560e6f8 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Sun, 7 Jan 2007 01:21:19 +0000 Subject: [PATCH] Use GetItem to get item info for events, even for virtual wxListCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44109 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/listctrl_mac.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index 138b90fd53..bdda88c39e 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -646,12 +646,8 @@ void wxListCtrl::FireMouseEvent(wxEventType eventType, wxPoint position) if (flags & wxLIST_HITTEST_ONITEM) { le.m_itemIndex = item; - if (!IsVirtual()) - { - - le.m_item.m_itemId = item; - GetItem(le.m_item); - } + le.m_item.m_itemId = item; + GetItem(le.m_item); GetEventHandler()->ProcessEvent(le); } } @@ -668,11 +664,8 @@ void wxListCtrl::OnChar(wxKeyEvent& event) if (m_current != -1) { le.m_itemIndex = m_current; - if (!IsVirtual()) - { - le.m_item.m_itemId = m_current; - GetItem(le.m_item); - } + le.m_item.m_itemId = m_current; + GetItem(le.m_item); GetEventHandler()->ProcessEvent(le); } } @@ -1075,7 +1068,10 @@ bool wxListCtrl::GetItem(wxListItem& info) const if (m_dbImpl) { if (!IsVirtual()) - m_dbImpl->MacGetColumnInfo(info.m_itemId, info.m_col, info); + { + if (info.m_itemId > 0 && info.m_itemId < GetItemCount()) + m_dbImpl->MacGetColumnInfo(info.m_itemId, info.m_col, info); + } else { info.SetText( OnGetItemText(info.m_itemId, info.m_col) ); @@ -2343,10 +2339,8 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner , event.SetEventObject( list ); event.m_itemIndex = owner->GetLineFromItem( this ) ; - if ( !list->IsVirtual() ) - { - lb->MacGetColumnInfo(event.m_itemIndex,0,event.m_item); - } + event.m_item.m_itemId = event.m_itemIndex; + list->GetItem(event.m_item); switch (message) { @@ -2898,14 +2892,13 @@ void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID, DataBrowserTableViewRowIndex result = 0; verify_noerr( GetItemRow( itemID, &result ) ) ; event.m_itemIndex = result; - - if (event.m_itemIndex >= 0) - MacGetColumnInfo(event.m_itemIndex,0,event.m_item); } else { event.m_itemIndex = (long)itemID-1; } + event.m_item.m_itemId = event.m_itemIndex; + list->GetItem(event.m_item); switch (message) { -- 2.45.2