# wxBitmapComboBox Class Reference
[Controls]

`#include </home/work/projects/wx/2.9/wx/interface/wx/bmpcbox.h>`

Inheritance diagram for wxBitmapComboBox:
[legend]

## Detailed Description

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.

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. Currently wxBitmapComboBox is implemented natively for MSW and GTK+.

## Styles

This class supports the following 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.

Todo:
  create wxCB_PROCESS_ENTER rather than reusing wxTE_PROCESS_ENTER!

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCommandEvent& event)

Event macros for events emitted by this class:

- 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.

##

Library: wxAdvanced
Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent

## Public Member Functions

| wxBitmapComboBox ()
| Default ctor.
| wxBitmapComboBox (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, 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=wxBitmapComboBoxNameStr)
| Constructor, creating and showing a combobox.
| wxBitmapComboBox (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxBitmapComboBoxNameStr)
| Constructor, creating and showing a combobox.
virtual | ~wxBitmapComboBox ()
| Destructor, destroying the combobox.
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)
| Adds the item to the end of the combo box, associating the given untyped, client data pointer clientData with the item.
int | Append (const wxString &item, const wxBitmap &bitmap, wxClientData *clientData)
| Adds the item to the end of the combo box, associating the given typed client data pointer clientData with the item.
bool | Create (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxBitmapComboBoxNameStr)
| Creates the combobox for two-step construction.
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=wxBitmapComboBoxNameStr)
| Creates the combobox for two-step construction.
virtual wxSize | GetBitmapSize () const
| Returns the size of the bitmaps used in the combo box.
virtual wxBitmap | GetItemBitmap (unsigned int n) const
| Returns the bitmap of the item with the given index.
int | Insert (const wxString &item, const wxBitmap &bitmap, unsigned int pos)
| Inserts the item into the list before pos.
int | Insert (const wxString &item, const wxBitmap &bitmap, unsigned int pos, void *clientData)
| Inserts the item into the list before pos, associating the given untyped, client data pointer with the item.
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 client data pointer with the item.
virtual void | SetItemBitmap (unsigned int n, const wxBitmap &bitmap)
| Sets the bitmap for the given item.

List of all members.

## Constructor & Destructor Documentation

wxBitmapComboBox::wxBitmapComboBox | ( |  | ) |

Default ctor.

wxBitmapComboBox::wxBitmapComboBox | ( | wxWindow * | parent,
|  | wxWindowID | id = `wxID_ANY`,
|  | const wxString & | value = `wxEmptyString`,
|  | 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 = `wxBitmapComboBoxNameStr` |
| ) |  |  |

Constructor, creating and showing a combobox.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. The value wxID_ANY indicates a default value.
  | value | Initial selection string. An empty string indicates no selection.
  | pos | Initial position.
  | size | Initial size.
  | n | Number of strings with which to initialise the control.
  | choices | An array of strings with which to initialise the control.
  | style | The window style, see wxCB_* flags.
  | validator | Validator which can be used for additional data checks.
  | name | Control name.

See also:
  Create(), wxValidator

wxBitmapComboBox::wxBitmapComboBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | value,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | const wxArrayString & | choices,
|  | long | style,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxBitmapComboBoxNameStr` |
| ) |  |  |

Constructor, creating and showing a combobox.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. The value wxID_ANY indicates a default value.
  | value | Initial selection string. An empty string indicates no selection.
  | pos | Initial position.
  | size | Initial size.
  | choices | An wxArrayString with which to initialise the control.
  | style | The window style, see wxCB_* flags.
  | validator | Validator which can be used for additional data checks.
  | name | Control name.

See also:
  Create(), wxValidator

virtual wxBitmapComboBox::~wxBitmapComboBox | ( |  | ) | `[virtual]`

Destructor, destroying the combobox.

## Member Function Documentation

int wxBitmapComboBox::Append | ( | const wxString & | item,
|  | const wxBitmap & | bitmap = `wxNullBitmap` |
| ) |  |  |

Adds the item to the end of the combo box.

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

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

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

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

bool wxBitmapComboBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | value,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | int | n,
|  | const wxString | choices[],
|  | long | style = `0`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxBitmapComboBoxNameStr` |
| ) |  |  |

Creates the combobox for two-step construction.

Reimplemented from wxComboBox.

bool wxBitmapComboBox::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 = `wxBitmapComboBoxNameStr` |
| ) |  |  |

Creates the combobox for two-step construction.

Reimplemented from wxComboBox.

virtual wxSize wxBitmapComboBox::GetBitmapSize | ( |  | ) | const`[virtual]`

Returns the size of the bitmaps used in the combo box.

If the combo box is empty, then wxDefaultSize is returned.

virtual wxBitmap wxBitmapComboBox::GetItemBitmap | ( | unsigned int | n | ) | const`[virtual]`

Returns the bitmap of the item with the given index.

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

Inserts the item into the list before pos, associating the given untyped, client data pointer with the item.

Not valid for `wxCB_SORT` style, use Append() instead.

int wxBitmapComboBox::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 wxBitmapComboBox::Insert | ( | const wxString & | item,
|  | const wxBitmap & | bitmap,
|  | unsigned int | pos,
|  | wxClientData * | clientData |
| ) |  |  |

Inserts the item into the list before pos, associating the given typed client data pointer with the item.

Not valid for `wxCB_SORT` style, use Append() instead.

virtual void wxBitmapComboBox::SetItemBitmap | ( | unsigned int | n,
|  | const wxBitmap & | bitmap |
| ) |  |  | `[virtual]`

Sets the bitmap for the given item.

|  | [ top ]