Rogue Wave Views
Gadgets Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Friends
IlvButton Class Reference

Gadget class. More...

#include <ilviews/gadgets/button.h>

Inheritance diagram for IlvButton:
IlvMessageLabel IlvGadget IlvGadgetItemHolder IlvSimpleGraphic IlvStylable IlvGraphic IlvValueInterface IlvArrowButton

Public Member Functions

 IlvButton (IlvDisplay *display, const char *label, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvButton (IlvDisplay *display, const IlvPoint &point, const char *label, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvButton (IlvDisplay *display, IlvBitmap *bitmap, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvButton (IlvDisplay *display, const IlvPoint &point, IlvBitmap *bitmap, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
virtual void activate ()
 Is called when the button is released after having been pressed. More...
 
virtual void drawGadgetItem (const IlvGadgetItem *, IlvPort *, const IlvRect &, const IlvTransformer *=0, const IlvRegion *=0) const
 Draws a specific gadget item. More...
 
IlvBitmapgetHighlightedBitmap () const
 Returns the bitmap associated with the highlighted state of the button. More...
 
IlUInt getPeriod () const
 Returns the repeat period of the button. More...
 
IlvBitmapgetSelectedBitmap () const
 Returns the bitmap associated with the selected state of the button. More...
 
IlBoolean isRepeat () const
 Indicates whether the button is in auto-repeat mode. More...
 
void setHighlightedBitmap (IlvBitmap *bitmap)
 Sets the highlighted bitmap of the button. More...
 
void setPeriod (IlUInt period)
 Sets the repeat period of the button. More...
 
void setRepeat (IlBoolean value)
 Specifies whether the button should be in auto-repeat mode. More...
 
void setSelectedBitmap (IlvBitmap *bitmap)
 Sets the selected bitmap of the button. More...
 
- Public Member Functions inherited from IlvMessageLabel
 IlvMessageLabel (IlvDisplay *display, const char *message, const IlvRect &rect, IlvAlignment alignment=IlvLeft, IlUShort thickness=0, IlvPalette *palette=0, IlBoolean copy=IlTrue)
 Constructor. More...
 
 IlvMessageLabel (IlvDisplay *display, const IlvPoint &at, const char *message, IlvAlignment alignment=IlvLeft, IlUShort thickness=0, IlvPalette *palette=0, IlBoolean copy=IlTrue)
 Constructor. More...
 
virtual IlvGadgetItemapplyToItems (IlvApplyGadgetItem f, IlAny arg)
 Applies the specified function to all the items of the holder. More...
 
IlvAlignment getAlignment () const
 Returns the alignment of the message label. More...
 
IlvBitmapgetBitmap () const
 Returns the bitmap associated with the message label. More...
 
IlvBitmapgetInsensitiveBitmap () const
 Returns the insensitive bitmap of the message label. More...
 
const char * getLabel () const
 Returns the label stored in the message label. More...
 
virtual void getLabelOrientation (IlvOrientation &orientation, IlBoolean &flip) const
 Returns the orientation of the label. More...
 
virtual IlvPosition getLabelPosition () const
 Returns the position of the label relative to the bitmap of the message label. More...
 
const char * getMessage () const
 Returns the translated message of the message label. More...
 
char getMnemonic () const
 Returns the mnemonic associated with the message label. More...
 
virtual IlvPalettegetNormalTextPalette () const
 Returns the default palette used to draw an item. More...
 
virtual IlvPalettegetOpaquePalette () const
 Returns the opaque palette used to draw opaque items. More...
 
IlUShort getSpacing () const
 Returns the spacing between the label and the bitmap of the message label. More...
 
void setAlignment (IlvAlignment alignment)
 Sets the alignment of this message label. More...
 
void setBitmap (IlvBitmap *bitmap)
 Sets the bitmap of the message label. More...
 
void setInsensitiveBitmap (IlvBitmap *bitmap)
 Sets the insensitive bitmap of the message label. More...
 
void setLabel (const char *label, IlBoolean copy=IlTrue)
 Sets the label of the message label. More...
 
void setLabelOrientation (IlvOrientation orientation, IlBoolean flip=IlFalse, IlBoolean redraw=IlTrue)
 Sets the orientation of the label. More...
 
void setLabelPosition (IlvPosition pos, IlBoolean redraw=IlTrue)
 Sets the position of the label relative to the bitmap of the message label. More...
 
void setSpacing (IlUShort spacing, IlBoolean redraw=IlTrue)
 Sets the spacing between the label and the bitmap of the message label. More...
 
- Public Member Functions inherited from IlvGadgetItemHolder
virtual IlvGadgetItemcreateItem (const char *label, IlvGraphic *graphic=0, IlvBitmap *bitmap=0, IlvBitmap *selbitmap=0, IlBoolean copy=IlTrue) const
 Returns a new gadget item. More...
 
IlvGadgetItemgetCallbackItem () const
 Returns the item that triggered a callback. More...
 
IlvGadgetItemgetDragDropTarget () const
 Returns the target item of a drag-and-drop operation. More...
 
IlvGraphicgetDraggedImage () const
 Returns the graphic object used to draw the ghost image during a drag-and-drop operation. More...
 
IlvGadgetItemgetDraggedItem () const
 Returns the item that is being dragged during a drag-and-drop operation. More...
 
IlvGadgetItemgetEditedItem () const
 Returns the item that is being edited. More...
 
virtual IlvPalettegetHighlightTextPalette () const
 Returns the highlight palette used to draw the label of highlighted items. More...
 
virtual IlvGadgetItemgetItemByName (const char *name) const
 Returns the item whose name is specified. More...
 
IlvGadgetItemgetToolTipItem () const
 Returns the item that is displaying a tooltip. More...
 
virtual void initReDrawItems ()
 Begins a redraw session. More...
 
virtual void recomputeAllItems ()
 Recomputes the size of all the items managed by the holder. More...
 
virtual void reDrawItems ()
 Ends a redraw session. More...
 
void setDragDropTarget (IlvGadgetItem *item)
 Sets the target item of a drag-and-drop operation. More...
 
void setDraggedImage (IlvGraphic *graphic)
 Sets the graphic object used to draw the ghost image during a drag-and-drop operation. More...
 
void setDraggedItem (IlvGadgetItem *item)
 Sets the dragged item. More...
 

Friends

class IlvDefaultButtonLFHandler
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvGadgetItemHolder
static IlSymbolAbortDragItemCallbackType ()
 Returns the callback type of the Abort Drag callback. More...
 
static IlSymbolAbortEditItemCallbackType ()
 Returns the callback type of the Abort Edit callback. More...
 
static IlSymbolActivateCallbackType ()
 Returns the callback type of the Activate callback. More...
 
static IlSymbolDragItemCallbackType ()
 Returns the callback type of the Drag Item callback. More...
 
static IlSymbolEndDragItemCallbackType ()
 Returns the callback type of the End Drag callback. More...
 
static IlSymbolEndEditItemCallbackType ()
 Returns the callback type of the End Edit callback. More...
 
static IlSymbolStartDragItemCallbackType ()
 Returns the callback type of the Start Drag callback. More...
 
static IlSymbolStartEditItemCallbackType ()
 Returns the callback type of the Start Edit callback. More...
 
- Protected Member Functions inherited from IlvGadgetItemHolder
virtual void abortDragItem ()
 Is called when a drag-and-drop operation is aborted. More...
 
virtual void abortEdit (IlvGadgetItem *item)
 Is called when the editing of the specified item is aborted. More...
 
virtual void drawDraggedImage (const IlvPoint &point, const IlvTransformer *t)
 Is called to draw the ghost image during a drag-and-drop operation. More...
 
virtual void endDragItem (const IlvPoint &point)
 Is called when a drag-and-drop operation is finished. More...
 
virtual void endEdit (IlvGadgetItem *item)
 Is called after an item has been edited. More...
 
virtual void itemActivated (IlvGadgetItem *item)
 Is called when an item is activated. More...
 
virtual void itemDeSelected (IlvGadgetItem *item)
 Is called when an item is deselected. More...
 
virtual void itemDragged (const IlvPoint &point)
 Is called each time the user moves the mouse during a drag-and-drop operation. More...
 
virtual void itemHighlighted (IlvGadgetItem *item)
 Is called when an item is highlighted or unhighlighted. More...
 
virtual void itemSelected (IlvGadgetItem *item)
 Is called when an item is selected. More...
 
virtual void startDragItem (IlvGadgetItem *item)
 Is called when a drag-and-drop operation begins. More...
 
virtual void startEdit (IlvGadgetItem *item)
 Is called when an item is edited. More...
 

Detailed Description

Gadget class.

Library: ilvgadgt

The IlvButton class is one of the simplest gadgets provided in the library. It displays a label and a bitmap inside a rectangle with a three-dimensional look.

- IlvButton -

See also
IlvToggle

Accessors

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 IlvMessageLabel and adds the following ones:

Name Type Equivalent methods
autoRepeat Boolean isRepeat(), setRepeat()
autoRepeatPeriod UInt getPeriod(), setPeriod()
highlightedBitmap Bitmap getHighlightedBitmap(), setHighlightedBitmap()
selectedBitmap Bitmap getSelectedBitmap(), setSelectedBitmap()

Styling

This class supports the following CSS properties:

Graphic property CSS property Type
Background color background-colorColor
Text color color Color

Constructor & Destructor Documentation

§ IlvButton() [1/4]

IlvButton::IlvButton ( IlvDisplay display,
const char *  label,
const IlvRect rect,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the IlvButton class with a label. The label is copied.

Parameters
displayThe connection to the display.
labelThe button label.
rectThe size and position of the button.
thicknessThe thickness of the button.
paletteThe palette used by the button.

§ IlvButton() [2/4]

IlvButton::IlvButton ( IlvDisplay display,
const IlvPoint point,
const char *  label,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the IlvButton class with a label. The label is copied. The button size is automatically computed from label. If you want to specify the size, use the constructor that takes a rectangle as parameter.

Parameters
displayThe connection to the display.
pointThe position of the button.
labelThe button label.
thicknessThe thickness of the button.
paletteThe palette used by the button.

§ IlvButton() [3/4]

IlvButton::IlvButton ( IlvDisplay display,
IlvBitmap bitmap,
const IlvRect rect,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the IlvButton class with a bitmap. The bitmap is locked.

Parameters
displayThe connection to the display.
bitmapThe button bitmap.
rectThe size and position of the button.
thicknessThe thickness of the button.
paletteThe palette used by the button.

§ IlvButton() [4/4]

IlvButton::IlvButton ( IlvDisplay display,
const IlvPoint point,
IlvBitmap bitmap,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the IlvButton class with a bitmap. The bitmap is locked. The button size is automatically computed from the bitmap size. If you want to specify the size, use the constructor that takes a rectangle as parameter.

Parameters
displayThe connection to the display.
pointThe position of the button.
bitmapThe button bitmap.
thicknessThe thickness of the button.
paletteThe palette used by the button.

Member Function Documentation

§ activate()

virtual void IlvButton::activate ( )
virtual

Is called when the button is released after having been pressed.

The default implementation calls the gadget callback.

See also
IlvGraphic::callCallback

§ drawGadgetItem()

virtual void IlvButton::drawGadgetItem ( const IlvGadgetItem item,
IlvPort port,
const IlvRect rect,
const IlvTransformer t = 0,
const IlvRegion clip = 0 
) const
virtual

Draws a specific gadget item.

Redraws item in port at the location specified by rect using the clipping area clip. This method simply calls IlvGadgetItem::draw() using the item instance.

Parameters
itemThe item to be redrawn.
portThe destination drawing port.
rectThe bounding box of the item.
tThe transformer used to draw the item. Not used.
clipThe clipping area.
See also
IlvGadgetItem::draw().

Reimplemented from IlvGadgetItemHolder.

§ getHighlightedBitmap()

IlvBitmap* IlvButton::getHighlightedBitmap ( ) const

Returns the bitmap associated with the highlighted state of the button.

Returns
The bitmap associated with the highlighted state of the button.
See also
setHighlightedBitmap, getSelectedBitmap, IlvMessageLabel::getInsensitiveBitmap

§ getPeriod()

IlUInt IlvButton::getPeriod ( ) const

Returns the repeat period of the button.

This value is meaningful only if the button is in auto-repeat mode.

Returns
The repeat period of the button in milliseconds.
See also
setPeriod, isRepeat

§ getSelectedBitmap()

IlvBitmap* IlvButton::getSelectedBitmap ( ) const

Returns the bitmap associated with the selected state of the button.

Returns
The bitmap associated with the selected state of the button.
See also
setSelectedBitmap, getHighlightedBitmap, IlvMessageLabel::getInsensitiveBitmap

§ isRepeat()

IlBoolean IlvButton::isRepeat ( ) const

Indicates whether the button is in auto-repeat mode.

Returns
IlTrue if the button is in auto-repeat mode.
See also
setRepeat, getPeriod

§ setHighlightedBitmap()

void IlvButton::setHighlightedBitmap ( IlvBitmap bitmap)

Sets the highlighted bitmap of the button.

The highlighted bitmap is displayed when the cursor is over the button.

Parameters
bitmapThe new highlighted bitmap. The previous highlighted bitmap, if any, is unlocked, and the new one is locked.
See also
getHighlightedBitmap, setSelectedBitmap

§ setPeriod()

void IlvButton::setPeriod ( IlUInt  period)

Sets the repeat period of the button.

Parameters
periodThe new period in milliseconds.
See also
getPeriod, setRepeat

§ setRepeat()

void IlvButton::setRepeat ( IlBoolean  value)

Specifies whether the button should be in auto-repeat mode.

When the button is an "auto-repeat" button, the callback is invoked repeatedly until the button is released.

Parameters
valueA Boolean value specifying whether the button is in auto-repeat mode (IlTrue) or not (IlFalse).
See also
isRepeat, setPeriod

§ setSelectedBitmap()

void IlvButton::setSelectedBitmap ( IlvBitmap bitmap)

Sets the selected bitmap of the button.

The selected bitmap is displayed when the button is clicked on.

Parameters
bitmapThe new selected bitmap. The previous selected bitmap, if any, is unlocked, and the new one is locked.
See also
getSelectedBitmap, setHighlightedBitmap

© Copyright 2017, 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.