Rogue Wave Views Gadgets Package API Reference Guide |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/toggle.h>
Public Member Functions | |
IlvToggle (IlvDisplay *display, const char *label, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvToggle (IlvDisplay *display, const IlvPoint &point, const char *label, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvToggle (IlvDisplay *display, IlvBitmap *bitmap, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvToggle (IlvDisplay *display, const IlvPoint &point, IlvBitmap *bitmap, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
virtual void | activate () |
Is called by the interactor when the state of the toggle button changes. More... | |
virtual void | drawCheckBox (IlvPort *dst, const IlvRect &rect, const IlvRegion *clip=0) const |
Is called to draw the check box of the toggle button. More... | |
virtual void | drawText (IlvPort *dst, const IlvRect &rect, const IlvRegion *clip=0) const |
Is called to draw the label and bitmap of the toggle button. More... | |
IlvBitmap * | getBitmap () const |
Returns the bitmap displayed by the toggle button. More... | |
IlvDim | getCheckSize () const |
Returns the size of the state marker of the toggle button. More... | |
const char * | getLabel () const |
Returns the label displayed by the toggle button. More... | |
IlvPosition | getPosition () const |
Returns the position of the label or the bitmap relative to the state marker of the toggle button. More... | |
IlBoolean | getState () const |
Returns the state of the toggle button (on or off). More... | |
IlvPosition | getTextAlignment () const |
Returns the alignment of the label or the bitmap relative to the bounding box of the toggle button. More... | |
IlBoolean | isIndeterminateMode () const |
Indicates whether the toggle is in the indeterminate mode. More... | |
IlBoolean | isIndeterminateState () const |
Indicates whether the state of the toggle button is indeterminate. More... | |
IlBoolean | isRadio () const |
Indicates whether the state marker has the shape of a radio button. More... | |
void | setBitmap (IlvBitmap *bitmap) |
Sets the bitmap displayed by the toggle button. More... | |
void | setCheckSize (IlvDim size) |
Sets the size of the state marker. More... | |
void | setIndeterminateMode (IlBoolean value) |
Sets the mode of the toggle button to indeterminate mode. More... | |
void | setIndeterminateState (IlBoolean value) |
Specifies whether the state of the toggle button should be indeterminate. More... | |
void | setLabel (const char *label) |
Sets the label displayed by the toggle button. More... | |
void | setPosition (IlvPosition position) |
Sets the position of the label or the bitmap relative to the state marker of the toggle button. More... | |
void | setRadio (IlBoolean value) |
Specifies whether the state marker should have the shape of a radio button. More... | |
void | setState (IlBoolean value) |
Sets the state of the toggle button (on or off). More... | |
void | setTextAlignment (IlvPosition alignment) |
Sets the alignment of the label or the bitmap relative to the bounding box of the toggle button. More... | |
Gadget class.
Library: ilvgadgt
The IlvToggle
class defines toggle and radio buttons. Toggle and radio buttons are composed of a label and a marker that shows a state. The state marker can be represented as a rectangle or a diamond.
- IlvToggle objects grouped in an IlvSelector
, IlvToggle
used as a check box
A toggle button can have three states: on, off, or indeterminate. The toggle button appears grayed when its state is indeterminate.
IlvButton
, IlvSelector
.Accessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods IlvValueInterface::queryValue()
, IlvValueInterface::queryValues()
, IlvValueInterface::changeValue()
, IlvValueInterface::changeValues()
. This class inherits the accessors of its superclass IlvGadget
and adds the following ones:
Name | Type | Equivalent methods |
---|---|---|
alignment | Direction | getTextAlignment() , setLabel() |
bitmap | Bitmap | getBitmap() , setBitmap() |
checkSize | UInt | getCheckSize() , setCheckSize() |
indeterminate | Boolean | isIndeterminateState() , setIndeterminateState() |
indeterminateMode | Boolean | isIndeterminateMode() , setIndeterminateMode() |
label | String | getLabel() , setLabel() |
position | Direction | getPosition() , setPosition() |
radioType | Boolean | isRadio() , setRadio() |
state | Boolean | getState() , setState() |
This class supports the following CSS properties:
Graphic property | CSS property | Type |
---|---|---|
Background color | background-color | Color |
Text color | color | Color |
IlvToggle::IlvToggle | ( | IlvDisplay * | display, |
const char * | label, | ||
const IlvRect & | rect, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the class IlvToggle
with a label. The label is copied.
display | The connection to the display. |
label | The label of the toggle button. |
rect | The size and position of the toggle button. |
thickness | The thickness of the toggle button. |
palette | The palette used by the toggle button. |
IlvToggle::IlvToggle | ( | IlvDisplay * | display, |
const IlvPoint & | point, | ||
const char * | label, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the class IlvToggle
with a label. The label is copied. The size of the toggle button is automatically computed from label. If you want to specify its size, use the constructor that takes a rectangle as parameter.
display | The connection to the display. |
point | The position of the toggle button. |
label | The label of the toggle button. |
thickness | The thickness of the toggle button. |
palette | The palette used by the toggle button. |
IlvToggle::IlvToggle | ( | IlvDisplay * | display, |
IlvBitmap * | bitmap, | ||
const IlvRect & | rect, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the class IlvToggle
with a bitmap. The bitmap is locked.
display | The connection to the display. |
bitmap | The bitmap of the toggle button. |
rect | The size and position of the toggle button. |
thickness | The thickness of the toggle button. |
palette | The palette used by the toggle button. |
IlvToggle::IlvToggle | ( | IlvDisplay * | display, |
const IlvPoint & | point, | ||
IlvBitmap * | bitmap, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the class IlvToggle
with a bitmap. The bitmap is locked. The size of the toggle button is automatically computed from the bitmap size. If you want to specify its size, use the constructor that takes a rectangle as parameter.
display | The connection to the display. |
point | The position of the toggle button. |
bitmap | The bitmap of the toggle button. |
thickness | The thickness of the toggle button. |
palette | The palette used by the toggle button. |
|
virtual |
Is called by the interactor when the state of the toggle button changes.
The default implementation calls the main callback attached to the toggle button.
IlvGraphic::callCallback()
.
|
virtual |
Is called to draw the check box of the toggle button.
dst | The destination port. |
rect | The rectangle where to draw the check box. |
clip | The clipping region. |
|
virtual |
Is called to draw the label and bitmap of the toggle button.
dst | The destination port. |
rect | The rectangle where to draw the label and bitmap. |
clip | The clipping region. |
IlvBitmap* IlvToggle::getBitmap | ( | ) | const |
Returns the bitmap displayed by the toggle button.
0
if there is no bitmap. setBitmap()
. IlvDim IlvToggle::getCheckSize | ( | ) | const |
Returns the size of the state marker of the toggle button.
setCheckSize()
. const char* IlvToggle::getLabel | ( | ) | const |
Returns the label displayed by the toggle button.
setLabel()
, getBitmap()
. IlvPosition IlvToggle::getPosition | ( | ) | const |
Returns the position of the label or the bitmap relative to the state marker of the toggle button.
setPosition()
, getTextAlignment()
. IlBoolean IlvToggle::getState | ( | ) | const |
Returns the state of the toggle button (on or off).
IlTrue
if the toggle button is on and IlFalse
otherwise. setState()
, isIndeterminateMode()
. IlvPosition IlvToggle::getTextAlignment | ( | ) | const |
Returns the alignment of the label or the bitmap relative to the bounding box of the toggle button.
setTextAlignment()
, getPosition()
. IlBoolean IlvToggle::isIndeterminateMode | ( | ) | const |
Indicates whether the toggle is in the indeterminate mode.
IlTrue
if the toggle is in the indeterminate mode. Otherwise it returns IlFalse
. IlBoolean IlvToggle::isIndeterminateState | ( | ) | const |
Indicates whether the state of the toggle button is indeterminate.
IlTrue
if the state of the toggle button is indeterminate and IlFalse
otherwise. Use the method getState()
to define its state. IlBoolean IlvToggle::isRadio | ( | ) | const |
Indicates whether the state marker has the shape of a radio button.
IlTrue
if the state marker has the shape of a radio button or IlFalse
if it has the shape of a check box. void IlvToggle::setBitmap | ( | IlvBitmap * | bitmap | ) |
Sets the bitmap displayed by the toggle button.
bitmap | The new bitmap. The old bitmap, if any, is unlocked, and the new one is locked. |
getBitmap()
. void IlvToggle::setCheckSize | ( | IlvDim | size | ) |
Sets the size of the state marker.
size | The new size of the state marker. |
getCheckSize()
. void IlvToggle::setIndeterminateMode | ( | IlBoolean | value | ) |
Sets the mode of the toggle button to indeterminate mode.
When a toggle button is in the indeterminate mode, it can have three states: set/not set/indeterminate. The indeterminate mode does not apply to radio buttons (see isRadio()
.
value | Specifies whether the toggle button should be in the indeterminate mode (IlTrue ) or not (IlFalse ). |
void IlvToggle::setIndeterminateState | ( | IlBoolean | value | ) |
Specifies whether the state of the toggle button should be indeterminate.
When isIndeterminateMode()
returns IlTrue
, the state of the toggle button is set to indeterminate if value is set to IlTrue
.
If value is set to IlFalse
, you must call setState()
to specify its state.
If the toggle button is not in the indeterminate mode, this method does nothing.
IlvSelector
and therefore its state can never be indeterminate.value | Specifies whether the state of the toggle button should be indeterminate (IlTrue ) or not (IlFalse ). |
void IlvToggle::setLabel | ( | const char * | label | ) |
Sets the label displayed by the toggle button.
label | The new label. The old label is deleted and the new one is copied. |
getLabel()
, setBitmap()
. void IlvToggle::setPosition | ( | IlvPosition | position | ) |
Sets the position of the label or the bitmap relative to the state marker of the toggle button.
position | The new position. Valid values are: IlvRight , IlvLeft , or IlvCenter . |
getPosition()
, setTextAlignment()
. void IlvToggle::setRadio | ( | IlBoolean | value | ) |
Specifies whether the state marker should have the shape of a radio button.
value | Specifies whether the state marker should have the shape of a radio button (IlTrue ) or of a check box (IlFalse ). |
void IlvToggle::setState | ( | IlBoolean | value | ) |
Sets the state of the toggle button (on or off).
The state of the toggle button can also be switched by calling the member function invert()
(see IlvGraphic::invert()
).
value | Specifies whether the toggle button should be on (IlTrue ) or off (IlFalse ). |
getState()
, setIndeterminateMode()
. void IlvToggle::setTextAlignment | ( | IlvPosition | alignment | ) |
Sets the alignment of the label or the bitmap relative to the bounding box of the toggle button.
alignment | The new alignment. Valid values are: IlvRight , IlvLeft , or IlvCenter . |
getTextAlignment()
, setPosition()
. © Copyright 2016, 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.