]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/univ/listbox.h
Applied patch [ 827399 ] sqltypes.h included without windows.h under Borland
[wxWidgets.git] / include / wx / univ / listbox.h
index 6f00f1d6c2a65a6515e0d95ff85af71d6029a4d8..06df165a0103bd05c093122540a64c83b694198a 100644 (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
@@ -55,7 +56,7 @@ class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper
 {
 public:
     // ctors and such
-    wxListBox() { Init(); }
+    wxListBox();
     wxListBox(wxWindow *parent,
               wxWindowID id,
               const wxPoint& pos = wxDefaultPosition,
@@ -63,12 +64,7 @@ public:
               int n = 0, const wxString choices[] = (const wxString *) NULL,
               long style = 0,
               const wxValidator& validator = wxDefaultValidator,
-              const wxString& name = wxListBoxNameStr )
-    {
-        Init();
-
-        Create(parent, id, pos, size, n, choices, style, validator, name);
-    }
+              const wxString& name = wxListBoxNameStr );
 
     virtual ~wxListBox();
 
@@ -85,11 +81,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; }
@@ -166,11 +162,9 @@ public:
                                long numArg = 0l,
                                const wxString& strArg = wxEmptyString);
 
-    // let wxColourScheme choose the right colours for us
-    virtual bool IsContainerWindow() const { return TRUE; }
-
     // idle processing
     virtual void OnInternalIdle();
+
 protected:
     // geometry
     virtual wxSize DoGetBestClientSize() const;
@@ -223,8 +217,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