rwlogo

Rogue Wave Views
Data Access Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator
List of all members | Public Member Functions
IliToggleSelector Class Reference

Field gadget class. More...

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

Inheritance diagram for IliToggleSelector:
IliGadgetSet IliFieldItf IlvGadget IlvSimpleGraphic IlvStylable IlvGraphic

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. More...
 
IlBoolean appendLabel (const char *label)
 Appends a new toggle after all existing toggles. More...
 
virtual IlBoolean f_externalToInternal ()
 Updates the internal value of a field according to its current external representation. More...
 
virtual const char * f_getLabel () const
 Returns the label displayed by the field gadget. More...
 
virtual const IliValuef_getValue (IlBoolean internalP=IlFalse) const
 Returns the value of the field. More...
 
virtual IlBoolean f_hasLabel () const
 Returns IlTrue if the field gadget can display a label. More...
 
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. More...
 
virtual IlBoolean f_isReadOnly () const
 Returns IlTrue if the field is read-only. More...
 
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. More...
 
virtual void f_setForeignTable (IliTable *, IlBoolean owner=IlFalse)
 Sets the foreign table of the field. More...
 
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. More...
 
virtual void f_setLabel (const char *)
 Sets the label of the field gadget. More...
 
virtual void f_setReadOnly (IlBoolean)
 Sets the read-only property for the field. More...
 
virtual IlBoolean f_setValue (const IliValue &, IlBoolean internalP=IlFalse)
 Sets the value of the field. More...
 
const char * getLabel (IlInt index) const
 Returns a label. More...
 
IlInt getLabelIndex (const char *label, IlInt from=0) const
 Returns a label index. More...
 
const char *const * getLabels (IlInt &count) const
 Returns the toggle labels. More...
 
IlInt getLabelsCount () const
 Returns the number of toggles in the toggle selector. More...
 
IlBoolean insertLabel (IlInt index, const char *label)
 Inserts a new toggle. More...
 
IlBoolean removeLabel (IlInt index)
 Removes a toggle. More...
 
virtual IlBoolean setFocusObject (IlvGadget *)
 Sets the focus gadget. More...
 
IlBoolean setLabel (IlInt index, const char *label)
 Sets a label. More...
 
void setLabels (const char *const *strings, IlInt count)
 Sets labels. More...
 
void setSelected (IlInt which)
 Selects a toggle. More...
 
IlInt whichSelected () const
 Returns the selected toggle position. More...
 
