## wxBitmapComboBox

A combobox that displays bitmap in front of the list items. It currently only allows using bitmaps of one size, and resizes itself so that a bitmap can be shown next to the text field.

Derived from

wxComboBox
wxControlWithItems
wxControl
wxWindow
wxEvtHandler
wxObject

Remarks

While wxBitmapComboBox contains the wxComboBox API, but it might not actually be derived from that class. In fact, if the platform does not have a native implementation, wxBitmapComboBox will inherit from wxOwnerDrawnComboBox. You can determine if the implementation is generic by checking whether wxGENERIC_BITMAPCOMBOBOX is defined.

Include files

<wx/bmpcbox.h>

Window styles

wxCB_READONLY | Creates a combobox without a text editor. On some platforms the control may appear very different when this style is used.
wxCB_SORT | Sorts the entries in the list alphabetically.
wxTE_PROCESS_ENTER | The control will generate the event wxEVT_COMMAND_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). Windows only.

See also window styles overview.

Event handling

EVT_COMBOBOX(id, func) | Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on the list is selected.
EVT_TEXT(id, func) | Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text changes.
EVT_TEXT_ENTER(id, func) | Process a wxEVT_COMMAND_TEXT_ENTER event, when <RETURN> is pressed in the combobox.

See also

wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent

Members

wxBitmapComboBox::wxBitmapComboBox
wxBitmapComboBox::~wxBitmapComboBox
wxBitmapComboBox::Create
wxBitmapComboBox::Append
wxBitmapComboBox::GetBitmapSize
wxBitmapComboBox::GetItemBitmap
wxBitmapComboBox::Insert
wxBitmapComboBox::SetItemBitmap

### wxBitmapComboBox::wxBitmapComboBox

wxBitmapComboBox()

Default constructor.

wxBitmapComboBox(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")

wxBitmapComboBox(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")

Constructor, creating and showing a combobox.

Parameters

parent

Parent window. Must not be NULL.

id

Window identifier. A value of -1 indicates a default value.

value

Initial selection string. An empty string indicates no selection.

pos

Window position.

size

Window size. If the default size (-1, -1) is specified then the window is sized appropriately.

n

Number of strings with which to initialise the control.

choices

An array of strings with which to initialise the control.

style

Window style. See wxBitmapComboBox.

validator

Window validator.

name

Window name.

See also

wxBitmapComboBox::Create, wxValidator

### wxBitmapComboBox::~wxBitmapComboBox

~wxBitmapComboBox()

Destructor, destroying the combobox.

### wxBitmapComboBox::Create

bool Create(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")

bool Create(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox")

Creates the combobox for two-step construction. Derived classes should call or replace this function. See wxBitmapComboBox::wxBitmapComboBox for further details.

### wxBitmapComboBox::Append

int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap)

Adds the item to the end of the combo box.

int Append(const wxString& item, const wxBitmap& bitmap, void *clientData)

int Append(const wxString& item, const wxBitmap& bitmap, wxClientData *clientData)

Adds the item to the end of the combo box, associating the given, typed or untyped, client data pointer with the item.

### wxBitmapComboBox::GetBitmapSize

wxSize GetBitmapSize() const

Returns size of bitmaps used in the list.

### wxBitmapComboBox::GetItemBitmap

wxBitmap GetItemBitmap(unsigned int n) const

Returns the bitmap of the item with the given index.

### wxBitmapComboBox::Insert

int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos)

Inserts the item into the list before pos. Not valid for `wxCB_SORT` style, use Append instead.

int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos, void *clientData)

int Insert(const wxString& item, const wxBitmap& bitmap, unsigned int pos, wxClientData *clientData)

Inserts the item into the list before pos, associating the given, typed or untyped, client data pointer with the item. Not valid for `wxCB_SORT` style, use Append instead.

### wxBitmapComboBox::SetItemBitmap

void SetItemBitmap(unsigned int n, const wxBitmap& bitmap)

Sets the bitmap for the given item.