Sorting fixes to wxUniv wxCombo/ListBox [part of bug #1040593].

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-11-19 20:38:04 +00:00
parent b8a9578b80
commit e1d6e01c88
3 changed files with 37 additions and 40 deletions

View File

@@ -102,11 +102,13 @@ public:
virtual void Clear();
virtual void Delete(int n);
virtual int GetCount() const { return (int)m_strings->GetCount(); }
virtual wxString GetString(int n) const { return (*m_strings)[n]; }
virtual int GetCount() const
{ return (int)m_strings->GetCount(); }
virtual wxString GetString(int n) const
{ return m_strings->Item(n); }
virtual void SetString(int n, const wxString& s);
virtual int FindString(const wxString& s) const
{ return IsSorted() ? m_stringsSorted->Index(s) : m_strings->Index(s); }
{ return m_strings->Index(s); }
virtual bool IsSelected(int n) const
{ return m_selections.Index(n) != wxNOT_FOUND; }
@@ -115,6 +117,7 @@ public:
virtual int GetSelections(wxArrayInt& aSelections) const;
protected:
virtual int DoAppendOnly(const wxString& item);
virtual int DoAppend(const wxString& item);
virtual void DoInsertItems(const wxArrayString& items, int pos);
virtual void DoSetItems(const wxArrayString& items, void **clientData);
@@ -238,14 +241,8 @@ protected:
void UpdateItems();
// the array containing all items (it is sorted if the listbox has
// wxLB_SORT style). Note the evil trick: the pointers share the
// same location, hence we use m_strings when we don't care if the
// array is sorted or not, m_stringsSorted when we do
union
{
wxArrayString* m_strings;
wxSortedArrayString* m_stringsSorted;
};
// wxLB_SORT style)
wxArrayString* m_strings;
// this array contains the indices of the selected items (for the single
// selection listboxes only the first element of it is used and contains