#include <wx/ctrlsub.h>
wxItemContainer defines an interface which is implemented by all controls which have string subitems each of which may be selected.
It is decomposed in wxItemContainerImmutable which omits all methods adding/removing items and is used by wxRadioBox and wxItemContainer itself.
Note that this is not a control, it's a mixin interface that classes have to derive from in addition to wxControl or wxWindow.
Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which implements an extended interface deriving from this one)
Public Member Functions | |
wxItemContainerImmutable () | |
Constructor. More... | |
virtual unsigned int | GetCount () const =0 |
Returns the number of items in the control. More... | |
bool | IsEmpty () const |
Returns true if the control is empty or false if it has some items. More... | |
virtual wxString | GetString (unsigned int n) const =0 |
Returns the label of the item with the given index. More... | |
wxArrayString | GetStrings () const |
Returns the array of the labels of all items in the control. More... | |
virtual void | SetString (unsigned int n, const wxString &string)=0 |
Sets the label for the given item. More... | |
virtual int | FindString (const wxString &string, bool caseSensitive=false) const |
Finds an item whose label matches the given string. More... | |
Selection | |
virtual void | SetSelection (int n)=0 |
Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND . More... | |
virtual int | GetSelection () const =0 |
Returns the index of the selected item or wxNOT_FOUND if no item is selected. More... | |
bool | SetStringSelection (const wxString &string) |
Selects the item with the specified string in the control. More... | |
virtual wxString | GetStringSelection () const |
Returns the label of the selected item or an empty string if no item is selected. More... | |
void | Select (int n) |
This is the same as SetSelection() and exists only because it is slightly more natural for controls which support multiple selection. More... | |
wxItemContainerImmutable::wxItemContainerImmutable | ( | ) |
Constructor.
|
virtual |
Finds an item whose label matches the given string.
string | String to find. |
caseSensitive | Whether search is case sensitive (default is not). |
Reimplemented in wxListBox, wxComboBox, wxRadioBox, and wxChoice.
|
pure virtual |
Returns the number of items in the control.
Implemented in wxRadioBox, wxComboBox, wxListBox, and wxChoice.
|
pure virtual |
Returns the index of the selected item or wxNOT_FOUND
if no item is selected.
Implemented in wxRadioBox, wxComboBox, wxListBox, and wxChoice.
|
pure virtual |
Returns the label of the item with the given index.
n | The zero-based index. |
Implemented in wxRadioBox, wxListBox, wxComboBox, and wxChoice.
wxArrayString wxItemContainerImmutable::GetStrings | ( | ) | const |
Returns the array of the labels of all items in the control.
|
virtual |
Returns the label of the selected item or an empty string if no item is selected.
Reimplemented in wxComboBox.
bool wxItemContainerImmutable::IsEmpty | ( | ) | const |
Returns true if the control is empty or false if it has some items.
void wxItemContainerImmutable::Select | ( | int | n | ) |
This is the same as SetSelection() and exists only because it is slightly more natural for controls which support multiple selection.
|
pure virtual |
Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND
.
Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections.
n | The string position to select, starting from zero. |
Implemented in wxComboBox, wxRadioBox, wxChoice, and wxListBox.
|
pure virtual |
Sets the label for the given item.
n | The zero-based item index. |
string | The label to set. |
Implemented in wxRadioBox, wxListBox, wxComboBox, and wxChoice.
bool wxItemContainerImmutable::SetStringSelection | ( | const wxString & | string | ) |
Selects the item with the specified string in the control.
This method doesn't cause any command events to be emitted.
Notice that this method is case-insensitive, i.e. the string is compared with all the elements of the control case-insensitively and the first matching entry is selected, even if it doesn't have exactly the same case as this string and there is an exact match afterwards.
string | The string to select. |