ubit::UChoice Class Reference

Exclusive selector for UListbox, UTreebox, UCombobox. More...

#include <uchoice.hpp>

Inheritance diagram for ubit::UChoice:

ubit::UProp ubit::UBrick ubit::UObject List of all members.

Public Types

 NO_SELECTION
 SINGLE_SELECTION
 SINGLE_INTERVAL_SELECTION
 MULTIPLE_INTERVAL_SELECTION
 SELECT_ON_ARM = 1<<0
 SELECT_ON_DISARM = 1<<1
 SELECT_ON_DRAG = 1<<2
enum  { NO_SELECTION, SINGLE_SELECTION, SINGLE_INTERVAL_SELECTION, MULTIPLE_INTERVAL_SELECTION }
enum  { SELECT_ON_ARM = 1<<0, SELECT_ON_DISARM = 1<<1, SELECT_ON_DRAG = 1<<2 }

Public Member Functions

 UChoice ()
 create a new UChoice object.
virtual void clearSelection ()
 deselects the selected object.
virtual UBoxgetSelectedItem () const
 returns the current selection; returns null if there is no selection.
virtual UBoxsetSelectedItem (UBox &obj)
 selects and returns 'obj' if it is in the list, returns null otherwise.
virtual int getSelectedIndex () const
 returns the index of the selection; returns -1 if there is no selection.
virtual UBoxsetSelectedIndex (int N)
 selects the Nth *selectable* object in the list.
virtual UBoxgetSelectableItem (int N) const
 returns the Nth *selectable* object.
virtual UBoxgetSelectableItem (const UStr &s, bool ignore_case=true) const
 returns the 1st *selectable* object which contains a string equal to 's'.
virtual int getSelectionMode () const
virtual void setSelectionMode (int)
 gets/sets the current selection mode.
virtual int getSelectionStyle () const
virtual void setSelectionStyle (int)
 gets/sets the current selection style.
virtual void setSelectionRule (IsSelectable &)
 define which objects can be selected in the list.
virtual void update ()
 updates parents graphics.

Friends

UChoiceuchoice ()
 shortcut that returns *new UChoice().

Detailed Description

Exclusive selector for UListbox, UTreebox, UCombobox.


Member Function Documentation

UBox * ubit::UChoice::getSelectableItem ( const UStr s,
bool  ignore_case = true 
) const [virtual]

returns the 1st *selectable* object which contains a string equal to 's'.

this function compares the content of the strings (not their addresses). NOTE: A list can contain non-selectable objects, which are ignored by this function. Use getChild() to have access to all objects.

UBox * ubit::UChoice::getSelectableItem ( int  N  )  const [virtual]

returns the Nth *selectable* object.

the last selectable object is returned if N = -1. NOTE: A list can contain non-selectable objects, which are ignored when counting indexes. Use getChild() to have access to all objects.

int ubit::UChoice::getSelectedIndex (  )  const [virtual]

returns the index of the selection; returns -1 if there is no selection.

NOTE: the returned value is the index among the *selectable* objects of the list. A list can contain non-selectable objects, which are ignored when counting indexes.

UBox * ubit::UChoice::setSelectedIndex ( int  N  )  [virtual]

selects the Nth *selectable* object in the list.

the last selectable object is selected if N = -1. The selected object is returned (if any, null is returned otherwise). NOTE: N is the index of the Nth *selectable* object. A list can contain non-selectable objects, which are ignored when counting indexes.

void ubit::UChoice::setSelectionMode ( int   )  [virtual]

gets/sets the current selection mode.

no effect with the current version: always in SINGLE_SELECTION mode.

void ubit::UChoice::setSelectionRule ( IsSelectable &   )  [virtual]

define which objects can be selected in the list.

by default, ARMable objects that derive from UBox can be selected, such as UItem, UButton ... or any box that has been made armable by adding the UMode::canArm property to it.

void ubit::UChoice::setSelectionStyle ( int   )  [virtual]

gets/sets the current selection style.

the selection style is an ORed combination of SELECT_ON_ARM, SELECT_ON_DISARM, SELECT_ON_DRAG


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:46 2007 for Ubit by  doxygen 1.4.7