2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: bmpcbox.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxBitmapComboBox
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxBitmapComboBox
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
@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
|
2008-05-27 06:24:04 -04:00
|
|
|
@c wxGENERIC_BITMAPCOMBOBOX is defined. Currently wxBitmapComboBox is
|
|
|
|
implemented natively for MSW and GTK+.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxCB_READONLY}
|
2008-03-08 08:52:38 -05:00
|
|
|
Creates a combobox without a text editor. On some platforms the
|
|
|
|
control may appear very different when this style is used.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxCB_SORT}
|
2008-03-08 08:52:38 -05:00
|
|
|
Sorts the entries in the list alphabetically.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTE_PROCESS_ENTER}
|
2008-03-08 08:52:38 -05:00
|
|
|
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
|
|
|
|
(otherwise pressing Enter key is either processed internally by the
|
2008-03-16 20:47:38 -04:00
|
|
|
control or used for navigation between dialog controls).
|
|
|
|
Windows only.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
@todo create wxCB_PROCESS_ENTER rather than reusing wxTE_PROCESS_ENTER!
|
|
|
|
|
2008-03-28 12:19:12 -04:00
|
|
|
@beginEventTable{wxCommandEvent}
|
2008-04-06 10:43:04 -04:00
|
|
|
@event{EVT_COMBOBOX(id, func)}
|
2008-03-08 08:52:38 -05:00
|
|
|
Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
|
|
|
|
the list is selected.
|
2008-04-06 10:43:04 -04:00
|
|
|
@event{EVT_TEXT(id, func)}
|
2008-03-16 20:47:38 -04:00
|
|
|
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text changes.
|
2008-04-06 10:43:04 -04:00
|
|
|
@event{EVT_TEXT_ENTER(id, func)}
|
2008-03-08 08:52:38 -05:00
|
|
|
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
|
|
|
|
the combobox.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxadv}
|
|
|
|
@category{ctrl}
|
2008-10-13 04:05:18 -04:00
|
|
|
@appearance{bitmapcombobox.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxBitmapComboBox : public wxComboBox
|
|
|
|
{
|
|
|
|
public:
|
2008-03-16 20:47:38 -04:00
|
|
|
/**
|
|
|
|
Default ctor.
|
|
|
|
*/
|
|
|
|
wxBitmapComboBox();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a combobox.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param value
|
2008-03-09 08:33:59 -04:00
|
|
|
Initial selection string. An empty string indicates no selection.
|
2008-10-04 10:52:38 -04:00
|
|
|
@param pos
|
|
|
|
Initial position.
|
|
|
|
@param size
|
|
|
|
Initial size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
Number of strings with which to initialise the control.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param choices
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of strings with which to initialise the control.
|
2008-10-04 10:52:38 -04:00
|
|
|
@param style
|
|
|
|
The window style, see wxCB_* flags.
|
|
|
|
@param validator
|
|
|
|
Validator which can be used for additional data checks.
|
|
|
|
@param name
|
|
|
|
Control name.
|
2008-03-16 20:47:38 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-21 12:50:52 -04:00
|
|
|
wxBitmapComboBox(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
int n = 0,
|
2008-03-09 08:33:59 -04:00
|
|
|
const wxString choices[] = NULL,
|
2008-03-08 09:43:31 -05:00
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-09-21 12:50:52 -04:00
|
|
|
const wxString& name = wxBitmapComboBoxNameStr);
|
2008-05-27 06:24:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a combobox.
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
Parent window. Must not be @NULL.
|
|
|
|
@param id
|
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
|
|
|
@param value
|
|
|
|
Initial selection string. An empty string indicates no selection.
|
2008-10-04 10:52:38 -04:00
|
|
|
@param pos
|
|
|
|
Initial position.
|
|
|
|
@param size
|
|
|
|
Initial size.
|
2008-05-27 06:24:04 -04:00
|
|
|
@param choices
|
|
|
|
An wxArrayString with which to initialise the control.
|
2008-10-04 10:52:38 -04:00
|
|
|
@param style
|
|
|
|
The window style, see wxCB_* flags.
|
|
|
|
@param validator
|
|
|
|
Validator which can be used for additional data checks.
|
|
|
|
@param name
|
|
|
|
Control name.
|
2008-05-27 06:24:04 -04:00
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxBitmapComboBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
const wxArrayString& choices,
|
2008-09-21 12:50:52 -04:00
|
|
|
long style,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-09-21 12:50:52 -04:00
|
|
|
const wxString& name = wxBitmapComboBoxNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the combobox.
|
|
|
|
*/
|
2008-03-24 18:17:25 -04:00
|
|
|
virtual ~wxBitmapComboBox();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-16 20:47:38 -04:00
|
|
|
Adds the item to the end of the combo box.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int Append(const wxString& item,
|
|
|
|
const wxBitmap& bitmap = wxNullBitmap);
|
2008-03-16 20:47:38 -04:00
|
|
|
|
|
|
|
/**
|
2008-05-27 06:24:04 -04:00
|
|
|
Adds the item to the end of the combo box, associating the given
|
2008-03-16 20:47:38 -04:00
|
|
|
untyped, client data pointer @a clientData with the item.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
int Append(const wxString& item, const wxBitmap& bitmap,
|
2008-03-09 08:33:59 -04:00
|
|
|
void* clientData);
|
2008-05-27 06:24:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Adds the item to the end of the combo box, associating the given typed
|
|
|
|
client data pointer @a clientData with the item.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
int Append(const wxString& item, const wxBitmap& bitmap,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxClientData* clientData);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-27 06:24:04 -04:00
|
|
|
Creates the combobox for two-step construction.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-09-18 14:47:34 -04:00
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
2008-03-08 08:52:38 -05:00
|
|
|
int n, const wxString choices[],
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-09-21 12:50:52 -04:00
|
|
|
const wxString& name = wxBitmapComboBoxNameStr);
|
2008-05-27 06:24:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the combobox for two-step construction.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
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,
|
2008-09-21 12:50:52 -04:00
|
|
|
const wxString& name = wxBitmapComboBoxNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns size of bitmaps used in the list.
|
|
|
|
*/
|
2008-03-25 18:06:48 -04:00
|
|
|
virtual wxSize GetBitmapSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the bitmap of the item with the given index.
|
|
|
|
*/
|
2008-03-25 18:06:48 -04:00
|
|
|
virtual wxBitmap GetItemBitmap(unsigned int n) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-16 20:47:38 -04:00
|
|
|
/**
|
|
|
|
Inserts the item into the list before @a pos.
|
|
|
|
Not valid for @c wxCB_SORT style, use Append() instead.
|
|
|
|
*/
|
|
|
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
|
|
|
unsigned int pos);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-27 06:24:04 -04:00
|
|
|
Inserts the item into the list before pos, associating the given
|
2008-03-08 08:52:38 -05:00
|
|
|
untyped, client data pointer with the item.
|
2008-03-16 20:47:38 -04:00
|
|
|
Not valid for @c wxCB_SORT style, use Append() instead.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
|
|
|
unsigned int pos,
|
2008-03-09 08:33:59 -04:00
|
|
|
void* clientData);
|
2008-05-27 06:24:04 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Inserts the item into the list before pos, associating the given typed
|
|
|
|
client data pointer with the item.
|
|
|
|
Not valid for @c wxCB_SORT style, use Append() instead.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
int Insert(const wxString& item, const wxBitmap& bitmap,
|
|
|
|
unsigned int pos,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxClientData* clientData);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the bitmap for the given item.
|
|
|
|
*/
|
2008-03-25 18:06:48 -04:00
|
|
|
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|