- Public Member Functions inherited from IliGadgetSet
 IliGadgetSet (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Initializes an empty gadget set. More...
 
virtual void addObject (IlvGadget *obj, IlBoolean visible=IlTrue)
 Adds a gadget to the gadget set. More...
 
void disableToolTip ()
 Disables tooltip display.
 
void enableToolTip ()
 Enables tooltip display. More...
 
IlUInt getCardinal () const
 Returns the number of gadgets in the gadget set. More...
 
IlvGadgetgetFocusObject () const
 Returns the focus gadget of the gadget set or NULL if no focus gadget is defined. More...
 
IlInt getIndex (IlvGadget *g) const
 Returns the position of a gadget in the gadget set. More...
 
IlvGadgetgetObject (IlUInt index) const
 Returns a gadget. More...
 
IlvGadgetgetObject (const char *name) const
 Returns a gadget. More...
 
IlBoolean isObjectSensitive (IlvGadget *obj) const
 Returns IlTrue if gadget is sensitive to user interaction. More...
 
IlBoolean isVisible (const IlvGadget *) const
 Returns IlTrue if the gadget parameter belongs to the gadget set and if it is visible. More...
 
virtual void objectReceivedEvent (IlvGadget *obj)
 Called when a gadget received an event. More...
 
virtual void removeObject (IlvGadget *obj, IlBoolean deleteIt=IlTrue)
 Removes a gadget from the gadget set. More...
 
void setObjectSensitive (IlvGadget *obj, IlBoolean active)
 Enables/disables user interaction. More...
 
void setVisible (IlvGadget *obj, IlBoolean visible)
 Shows/Hides a gadget. More...
 
- Public Member Functions inherited from IliFieldItf
void f_applyReferences (IlvApplyObject f, IlAny a)
 Should be called when the applyReferences member function, of the gadget class, is called. More...
 
virtual IlBoolean f_complete ()
 Updates the internal value of the field, according to its current external representation and its foreign table, provided completion is enabled for the field. More...
 
virtual void f_enableCompletion (IlBoolean flag)
 Sets the completion property of the field. More...
 
virtual IlvAlignment f_getAlignment () const
 Returns the text alignment of the field. More...
 
const IliDataSourcef_getDataSource () const
 Returns the data source. More...
 
IliDataSourcef_getDataSource ()
 Returns the data source. More...
 
const char * f_getDataSourceColumnName () const
 Returns the name of the column. More...
 
const char * f_getDataSourceName () const
 Returns the name of the data source, which this field is (or must be) connected to. More...
 
virtual const
IliTablePropertyManager
f_getEffectiveTablePropertyManager () const
 Returns the effective table property manager. More...
 
virtual IliTablePropertyManagerf_getEffectiveTablePropertyManager ()
 Returns the effective table property manager. More...
 
const char * f_getForeignDataSourceName () const
 Returns the name of the foreign data source. More...
 
const char * f_getForeignDisplayColumnName () const
 Returns the name of the column of the foreign table that will serve as a result. More...
 
const IliTablef_getForeignTable () const
 Returns the foreign table. More...
 
IliTablef_getForeignTable ()
 Returns the foreign table. More...
 
const char * f_getForeignValueColumnName () const
 Returns the name of the column of the foreign table that will serve as a key. More...
 
virtual const IliFormatf_getFormat () const
 Returns the format used to derive the external representation of the field from its internal value. More...
 
const IlvGadgetf_getGadget () const
 Returns the constant gadget associated with this field through multiple inheritance. More...
 
IlvGadgetf_getGadget ()
 Returns the gadget associated with this field through multiple inheritance. More...
 
const IlvGraphicf_getGraphic () const
 Returns the constant graphic associated with this field through multiple inheritance. More...
 
IlvGraphicf_getGraphic ()
 Returns the graphic associated with this field through multiple inheritance. More...
 
virtual const IliInputMaskf_getMask () const
 Returns the input mask used to edit values in the field. More...
 
virtual IlShort f_getMaxLength () const
 Returns the maximum length allowed for the external representation of the field. More...
 
const char * f_getTablePropertyManagerName () const
 Returns the name of the table property manager used by this field. More...
 
IlInt f_getVisibleRowsCount () const
 Returns the number of rows that will be displayed when the foreign table is displayed. More...
 
virtual void f_ignoreModifiedState (IlBoolean ignore)
 Sets the ignore modified state attribute of the field. More...
 
virtual IlBoolean f_isAutoFitPullDown () const
 Returns IlTrue if the width of the pull-down menu is automatically computed so that its contents fit. More...
 
IlBoolean f_isCompletionEnabled () const
 Returns IlTrue if completion is enabled. More...
 
IlBoolean f_isConnectedToDataSource () const
 Returns IlTrue if the field is currently connected to a column of a data source. More...
 
IlBoolean f_isConstrained () const
 Returns IlTrue if the foreign table limits the set of possible internal values for this field. More...
 
IlBoolean f_isDataSourceOwner () const
 Returns IlTrue if the field owns the data source. More...
 
IlBoolean f_isForeignTableOwner () const
 Returns IlTrue if the field owns its foreign table. More...
 
virtual IlBoolean f_isInputModified () const
 Returns IlTrue if the external representation has been edited by the end-user. More...
 
virtual IlBoolean f_isModifiedStateIgnored () const
 Returns IlTrue if the modified states are ignored when the f_setValue function is called. More...
 
IlBoolean f_isUsingTableProperties () const
 Returns IlTrue if the field uses table properties. More...
 
void f_killFocus ()
 Should be called when the gadget loses the focus.
 
virtual void f_selectTextForAppend ()
 Deselects all the text and positions the editing caret at the end of the text, provided the field gadget supports text selection.
 
virtual void f_selectTextForOverwrite ()
 Selects all the text, provided the field gadget supports text selection.
 
virtual void f_setAlignment (IlvAlignment align)
 Sets the text alignment of the field. More...
 
virtual void f_setAutoFitPullDown (IlBoolean flag)
 Enables/disables the automatic width computing of the pull-down menu. More...
 
virtual void f_setConstrained (IlBoolean flag)
 Sets the constrained property of the field. More...
 
virtual void f_setDataSourceColumnName (const char *name)
 Sets the name of the column. More...
 
virtual void f_setDataSourceName (const char *name)
 Sets the name of the data source. More...
 
void f_setFocus ()
 Should be called when the gadget receives the focus.
 
virtual void f_setForeignDataSourceName (const char *name)
 Sets the name of the foreign data source. More...
 
virtual void f_setFormat (const IliFormat &fmt)
 Sets the format used to derive the external representation of the field from its internal value. More...
 
virtual void f_setInputModified (IlBoolean flag)
 Sets the input-modified attribute of the field. More...
 
virtual void f_setMask (const IliInputMask &msk)
 Sets the input mask. More...
 
virtual void f_setMaxLength (IlShort vmax)
 Sets the maximum length allowed for the external representation of the field. More...
 
virtual void f_setTablePropertyManagerName (const char *name)
 Sets the name of the table property manager to use. More...
 
virtual void f_setVisibleRowsCount (IlInt count)
 Sets the number of rows to be displayed when the foreign table is displayed. More...
 
virtual IlBoolean f_supportsTableProperties () const
 Returns IlTrue if this gadget supports table properties. More...
 
virtual void f_useTableProperties (IlBoolean flag)
 Enables/Disables the use of the table properties. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IliFieldItf
static IlvSymbolInputModifiedSymbol ()
 Returns the name of the callback that the field gadget will invoke every time the field input-modified property changes from IlFalse to IlTrue. More...
 
- Protected Member Functions inherited from IliFieldItf
void f_read (IlvInputFile &input)
 Should be called by the stream-based constructor of the gadget. More...
 
void f_set (IlvGraphic *g, const IliFieldItf &other)
 Should be called by the copy constructor of the graphic class that is passed. More...
 
void f_setGraphic (IlvGraphic *g)
 Should be called by all constructors of the graphic class (except the copy constructor). More...
 
void f_subscribe ()
 Should be called after the setHolder member function of the gadget class.
 
void f_unsubscribe ()
 Should be called before the setHolder member function of the gadget class. More...
 
void f_write (IlvOutputFile &output) const
 Should be called by the write member function of the gadget class. More...
 

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
displayThe display.
rectThe location.
thicknessThe border thickness.
paletteThe palette.

Member Function Documentation

IlBoolean IliToggleSelector::appendLabel ( const char *  label)

Appends a new toggle after all existing toggles.

Parameters
labelThe 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
internalIf 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
nameThe column name.

Reimplemented from IliFieldItf.

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

Sets the foreign table of the field.

Parameters
tblThe table.
ownerDetermines 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
nameThe column name.

Reimplemented from IliFieldItf.

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

Sets the label of the field gadget.

Parameters
labelThe label.

Reimplemented from IliFieldItf.

virtual void IliToggleSelector::f_setReadOnly ( IlBoolean  flag)
virtual

Sets the read-only property for the field.

Parameters
flagThe 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
valThe value.
internalIf 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
indexThe 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
labelThe label.
fromThe 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
countThe 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
indexThe insertion position.
labelThe label is copied.
Returns
IlTrue if successful.
IlBoolean IliToggleSelector::removeLabel ( IlInt  index)

Removes a toggle.

Parameters
indexThe label position.
Returns
IlTrue if successful.
virtual IlBoolean IliToggleSelector::setFocusObject ( IlvGadget obj)
virtual

Sets the focus gadget.

Parameters
objThe 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
indexThe label position.
labelThe 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
stringsThe labels.
countThe 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
whichThe 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 2015, 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.