Version: 2.9.4
Public Member Functions
wxItemContainerImmutable Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/ctrlsub.h>

Inheritance diagram for wxItemContainerImmutable:

Detailed Description

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)

Library:  wxCore
Category:  Controls
参照:
wxControlWithItems, wxItemContainer

Public Member Functions

 wxItemContainerImmutable ()
 Constructor.
virtual unsigned int GetCount () const =0
 Returns the number of items in the control.
bool IsEmpty () const
 Returns true if the control is empty or false if it has some items.
virtual wxString GetString (unsigned int n) const =0
 Returns the label of the item with the given index.
wxArrayString GetStrings () const
 Returns the array of the labels of all items in the control.
virtual void SetString (unsigned int n, const wxString &string)=0
 Sets the label for the given item.
virtual int FindString (const wxString &string, bool caseSensitive=false) const
 Finds an item whose label matches the given string.
Selection
virtual void SetSelection (int n)=0
 Sets the selection to the given item n or removes the selection entirely if n == wxNOT_FOUND.
virtual int GetSelection () const =0
 Returns the index of the selected item or wxNOT_FOUND if no item is selected.
bool SetStringSelection (const wxString &string)
 Selects the item with the specified string in the control.
virtual wxString GetStringSelection () const
 Returns the label of the selected item or an empty string if no item is selected.
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.

List of all members.


Constructor & Destructor Documentation

wxItemContainerImmutable::wxItemContainerImmutable ( )

Constructor.


Member Function Documentation

virtual int wxItemContainerImmutable::FindString ( const wxString string,
bool  caseSensitive = false 
) const [virtual]

Finds an item whose label matches the given string.

Parameters:
stringString to find.
caseSensitiveWhether search is case sensitive (default is not).
Returns:
The zero-based position of the item, or wxNOT_FOUND if the string was not found.

Reimplemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

virtual unsigned int wxItemContainerImmutable::GetCount ( ) const [pure virtual]

Returns the number of items in the control.

参照:
IsEmpty()

Implemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

virtual int wxItemContainerImmutable::GetSelection ( ) const [pure virtual]

Returns the index of the selected item or wxNOT_FOUND if no item is selected.

Returns:
The position of the current selection.
注意:
This method can be used with single selection list boxes only, you should use wxListBox::GetSelections() for the list boxes with wxLB_MULTIPLE style.
参照:
SetSelection(), GetStringSelection()

Implemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

virtual wxString wxItemContainerImmutable::GetString ( unsigned int  n) const [pure virtual]

Returns the label of the item with the given index.

Parameters:
nThe zero-based index.
Returns:
The label of the item or an empty string if the position was invalid.

Implemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

wxArrayString wxItemContainerImmutable::GetStrings ( ) const

Returns the array of the labels of all items in the control.

virtual wxString wxItemContainerImmutable::GetStringSelection ( ) const [virtual]

Returns the label of the selected item or an empty string if no item is selected.

参照:
GetSelection()

Reimplemented in wxComboBox.

bool wxItemContainerImmutable::IsEmpty ( ) const

Returns true if the control is empty or false if it has some items.

参照:
GetCount()

Reimplemented in wxComboBox.

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.

virtual void wxItemContainerImmutable::SetSelection ( int  n) [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.

Parameters:
nThe string position to select, starting from zero.
参照:
SetString(), SetStringSelection()

Implemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

virtual void wxItemContainerImmutable::SetString ( unsigned int  n,
const wxString string 
) [pure virtual]

Sets the label for the given item.

Parameters:
nThe zero-based item index.
stringThe label to set.

Implemented in wxChoice, wxComboBox, wxListBox, and wxRadioBox.

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.

Parameters:
stringThe string to select.
Returns:
true if the specified string has been selected, false if it wasn't found in the control.

Reimplemented in wxListBox.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines