wxUniversal STL-ification.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-09-13 12:14:20 +00:00
parent 7218d34b0a
commit 18dbdd3c27
2 changed files with 59 additions and 20 deletions

View File

@@ -18,6 +18,7 @@
#include "wx/scrolwin.h" // for wxScrollHelper
#include "wx/dynarray.h"
#include "wx/arrstr.h"
// ----------------------------------------------------------------------------
// the actions supported by this control
@@ -85,11 +86,11 @@ 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)[n]; }
virtual void SetString(int n, const wxString& s);
virtual int FindString(const wxString& s) const
{ return m_strings.Index(s); }
{ return IsSorted() ? m_stringsSorted->Index(s) : m_strings->Index(s); }
virtual bool IsSelected(int n) const
{ return m_selections.Index(n) != wxNOT_FOUND; }
@@ -223,8 +224,14 @@ protected:
void UpdateItems();
// the array containing all items (it is sorted if the listbox has
// wxLB_SORT style)
wxArrayString m_strings;
// 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;
};
// this array contains the indices of the selected items (for the single
// selection listboxes only the first element of it is used and contains