Apply patch #1626802, which fixes GetNextItem to return -1 instead of 0 when an item can't be found, and add support for wxLIST_NEXT_ABOVE, wxLIST_NEXT_BELOW, and wxLIST_STATE_DONTCARE.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ccf6c43b3d
commit
e5d3d8ad45
@ -1560,19 +1560,43 @@ long wxListCtrl::GetNextItem(long item, int geom, int state) const
|
||||
if (m_genericImpl)
|
||||
return m_genericImpl->GetNextItem(item, geom, state);
|
||||
|
||||
if (m_dbImpl && geom == wxLIST_NEXT_ALL && state == wxLIST_STATE_SELECTED )
|
||||
// TODO: implement all geometry and state options?
|
||||
if ( m_dbImpl )
|
||||
{
|
||||
long count = m_dbImpl->MacGetCount() ;
|
||||
for ( long line = item + 1 ; line < count; line++ )
|
||||
if ( geom == wxLIST_NEXT_ALL || geom == wxLIST_NEXT_BELOW )
|
||||
{
|
||||
wxMacDataItem* id = m_dbImpl->GetItemFromLine(line);
|
||||
if ( m_dbImpl->IsItemSelected(id ) )
|
||||
return line;
|
||||
long count = m_dbImpl->MacGetCount() ;
|
||||
for ( long line = item + 1 ; line < count; line++ )
|
||||
{
|
||||
wxMacDataItem* id = m_dbImpl->GetItemFromLine(line);
|
||||
|
||||
if ( (state == wxLIST_STATE_DONTCARE ) )
|
||||
return line;
|
||||
|
||||
if ( (state & wxLIST_STATE_SELECTED) && m_dbImpl->IsItemSelected( id ) )
|
||||
return line;
|
||||
}
|
||||
}
|
||||
else if ( geom == wxLIST_NEXT_ABOVE )
|
||||
{
|
||||
int item2 = item;
|
||||
if ( item2 == -1 )
|
||||
item2 = m_dbImpl->MacGetCount();
|
||||
|
||||
for ( long line = item2 - 1 ; line >= 0; line-- )
|
||||
{
|
||||
wxMacDataItem* id = m_dbImpl->GetItemFromLine(line);
|
||||
|
||||
if ( (state == wxLIST_STATE_DONTCARE ) )
|
||||
return line;
|
||||
|
||||
if ( (state & wxLIST_STATE_SELECTED) && m_dbImpl->IsItemSelected( id ) )
|
||||
return line;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user