10#ifndef BUTTON_STATE_INCLUDED
11#define BUTTON_STATE_INCLUDED
36 const uint16_t _DEST_X;
37 const uint16_t _DEST_Y;
39 const uint16_t _WIDTH;
40 const uint16_t _HEIGHT;
43 const uint8_t _BORDER_WIDTH = 0;
44 const uint16_t _BORDER_COLOR = 0xFFFF;
45 const uint16_t _FILL_COLOR = 0x0000;
46 const unsigned short _CORNER_RADIUS = 30;
74 unsigned short cornerRadius, uint8_t borderWidth, uint16_t borderColor, uint16_t fillColor16)
77 _DestCanvas{destCanvas},
82 _BORDER_WIDTH{borderWidth},
83 _BORDER_COLOR{borderColor},
84 _FILL_COLOR{fillColor16},
85 _CORNER_RADIUS{cornerRadius} {};
112 virtual void draw(
void);
126 virtual void draw(
Canvas &newCanvas,
bool TransparentOn =
true);
176 inline uint16_t
x(
void)
const
185 inline uint16_t
y(
void)
const
202 const uint16_t _buttonGfxColor;
218 uint16_t buttonGfxColor16,
unsigned short cornerRadius, uint8_t borderWidth, uint16_t borderColor16, uint16_t fillColor16)
220 cornerRadius, borderWidth, borderColor16, fillColor16),
221 _buttonGfxColor{
rgb16to12(buttonGfxColor16)}
238 void begin(
void)
override;
252 const char *_buttonText;
274 uint16_t baseline,
unsigned short cornerRadius, uint16_t borderWidth,
275 uint16_t borderColor16, uint16_t fillColor16)
276 :
ButtonState(Destination, DestLoc.
x, DestLoc.
y, DestLoc.
width, DestLoc.
height,
callback, cornerRadius, borderWidth, borderColor16, fillColor16),
277 _buttonText{_buttonText}
297 void begin(
void)
override;
325 :
ButtonState(Destination, config.
x, config.
y, config.textWidth + config.shape.unitsWidth, config.shape.
height,
352 void begin(
void)
override;
370 _TextBoxObj->Value.update(text, strlen(text));
379 _TextBoxObj->Value.update(value);
388 _TextBoxObj->Units.update(text, strlen(text));
uint16_t rgb16to12(uint16_t color16Bit)
Function for converting 16-bit colors into the 12-bit color used by the TFT.
Definition GrFont.cpp:16
Defines TextBox and TextBox which are used to display dynamic text within a canvas.
Provides higher level TFT graphic functionality used by the menu system.
Definition Canvas.h:34
Defines a simple text box for displaying dynamic text onto a Canvas.
Definition TextBox.h:46
FontID
Enumeration listing available fonts.
Definition FontList.h:35
A variation of the Canvas class that can load imagery from Flash ROM.
Definition Canvas.h:405
void setUnits(const char *text)
Update the units text inside the TextBox.
Definition ButtonState.h:386
void update(const char *text)
Update the text inside the TextBox.
Definition ButtonState.h:368
void draw(void) override
Draw the button onto Destination canvas at the specified location.
Definition ButtonState.h:359
~TextBoxButtonState(void)=default
Destroys the Text Box Button State object.
TextBoxButtonState(Canvas &Destination, const ConfigTextBox_t &config, buttonCallbackFunction callback)
Construct a new Text Box Button State object.
Definition ButtonState.h:324
void update(int value)
Update the text inside the TextBox.
Definition ButtonState.h:377
void begin(void) override
Initializes the button state object. This method should be called before first use of the object.
Definition ButtonState.cpp:89
Composite object containing a "Value" and "Units" Text Box.
Definition TextBox.h:157
void begin(void) override
Initializes the button state object. This method should be called before first use of the object.
Definition ButtonState.cpp:72
~TextButtonState(void)=default
Destroys the Text Button State object.
TextButtonState(Canvas &Destination, const Block_Image &DestLoc, const char *_buttonText, FontList::FontID Font, ButtonState::buttonCallbackFunction callback, uint16_t baseline, unsigned short cornerRadius, uint16_t borderWidth, uint16_t borderColor16, uint16_t fillColor16)
Construct a new Text Button State object.
Definition ButtonState.h:272
Structure to define sub-images. Generally associated with a ROM_Image.
Definition ROM_Images.h:22
uint16_t width
Definition ROM_Images.h:25
uint16_t height
Definition ROM_Images.h:26
Configuration information for a TextBox object.
Definition Definitions.h:38
FontList::FontID UnitsFont
Font object used to render units text.
Definition Definitions.h:54
Shape_t shape
Geometric configuration information.
Definition Definitions.h:51
FontList::FontID TextFont
Font object used to render the primary text.
Definition Definitions.h:53
uint16_t textWidth
Width in pixels of the DynamicText holding the main text.
Definition Definitions.h:41
Structure to define the size and location of an image in Flash.
Definition ROM_Images.h:14
uint16_t unitsWidth
Width in pixels of the DynamicText used to write the 'units' text to the screen.
Definition Definitions.h:20
uint16_t baseline
Location within DynamicText where the font baseline is to be placed.
Definition Definitions.h:30
uint16_t height
Overall height of the DynamicText. This height is selected to accommodate the height of the selected ...
Definition Definitions.h:21