]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bmpcbox.h | |
e54c96f1 | 3 | // Purpose: interface of wxBitmapComboBox |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxBitmapComboBox | |
7c913512 | 10 | |
23324ae1 FM |
11 | A combobox that displays bitmap in front of the list items. |
12 | It currently only allows using bitmaps of one size, and resizes itself | |
13 | so that a bitmap can be shown next to the text field. | |
7c913512 | 14 | |
8024723d FM |
15 | @remarks |
16 | While wxBitmapComboBox contains the wxComboBox API, but it might not actually | |
17 | be derived from that class. In fact, if the platform does not have a native | |
18 | implementation, wxBitmapComboBox will inherit from wxOwnerDrawnComboBox. | |
19 | You can determine if the implementation is generic by checking whether | |
516d86de RR |
20 | @c wxGENERIC_BITMAPCOMBOBOX is defined. Currently wxBitmapComboBox is |
21 | implemented natively for MSW and GTK+. | |
8024723d | 22 | |
23324ae1 | 23 | @beginStyleTable |
8c6791e4 | 24 | @style{wxCB_READONLY} |
23324ae1 FM |
25 | Creates a combobox without a text editor. On some platforms the |
26 | control may appear very different when this style is used. | |
8c6791e4 | 27 | @style{wxCB_SORT} |
23324ae1 | 28 | Sorts the entries in the list alphabetically. |
8c6791e4 | 29 | @style{wxTE_PROCESS_ENTER} |
ce7fe42e | 30 | The control will generate the event wxEVT_TEXT_ENTER |
23324ae1 | 31 | (otherwise pressing Enter key is either processed internally by the |
8024723d FM |
32 | control or used for navigation between dialog controls). |
33 | Windows only. | |
23324ae1 | 34 | @endStyleTable |
7c913512 | 35 | |
8024723d FM |
36 | @todo create wxCB_PROCESS_ENTER rather than reusing wxTE_PROCESS_ENTER! |
37 | ||
3051a44a | 38 | @beginEventEmissionTable{wxCommandEvent} |
8c6791e4 | 39 | @event{EVT_COMBOBOX(id, func)} |
ce7fe42e | 40 | Process a @c wxEVT_COMBOBOX event, when an item on |
23324ae1 | 41 | the list is selected. |
8c6791e4 | 42 | @event{EVT_TEXT(id, func)} |
ce7fe42e | 43 | Process a @c wxEVT_TEXT event, when the combobox text changes. |
8c6791e4 | 44 | @event{EVT_TEXT_ENTER(id, func)} |
ce7fe42e | 45 | Process a @c wxEVT_TEXT_ENTER event, when RETURN is pressed in |
23324ae1 FM |
46 | the combobox. |
47 | @endEventTable | |
7c913512 | 48 | |
23324ae1 FM |
49 | @library{wxadv} |
50 | @category{ctrl} | |
ce154616 | 51 | @appearance{bitmapcombobox} |
7c913512 | 52 | |
e54c96f1 | 53 | @see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent |
23324ae1 FM |
54 | */ |
55 | class wxBitmapComboBox : public wxComboBox | |
56 | { | |
57 | public: | |
8024723d FM |
58 | /** |
59 | Default ctor. | |
60 | */ | |
61 | wxBitmapComboBox(); | |
62 | ||
23324ae1 FM |
63 | /** |
64 | Constructor, creating and showing a combobox. | |
8024723d | 65 | |
7c913512 | 66 | @param parent |
4cc4bfaf | 67 | Parent window. Must not be @NULL. |
7c913512 | 68 | @param id |
4cc4bfaf | 69 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 70 | @param value |
4cc4bfaf | 71 | Initial selection string. An empty string indicates no selection. |
77bfb902 FM |
72 | @param pos |
73 | Initial position. | |
74 | @param size | |
75 | Initial size. | |
7c913512 | 76 | @param n |
4cc4bfaf | 77 | Number of strings with which to initialise the control. |
7c913512 | 78 | @param choices |
4cc4bfaf | 79 | An array of strings with which to initialise the control. |
77bfb902 FM |
80 | @param style |
81 | The window style, see wxCB_* flags. | |
82 | @param validator | |
83 | Validator which can be used for additional data checks. | |
84 | @param name | |
85 | Control name. | |
8024723d | 86 | |
4cc4bfaf | 87 | @see Create(), wxValidator |
23324ae1 | 88 | */ |
bc35c728 FM |
89 | wxBitmapComboBox(wxWindow* parent, wxWindowID id = wxID_ANY, |
90 | const wxString& value = wxEmptyString, | |
7c913512 FM |
91 | const wxPoint& pos = wxDefaultPosition, |
92 | const wxSize& size = wxDefaultSize, | |
93 | int n = 0, | |
4cc4bfaf | 94 | const wxString choices[] = NULL, |
7c913512 FM |
95 | long style = 0, |
96 | const wxValidator& validator = wxDefaultValidator, | |
bc35c728 | 97 | const wxString& name = wxBitmapComboBoxNameStr); |
516d86de RR |
98 | |
99 | /** | |
100 | Constructor, creating and showing a combobox. | |
101 | ||
102 | @param parent | |
103 | Parent window. Must not be @NULL. | |
104 | @param id | |
105 | Window identifier. The value wxID_ANY indicates a default value. | |
106 | @param value | |
107 | Initial selection string. An empty string indicates no selection. | |
77bfb902 FM |
108 | @param pos |
109 | Initial position. | |
110 | @param size | |
111 | Initial size. | |
516d86de RR |
112 | @param choices |
113 | An wxArrayString with which to initialise the control. | |
77bfb902 FM |
114 | @param style |
115 | The window style, see wxCB_* flags. | |
116 | @param validator | |
117 | Validator which can be used for additional data checks. | |
118 | @param name | |
119 | Control name. | |
516d86de RR |
120 | |
121 | @see Create(), wxValidator | |
122 | */ | |
7c913512 FM |
123 | wxBitmapComboBox(wxWindow* parent, wxWindowID id, |
124 | const wxString& value, | |
125 | const wxPoint& pos, | |
126 | const wxSize& size, | |
127 | const wxArrayString& choices, | |
bc35c728 | 128 | long style, |
7c913512 | 129 | const wxValidator& validator = wxDefaultValidator, |
bc35c728 | 130 | const wxString& name = wxBitmapComboBoxNameStr); |
23324ae1 FM |
131 | |
132 | /** | |
133 | Destructor, destroying the combobox. | |
134 | */ | |
d2aa927a | 135 | virtual ~wxBitmapComboBox(); |
23324ae1 | 136 | |
23324ae1 | 137 | /** |
8024723d | 138 | Adds the item to the end of the combo box. |
23324ae1 FM |
139 | */ |
140 | int Append(const wxString& item, | |
141 | const wxBitmap& bitmap = wxNullBitmap); | |
8024723d | 142 | |
8024723d | 143 | /** |
516d86de | 144 | Adds the item to the end of the combo box, associating the given |
8024723d FM |
145 | untyped, client data pointer @a clientData with the item. |
146 | */ | |
7c913512 | 147 | int Append(const wxString& item, const wxBitmap& bitmap, |
4cc4bfaf | 148 | void* clientData); |
516d86de RR |
149 | |
150 | /** | |
151 | Adds the item to the end of the combo box, associating the given typed | |
152 | client data pointer @a clientData with the item. | |
153 | */ | |
7c913512 | 154 | int Append(const wxString& item, const wxBitmap& bitmap, |
4cc4bfaf | 155 | wxClientData* clientData); |
23324ae1 | 156 | |
23324ae1 | 157 | /** |
516d86de | 158 | Creates the combobox for two-step construction. |
23324ae1 FM |
159 | */ |
160 | bool Create(wxWindow* parent, wxWindowID id, | |
f910f4d5 FM |
161 | const wxString& value, |
162 | const wxPoint& pos, | |
163 | const wxSize& size, | |
23324ae1 FM |
164 | int n, const wxString choices[], |
165 | long style = 0, | |
166 | const wxValidator& validator = wxDefaultValidator, | |
bc35c728 | 167 | const wxString& name = wxBitmapComboBoxNameStr); |
516d86de RR |
168 | |
169 | /** | |
170 | Creates the combobox for two-step construction. | |
171 | */ | |
7c913512 FM |
172 | bool Create(wxWindow* parent, wxWindowID id, |
173 | const wxString& value, | |
174 | const wxPoint& pos, | |
175 | const wxSize& size, | |
176 | const wxArrayString& choices, | |
177 | long style = 0, | |
178 | const wxValidator& validator = wxDefaultValidator, | |
bc35c728 | 179 | const wxString& name = wxBitmapComboBoxNameStr); |
23324ae1 FM |
180 | |
181 | /** | |
60b71826 FM |
182 | Returns the size of the bitmaps used in the combo box. |
183 | If the combo box is empty, then ::wxDefaultSize is returned. | |
23324ae1 | 184 | */ |
1413ac04 | 185 | virtual wxSize GetBitmapSize() const; |
23324ae1 FM |
186 | |
187 | /** | |
188 | Returns the bitmap of the item with the given index. | |
189 | */ | |
1413ac04 | 190 | virtual wxBitmap GetItemBitmap(unsigned int n) const; |
23324ae1 | 191 | |
8024723d FM |
192 | /** |
193 | Inserts the item into the list before @a pos. | |
194 | Not valid for @c wxCB_SORT style, use Append() instead. | |
195 | */ | |
196 | int Insert(const wxString& item, const wxBitmap& bitmap, | |
197 | unsigned int pos); | |
198 | ||
23324ae1 | 199 | /** |
516d86de | 200 | Inserts the item into the list before pos, associating the given |
23324ae1 | 201 | untyped, client data pointer with the item. |
8024723d | 202 | Not valid for @c wxCB_SORT style, use Append() instead. |
23324ae1 | 203 | */ |
7c913512 FM |
204 | int Insert(const wxString& item, const wxBitmap& bitmap, |
205 | unsigned int pos, | |
4cc4bfaf | 206 | void* clientData); |
516d86de RR |
207 | |
208 | /** | |
209 | Inserts the item into the list before pos, associating the given typed | |
210 | client data pointer with the item. | |
211 | Not valid for @c wxCB_SORT style, use Append() instead. | |
212 | */ | |
7c913512 FM |
213 | int Insert(const wxString& item, const wxBitmap& bitmap, |
214 | unsigned int pos, | |
4cc4bfaf | 215 | wxClientData* clientData); |
23324ae1 FM |
216 | |
217 | /** | |
218 | Sets the bitmap for the given item. | |
219 | */ | |
1413ac04 | 220 | virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap); |
23324ae1 | 221 | }; |
e54c96f1 | 222 |