68 bool _enabled =
false;
70 const char *_BUTTON_NAME;
75 const uint16_t _DEST_X;
76 const uint16_t _DEST_Y;
79 const uint16_t _WIDTH;
80 const uint16_t _HEIGHT;
87 bool _isValidState(uint8_t
state);
109 : _BUTTON_NAME{buttonName},
110 _whenCallback{whenCallback},
111 _DestCanvas{DestCanvas},
133 virtual void begin(
void);
187 if (++_state >= _nStates)
200 _buttonState[_state]->draw();
209 _buttonState[_state]->draw(newCanvas);
285 _whenCallback = type;
300class ToggleButton :
public Button
302 static const uint8_t _NUM_STATES = 2;
307 ToggleButton(
void) =
delete;
335 _ButtonState[0] =
new TextButtonState(Destination, DestLoc, buttonText0, Font0, callback0, fontBaseline,
336 config.cornerRadius, config.borderWidth, config.borderColor, fillColor0);
337 _ButtonState[1] =
new TextButtonState(Destination, DestLoc, buttonText1, Font1, callback1, fontBaseline,
338 config.cornerRadius, config.borderWidth, config.borderColor, fillColor1);
366 _ButtonState[0] =
new ImageButtonState(Destination, DestLoc, callback0, ButtonImg0, ButtonImgColor0,
367 config.cornerRadius, config.borderWidth, config.borderColor, ButtonFillColor0);
368 _ButtonState[1] =
new ImageButtonState(Destination, DestLoc, callback1, ButtonImg1, ButtonImgColor1,
369 config.cornerRadius, config.borderWidth, config.borderColor, ButtonFillColor1);
385 void begin(
void)
override;
402class MomentaryButton :
public ToggleButton
405 static const uint8_t _NUM_STATES = 1;
410 MomentaryButton(
void) =
delete;
435 : ToggleButton(buttonName, Destination, DestLoc,
436 buttonText0, Font0, fillColor0, nullptr, buttonText1, Font1, fillColor1, callback,
437 fontBaseline, config)
461 ROM_Image ButtonImg0, uint16_t ButtonImgColor0, uint16_t ButtonFillColor0,
462 ROM_Image ButtonImg1, uint16_t ButtonImgColor1, uint16_t ButtonFillColor1,
464 : ToggleButton(buttonName, Destination, DestLoc,
465 ButtonImg0, ButtonImgColor0, ButtonFillColor0, nullptr, ButtonImg1, ButtonImgColor1, ButtonFillColor1, callback,
498class TextBoxButton :
public Button
501 static const uint8_t _NUM_STATES = 1;
506 TextBoxButton(
void) =
delete;
521 : Button(buttonName, Destination, config.x, config.y, config.textWidth + config.UnitsFont, config.shape.
height,
545 void begin(
void)
override;
554 _ButtonState[0]->update(text);
555 _ButtonState[0]->draw();
565 _ButtonState[0]->update(value);
566 _ButtonState[0]->draw();
576 _ButtonState[0]->setUnits(text);
const struct @335246042156366161160006341037173214026114026241 COLORS
Colors used by the application.
Provides higher level TFT graphic functionality used by the menu system.
Definition Canvas.h:34
FontID
Enumeration listing available fonts.
Definition FontList.h:35
void update(int value)
Updates the numerical value (int) inside the button.
Definition Button.h:563
~TextBoxButton(void)=default
Default destructor.
void begin(void) override
Initializes the button. This method should be called before first use of the object.
Definition Button.cpp:160
TextBoxButton(const char *buttonName, Canvas &Destination, const ConfigTextBox_t &config, ButtonState::buttonCallbackFunction callback)
Constructor for button containing text with both a value and units component.
Definition Button.h:519
void update(const char *text)
Updates the value inside the button. Assumes that the string is null terminated.
Definition Button.h:552
void setUnits(const char *text)
Updates the units text inside the button. Assumes that the string is null terminated.
Definition Button.h:574
Button State for a button that uses TextBox to display a value and units inside the button.
Definition ButtonState.h:310
Button State for a button that displays text in the button.
Definition ButtonState.h:250
Structure to define sub-images. Generally associated with a ROM_Image.
Definition ROM_Images.h:22
Configuration information for a TextBox object.
Definition Definitions.h:38
Definition TFTM070A1.h:435
Structure to define the size and location of an image in Flash.
Definition ROM_Images.h:14