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
|
|
|
|
@wxheader{bmpcbox.h}
|
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
|
|
|
|
@c wxGENERIC_BITMAPCOMBOBOX is defined.
|
|
|
|
|
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!
|
|
|
|
|
2008-03-28 16:19:12 +00:00
|
|
|
@beginEventTable{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-05-02 04:52:42 +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-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Window position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-17 00:47:38 +00:00
|
|
|
Window size. If wxDefaultSize is specified then the window is sized
|
2008-03-09 12:33:59 +00:00
|
|
|
appropriately.
|
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-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxBitmapComboBox.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Window validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Window 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-03-08 14:43:31 +00:00
|
|
|
wxBitmapComboBox(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& value = "",
|
|
|
|
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,
|
|
|
|
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");
|
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
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Adds the item to the end of the combo box, associating the given, typed or
|
|
|
|
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-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
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates the combobox for two-step construction. Derived classes
|
|
|
|
should call or replace this function. See wxBitmapComboBox()
|
|
|
|
for further details.
|
|
|
|
*/
|
|
|
|
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");
|
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,
|
|
|
|
const wxString& name = "comboBox");
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns size of bitmaps used in the list.
|
|
|
|
*/
|
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
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Inserts the item into the list before pos, associating the given, typed or
|
|
|
|
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-17 00:47: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-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
|
|
|
|