]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/mac/carbon/listbox.h |
8cf73271 SC |
3 | // Purpose: wxListBox class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
8cf73271 SC |
12 | #ifndef _WX_LISTBOX_H_ |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
8cf73271 SC |
15 | // ---------------------------------------------------------------------------- |
16 | // simple types | |
17 | // ---------------------------------------------------------------------------- | |
18 | #include "wx/dynarray.h" | |
19 | #include "wx/arrstr.h" | |
20 | ||
8cf73271 SC |
21 | // forward decl for GetSelections() |
22 | class wxArrayInt; | |
23 | ||
e2bc1d69 KO |
24 | // forward decl for wxMacListControl data type. |
25 | class wxMacListControl; | |
ba5b8a68 | 26 | |
8cf73271 SC |
27 | // List box item |
28 | ||
12cb7591 | 29 | WX_DEFINE_ARRAY( char* , wxListDataArray ); |
8cf73271 SC |
30 | |
31 | // ---------------------------------------------------------------------------- | |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
53a2db12 | 35 | class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase |
8cf73271 SC |
36 | { |
37 | public: | |
38 | // ctors and such | |
39 | wxListBox(); | |
12cb7591 DS |
40 | |
41 | wxListBox( | |
42 | wxWindow *parent, | |
c82af6ee | 43 | wxWindowID winid, |
12cb7591 DS |
44 | const wxPoint& pos = wxDefaultPosition, |
45 | const wxSize& size = wxDefaultSize, | |
46 | int n = 0, const wxString choices[] = NULL, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxListBoxNameStr) | |
8cf73271 | 50 | { |
c82af6ee | 51 | Create(parent, winid, pos, size, n, choices, style, validator, name); |
8cf73271 | 52 | } |
12cb7591 DS |
53 | |
54 | wxListBox( | |
55 | wxWindow *parent, | |
c82af6ee | 56 | wxWindowID winid, |
12cb7591 DS |
57 | const wxPoint& pos, |
58 | const wxSize& size, | |
59 | const wxArrayString& choices, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxListBoxNameStr) | |
8cf73271 | 63 | { |
c82af6ee | 64 | Create(parent, winid, pos, size, choices, style, validator, name); |
8cf73271 SC |
65 | } |
66 | ||
12cb7591 DS |
67 | bool Create( |
68 | wxWindow *parent, | |
c82af6ee | 69 | wxWindowID winid, |
12cb7591 DS |
70 | const wxPoint& pos = wxDefaultPosition, |
71 | const wxSize& size = wxDefaultSize, | |
72 | int n = 0, | |
73 | const wxString choices[] = NULL, | |
74 | long style = 0, | |
75 | const wxValidator& validator = wxDefaultValidator, | |
76 | const wxString& name = wxListBoxNameStr); | |
77 | ||
78 | bool Create( | |
79 | wxWindow *parent, | |
c82af6ee | 80 | wxWindowID winid, |
12cb7591 DS |
81 | const wxPoint& pos, |
82 | const wxSize& size, | |
83 | const wxArrayString& choices, | |
84 | long style = 0, | |
85 | const wxValidator& validator = wxDefaultValidator, | |
86 | const wxString& name = wxListBoxNameStr); | |
8cf73271 SC |
87 | |
88 | virtual ~wxListBox(); | |
de1b0aeb | 89 | |
8cf73271 | 90 | // implement base class pure virtuals |
12cb7591 | 91 | virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); |
8cf73271 | 92 | |
aa61d352 VZ |
93 | virtual unsigned int GetCount() const; |
94 | virtual wxString GetString(unsigned int n) const; | |
95 | virtual void SetString(unsigned int n, const wxString& s); | |
853dcc57 | 96 | virtual int FindString(const wxString& s, bool bCase = false) const; |
8cf73271 SC |
97 | |
98 | virtual bool IsSelected(int n) const; | |
8cf73271 SC |
99 | virtual int GetSelection() const; |
100 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
101 | ||
c82af6ee SC |
102 | virtual void EnsureVisible(int n); |
103 | ||
5c66d7f7 VS |
104 | virtual wxVisualAttributes GetDefaultAttributes() const |
105 | { | |
106 | return GetClassDefaultAttributes(GetWindowVariant()); | |
107 | } | |
108 | ||
8cf73271 | 109 | // wxCheckListBox support |
b6a20a20 RD |
110 | static wxVisualAttributes |
111 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
54933611 | 112 | |
c82af6ee SC |
113 | wxMacListControl* GetPeer() const; |
114 | ||
8cf73271 | 115 | protected: |
4e7b25f0 PC |
116 | virtual void DoClear(); |
117 | virtual void DoDeleteOneItem(unsigned int n); | |
118 | ||
54933611 | 119 | // from wxItemContainer |
a236aa20 VZ |
120 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
121 | unsigned int pos, | |
122 | void **clientData, wxClientDataType type); | |
123 | ||
aa61d352 VZ |
124 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
125 | virtual void* DoGetItemClientData(unsigned int n) const; | |
c82af6ee SC |
126 | |
127 | // from wxListBoxBase | |
128 | virtual void DoSetSelection(int n, bool select); | |
c82af6ee | 129 | virtual void DoSetFirstItem(int n); |
c00fed0e | 130 | virtual int DoListHitTest(const wxPoint& point) const; |
6f02a879 | 131 | |
8cf73271 | 132 | // free memory (common part of Clear() and dtor) |
de1b0aeb | 133 | // prevent collision with some BSD definitions of macro Free() |
8cf73271 SC |
134 | void FreeData(); |
135 | ||
c82af6ee | 136 | virtual wxSize DoGetBestSize() const; |
8cf73271 | 137 | |
8cf73271 SC |
138 | private: |
139 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
140 | DECLARE_EVENT_TABLE() | |
141 | }; | |
142 | ||
de1b0aeb | 143 | #endif // _WX_LISTBOX_H_ |