メイン・コンテンツまでスキップ

IconButtonStyle

An icon button style. This class is supposed to be used with one of the ButtonTrigger classes to create a functional button. This class will show one of two icons depending on the state of the button (pressed or released).

To get a background behind the icon, use IconButtonStyle together with e.g. ImageButtonStyle: IconButtonStyle<ImageButtonStyle<ClickButtonTrigger> > myButton;

The IconButtonStyle will center the icon on the enclosing container (normally AbstractButtonContainer). Set the size of the button before setting the icons.

The position of the icon can be adjusted with setIconXY.

See: AbstractButtonContainer

Inherits from: T

Public Functions

BitmapgetCurrentlyDisplayedIcon() const
Gets currently displayed icon.
int16_tgetIconX() const
Gets icon x coordinate.
int16_tgetIconY() const
Gets icon y coordinate.
IconButtonStyle()
virtual voidsetIconBitmaps(const Bitmap & newIconReleased, const Bitmap & newIconPressed)
Sets icon bitmaps.
voidsetIconX(int16_t x)
Sets icon x coordinate.
voidsetIconXY(int16_t x, int16_t y)
Sets the position of the icon.
voidsetIconY(int16_t y)
Sets icon y coordinate.

Protected Functions

virtual voidhandleAlphaUpdated()
Handles what should happen when the alpha is updated.
virtual voidhandlePressedUpdated()
Handles what should happen when the pressed state is updated.

Protected Attributes

ImageiconImage
The icon image.
BitmapiconPressed
Icon to display when button is pressed.
BitmapiconReleased
Icon to display when button is not pressed.

Public Functions Documentation

getCurrentlyDisplayedIcon

Gets currently displayed icon.

Returns:

The currently displayed icon.

getIconX

int16_t getIconX()const

Gets icon x coordinate.

Returns:

The icon x coordinate.

getIconY

int16_t getIconY()const

Gets icon y coordinate.

Returns:

The icon y coordinate.

IconButtonStyle

setIconBitmaps

virtual void setIconBitmaps(const Bitmap &newIconReleased ,
const Bitmap &newIconPressed
)

Sets icon bitmaps.

Parameters:
newIconReleasedThe new icon released.
newIconPressedThe new icon pressed.

setIconX

void setIconX(int16_tx)

Sets icon x coordinate.

Parameters:
xThe x coordinate.

setIconXY

void setIconXY(int16_tx ,
int16_ty
)

Sets the position of the icon.

Parameters:
xThe x coordinate.
yThe y coordinate.

setIconY

void setIconY(int16_ty)

Sets icon y coordinate.

Parameters:
yThe y coordinate.

Protected Functions Documentation

handleAlphaUpdated

virtual void handleAlphaUpdated()

Handles what should happen when the alpha is updated.

handlePressedUpdated

virtual void handlePressedUpdated()

Handles what should happen when the pressed state is updated.

Protected Attributes Documentation

iconImage

Image iconImage

The icon image.

iconPressed

Bitmap iconPressed

Icon to display when button is pressed.

iconReleased

Bitmap iconReleased

Icon to display when button is not pressed.