]> git.saurik.com Git - wxWidgets.git/blame - interface/bmpcbox.h
use a different method to prevent an early size_allocate,
[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
23324ae1
FM
17 @beginStyleTable
18 @style{wxCB_READONLY}:
19 Creates a combobox without a text editor. On some platforms the
20 control may appear very different when this style is used.
21 @style{wxCB_SORT}:
22 Sorts the entries in the list alphabetically.
23 @style{wxTE_PROCESS_ENTER}:
24 The control will generate the event wxEVT_COMMAND_TEXT_ENTER
25 (otherwise pressing Enter key is either processed internally by the
26 control or used for navigation between dialog controls). Windows
27 only.
28 @endStyleTable
7c913512 29
23324ae1 30 @beginEventTable
4cc4bfaf 31 @event{EVT_COMBOBOX(id, func)}:
23324ae1
FM
32 Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
33 the list is selected.
4cc4bfaf 34 @event{EVT_TEXT(id, func)}:
23324ae1
FM
35 Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text
36 changes.
4cc4bfaf 37 @event{EVT_TEXT_ENTER(id, func)}:
23324ae1
FM
38 Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
39 the combobox.
40 @endEventTable
7c913512 41
23324ae1
FM
42 @library{wxadv}
43 @category{ctrl}
44 @appearance{bitmapcombobox.png}
7c913512 45
e54c96f1 46 @see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
23324ae1
FM
47*/
48class wxBitmapComboBox : public wxComboBox
49{
50public:
51 //@{
52 /**
53 Constructor, creating and showing a combobox.
54
7c913512 55 @param parent
4cc4bfaf 56 Parent window. Must not be @NULL.
7c913512 57 @param id
4cc4bfaf 58 Window identifier. The value wxID_ANY indicates a default value.
7c913512 59 @param value
4cc4bfaf 60 Initial selection string. An empty string indicates no selection.
7c913512 61 @param pos
4cc4bfaf 62 Window position.
7c913512 63 @param size
4cc4bfaf
FM
64 Window size. If wxDefaultSize is specified then the window is
65 sized
66 appropriately.
7c913512 67 @param n
4cc4bfaf 68 Number of strings with which to initialise the control.
7c913512 69 @param choices
4cc4bfaf 70 An array of strings with which to initialise the control.
7c913512 71 @param style
4cc4bfaf 72 Window style. See wxBitmapComboBox.
7c913512 73 @param validator
4cc4bfaf 74 Window validator.
7c913512 75 @param name
4cc4bfaf 76 Window name.
23324ae1 77
4cc4bfaf 78 @see Create(), wxValidator
23324ae1
FM
79 */
80 wxBitmapComboBox();
7c913512
FM
81 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
82 const wxString& value = "",
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
85 int n = 0,
4cc4bfaf 86 const wxString choices[] = NULL,
7c913512
FM
87 long style = 0,
88 const wxValidator& validator = wxDefaultValidator,
89 const wxString& name = "comboBox");
90 wxBitmapComboBox(wxWindow* parent, wxWindowID id,
91 const wxString& value,
92 const wxPoint& pos,
93 const wxSize& size,
94 const wxArrayString& choices,
95 long style = 0,
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = "comboBox");
23324ae1
FM
98 //@}
99
100 /**
101 Destructor, destroying the combobox.
102 */
103 ~wxBitmapComboBox();
104
105 //@{
106 /**
107 Adds the item to the end of the combo box, associating the given, typed or
108 untyped, client data pointer with the item.
109 */
110 int Append(const wxString& item,
111 const wxBitmap& bitmap = wxNullBitmap);
7c913512 112 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 113 void* clientData);
7c913512 114 int Append(const wxString& item, const wxBitmap& bitmap,
4cc4bfaf 115 wxClientData* clientData);
23324ae1
FM
116 //@}
117
118 //@{
119 /**
120 Creates the combobox for two-step construction. Derived classes
121 should call or replace this function. See wxBitmapComboBox()
122 for further details.
123 */
124 bool Create(wxWindow* parent, wxWindowID id,
125 const wxString& value = "",
126 const wxPoint& pos = wxDefaultPosition,
127 const wxSize& size = wxDefaultSize,
128 int n, const wxString choices[],
129 long style = 0,
130 const wxValidator& validator = wxDefaultValidator,
131 const wxString& name = "comboBox");
7c913512
FM
132 bool Create(wxWindow* parent, wxWindowID id,
133 const wxString& value,
134 const wxPoint& pos,
135 const wxSize& size,
136 const wxArrayString& choices,
137 long style = 0,
138 const wxValidator& validator = wxDefaultValidator,
139 const wxString& name = "comboBox");
23324ae1
FM
140 //@}
141
142 /**
143 Returns size of bitmaps used in the list.
144 */
328f5751 145 wxSize GetBitmapSize() const;
23324ae1
FM
146
147 /**
148 Returns the bitmap of the item with the given index.
149 */
328f5751 150 wxBitmap GetItemBitmap(unsigned int n) const;
23324ae1
FM
151
152 //@{
153 /**
154 Inserts the item into the list before pos, associating the given, typed or
155 untyped, client data pointer with the item.
156 Not valid for @c wxCB_SORT style, use Append instead.
157 */
158 int Insert(const wxString& item, const wxBitmap& bitmap,
159 unsigned int pos);
7c913512
FM
160 int Insert(const wxString& item, const wxBitmap& bitmap,
161 unsigned int pos,
4cc4bfaf 162 void* clientData);
7c913512
FM
163 int Insert(const wxString& item, const wxBitmap& bitmap,
164 unsigned int pos,
4cc4bfaf 165 wxClientData* clientData);
23324ae1
FM
166 //@}
167
168 /**
169 Sets the bitmap for the given item.
170 */
171 void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
172};
e54c96f1 173