]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/bmpcbox.h
add wxVector(size_t size[, const value_type& value]) ctors
[wxWidgets.git] / interface / wx / bmpcbox.h
CommitLineData
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}
7e59b885 52 @appearance{bitmapcombobox.png}
7c913512 53
e54c96f1 54 @see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
23324ae1
FM
55*/
56class wxBitmapComboBox : public wxComboBox
57{
58public:
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.
77bfb902
FM
73 @param pos
74 Initial position.
75 @param size
76 Initial size.
7c913512 77 @param n
4cc4bfaf 78 Number of strings with which to initialise the control.
7c913512 79 @param choices
4cc4bfaf 80 An array of strings with which to initialise the control.
77bfb902
FM
81 @param style
82 The window style, see wxCB_* flags.
83 @param validator
84 Validator which can be used for additional data checks.
85 @param name
86 Control name.
8024723d 87
4cc4bfaf 88 @see Create(), wxValidator
23324ae1 89 */
bc35c728
FM
90 wxBitmapComboBox(wxWindow* parent, wxWindowID id = wxID_ANY,
91 const wxString& value = wxEmptyString,
7c913512
FM
92 const wxPoint& pos = wxDefaultPosition,
93 const wxSize& size = wxDefaultSize,
94 int n = 0,
4cc4bfaf 95 const wxString choices[] = NULL,
7c913512
FM
96 long style = 0,
97 const wxValidator& validator = wxDefaultValidator,
bc35c728 98 const wxString& name = wxBitmapComboBoxNameStr);
516d86de
RR
99
100 /**
101 Constructor, creating and showing a combobox.
102
103 @param parent
104 Parent window. Must not be @NULL.
105 @param id
106 Window identifier. The value wxID_ANY indicates a default value.
107 @param value
108 Initial selection string. An empty string indicates no selection.
77bfb902
FM
109 @param pos
110 Initial position.
111 @param size
112 Initial size.
516d86de
RR
113 @param choices
114 An wxArrayString with which to initialise the control.
77bfb902
FM
115 @param style
116 The window style, see wxCB_* flags.
117 @param validator
118 Validator which can be used for additional data checks.
119 @param name
120 Control name.
516d86de
RR
121
122 @see Create(), wxValidator
123 */
7c913512
FM
124 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
125 const wxString& value,
126 const wxPoint& pos,
127 const wxSize& size,
128 const wxArrayString& choices,
bc35c728 129 long style,
7c913512 130 const wxValidator& validator = wxDefaultValidator,
bc35c728 131 const wxString& name = wxBitmapComboBoxNameStr);
23324ae1
FM
132
133 /**
134 Destructor, destroying the combobox.
135 */
d2aa927a 136 virtual ~wxBitmapComboBox();
23324ae1 137
23324ae1 138 /**
8024723d 139 Adds the item to the end of the combo box.
23324ae1
FM
140 */
141 int Append(const wxString& item,
142 const wxBitmap& bitmap = wxNullBitmap);
8024723d 143
8024723d 144 /**
516d86de 145 Adds the item to the end of the combo box, associating the given
8024723d
FM
146 untyped, client data pointer @a clientData with the item.
147 */
7c913512 148 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 149 void* clientData);
516d86de
RR
150
151 /**
152 Adds the item to the end of the combo box, associating the given typed
153 client data pointer @a clientData with the item.
154 */
7c913512 155 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 156 wxClientData* clientData);
23324ae1 157
23324ae1 158 /**
516d86de 159 Creates the combobox for two-step construction.
23324ae1
FM
160 */
161 bool Create(wxWindow* parent, wxWindowID id,
f910f4d5
FM
162 const wxString& value,
163 const wxPoint& pos,
164 const wxSize& size,
23324ae1
FM
165 int n, const wxString choices[],
166 long style = 0,
167 const wxValidator& validator = wxDefaultValidator,
bc35c728 168 const wxString& name = wxBitmapComboBoxNameStr);
516d86de
RR
169
170 /**
171 Creates the combobox for two-step construction.
172 */
7c913512
FM
173 bool Create(wxWindow* parent, wxWindowID id,
174 const wxString& value,
175 const wxPoint& pos,
176 const wxSize& size,
177 const wxArrayString& choices,
178 long style = 0,
179 const wxValidator& validator = wxDefaultValidator,
bc35c728 180 const wxString& name = wxBitmapComboBoxNameStr);
23324ae1
FM
181
182 /**
60b71826
FM
183 Returns the size of the bitmaps used in the combo box.
184 If the combo box is empty, then ::wxDefaultSize is returned.
23324ae1 185 */
1413ac04 186 virtual wxSize GetBitmapSize() const;
23324ae1
FM
187
188 /**
189 Returns the bitmap of the item with the given index.
190 */
1413ac04 191 virtual wxBitmap GetItemBitmap(unsigned int n) const;
23324ae1 192
8024723d
FM
193 /**
194 Inserts the item into the list before @a pos.
195 Not valid for @c wxCB_SORT style, use Append() instead.
196 */
197 int Insert(const wxString& item, const wxBitmap& bitmap,
198 unsigned int pos);
199
23324ae1 200 /**
516d86de 201 Inserts the item into the list before pos, associating the given
23324ae1 202 untyped, client data pointer with the item.
8024723d 203 Not valid for @c wxCB_SORT style, use Append() instead.
23324ae1 204 */
7c913512
FM
205 int Insert(const wxString& item, const wxBitmap& bitmap,
206 unsigned int pos,
4cc4bfaf 207 void* clientData);
516d86de
RR
208
209 /**
210 Inserts the item into the list before pos, associating the given typed
211 client data pointer with the item.
212 Not valid for @c wxCB_SORT style, use Append() instead.
213 */
7c913512
FM
214 int Insert(const wxString& item, const wxBitmap& bitmap,
215 unsigned int pos,
4cc4bfaf 216 wxClientData* clientData);
23324ae1
FM
217
218 /**
219 Sets the bitmap for the given item.
220 */
1413ac04 221 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
23324ae1 222};
e54c96f1 223