]> git.saurik.com Git - wxWidgets.git/blob - interface/bmpcbox.h
Finished initial review of a few [g*] interface headers.
[wxWidgets.git] / interface / bmpcbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: bmpcbox.h
3 // Purpose: interface of wxBitmapComboBox
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxBitmapComboBox
11 @wxheader{bmpcbox.h}
12
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.
16
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
24 @beginStyleTable
25 @style{wxCB_READONLY}
26 Creates a combobox without a text editor. On some platforms the
27 control may appear very different when this style is used.
28 @style{wxCB_SORT}
29 Sorts the entries in the list alphabetically.
30 @style{wxTE_PROCESS_ENTER}
31 The control will generate the event wxEVT_COMMAND_TEXT_ENTER
32 (otherwise pressing Enter key is either processed internally by the
33 control or used for navigation between dialog controls).
34 Windows only.
35 @endStyleTable
36
37 @todo create wxCB_PROCESS_ENTER rather than reusing wxTE_PROCESS_ENTER!
38
39 @beginEventTable{wxCommandEvent}
40 @event{EVT_COMBOBOX(id, func)}
41 Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
42 the list is selected.
43 @event{EVT_TEXT(id, func)}
44 Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text changes.
45 @event{EVT_TEXT_ENTER(id, func)}
46 Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
47 the combobox.
48 @endEventTable
49
50 @library{wxadv}
51 @category{ctrl}
52 @appearance{bitmapcombobox.png}
53
54 @see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
55 */
56 class wxBitmapComboBox : public wxComboBox
57 {
58 public:
59 /**
60 Default ctor.
61 */
62 wxBitmapComboBox();
63
64 //@{
65 /**
66 Constructor, creating and showing a combobox.
67
68 @param parent
69 Parent window. Must not be @NULL.
70 @param id
71 Window identifier. The value wxID_ANY indicates a default value.
72 @param value
73 Initial selection string. An empty string indicates no selection.
74 @param pos
75 Window position.
76 @param size
77 Window size. If wxDefaultSize is specified then the window is sized
78 appropriately.
79 @param n
80 Number of strings with which to initialise the control.
81 @param choices
82 An array of strings with which to initialise the control.
83 @param style
84 Window style. See wxBitmapComboBox.
85 @param validator
86 Window validator.
87 @param name
88 Window name.
89
90 @see Create(), wxValidator
91 */
92 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
93 const wxString& value = "",
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 int n = 0,
97 const wxString choices[] = NULL,
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");
109 //@}
110
111 /**
112 Destructor, destroying the combobox.
113 */
114 virtual ~wxBitmapComboBox();
115
116 /**
117 Adds the item to the end of the combo box.
118 */
119 int Append(const wxString& item,
120 const wxBitmap& bitmap = wxNullBitmap);
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 */
127 int Append(const wxString& item, const wxBitmap& bitmap,
128 void* clientData);
129 int Append(const wxString& item, const wxBitmap& bitmap,
130 wxClientData* clientData);
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");
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");
155 //@}
156
157 /**
158 Returns size of bitmaps used in the list.
159 */
160 virtual wxSize GetBitmapSize() const;
161
162 /**
163 Returns the bitmap of the item with the given index.
164 */
165 virtual wxBitmap GetItemBitmap(unsigned int n) const;
166
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
174 //@{
175 /**
176 Inserts the item into the list before pos, associating the given, typed or
177 untyped, client data pointer with the item.
178 Not valid for @c wxCB_SORT style, use Append() instead.
179 */
180
181 int Insert(const wxString& item, const wxBitmap& bitmap,
182 unsigned int pos,
183 void* clientData);
184 int Insert(const wxString& item, const wxBitmap& bitmap,
185 unsigned int pos,
186 wxClientData* clientData);
187 //@}
188
189 /**
190 Sets the bitmap for the given item.
191 */
192 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
193 };
194