TextButtonStyle
touchgfx/containers/buttons/TextButtonStyle.hpp
A text button style. This class is supposed to be used with one of the ButtonTrigger classes to create a functional button. This class will show a text in one of two colors depending on the state of the button (pressed or released).
The TextButtonStyle does not set the size of the enclosing container (normally AbstractButtonContainer). The size must be set manually.
To get a background behind the text, use TextButtonStyle together with e.g. ImageButtonStyle: TextButtonStyle<ImageButtonStyle<ClickButtonTrigger> > myButton;
The position of the text can be adjusted with setTextXY (default is centered).
Inherits from: T
Public Functions
void | setText(TypedText t) |
Sets a text. | |
void | setTextColors(colortype newColorReleased, colortype newColorPressed) |
Sets text colors. | |
void | setTextPosition(int16_t x, int16_t y, int16_t width, int16_t height) |
Sets text position. | |
void | setTextRotation(TextRotation rotation) |
Sets text rotation. | |
void | setTextX(int16_t x) |
Sets text x coordinate. | |
void | setTextXY(int16_t x, int16_t y) |
Sets text x and y. | |
void | setTextY(int16_t y) |
Sets text y coordinate. | |
TextButtonStyle() | |
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
colortype | colorPressed |
The color pressed. | |
colortype | colorReleased |
The color released. | |
TextArea | text |
The text. | |
Public Functions Documentation
setText
setTextColors
void setTextColors | ( | colortype | newColorReleased , | ||
colortype | newColorPressed | ||||
) |
Sets text colors.
newColorReleased | The new color released. |
newColorPressed | The new color pressed. |
setTextPosition
void setTextPosition | ( | int16_t | x , | ||
int16_t | y , | ||||
int16_t | width , | ||||
int16_t | height | ||||
) |
Sets text position.
x | The x coordinate. |
y | The y coordinate. |
width | The width of the text. |
height | The height of the text. |
setTextRotation
void setTextRotation | ( | TextRotation | rotation | ) | |
Sets text rotation.
rotation | The rotation. |
setTextX
void setTextX | ( | int16_t | x | ) | |
Sets text x coordinate.
x | The x coordinate. |
setTextXY
void setTextXY | ( | int16_t | x , | ||
int16_t | y | ||||
) |
Sets text x and y.
x | The x coordinate. |
y | The y coordinate. |
setTextY
void setTextY | ( | int16_t | y | ) | |
Sets text y coordinate.
y | The y coordinate. |
TextButtonStyle
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
colorPressed
colortype colorPressed
The color pressed.
colorReleased
colortype colorReleased
The color released.
text
TextArea text
The text.