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

Base class used by all derived Button State classes. More...

#include <ButtonState.h>

Inheritance diagram for ButtonState:
ImageButtonState TextBoxButtonState TextButtonState

Public Types

typedef void(* buttonCallbackFunction) (void)
 Defines the form of the callback functions expected by the Button class.
 

Public Member Functions

Constructors and Destructors
 ButtonState (Canvas &destCanvas, uint16_t x, uint16_t y, uint16_t width, uint16_t height, buttonCallbackFunction callback, unsigned short cornerRadius, uint8_t borderWidth, uint16_t borderColor, uint16_t fillColor16)
 Construct a new Button State object.
 
virtual ~ButtonState ()=default
 Default destructor.
 
General Methods
virtual void updateBackground (void)
 Update the button background graphics.
 
virtual void draw (void)
 Draw the button assuming images have transparent background.
 
virtual void drawOpaque (void)
 Draw the button assuming images have an opaque background.
 
virtual void draw (Canvas &newCanvas, bool TransparentOn=true)
 Draw the button onto the specified canvas at the specified location.
 
virtual void begin (void)
 Initializes the button state object. This method should be called before first use of the object.
 
void callback (void) const
 Calls the callback function associated with this button state.
 
Accessor Methods
uint16_t width (void) const
 Returns the width of the button state.
 
uint16_t height (void) const
 Returns the height of the button state.
 
uint16_t x (void) const
 Returns the X location of the button state on the destination canvas.
 
uint16_t y (void) const
 Returns the Y location of the button state on the destination canvas.
 

Protected Attributes

Canvas_ButtonGfxCanvas = nullptr
 Canvas that holds the colorized button graphics. Derived classes will define this canvas as appropriate.
 

Detailed Description

Base class used by all derived Button State classes.

This class is used internally by the Button class and its derivatives.

Member Typedef Documentation

◆ buttonCallbackFunction

typedef void(* ButtonState::buttonCallbackFunction) (void)

Defines the form of the callback functions expected by the Button class.

Constructor & Destructor Documentation

◆ ButtonState()

ButtonState::ButtonState ( Canvas & destCanvas,
uint16_t x,
uint16_t y,
uint16_t width,
uint16_t height,
buttonCallbackFunction callback,
unsigned short cornerRadius,
uint8_t borderWidth,
uint16_t borderColor,
uint16_t fillColor16 )
inline

Construct a new Button State object.

Parameters
[in]destCanvasCanvas where the button will be drawn
[in]xX location of the image in the destination canvas
[in]yY location of the image in the destination canvas
[in]widthWidth of the image
[in]heightHeight of the image
[in]callbackCallback function associated with this button state
[in]cornerRadiusCorner radius for the button
[in]borderWidthBorder width in pixels of the button border
[in]borderColorBorder color in 16-bit RGB format
[in]fillColor16Fill color in 16-bit RGB format

◆ ~ButtonState()

virtual ButtonState::~ButtonState ( )
virtualdefault

Default destructor.

Parameters
None.

Member Function Documentation

◆ begin()

virtual void ButtonState::begin ( void )
inlinevirtual

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

Parameters
None.

Reimplemented in ImageButtonState, TextBoxButtonState, and TextButtonState.

◆ callback()

void ButtonState::callback ( void ) const
inline

Calls the callback function associated with this button state.

Parameters
None.

◆ draw() [1/2]

void ButtonState::draw ( Canvas & newCanvas,
bool TransparentOn = true )
virtual

Draw the button onto the specified canvas at the specified location.

Parameters
[in]newCanvasCanvas where the button will be drawn
[in]TransparentOnIf true, the button graphics will be drawn with transparency

◆ draw() [2/2]

void ButtonState::draw ( void )
virtual

Draw the button assuming images have transparent background.

Parameters
None.

Reimplemented in TextBoxButtonState.

◆ drawOpaque()

void ButtonState::drawOpaque ( void )
virtual

Draw the button assuming images have an opaque background.

Parameters
None.

◆ height()

uint16_t ButtonState::height ( void ) const
inline

Returns the height of the button state.

Returns
height of the button state in pixels

◆ updateBackground()

void ButtonState::updateBackground ( void )
virtual

Update the button background graphics.

Parameters
None.

◆ width()

uint16_t ButtonState::width ( void ) const
inline

Returns the width of the button state.

Returns
width of the button state in pixels

◆ x()

uint16_t ButtonState::x ( void ) const
inline

Returns the X location of the button state on the destination canvas.

Returns
UL X location of the button state in pixels

◆ y()

uint16_t ButtonState::y ( void ) const
inline

Returns the Y location of the button state on the destination canvas.

Returns
UL Y location of the button state in pixels

Member Data Documentation

◆ _ButtonGfxCanvas

Canvas* ButtonState::_ButtonGfxCanvas = nullptr
protected

Canvas that holds the colorized button graphics. Derived classes will define this canvas as appropriate.


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