Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Field gadget class. More...
#include <ilviews/dataccess/gadgets/toggsel.h>
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 IliValue & | f_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. |
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:
value column
, display column
, IliFieldItf::f_getLabel
and IliFieldItf::f_setLabel
). 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.
IliToggleSelector::IliToggleSelector | ( | IlvDisplay * | display, | |
const IlvRect & | rect, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
This constructor creates a toggle selector gadget. Initially, it is empty.
display | The display. | |
rect | The location. | |
thickness | The border thickness. | |
palette | The palette. |
IlBoolean IliToggleSelector::appendLabel | ( | const char * | label | ) |
Appends a new toggle after all existing toggles.
label | The label. It is copied. |
IlTrue
if successful. virtual IlBoolean IliToggleSelector::f_externalToInternal | ( | ) | [virtual] |
Updates the internal value of a field according to its current external representation.
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] |
virtual const IliValue& IliToggleSelector::f_getValue | ( | IlBoolean | internal = IlFalse |
) | const [virtual] |
Returns the value of the field.
internal | If IlTrue , the returned value does not necessarily reflect the state of the field as the user sees it. |
Reimplemented from IliFieldItf.
virtual IlBoolean IliToggleSelector::f_hasLabel | ( | ) | const [virtual] |
Returns IlTrue
if the field gadget can display a label.
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.
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.
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.
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.
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.
name | The column name. |
Reimplemented from IliFieldItf.
virtual void IliToggleSelector::f_setLabel | ( | const char * | label | ) | [virtual] |
virtual void IliToggleSelector::f_setReadOnly | ( | IlBoolean | flag | ) | [virtual] |
Sets the read-only property for the field.
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.
val | The value. | |
internal | If IlFalse , then the external representation and the display of the field are automatically updated. |
IlTrue
if successful, and IlFalse
otherwise. Reimplemented from IliFieldItf.
const char* IliToggleSelector::getLabel | ( | IlInt | index | ) | const |
Returns a label.
index | The label position. |
index
. This member function returns NULL
if index
is out of bounds. Returns a label index.
label | The label. | |
from | The search start position. |
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.
count | The label count. |
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.
Inserts a new toggle.
index | The insertion position. | |
label | The label is copied. |
IlTrue
if successful. Removes a toggle.
index | The label position. |
IlTrue
if successful. Sets a label.
Changes the label of the toggle at position index
to a copy of label
. This member function returns IlTrue
if successful.
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.
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.
which | The toggle position. |
IlInt IliToggleSelector::whichSelected | ( | ) | const |
Returns the selected toggle position.
-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.