rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvToggle Class Reference

Gadget class. More...

#include <ilviews/gadgets/toggle.h>

Inheritance diagram for IlvToggle:
IlvGadget IlvSimpleGraphic IlvGraphic IlvColoredToggle

List of all members.

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.
IlvBitmapgetBitmap () 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.

Detailed Description

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.

IlvTogglea.gif

- 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.

See also:
IlvButton, IlvSelector

Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Member Function Documentation

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.

See also:
IlvGraphic::callCallback
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.

Parameters:
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.

Parameters:
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.

Returns:
The bitmap displayed by the toggle button, or 0 if there is no bitmap.
See also:
setBitmap
IlvDim IlvToggle::getCheckSize (  )  const

Returns the size of the state marker of the toggle button.

Returns:
The size of the bounding box of the state marker.
See also:
setCheckSize
const char* IlvToggle::getLabel (  )  const

Returns the label displayed by the toggle button.

Returns:
The label displayed by the toggle button.
See also:
setLabel, getBitmap
IlvPosition IlvToggle::getPosition (  )  const

Returns the position of the label or the bitmap relative to the state marker of the toggle button.

Returns:
The position of the label or the bitmap, relative to the state marker of the toggle button.
See also:
setPosition, getTextAlignment
IlBoolean IlvToggle::getState (  )  const

Returns the state of the toggle button (on or off).

Returns:
IlTrue if the toggle button is on and IlFalse otherwise.
See also:
setState, isIndeterminateMode
IlvPosition IlvToggle::getTextAlignment (  )  const

Returns the alignment of the label or the bitmap relative to the bounding box of the toggle button.

Returns:
The alignment of the label or the bitmap relative to the bounding box of the toggle button.
See also:
setTextAlignment, getPosition
IlBoolean IlvToggle::isIndeterminateMode (  )  const

Indicates whether the toggle is in the indeterminate mode.

Returns:
IlTrue if the toggle is in the indeterminate mode. Otherwise it returns IlFalse.
See also:
setIndeterminateState, isIndeterminateState
IlBoolean IlvToggle::isIndeterminateState (  )  const

Indicates whether the state of the toggle button is indeterminate.

Returns:
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.

Returns:
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.

Parameters:
bitmap The new bitmap. The old bitmap, if any, is unlocked, and the new one is locked.
See also:
getBitmap
void IlvToggle::setCheckSize ( IlvDim  size  ) 

Sets the size of the state marker.

Parameters:
size The new size of the state marker.
See also:
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 IlvToggle::isRadio.

Parameters:
value A Boolean value specifying whether the toggle button should be in the indeterminate mode (IlTrue) or not (IlFalse).
See also:
isIndeterminateMode, setIndeterminateState, isRadio
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.

Warning:
[note] A toggle button with a radio look must be used inside an IlvSelector and therefore its state can never be indeterminate.
Parameters:
value A Boolean value specifying whether the state of the toggle button should be indeterminate (IlTrue) or not (IlFalse).
See also:
isIndeterminateMode, getState, isIndeterminateState
void IlvToggle::setLabel ( const char *  label  ) 

Sets the label displayed by the toggle button.

Parameters:
label The new label. The old label is deleted and the new one is copied.
See also:
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.

Parameters:
position The new position. Valid values are: IlvRight , IlvLeft, or IlvCenter.
See also:
getPosition, setTextAlignment
void IlvToggle::setRadio ( IlBoolean  v  ) 

Specifies whether the state marker should have the shape of a radio button.

Parameters:
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).

Parameters:
value A Boolean value specifying whether the toggle button should be on (IlTrue) or off (IlFalse).
See also:
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.

Parameters:
alignment The new alignment. Valid values are: IlvRight, IlvLeft, or IlvCenter.
See also:
getTextAlignment, setPosition

© 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.