]> git.saurik.com Git - wxWidgets.git/blame - interface/bmpcbox.h
More interface header reviews by Azriel Fasten, and added skeleton docs for wxBookCtr...
[wxWidgets.git] / interface / 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
11 @wxheader{bmpcbox.h}
7c913512 12
23324ae1
FM
13 A combobox that displays bitmap in front of the list items.
14 It currently only allows using bitmaps of one size, and resizes itself
15 so that a bitmap can be shown next to the text field.
7c913512 16
8024723d
FM
17 @remarks
18 While wxBitmapComboBox contains the wxComboBox API, but it might not actually
19 be derived from that class. In fact, if the platform does not have a native
20 implementation, wxBitmapComboBox will inherit from wxOwnerDrawnComboBox.
21 You can determine if the implementation is generic by checking whether
22 @c wxGENERIC_BITMAPCOMBOBOX is defined.
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*/
56class wxBitmapComboBox : public wxComboBox
57{
58public:
8024723d
FM
59 /**
60 Default ctor.
61 */
62 wxBitmapComboBox();
63
23324ae1
FM
64 //@{
65 /**
66 Constructor, creating and showing a combobox.
8024723d 67
7c913512 68 @param parent
4cc4bfaf 69 Parent window. Must not be @NULL.
7c913512 70 @param id
4cc4bfaf 71 Window identifier. The value wxID_ANY indicates a default value.
7c913512 72 @param value
4cc4bfaf 73 Initial selection string. An empty string indicates no selection.
7c913512 74 @param pos
4cc4bfaf 75 Window position.
7c913512 76 @param size
8024723d 77 Window size. If wxDefaultSize is specified then the window is sized
4cc4bfaf 78 appropriately.
7c913512 79 @param n
4cc4bfaf 80 Number of strings with which to initialise the control.
7c913512 81 @param choices
4cc4bfaf 82 An array of strings with which to initialise the control.
7c913512 83 @param style
4cc4bfaf 84 Window style. See wxBitmapComboBox.
7c913512 85 @param validator
4cc4bfaf 86 Window validator.
7c913512 87 @param name
4cc4bfaf 88 Window name.
8024723d 89
4cc4bfaf 90 @see Create(), wxValidator
23324ae1 91 */
7c913512
FM
92 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
93 const wxString& value = "",
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 int n = 0,
4cc4bfaf 97 const wxString choices[] = NULL,
7c913512
FM
98 long style = 0,
99 const wxValidator& validator = wxDefaultValidator,
100 const wxString& name = "comboBox");
101 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
102 const wxString& value,
103 const wxPoint& pos,
104 const wxSize& size,
105 const wxArrayString& choices,
106 long style = 0,
107 const wxValidator& validator = wxDefaultValidator,
108 const wxString& name = "comboBox");
23324ae1
FM
109 //@}
110
111 /**
112 Destructor, destroying the combobox.
113 */
d2aa927a 114 virtual ~wxBitmapComboBox();
23324ae1 115
23324ae1 116 /**
8024723d 117 Adds the item to the end of the combo box.
23324ae1
FM
118 */
119 int Append(const wxString& item,
120 const wxBitmap& bitmap = wxNullBitmap);
8024723d
FM
121
122 //@{
123 /**
124 Adds the item to the end of the combo box, associating the given, typed or
125 untyped, client data pointer @a clientData with the item.
126 */
7c913512 127 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 128 void* clientData);
7c913512 129 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 130 wxClientData* clientData);
23324ae1
FM
131 //@}
132
133 //@{
134 /**
135 Creates the combobox for two-step construction. Derived classes
136 should call or replace this function. See wxBitmapComboBox()
137 for further details.
138 */
139 bool Create(wxWindow* parent, wxWindowID id,
140 const wxString& value = "",
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 int n, const wxString choices[],
144 long style = 0,
145 const wxValidator& validator = wxDefaultValidator,
146 const wxString& name = "comboBox");
7c913512
FM
147 bool Create(wxWindow* parent, wxWindowID id,
148 const wxString& value,
149 const wxPoint& pos,
150 const wxSize& size,
151 const wxArrayString& choices,
152 long style = 0,
153 const wxValidator& validator = wxDefaultValidator,
154 const wxString& name = "comboBox");
23324ae1
FM
155 //@}
156
157 /**
158 Returns size of bitmaps used in the list.
159 */
1413ac04 160 virtual wxSize GetBitmapSize() const;
23324ae1
FM
161
162 /**
163 Returns the bitmap of the item with the given index.
164 */
1413ac04 165 virtual wxBitmap GetItemBitmap(unsigned int n) const;
23324ae1 166
8024723d
FM
167 /**
168 Inserts the item into the list before @a pos.
169 Not valid for @c wxCB_SORT style, use Append() instead.
170 */
171 int Insert(const wxString& item, const wxBitmap& bitmap,
172 unsigned int pos);
173
23324ae1
FM
174 //@{
175 /**
176 Inserts the item into the list before pos, associating the given, typed or
177 untyped, client data pointer with the item.
8024723d 178 Not valid for @c wxCB_SORT style, use Append() instead.
23324ae1 179 */
8024723d 180
7c913512
FM
181 int Insert(const wxString& item, const wxBitmap& bitmap,
182 unsigned int pos,
4cc4bfaf 183 void* clientData);
7c913512
FM
184 int Insert(const wxString& item, const wxBitmap& bitmap,
185 unsigned int pos,
4cc4bfaf 186 wxClientData* clientData);
23324ae1
FM
187 //@}
188
189 /**
190 Sets the bitmap for the given item.
191 */
1413ac04 192 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
23324ae1 193};
e54c96f1 194