wxItemContainerImmutable Class Reference
[Controls]

#include <wx/ctrlsub.h>

Inheritance diagram for wxItemContainerImmutable:

wxItemContainer wxRadioBox wxComboBox wxControlWithItems wxBitmapComboBox wxChoice wxListBox wxCheckListBox

List of all members.


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

See also:
wxControlWithItems, wxItemContainer

Public Member Functions

 wxItemContainerImmutable ()
 Constructor.
virtual unsigned int GetCount () const
bool IsEmpty () const
virtual wxString GetString (unsigned int n) const
wxArrayString GetStrings () const
virtual void SetString (unsigned int n, const wxString &string)
virtual int FindString (const wxString &string, bool caseSensitive=false) const
Selection
virtual void SetSelection (int n)
virtual int GetSelection () const
bool SetStringSelection (const wxString &string)
virtual wxString GetStringSelection () const
void Select (int n)

Constructor & Destructor Documentation

wxItemContainerImmutable::wxItemContainerImmutable (  ) 


Member Function Documentation

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

Returns the number of items in the control.

See also:
IsEmpty()

bool wxItemContainerImmutable::IsEmpty (  )  const

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

See also:
GetCount()

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

Returns the label of the item with the given index.

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

wxArrayString wxItemContainerImmutable::GetStrings (  )  const

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

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

Sets the label for the given item.

Parameters:
n The zero-based item index.
string The label to set.

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

Finds an item whose label matches the given string.

Parameters:
string String to find.
caseSensitive Whether 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 wxRadioBox.

virtual void wxItemContainerImmutable::SetSelection ( int  n  )  [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:
n The string position to select, starting from zero.
See also:
SetString(), SetStringSelection()

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

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

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

bool wxItemContainerImmutable::SetStringSelection ( const wxString string  ) 

Selects the item with the specified string in the control. This doesn't cause any command events to be emitted.

Parameters:
string The string to select.
Returns:
true if the specified string has been selected, false if it wasn't found 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.

See also:
GetSelection()

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.



wxWidgets logo

[ top ]