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

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).

See: AbstractButtonContainer

Inherits from: T

Public Functions

voidsetText(TypedText t)
Sets a text.
voidsetTextColors(colortype newColorReleased, colortype newColorPressed)
Sets text colors.
voidsetTextPosition(int16_t x, int16_t y, int16_t width, int16_t height)
Sets text position.
voidsetTextRotation(TextRotation rotation)
Sets text rotation.
voidsetTextX(int16_t x)
Sets text x coordinate.
voidsetTextXY(int16_t x, int16_t y)
Sets text x and y.
voidsetTextY(int16_t y)
Sets text y coordinate.
TextButtonStyle()

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

colortypecolorPressed
The color pressed.
colortypecolorReleased
The color released.
TextAreatext
The text.

Public Functions Documentation

setText

Sets a text.

Parameters:
tA TypedText to process.

setTextColors

void setTextColors(colortypenewColorReleased ,
colortypenewColorPressed
)

Sets text colors.

Parameters:
newColorReleasedThe new color released.
newColorPressedThe new color pressed.

setTextPosition

void setTextPosition(int16_tx ,
int16_ty ,
int16_twidth ,
int16_theight
)

Sets text position.

Parameters:
xThe x coordinate.
yThe y coordinate.
widthThe width of the text.
heightThe height of the text.

setTextRotation

Sets text rotation.

Parameters:
rotationThe rotation.

setTextX

void setTextX(int16_tx)

Sets text x coordinate.

Parameters:
xThe x coordinate.

setTextXY

void setTextXY(int16_tx ,
int16_ty
)

Sets text x and y.

Parameters:
xThe x coordinate.
yThe y coordinate.

setTextY

void setTextY(int16_ty)

Sets text y coordinate.

Parameters:
yThe 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.