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