X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18dbdd3c2785b504c02ebf3739503a0183cae39b..e5d92e2bef8fed2f3fabaf9662902eb7189f5f92:/include/wx/univ/listbox.h?ds=sidebyside diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index 07bbd27a55..d837a94b04 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" @@ -70,6 +66,14 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ); virtual ~wxListBox(); @@ -81,24 +85,35 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // implement the listbox interface defined by wxListBoxBase 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); } + 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 void DoSetSelection(int n, bool select); virtual int GetSelection() const; 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); @@ -131,10 +146,10 @@ public: void Activate(int item = -1); // select or unselect the specified or current (if -1) item - void DoSelect(int item = -1, bool sel = TRUE); + void DoSelect(int item = -1, bool sel = true); // more readable wrapper - void DoUnselect(int item) { DoSelect(item, FALSE); } + void DoUnselect(int item) { DoSelect(item, false); } // select an item and send a notification about it void SelectAndNotify(int item); @@ -143,10 +158,10 @@ public: virtual void EnsureVisible(int n); // find the first item [strictly] after the current one which starts with - // the given string and make it the current one, return TRUE if the current + // the given string and make it the current one, return true if the current // item changed - bool FindItem(const wxString& prefix, bool strictlyAfter = FALSE); - bool FindNextItem(const wxString& prefix) { return FindItem(prefix, TRUE); } + bool FindItem(const wxString& prefix, bool strictlyAfter = false); + bool FindNextItem(const wxString& prefix) { return FindItem(prefix, true); } // extend the selection to span the range from the anchor (see below) to // the specified or current item @@ -167,11 +182,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; @@ -224,14 +237,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 @@ -292,11 +299,11 @@ class WXDLLEXPORT wxStdListboxInputHandler : public wxStdInputHandler { public: // if pressing the mouse button in a multiselection listbox should toggle - // the item under mouse immediately, then specify TRUE as the second + // the item under mouse immediately, then specify true as the second // parameter (this is the standard behaviour, under GTK the item is toggled // only when the mouse is released in the multi selection listbox) wxStdListboxInputHandler(wxInputHandler *inphand, - bool toggleOnPressAlways = TRUE); + bool toggleOnPressAlways = true); // base class methods virtual bool HandleKey(wxInputConsumer *consumer, @@ -314,7 +321,7 @@ protected: // parts of HitTest(): first finds the pseudo (because not in range) index // of the item and the second one adjusts it if necessary - that is if the - // third one returns FALSE + // third one returns false int HitTestUnsafe(const wxListBox *listbox, const wxMouseEvent& event); int FixItemIndex(const wxListBox *listbox, int item); bool IsValidIndex(const wxListBox *listbox, int item);