X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a290fa5a7deebe9d96c0c0089d18e27d4bd9b624..6a5c9b3ff71334ed30bd9ae15425a1ca8ae71174:/include/wx/univ/listbox.h?ds=inline diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index e47013efdd..837095cc86 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -12,10 +12,6 @@ #ifndef _WX_UNIV_LISTBOX_H_ #define _WX_UNIV_LISTBOX_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "univlistbox.h" -#endif - #include "wx/scrolwin.h" // for wxScrollHelper #include "wx/dynarray.h" #include "wx/arrstr.h" @@ -56,7 +52,7 @@ class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper { public: // ctors and such - wxListBox() { Init(); } + wxListBox() : wxScrollHelper(this) { Init(); } wxListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -65,6 +61,7 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr ) + : wxScrollHelper(this) { Init(); @@ -100,31 +97,34 @@ public: // implement the listbox interface defined by wxListBoxBase virtual void Clear(); - virtual void Delete(int n); + virtual void Delete(unsigned int 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 IsSorted() ? m_stringsSorted->Index(s) : m_strings->Index(s); } + virtual unsigned int GetCount() const + { return (unsigned int)m_strings->GetCount(); } + virtual wxString GetString(unsigned int n) const + { return m_strings->Item(n); } + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const + { return m_strings->Index(s, bCase); } virtual bool IsSelected(int n) const { return m_selections.Index(n) != wxNOT_FOUND; } - virtual void SetSelection(int n, bool select = true); virtual int GetSelection() const; virtual int GetSelections(wxArrayInt& aSelections) const; protected: + virtual void DoSetSelection(int n, bool select); + virtual int DoAppendOnly(const wxString& item); virtual int DoAppend(const wxString& item); - virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); virtual void DoSetItems(const wxArrayString& items, void **clientData); virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(int n, void* clientData); - virtual void* DoGetItemClientData(int n) const; - virtual void DoSetItemClientObject(int n, wxClientData* clientData); - virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; public: // override some more base class methods @@ -238,14 +238,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