Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/toggle.h>
Public Member Functions | |
IlvToggle (IlvDisplay *display, const IlvPoint &point, IlvBitmap *bitmap, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvToggle (IlvDisplay *display, IlvBitmap *bitmap, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvToggle (IlvDisplay *display, const IlvPoint &point, const char *label, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvToggle (IlvDisplay *display, const char *label, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
virtual void | activate () |
Is called by the interactor when the state of the toggle button changes. | |
virtual void | drawCheckBox (IlvPort *dst, const IlvRect &rect, const IlvRegion *clip=0) const |
Is called to draw the check box of the toggle button. | |
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. | |
IlvBitmap * | getBitmap () const |
Returns the bitmap displayed by the toggle button. | |
IlvDim | getCheckSize () const |
Returns the size of the state marker of the toggle button. | |
const char * | getLabel () const |
Returns the label displayed by the toggle button. | |
IlvPosition | getPosition () const |
Returns the position of the label or the bitmap relative to the state marker of the toggle button. | |
IlBoolean | getState () const |
Returns the state of the toggle button (on or off). | |
IlvPosition | getTextAlignment () const |
Returns the alignment of the label or the bitmap relative to the bounding box of the toggle button. | |
IlBoolean | isIndeterminateMode () const |
Indicates whether the toggle is in the indeterminate mode. | |
IlBoolean | isIndeterminateState () const |
Indicates whether the state of the toggle button is indeterminate. | |
IlBoolean | isRadio () const |
Indicates whether the state marker has the shape of a radio button. | |
void | setBitmap (IlvBitmap *bitmap) |
Sets the bitmap displayed by the toggle button. | |
void | setCheckSize (IlvDim size) |
Sets the size of the state marker. | |
void | setIndeterminateMode (IlBoolean value) |
Sets the mode of the toggle button to indeterminate mode. | |
void | setIndeterminateState (IlBoolean value) |
Specifies whether the state of the toggle button should be indeterminate. | |
void | setLabel (const char *label) |
Sets the label displayed by the toggle button. | |
void | setPosition (IlvPosition position) |
Sets the position of the label or the bitmap relative to the state marker of the toggle button. | |
void | setRadio (IlBoolean v) |
Specifies whether the state marker should have the shape of a radio button. | |
void | setState (IlBoolean value) |
Sets the state of the toggle button (on or off). | |
void | setTextAlignment (IlvPosition alignment) |
Sets the alignment of the label or the bitmap relative to the bounding box of the toggle button. |
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.
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 void IlvToggle::activate | ( | ) | [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.
virtual void IlvToggle::drawCheckBox | ( | IlvPort * | dst, | |
const IlvRect & | rect, | |||
const IlvRegion * | clip = 0 | |||
) | const [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 void IlvToggle::drawText | ( | IlvPort * | dst, | |
const IlvRect & | rect, | |||
const IlvRegion * | clip = 0 | |||
) | const [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. IlvDim IlvToggle::getCheckSize | ( | ) | const |
Returns the size of the state marker of the toggle button.
const char* IlvToggle::getLabel | ( | ) | const |
IlvPosition IlvToggle::getPosition | ( | ) | const |
Returns the position of the label or the bitmap relative to the state marker of the toggle button.
IlBoolean IlvToggle::getState | ( | ) | const |
Returns the state of the toggle button (on or off).
IlTrue
if the toggle button is on and IlFalse
otherwise. IlvPosition IlvToggle::getTextAlignment | ( | ) | const |
Returns the alignment of the label or the bitmap relative to the bounding box of the toggle button.
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 IlvToggle::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. |
void IlvToggle::setCheckSize | ( | IlvDim | size | ) |
Sets the size of the state marker.
size | The new size of the state marker. |
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 IlvToggle::isRadio
.
value | A Boolean value specifying 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 IlvToggle::getState
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 | A Boolean value specifying whether the state of the toggle button should be indeterminate (IlTrue ) or not (IlFalse ). |
void IlvToggle::setLabel | ( | const char * | label | ) |
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 . |
void IlvToggle::setRadio | ( | IlBoolean | v | ) |
Specifies whether the state marker should have the shape of a radio button.
value | A Boolean value specifying 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 | A Boolean value specifying whether the toggle button should be on (IlTrue ) or off (IlFalse ). |
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 . |
© 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.