Keyboard GUI element.
More...
#include <hV_GUI.h>
|
| Keyboard (GUI *gui) |
| Constructor.
|
|
void | dDefine (uint16_t x0, uint16_t y0, uint16_t dx, uint16_t dy, Item *keys, uint8_t columns=4, uint8_t lines=3, uint8_t size0=0xff) |
| Define the keyboard, vector coordinates.
|
|
void | define (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, Item *keys, uint8_t columns=4, uint8_t lines=3, uint8_t size0=0xff) |
| Define the keyboard, rectangle coordinates.
|
|
void | setOption (bool option=true) |
| Draw frames around keys.
|
|
void | drawInitial () |
| Draw the initial keyboard.
|
|
void | draw (uint8_t indexColumn, uint8_t indexLine, fsmGUI_e fsm=fsmReleased) |
| Update the keyboard.
|
|
void | setState (bool state=true) |
| Define state of the area.
|
|
bool | check (uint8_t mode=0) |
| Check if area is pressed.
|
|
uint16_t | getIndex () |
| Return index of the touched key.
|
|
| 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.
|
|
Keyboard GUI element.
Keyboard displays columns and rows of keys.
◆ Keyboard()
Keyboard::Keyboard |
( |
GUI * | gui | ) |
|
Constructor.
- Parameters
-
gui | &gui to which the element belongs |
◆ check()
bool Keyboard::check |
( |
uint8_t | mode = 0 | ) |
|
Check if area is pressed.
- Parameters
-
mode | default = checkNormal = area waits for release, checkInstant = element is activated by press only |
- Returns
- true if button pressed
◆ dDefine()
void Keyboard::dDefine |
( |
uint16_t | x0, |
|
|
uint16_t | y0, |
|
|
uint16_t | dx, |
|
|
uint16_t | dy, |
|
|
Item * | keys, |
|
|
uint8_t | columns = 4, |
|
|
uint8_t | lines = 3, |
|
|
uint8_t | size0 = 0xff ) |
Define the keyboard, vector coordinates.
- Parameters
-
x0 | point coordinate, x-axis |
y0 | point coordinate, y-axis |
dx | length, x-axis |
dy | height, y-axis |
keys | array of items for keys, one item per key |
columns | number of columns, default = 4 |
lines | number of rows, default = 3 |
size0 | size for text, default = fontSizeAutomatic = automatic |
- Note
- Keys are arranged per line.
Line 1: Column 1, Column 2, ... Column<columns>
Line 2: Column 1, Column 2, ... Column<columns>
...
Line <lines>: Column 1, Column 2, ... Column<columns>
More: Coordinates, Colours
◆ define()
void Keyboard::define |
( |
uint16_t | x1, |
|
|
uint16_t | y1, |
|
|
uint16_t | x2, |
|
|
uint16_t | y2, |
|
|
Item * | keys, |
|
|
uint8_t | columns = 4, |
|
|
uint8_t | lines = 3, |
|
|
uint8_t | size0 = 0xff ) |
Define the keyboard, rectangle coordinates.
- Parameters
-
x1 | top left coordinate, x-axis |
y1 | top left coordinate, y-axis |
x2 | bottom right coordinate, x-axis |
y2 | bottom right coordinate, y-axis |
keys | array of items for keys |
columns | number of columns, default = 4 |
lines | number of rows, default = 3 |
size0 | size for text, default = fontSizeAutomatic = automatic |
More: Coordinates, Colours
◆ draw()
Update the keyboard.
- Parameters
-
indexColumn | cell to update, column number = 0..columns - 1 |
indexLine | cell to update, row number = 0..lines - 1 |
fsm | state |
- Note
- 4 states
* if button enabled,
fsm = fsmReleased, fsmTouched, fsmConfirmed
* if button disabled,
flag = true: statement checkbox, flag = false: unavailable checkbox
◆ getIndex()
uint16_t Keyboard::getIndex |
( |
| ) |
|
Return index of the touched key.
- Returns
- index from items defined with dDefine, 0 = none
◆ setOption()
void Keyboard::setOption |
( |
bool | option = true | ) |
|
Draw frames around keys.
The keyboard is initialised with false = no boxes. Use setOption to draw frames.
- Parameters
-
option | default = optionWithFrame = within boxes, false = no frames |
◆ setState()
void Keyboard::setState |
( |
bool | state = true | ) |
|
Define state of the area.
- Parameters
-
state | default = stateEnabled = area enabled, stateDisabled = otherwise |
- Note
- When created, state set to false
The documentation for this class was generated from the following file: