Switch GUI element.
More...
#include <hV_GUI.h>
|
| Switch (GUI *gui) |
| Constructor.
|
|
void | dDefine (uint16_t x0, uint16_t y0, uint16_t dx, uint16_t dy, Item itemLeftBottom, Item itemRightTop, uint8_t size0=0xff) |
| Define item-based switch, vector coordinates.
|
|
void | dStringDefine (uint16_t x0, uint16_t y0, uint16_t dx, uint16_t dy, STRING_CONST_TYPE textLeftBottom, STRING_CONST_TYPE textRightTop, uint8_t size=0xff) |
| Define switch, vector coordinates.
|
|
void | draw (fsmGUI_e fsm=fsmReleased) |
| Draw the switch.
|
|
bool | check (uint8_t mode=0) |
| Check switch is pressed.
|
|
int8_t | getValue () |
| Return current value.
|
|
uint16_t | getIndex () |
| Return index of the switch.
|
|
| Area (GUI *gui) |
| Constructor.
|
|
void | dDefine (uint16_t x0, uint16_t y0, uint16_t dx, uint16_t dy, uint16_t index=0x0000) |
| Define area, vector coordinates.
|
|
bool | getState () |
| Return state of the area.
|
|
void | setState (bool state=true) |
| Define state of the area.
|
|
void | setOption (bool option=true) |
| Set option of the area.
|
|
void | setStyle (uint8_t style=0) |
| Define the default style.
|
|
bool | check (uint8_t mode=0) |
| Check if area is pressed.
|
|
uint16_t | getIndex () |
| Return index.
|
|
Switch GUI element.
Switch is a two-state button
◆ Switch()
Switch::Switch |
( |
GUI * | gui | ) |
|
Constructor.
- Parameters
-
gui | &gui to which the element belongs |
◆ check()
bool Switch::check |
( |
uint8_t | mode = 0 | ) |
|
Check switch is pressed.
With switch animation
- Parameters
-
mode | default = checkNormal = area waits for release, checkInstant = element is activated by press only |
- Returns
- true if switch pressed
◆ dDefine()
void Switch::dDefine |
( |
uint16_t | x0, |
|
|
uint16_t | y0, |
|
|
uint16_t | dx, |
|
|
uint16_t | dy, |
|
|
Item | itemLeftBottom, |
|
|
Item | itemRightTop, |
|
|
uint8_t | size0 = 0xff ) |
Define item-based switch, vector coordinates.
- Parameters
-
x0 | point coordinate, x-axis |
y0 | point coordinate, y-axis |
dx | length, x-axis |
dy | height, y-axis |
itemLeftBottom | left or bottom item (including index and text) |
itemRightTop | right or top item (including index and text) |
size0 | size for text, default = fontSizeAutomatic = automatic |
More: Coordinates, Colours
◆ draw()
Draw the switch.
- Parameters
-
- Note
- 4 states
* if switch enabled,
fsm = fsmReleased, fsmTouched, fsmConfirmed
* if switch disabled,
flag = true: statement switch, flag = false: unavailable switch
◆ dStringDefine()
void Switch::dStringDefine |
( |
uint16_t | x0, |
|
|
uint16_t | y0, |
|
|
uint16_t | dx, |
|
|
uint16_t | dy, |
|
|
STRING_CONST_TYPE | textLeftBottom, |
|
|
STRING_CONST_TYPE | textRightTop, |
|
|
uint8_t | size = 0xff ) |
Define switch, vector coordinates.
- Parameters
-
x0 | point coordinate, x-axis |
y0 | point coordinate, y-axis |
dx | length, x-axis |
dy | height, y-axis |
textLeftBottom | text for left or bottom |
textRightTop | text for right or top |
size | size of the font, default = fontSizeAutomatic = automatic, optional |
◆ getIndex()
uint16_t Switch::getIndex |
( |
| ) |
|
Return index of the switch.
- Returns
- index from items defined with dDefine
◆ getValue()
int8_t Switch::getValue |
( |
| ) |
|
Return current value.
- Returns
- current position, horizontalLeft = verticalBottom = -1 or horizontalRight = verticalTop = +1
The documentation for this class was generated from the following file: