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

#include <Button.h>

Inheritance diagram for Button:
ImmediateButton MomentaryButton ToggleButton

Public Types

typedef void(* callback_function) (void)
 

Public Member Functions

Constructors and Destructors
 Button (Canvas &DestCanvas, const Block_Image &DestLoc, const DRAM_Canvas *Imgs, uint8_t maxNumStates)
 Constructor for creating a Button.
 
 ~Button (void)=default
 Default destructor.
 
General Methods
void begin (void)
 Initializes the button. This method should be called before first use.
 
virtual bool press (FT5316::TouchLocation loc)
 Presses the button if loc is within the bounds of the button.
 
virtual void release (void)
 Releases the button if it has been pressed.
 
void enable (void)
 Enables the button, makking it accept button presses.
 
void disable (void)
 Disables the button, so that it ignores button presses.
 
Accesor Methods
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.
 

Protected Member Functions

void _resetToState0 (void)
 Internal method for resetting the button to state 0.
 

Member Typedef Documentation

◆ callback_function

typedef void(* Button::callback_function) (void)

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

Constructor & Destructor Documentation

◆ Button()

Button::Button ( Canvas & DestCanvas,
const Block_Image & DestLoc,
const DRAM_Canvas * Imgs,
uint8_t maxNumStates )
inline

Constructor for creating a Button.

Parameters
[in]DestCanvasDestination canvas where the current button image is copied
[in]DestLocUL x-y coordinate within DestCanvas where the button is to be copied
[in]ImgsArray of locations, pointing to button images. One image per state
[in]maxNumStatesNumber of button states

This button will toggle between the number of states specified by maxNumStates. When the button is pressed, this class will increase the state by one. If the state exceeds maxNumStates, the state is reset to 0. The button imagery is copied from the Imgs array onto the DestCanvas.

◆ ~Button()

Button::~Button ( void )
default

Default destructor.

Parameters
None.

Member Function Documentation

◆ _resetToState0()

void Button::_resetToState0 ( void )
inlineprotected

Internal method for resetting the button to state 0.

Parameters
None.

◆ begin()

void Button::begin ( void )

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

Parameters
None.

This method loads the button imagery from the source canvas, making the imagery available for use.

◆ disable()

void Button::disable ( void )
inline

Disables the button, so that it ignores button presses.

Parameters
None.

◆ enable()

void Button::enable ( void )
inline

Enables the button, makking it accept button presses.

Parameters
None.

◆ height()

uint16_t Button::height ( void ) const
inline

Returns the height of the button in pixels.

Parameters
None.
Returns
Height of Button

◆ isEnabled()

bool Button::isEnabled ( void ) const
inline

Indicates whether the Button is enabled.

Parameters
None.
Returns
True if enabled, false otherwise.

◆ press()

bool Button::press ( FT5316::TouchLocation loc)
virtual

Presses the button if loc is within the bounds of the button.

Parameters
[in]locx-y coordinate where the TFT screen has been touched

If the loc check is successful, this method updates the button imagery.

Reimplemented in ImmediateButton, and ToggleButton.

◆ release()

virtual void Button::release ( void )
inlinevirtual

Releases the button if it has been pressed.

Parameters
None.

Reimplemented in MomentaryButton.

◆ state()

uint8_t Button::state ( void ) const
inline

Returns the current state of the button.

Parameters
None.
Returns
State of the button

◆ width()

uint16_t Button::width ( void ) const
inline

Returns the width of the button in pixels.

Parameters
None.
Returns
Width of Button

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