From adc1049354d822ec0c2de0577b5cdf6fb55b74d4 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Sat, 2 May 2009 18:55:12 +0000 Subject: [PATCH] Allow m_current to be used for the focused item, and reset the scroll position when removing all items from the data browser control. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@60485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/listctrl_mac.cpp | 10 +++++++++- src/mac/carbon/utils.cpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index 7d82b0996e..2e2334570c 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -620,7 +620,8 @@ void wxListCtrl::OnLeftDown(wxMouseEvent& event) void wxListCtrl::OnDblClick(wxMouseEvent& event) { - m_current = -1; + if ( m_renameTimer->IsRunning() ) + m_renameTimer->Stop(); event.Skip(); } @@ -1659,6 +1660,9 @@ long wxListCtrl::GetNextItem(long item, int geom, int state) const if ( !IsVirtual() ) id = (DataBrowserItemID)m_dbImpl->GetItemFromLine(line); + if ( (state & wxLIST_STATE_FOCUSED) && (m_current == line)) + return line; + if ( (state == wxLIST_STATE_DONTCARE ) ) return line; @@ -1679,6 +1683,9 @@ long wxListCtrl::GetNextItem(long item, int geom, int state) const if ( !IsVirtual() ) id = (DataBrowserItemID)m_dbImpl->GetItemFromLine(line); + if ( (state & wxLIST_STATE_FOCUSED) && (m_current == line)) + return line; + if ( (state == wxLIST_STATE_DONTCARE ) ) return line; @@ -1790,6 +1797,7 @@ bool wxListCtrl::DeleteItem(long item) // Deletes all items bool wxListCtrl::DeleteAllItems() { + m_current = -1; if (m_genericImpl) return m_genericImpl->DeleteAllItems(); diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index f3b85239cd..6e0271ed21 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -2049,6 +2049,7 @@ void wxMacDataItemBrowserControl::RemoveItems(wxMacDataItem *container, wxArrayM void wxMacDataItemBrowserControl::RemoveAllItems(wxMacDataItem *container) { + SetScrollPosition(0, 0); OSStatus err = wxMacDataBrowserControl::RemoveItems( (DataBrowserItemID)container, 0 , NULL , kDataBrowserItemNoProperty ); verify_noerr( err ); }