Solo Controller Documentation 1.0
Documentation for the Solo Controller
 
Loading...
Searching...
No Matches
TextBoxButton Class Reference

Defines a single state button containing text with both a value and units component. More...

#include <Button.h>

Inheritance diagram for TextBoxButton:
Button

Public Member Functions

Constructors and Destructors
 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.
 
 ~TextBoxButton (void)=default
 Default destructor.
 
General Methods
void begin (void) override
 Initializes the button. This method should be called before first use of the object.
 
void update (const char *text)
 Updates the value inside the button. Assumes that the string is null terminated.
 
void update (int value)
 Updates the numerical value (int) inside the button.
 
void setUnits (const char *text)
 Updates the units text inside the button. Assumes that the string is null terminated.
 
- Public Member Functions inherited from Button
 Button (const char *buttonName, Canvas &DestCanvas, uint16_t dest_x, uint16_t dest_y, uint16_t width, uint16_t height, callback_type whenCallback)
 Constructor for creating a Button object.
 
virtual ~Button (void)=default
 Default destructor.
 
virtual bool press (FT5316::TouchLocation loc)
 Presses the button if loc is within the bounds of the button.
 
virtual void release (void)
 Called when the button is released.
 
void enable (void)
 Enables the button, making it accept button presses.
 
void disable (void)
 Disables the button, so that it ignores button presses.
 
void setState (uint8_t state)
 Sets the button to the specified state.
 
void nextState (void)
 Advances the button to the next state.
 
void draw (void)
 Draws the image from the current ButtonState onto the destination canvas.
 
void draw (Canvas &newCanvas)
 Draws the image from the current ButtonState onto the specified canvas.
 
bool isEnabled (void) const
 Indicates whether the Button is enabled.
 
uint16_t width (void) const
 Returns the width of the button in pixels.
 
uint16_t height (void) const
 Returns the height of the button in pixels.
 
uint8_t state (void) const
 Returns the current state of the button.
 

Additional Inherited Members

- Public Types inherited from Button
enum  callback_type { ON_PRESS , ON_RELEASE }
 Type definition that defines when the callback function is called relative to button press/release. More...
 
- Protected Member Functions inherited from Button
void _validateObject (void)
 Validates that all ButtonState objects have been defined.
 
void _registerButtonStates (ButtonState **buttonStatePtrArr, uint8_t numStates)
 Registers the ButtonState objects that define this button.
 
void _changeCallback (callback_type type)
 Convenience method that changes when the callback is called.
 

Detailed Description

Defines a single state button containing text with both a value and units component.

The text displayed within the button has both a value and units component.

Constructor & Destructor Documentation

◆ TextBoxButton()

TextBoxButton::TextBoxButton ( const char * buttonName,
Canvas & Destination,
const ConfigTextBox_t & config,
ButtonState::buttonCallbackFunction callback )
inline

Constructor for button containing text with both a value and units component.

Parameters
[in]buttonNameString containing the name of the button (used for error messages)
[in]DestinationDestination canvas to where the current button image is drawn
[in]configGraphical configuration parameters for the button
[in]callbackCallback function when the button is released

◆ ~TextBoxButton()

TextBoxButton::~TextBoxButton ( void )
default

Default destructor.

Parameters
None.

Member Function Documentation

◆ begin()

void TextBoxButton::begin ( void )
overridevirtual

Initializes the button. This method should be called before first use of the object.

Parameters
None.

Reimplemented from Button.

◆ setUnits()

void TextBoxButton::setUnits ( const char * text)
inline

Updates the units text inside the button. Assumes that the string is null terminated.

Parameters
[in]textNull-terminated character array containing the text

◆ update() [1/2]

void TextBoxButton::update ( const char * text)
inline

Updates the value inside the button. Assumes that the string is null terminated.

Parameters
[in]textNull-terminated character array containing the text

◆ update() [2/2]

void TextBoxButton::update ( int value)
inline

Updates the numerical value (int) inside the button.

Parameters
[in]valueValue to be displayed inside the button

The documentation for this class was generated from the following files: