+bool wxVListBox::IsSelected(size_t line) const
+{
+ return m_selStore ? m_selStore->IsSelected(line) : (int)line == m_current;
+}
+
+bool wxVListBox::Select(size_t item, bool select)
+{
+ wxCHECK_MSG( m_selStore, false,
+ _T("Select() may only be used with multiselection listbox") );
+
+ wxCHECK_MSG( item < GetItemCount(), false,
+ _T("Select(): invalid item index") );
+
+ bool changed = m_selStore->SelectItem(item, select);
+ if ( changed )
+ {
+ // selection really changed
+ RefreshLine(item);
+ }
+
+ DoSetCurrent(item);
+
+ return changed;
+}
+
+bool wxVListBox::SelectRange(size_t from, size_t to)
+{
+ 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)