+ wxCHECK_MSG( m_selStore, false,
+ _T("SelectRange() may only be used with multiselection listbox") );
+
+ // make sure items are in correct order
+ if ( from > to )
+ {
+ size_t tmp = from;
+ from = to;
+ to = tmp;
+ }
+
+ wxCHECK_MSG( to < GetItemCount(), false,
+ _T("SelectRange(): invalid item index") );
+
+ wxArrayInt changed;
+ if ( !m_selStore->SelectRange(from, to, true, &changed) )
+ {
+ // too many items have changed, we didn't record them in changed array
+ // so we have no choice but to refresh everything between from and to
+ RefreshLines(from, to);
+ }
+ else // we've got the indices of the changed items
+ {
+ const size_t count = changed.GetCount();
+ if ( !count )
+ {
+ // nothing changed
+ return false;
+ }
+
+ // refresh just the lines which have really changed
+ for ( size_t n = 0; n < count; n++ )
+ {
+ RefreshLine(changed[n]);
+ }
+ }
+
+ // something changed
+ return true;
+}
+
+bool wxVListBox::DoSelectAll(bool select)
+{
+ wxCHECK_MSG( m_selStore, false,
+ _T("SelectAll may only be used with multiselection listbox") );
+
+ size_t count = GetItemCount();
+ if ( count )
+ {
+ wxArrayInt changed;
+ if ( !m_selStore->SelectRange(0, count - 1, select) ||
+ !changed.IsEmpty() )
+ {
+ Refresh();
+
+ // something changed
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool wxVListBox::DoSetCurrent(int current)
+{
+ wxASSERT_MSG( current == wxNOT_FOUND ||
+ (current >= 0 && (size_t)current < GetItemCount()),
+ _T("wxVListBox::DoSetCurrent(): invalid item index") );
+
+ if ( current == m_current )