#include <Button.h>
|
|
| | Button (Canvas &DestCanvas, const Block_Image &DestLoc, const DRAM_Canvas *Imgs, uint8_t maxNumStates) |
| | Constructor for creating a Button.
|
| |
| | ~Button (void)=default |
| | Default destructor.
|
| |
|
| 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.
|
| |
|
| 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.
|
| |
|
| void | _resetToState0 (void) |
| | Internal method for resetting the button to state 0.
|
| |
◆ callback_function
| typedef void(* Button::callback_function) (void) |
Defines the form of the callback functions expected by the Button class
◆ Button()
Constructor for creating a Button.
- Parameters
-
| [in] | DestCanvas | Destination canvas where the current button image is copied |
| [in] | DestLoc | UL x-y coordinate within DestCanvas where the button is to be copied |
| [in] | Imgs | Array of locations, pointing to button images. One image per state |
| [in] | maxNumStates | Number 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()
Default destructor.
- Parameters
- None.
◆ _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()
Presses the button if loc is within the bounds of the button.
- Parameters
-
| [in] | loc | x-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:
- C:/Users/david/Documents/PlatformIO/Solo_Controller/Solo_Controller_Repo/src/Button.h
- C:/Users/david/Documents/PlatformIO/Solo_Controller/Solo_Controller_Repo/src/Button.cpp