fixed GetNextItem(item = -1)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2331,21 +2331,31 @@ void wxListMainWindow::RealizeChanges( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxListMainWindow::GetNextItem( long item, int WXUNUSED(geometry), int state )
|
long wxListMainWindow::GetNextItem( long item,
|
||||||
|
int WXUNUSED(geometry),
|
||||||
|
int state )
|
||||||
{
|
{
|
||||||
long ret = 0;
|
long ret = item;
|
||||||
if (item > 0) ret = item;
|
wxCHECK_MSG( ret < GetItemCount(), -1, _T("invalid listctrl index") );
|
||||||
if(ret >= GetItemCount()) return -1;
|
|
||||||
|
// notice that we start with the next item (or the first one if item == -1)
|
||||||
|
// and this is intentional to allow writing a simple loop to iterate over
|
||||||
|
// all selected items
|
||||||
wxNode *node = m_lines.Nth( (size_t)++ret );
|
wxNode *node = m_lines.Nth( (size_t)++ret );
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxListLineData *line = (wxListLineData*)node->Data();
|
wxListLineData *line = (wxListLineData*)node->Data();
|
||||||
if ((state & wxLIST_STATE_FOCUSED) && (line == m_current)) return ret;
|
if ((state & wxLIST_STATE_FOCUSED) && (line == m_current))
|
||||||
if ((state & wxLIST_STATE_SELECTED) && (line->IsHilighted())) return ret;
|
return ret;
|
||||||
if (!state) return ret;
|
if ((state & wxLIST_STATE_SELECTED) && (line->IsHilighted()))
|
||||||
|
return ret;
|
||||||
|
if (!state)
|
||||||
|
return ret;
|
||||||
ret++;
|
ret++;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user