跳轉到主要內容

TwoWildcardTextButtonStyle

touchgfx/containers/buttons/TwoWildcardTextButtonStyle.hpp

A wildcard text button style. An wildcard 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 with a wildcard in one of two colors depending on the state of the button (pressed or released).

The TwoWildcardTextButtonStyle 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 TwoWildcardTextButtonStyle together with e.g. ImageButtonStyle:

TwoWildcardTextButtonStyle<ImageButtonStyle<ClickButtonTrigger> > myButton;

The position of the text can be adjusted with setTwoWildcardTextXY (default is centered).

Template Parameters:

See: AbstractButtonContainer

Inherits from: T

Public Functions

voidsetTwoWildcardText(TypedText t)
Sets wildcard text.
voidsetTwoWildcardTextColors(colortype newColorReleased, colortype newColorPressed)
Sets wild card text colors.
voidsetTwoWildcardTextPosition(int16_t x, int16_t y, int16_t width, int16_t height)
Sets text position and dimensions.
voidsetTwoWildcardTextRotation(TextRotation rotation)
Sets wildcard text rotation.
voidsetTwoWildcardTextX(int16_t x)
Sets wildcard text x coordinate.
voidsetTwoWildcardTextXY(int16_t x, int16_t y)
Sets wildcard text position.
voidsetTwoWildcardTextY(int16_t y)
Sets wildcard text y coordinate.
voidsetWildcardTextBuffer1(const Unicode::UnicodeChar * value)
Sets the first wildcard in the text.
voidsetWildcardTextBuffer2(const Unicode::UnicodeChar * value)
Sets the second wildcard in the text.
TwoWildcardTextButtonStyle()

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.
TextAreaWithTwoWildcardstwoWildcardText
The wildcard text.

Public Functions Documentation

setTwoWildcardText

Sets wildcard text.

Parameters:
tA TypedText to process.

setTwoWildcardTextColors

void setTwoWildcardTextColors(colortypenewColorReleased ,
colortypenewColorPressed
)

Sets wild card text colors.

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

setTwoWildcardTextPosition

void setTwoWildcardTextPosition(int16_tx ,
int16_ty ,
int16_twidth ,
int16_theight
)

Sets text position and dimensions.

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

setTwoWildcardTextRotation

Sets wildcard text rotation.

Parameters:
rotationThe rotation.

setTwoWildcardTextX

void setTwoWildcardTextX(int16_tx)

Sets wildcard text x coordinate.

Parameters:
xThe x coordinate.

setTwoWildcardTextXY

void setTwoWildcardTextXY(int16_tx ,
int16_ty
)

Sets wildcard text position.

Parameters:
xThe x coordinate.
yThe y coordinate.

setTwoWildcardTextY

void setTwoWildcardTextY(int16_ty)

Sets wildcard text y coordinate.

Parameters:
yThe y coordinate.

setWildcardTextBuffer1

Sets the first wildcard in the text.

Must be a null-terminated UnicodeChar array.

Parameters:
valueA pointer to the UnicodeChar to set the wildcard to.

setWildcardTextBuffer2

Sets the second wildcard in the text.

Must be a null-terminated UnicodeChar array.

Parameters:
valueA pointer to the UnicodeChar to set the wildcard to.

TwoWildcardTextButtonStyle

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.

twoWildcardText

TextAreaWithTwoWildcards twoWildcardText

The wildcard text.