X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9467bdb7f5bfde9f99331097daacb93564ca122e..4f2511d706e5274a34e1521e11c1b95fed735b42:/include/wx/univ/listbox.h diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index 2edbdc1003..f70d98abc9 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -48,7 +48,7 @@ // wxListBox: a list of selectable items // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxListBox : public wxListBoxBase, public wxScrollHelper +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase, public wxScrollHelper { public: // ctors and such @@ -96,16 +96,13 @@ public: const wxString& name = wxListBoxNameStr); // implement the listbox interface defined by wxListBoxBase - virtual void Clear(); - virtual void Delete(unsigned int n); + virtual void DoClear(); + virtual void DoDeleteOneItem(unsigned int n); - virtual unsigned int GetCount() const - { return (unsigned int)m_strings->GetCount(); } - virtual wxString GetString(unsigned int n) const - { return m_strings->Item(n); } + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; 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 int FindString(const wxString& s, bool bCase = false) const; virtual bool IsSelected(int n) const { return m_selections.Index(n) != wxNOT_FOUND; } @@ -114,17 +111,19 @@ public: 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, unsigned int pos); - virtual void DoSetItems(const wxArrayString& items, void **clientData); + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, + wxClientDataType type); + + // universal wxComboBox implementation internally uses wxListBox + friend class WXDLLIMPEXP_FWD_CORE wxComboBox; virtual void DoSetFirstItem(int n); 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 @@ -202,15 +201,17 @@ protected: virtual void DoDraw(wxControlRenderer *renderer); virtual wxBorder GetDefaultBorder() const; + // special hook for wxCheckListBox which allows it to update its internal + // data when a new item is inserted into the listbox + virtual void OnItemInserted(unsigned int WXUNUSED(pos)) { } + + // common part of all ctors void Init(); // event handlers void OnSize(wxSizeEvent& event); - // common part of Clear() and DoSetItems(): clears everything - virtual void DoClear(); - // refresh the given item(s) or everything void RefreshItems(int from, int count); void RefreshItem(int n); @@ -245,7 +246,11 @@ protected: // the array containing all items (it is sorted if the listbox has // wxLB_SORT style) - wxArrayString* m_strings; + union + { + wxArrayString *unsorted; + wxSortedArrayString *sorted; + } 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