wxListBox::~wxListBox()
{
+ // call this just to free the client data -- and avoid leaking memory
+ DoClear();
}
// ----------------------------------------------------------------------------
void wxListBox::Delete(int n)
{
- wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") );
+ wxCHECK_RET( n >= 0 && n < GetCount(),
+ _T("invalid index in wxListBox::Delete") );
// do it before removing the index as otherwise the last item will not be
// refreshed (as GetCount() will be decremented)
}
}
-void wxListBox::Select(bool sel, int item)
+void wxListBox::DoSelect(int item, bool sel)
{
if ( item != -1 )
{
void wxListBox::SelectAndNotify(int item)
{
- Select(TRUE, item);
+ DoSelect(item);
SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
}
if ( item != -1 )
{
- Select(TRUE, item);
+ DoSelect(item);
SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
}
item = m_current;
if ( IsSelected(item) )
- Unselect(item);
+ DoUnselect(item);
else
SelectAndNotify(item);
}
if ( strArg.empty() )
SelectAndNotify(item);
else
- Select(TRUE, item);
+ DoSelect(item);
}
else if ( action == wxACTION_LISTBOX_SELECTADD )
- Select(TRUE, item);
+ DoSelect(item);
else if ( action == wxACTION_LISTBOX_UNSELECT )
- Select(FALSE, item);
+ DoUnselect(item);
else if ( action == wxACTION_LISTBOX_MOVEDOWN )
ChangeCurrent(1);
else if ( action == wxACTION_LISTBOX_MOVEUP )