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:
- T Generic type parameter. Typically a AbstractButtonContainer subclass.
Inherits from: T
Public Functions
Bitmap | getCurrentlyDisplayedBitmap() const |
Gets currently displayed bitmap. | |
ImageButtonStyle() | |
virtual void | setBitmaps(const Bitmap & bmpReleased, const Bitmap & bmpPressed) |
Sets the bitmaps. | |
void | setBitmapXY(uint16_t x, uint16_t y) |
Sets bitmap x and y. | |
Protected Functions
virtual void | handleAlphaUpdated() |
Handles what should happen when the alpha is updated. | |
virtual void | handlePressedUpdated() |
Handles what should happen when the pressed state is updated. | |
Protected Attributes
Image | buttonImage |
The button image. | |
Bitmap | down |
The image to display when button is pressed. | |
Bitmap | up |
The image to display when button is released. | |
Public Functions Documentation
getCurrentlyDisplayedBitmap
Bitmap getCurrentlyDisplayedBitmap | ( | ) | const |
Gets currently displayed bitmap.
The currently displayed bitmap.
ImageButtonStyle
setBitmaps
virtual void setBitmaps | ( | const Bitmap & | bmpReleased , | ||
const Bitmap & | bmpPressed | ||||
) |
Sets the bitmaps.
bmpReleased | The bitmap released. |
bmpPressed | The bitmap pressed. |
setBitmapXY
void setBitmapXY | ( | uint16_t | x , | ||
uint16_t | y | ||||
) |
Sets bitmap x and y.
x | An uint16_t to process. |
y | An 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.