rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IliToggleSelector Class Reference

Field gadget class. More...

#include <ilviews/dataccess/gadgets/toggsel.h>

Inheritance diagram for IliToggleSelector:
IliGadgetSet IliFieldItf IlvGadget IlvSimpleGraphic IlvGraphic

List of all members.

Public Member Functions

 IliToggleSelector (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 This constructor creates a toggle selector gadget. Initially, it is empty.
IlBoolean appendLabel (const char *label)
 Appends a new toggle after all existing toggles.
virtual IlBoolean f_externalToInternal ()
 Updates the internal value of a field according to its current external representation.
virtual const char * f_getLabel () const
 Returns the label displayed by the field gadget.
virtual const IliValuef_getValue (IlBoolean internalP=IlFalse) const
 Returns the value of the field.
virtual IlBoolean f_hasLabel () const
 Returns IlTrue if the field gadget can display a label.
virtual void f_internalToExternal ()
 Updates the external representation of the field and its display according to its current internal value.
virtual IlBoolean f_isConsistent () const
 Returns IlTrue if the internal value of the field corresponds to its current external representation.
virtual IlBoolean f_isReadOnly () const
 Returns IlTrue if the field is read-only.
virtual void f_setForeignDisplayColumnName (const char *)
 Sets the name of the column of the foreign table that will serve as a result, when the table is used as a map to convert internal values into external representations.
virtual void f_setForeignTable (IliTable *, IlBoolean owner=IlFalse)
 Sets the foreign table of the field.
virtual void f_setForeignValueColumnName (const char *)
 Sets the name of the column of the foreign table that will serve as a key, when the table is used as a map to convert internal values into external representations.
virtual void f_setLabel (const char *)
 Sets the label of the field gadget.
virtual void f_setReadOnly (IlBoolean)
 Sets the read-only property for the field.
virtual IlBoolean f_setValue (const IliValue &, IlBoolean internalP=IlFalse)
 Sets the value of the field.
const char * getLabel (IlInt index) const
 Returns a label.
IlInt getLabelIndex (const char *label, IlInt from=0) const
 Returns a label index.
const char *const * getLabels (IlInt &count) const
 Returns the toggle labels.
IlInt getLabelsCount () const
 Returns the number of toggles in the toggle selector.
IlBoolean insertLabel (IlInt index, const char *label)
 Inserts a new toggle.
IlBoolean removeLabel (IlInt index)
 Removes a toggle.
virtual IlBoolean setFocusObject (IlvGadget *)
 Sets the focus gadget.
IlBoolean setLabel (IlInt index, const char *label)
 Sets a label.
void setLabels (const char *const *strings, IlInt count)
 Sets labels.
void setSelected (IlInt which)
 Selects a toggle.
IlInt whichSelected () const
 Returns the selected toggle position.

Detailed Description

Field gadget class.

Library: dbgadget

The IliToggleSelector class defines a gadget that contains a set of toggle gadgets. Each toggle gadget corresponds to a row of the foreign table. A maximum of one toggle can be checked. The value of the toggle selector is closely related to which toggle is checked. A IliToggleSelector gadget inherits the following properties from the IliFieldItf class:

When a toggle selector receives a new value, it checks the foreign table to find a row that contains this value in its value column. If such a row is found, the toggle selector checks the toggle that has the value of the display column of this row, as a label. Any other previously checked toggle is unchecked. Therefore, a toggle selector does not display its actual value. Instead, it displays another value that is derived from the original value, through the foreign table. The foreign table serves as a value converter. In addition, if the user edits the value displayed by the toggle selector, the edited value is converted back in a reversal of the procedure described above. A row that contains this value in its display column is searched for in the foreign table. If such a row is found, the value of the combo box changes to the value contained in the value column of the row. As an alternative to using a foreign table, it is possible to alter the toggles and their labels directly, using one of the member functions, setLabels, setLabel, insertLabel, appendLabel, or removeLabel. Note that these member functions may not be used in conjunction with a foreign table. When the toggle selector has no foreign table, its value is an integer ranging from 0 to one less than the number of toggles.

See also:
IliTable, IlvToggle.

Constructor & Destructor Documentation

IliToggleSelector::IliToggleSelector ( IlvDisplay display,
const IlvRect rect,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

This constructor creates a toggle selector gadget. Initially, it is empty.

Parameters:
display The display.
rect The location.
thickness The border thickness.
palette The palette.

Member Function Documentation

IlBoolean IliToggleSelector::appendLabel ( const char *  label  ) 

Appends a new toggle after all existing toggles.

Parameters:
label The label. It is copied.
Returns:
IlTrue if successful.
virtual IlBoolean IliToggleSelector::f_externalToInternal (  )  [virtual]

Updates the internal value of a field according to its current external representation.

Returns:
IlTrue if successful and IlFalse otherwise. Note that this may fail due to the fact that not all external representations can be converted to a value object. For example, this is especially true for text fields that are used to edit numeric or date values.

Reimplemented from IliFieldItf.

virtual const char* IliToggleSelector::f_getLabel (  )  const [virtual]

Returns the label displayed by the field gadget.

Returns:
The label.

Reimplemented from IliFieldItf.

virtual const IliValue& IliToggleSelector::f_getValue ( IlBoolean  internal = IlFalse  )  const [virtual]

Returns the value of the field.

Parameters:
internal If IlTrue, the returned value does not necessarily reflect the state of the field as the user sees it.
Returns:
The value.

Reimplemented from IliFieldItf.

virtual IlBoolean IliToggleSelector::f_hasLabel (  )  const [virtual]

Returns IlTrue if the field gadget can display a label.

Returns:
IlTrue if the field gadget can display a label.

Reimplemented from IliFieldItf.

virtual IlBoolean IliToggleSelector::f_isConsistent (  )  const [virtual]

Returns IlTrue if the internal value of the field corresponds to its current external representation.

A return value of IlFalse means that the external representation of the field has been edited by the end-user since the last time one of the member functions, f_setValue, f_externalToInternal, f_internalToExternal or f_complete was successfully called.

Returns:
IlTrue if the internal value of the field corresponds to its current external representation.

Reimplemented from IliFieldItf.

virtual IlBoolean IliToggleSelector::f_isReadOnly (  )  const [virtual]

Returns IlTrue if the field is read-only.

Returns:
IlTrue if the field is read-only.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setForeignDisplayColumnName ( const char *  name  )  [virtual]

Sets the name of the column of the foreign table that will serve as a result, when the table is used as a map to convert internal values into external representations.

Parameters:
name The column name.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setForeignTable ( IliTable tbl,
IlBoolean  owner = IlFalse 
) [virtual]

Sets the foreign table of the field.

Parameters:
tbl The table.
owner Determines whether the field will own the table.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setForeignValueColumnName ( const char *  name  )  [virtual]

Sets the name of the column of the foreign table that will serve as a key, when the table is used as a map to convert internal values into external representations.

Parameters:
name The column name.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setLabel ( const char *  label  )  [virtual]

Sets the label of the field gadget.

Parameters:
label The label.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setReadOnly ( IlBoolean  flag  )  [virtual]

Sets the read-only property for the field.

Parameters:
flag The read-only flag.

Reimplemented from IliFieldItf.

virtual IlBoolean IliToggleSelector::f_setValue ( const IliValue val,
IlBoolean  internal = IlFalse 
) [virtual]

Sets the value of the field.

Parameters:
val The value.
internal If IlFalse, then the external representation and the display of the field are automatically updated.
Returns:
IlTrue if successful, and IlFalse otherwise.

Reimplemented from IliFieldItf.

const char* IliToggleSelector::getLabel ( IlInt  index  )  const

Returns a label.

Parameters:
index The label position.
Returns:
The label of the toggle at position index. This member function returns NULL if index is out of bounds.
IlInt IliToggleSelector::getLabelIndex ( const char *  label,
IlInt  from = 0 
) const

Returns a label index.

Parameters:
label The label.
from The search start position.
Returns:
The position of the first toggle with the given label. The search starts at position from. This member function returns -1 if no such toggle is found.
const char* const* IliToggleSelector::getLabels ( IlInt count  )  const

Returns the toggle labels.

Parameters:
count The label count.
Returns:
An array of character strings containing the labels of all the toggles in the toggle selector. The number of strings in this array is returned through the count parameter. The returned array should be used as soon as possible, since it may be overwritten without warning by a later call to an API function.
IlInt IliToggleSelector::getLabelsCount (  )  const

Returns the number of toggles in the toggle selector.

Returns:
The count.
IlBoolean IliToggleSelector::insertLabel ( IlInt  index,
const char *  label 
)

Inserts a new toggle.

Parameters:
index The insertion position.
label The label is copied.
Returns:
IlTrue if successful.
IlBoolean IliToggleSelector::removeLabel ( IlInt  index  ) 

Removes a toggle.

Parameters:
index The label position.
Returns:
IlTrue if successful.
virtual IlBoolean IliToggleSelector::setFocusObject ( IlvGadget obj  )  [virtual]

Sets the focus gadget.

Parameters:
obj The gadget.

Reimplemented from IliGadgetSet.

IlBoolean IliToggleSelector::setLabel ( IlInt  index,
const char *  label 
)

Sets a label.

Changes the label of the toggle at position index to a copy of label. This member function returns IlTrue if successful.

Parameters:
index The label position.
label The label.
void IliToggleSelector::setLabels ( const char *const *  strings,
IlInt  count 
)

Sets labels.

Replaces the current set of toggles with a new set containing count new toggles. The labels of the new toggles are given by the strings parameter, which must be an array of count character strings. No pointer is kept to the strings array or to any of the strings it contains.

Parameters:
strings The labels.
count The label count.
void IliToggleSelector::setSelected ( IlInt  which  ) 

Selects a toggle.

Checks the toggle at position which, and unchecks all other toggles. If which equals -1, all toggles are unchecked.

Parameters:
which The toggle position.
IlInt IliToggleSelector::whichSelected (  )  const

Returns the selected toggle position.

Returns:
The position of the currently checked toggle. This member function returns -1 if all toggles are unchecked.

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.