rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
ui_textkey.h
Go to the documentation of this file.
1
51#pragma once
52
53#include <stdbool.h>
54#include <stddef.h>
55#include <stdint.h>
56
57#include "gfx.h"
58#include "touch_types.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
65#define UI_TEXTKEY_MAX 23
67#define UI_TEXTKEY_PASS_MAX 63
69#define UI_TEXTKEY_PASS_MIN 8
71#define UI_TEXTKEY_SSID_MAX 32
72
75#define UI_TEXTKEY_CHARS 40
77enum {
83};
86#define UI_TK_SHOW UI_TK_KEYS
88#define UI_TK_SHIFT 30
90#define UI_TK_LAYER 38
92#define UI_TK_DEL (UI_TEXTKEY_CHARS - 1)
94#define UI_TK_MARK (UI_TEXTKEY_CHARS - 3)
96#define UI_TK_DOT (UI_TEXTKEY_CHARS - 2)
97
104
111
114typedef struct {
115 bool open;
117 char title[48];
119 int len;
121 bool refused;
122 bool search;
123 bool folder;
124 bool file;
125 uint8_t why;
127 bool wifi;
128 bool secret;
129 bool show;
132 uint8_t press_id;
133 uint32_t revision;
135
145void ui_textkey_open(ui_textkey_t *k, gfx_rect_t area, const char *title,
146 const char *text, int max_len);
147
157 const char *title, const char *text,
158 int max_len);
159
169 const char *title, const char *text);
170
182 const char *title, const char *text, bool secret);
183
194 const char *title, const char *text);
195
201
208
224 char *out, size_t n);
225
235
241const char *ui_textkey_label(int key);
242
251const char *ui_textkey_key_label(const ui_textkey_t *k, int key);
252
262
275
287
288#ifdef __cplusplus
289}
290#endif
gfx: an RGB565 (16-bit red, green, blue) rasteriser with no dependencies.
#define k
Short name for kst_panel_k inside the overlay's seven files.
Definition kst_panel_int.h:238
Definition gfx.h:129
Definition gfx.h:250
Definition gfx.h:81
A DOWN, MOVE or UP of one contact.
Definition touch_types.h:69
A keyboard: what it was opened for, what is typed, and the press it holds.
Definition ui_textkey.h:114
int len
Definition ui_textkey.h:119
char title[48]
Definition ui_textkey.h:117
gfx_rect_t area
Definition ui_textkey.h:116
int max_len
Definition ui_textkey.h:120
ui_textkey_layer_t layer
Definition ui_textkey.h:130
bool folder
Definition ui_textkey.h:123
uint8_t why
Definition ui_textkey.h:125
char text[UI_TEXTKEY_PASS_MAX+1]
Definition ui_textkey.h:118
bool file
Definition ui_textkey.h:124
uint32_t revision
Definition ui_textkey.h:133
uint8_t press_id
Definition ui_textkey.h:132
bool refused
Definition ui_textkey.h:121
bool search
Definition ui_textkey.h:122
bool wifi
Definition ui_textkey.h:127
int pressed
Definition ui_textkey.h:131
bool secret
Definition ui_textkey.h:128
bool show
Definition ui_textkey.h:129
bool open
Definition ui_textkey.h:115
Plain data types shared by the touch controller driver, the coordinate mapper and the event tracker....
void ui_textkey_open_folder(ui_textkey_t *k, gfx_rect_t area, const char *title, const char *text)
Open for a folder of the card; see the top of this file. Up to UI_TEXTKEY_MAX characters.
Definition ui_textkey.c:99
gfx_rect_t ui_textkey_key_rect(const ui_textkey_t *k, int key)
Where a key is drawn and hit: the grid ends 8px inside the area, or at UI_KEYS_FOOT (4px above the al...
Definition ui_textkey.c:233
const gfx_font_t * ui_textkey_char_font(const ui_textkey_t *k)
The face of the character keys: the largest of 20 x 36, 16 x 28, 12 x 24 and 10 x 20 whose cell fits ...
Definition ui_textkey.c:542
#define UI_TEXTKEY_PASS_MAX
The longest Wi-Fi password, in characters.
Definition ui_textkey.h:67
ui_textkey_result_t
What an event on the keyboard came to.
Definition ui_textkey.h:99
@ UI_TEXTKEY_OK
Definition ui_textkey.h:101
@ UI_TEXTKEY_CANCELLED
Definition ui_textkey.h:102
@ UI_TEXTKEY_NONE
Definition ui_textkey.h:100
void ui_textkey_render(const ui_textkey_t *k, gfx_canvas_t *c)
The whole keyboard over its area: the title and the count in 10 x 20 (8 x 16 where they do not fit si...
Definition ui_textkey.c:577
void ui_textkey_cancel_press(ui_textkey_t *k)
A press under way is dropped: the touch stream lost an event. What was typed stays typed.
Definition ui_textkey.c:162
const gfx_font_t * ui_textkey_word_font(const ui_textkey_t *k)
The face of the word keys (the bottom row, DEL, and the Wi-Fi layer keys) in the language shown: the ...
Definition ui_textkey.c:547
const char * ui_textkey_key_label(const ui_textkey_t *k, int key)
A key's label as k shows it.
Definition ui_textkey.c:188
ui_textkey_result_t ui_textkey_event(ui_textkey_t *k, const touch_event_t *evt, char *out, size_t n)
One touch event.
Definition ui_textkey.c:408
void ui_textkey_close(ui_textkey_t *k)
Close, dropping a press under way.
Definition ui_textkey.c:152
@ UI_TK_CLR
Definition ui_textkey.h:79
@ UI_TK_OK
Definition ui_textkey.h:81
@ UI_TK_SPACE
Definition ui_textkey.h:78
@ UI_TK_KEYS
Definition ui_textkey.h:82
@ UI_TK_CANCEL
Definition ui_textkey.h:80
void ui_textkey_open_wifi(ui_textkey_t *k, gfx_rect_t area, const char *title, const char *text, bool secret)
Open for a Wi-Fi password or network name; see the top of this file. Lower case first.
Definition ui_textkey.c:108
void ui_textkey_open_file(ui_textkey_t *k, gfx_rect_t area, const char *title, const char *text)
Open for a file name; see the top of this file. Lower case first.
Definition ui_textkey.c:123
#define UI_TEXTKEY_CHARS
The keys: forty characters in four rows of ten, then SPACE, CLR, CANCEL and OK along the bottom.
Definition ui_textkey.h:75
void ui_textkey_open(ui_textkey_t *k, gfx_rect_t area, const char *title, const char *text, int max_len)
Open over area on text.
Definition ui_textkey.c:69
void ui_textkey_open_search(ui_textkey_t *k, gfx_rect_t area, const char *title, const char *text, int max_len)
Open for a search pattern; see the top of this file.
Definition ui_textkey.c:89
ui_textkey_layer_t
The Wi-Fi keyboard's layers.
Definition ui_textkey.h:106
@ UI_TK_MARKS
Definition ui_textkey.h:109
@ UI_TK_LOWER
Definition ui_textkey.h:107
@ UI_TK_UPPER
Definition ui_textkey.h:108
const char * ui_textkey_label(int key)
A key's label as a name keyboard shows it.
Definition ui_textkey.c:170