跳转到主要内容

ImageButtonStyle

touchgfx/containers/buttons/ImageButtonStyle.hpp

An image 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 images depending on the state of the button (pressed or released).

The ImageButtonStyle will set the size of the enclosing container (normally AbstractButtonContainer) to the size of the pressed Bitmap. This can be overridden by calling setWidth/setHeight after setting the bitmaps.

The position of the bitmap can be adjusted with setBitmapXY (default is upper left corner).

Template Parameters:

See: AbstractButtonContainer

Inherits from: T

Public Functions

BitmapgetCurrentlyDisplayedBitmap() const
Gets currently displayed bitmap.
ImageButtonStyle()
virtual voidsetBitmaps(const Bitmap & bmpReleased, const Bitmap & bmpPressed)
Sets the bitmaps.
voidsetBitmapXY(uint16_t x, uint16_t y)
Sets bitmap x and y.

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

ImagebuttonImage
The button image.
Bitmapdown
The image to display when button is pressed.
Bitmapup
The image to display when button is released.

Public Functions Documentation

getCurrentlyDisplayedBitmap

Gets currently displayed bitmap.

Returns:

The currently displayed bitmap.

ImageButtonStyle

setBitmaps

virtual void setBitmaps(const Bitmap &bmpReleased ,
const Bitmap &bmpPressed
)

Sets the bitmaps.

Parameters:
bmpReleasedThe bitmap released.
bmpPressedThe bitmap pressed.

setBitmapXY

void setBitmapXY(uint16_tx ,
uint16_ty
)

Sets bitmap x and y.

Parameters:
xAn uint16_t to process.
yAn uint16_t to process.

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

buttonImage

Image buttonImage

The button image.

down

Bitmap down

The image to display when button is pressed.

up

Bitmap up

The image to display when button is released.