IconButtonStyle
touchgfx/containers/buttons/IconButtonStyle.hpp
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.
Inherits from: T
Public Functions
Bitmap | getCurrentlyDisplayedIcon() const |
Gets currently displayed icon. | |
int16_t | getIconX() const |
Gets icon x coordinate. | |
int16_t | getIconY() const |
Gets icon y coordinate. | |
IconButtonStyle() | |
virtual void | setIconBitmaps(const Bitmap & newIconReleased, const Bitmap & newIconPressed) |
Sets icon bitmaps. | |
void | setIconX(int16_t x) |
Sets icon x coordinate. | |
void | setIconXY(int16_t x, int16_t y) |
Sets the position of the icon. | |
void | setIconY(int16_t y) |
Sets icon y coordinate. | |
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 | iconImage |
The icon image. | |
Bitmap | iconPressed |
Icon to display when button is pressed. | |
Bitmap | iconReleased |
Icon to display when button is not pressed. | |
Public Functions Documentation
getCurrentlyDisplayedIcon
Bitmap getCurrentlyDisplayedIcon | ( | ) | const |
Gets currently displayed icon.
The currently displayed icon.
getIconX
int16_t getIconX | ( | ) | const |
Gets icon x coordinate.
The icon x coordinate.
getIconY
int16_t getIconY | ( | ) | const |
Gets icon y coordinate.
The icon y coordinate.
IconButtonStyle
setIconBitmaps
virtual void setIconBitmaps | ( | const Bitmap & | newIconReleased , | ||
const Bitmap & | newIconPressed | ||||
) |
Sets icon bitmaps.
newIconReleased | The new icon released. |
newIconPressed | The new icon pressed. |
setIconX
void setIconX | ( | int16_t | x | ) | |
Sets icon x coordinate.
x | The x coordinate. |
setIconXY
void setIconXY | ( | int16_t | x , | ||
int16_t | y | ||||
) |
Sets the position of the icon.
x | The x coordinate. |
y | The y coordinate. |
setIconY
void setIconY | ( | int16_t | y | ) | |
Sets icon y coordinate.
y | The 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.