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