rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
ui_tabs.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <stdbool.h>
13
14#include "gfx.h"
15#include "touch_types.h"
16#include "ui_text.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
23#define UI_TABS_MAX 6
24
27typedef struct {
28 const char *label[UI_TABS_MAX];
29 int16_t text[UI_TABS_MAX];
31 int count;
33 int pressed;
34 uint8_t press_id;
35} ui_tabs_t;
36
45void ui_tabs_init(ui_tabs_t *t, const char *const *labels, int count,
46 gfx_rect_t row);
55void ui_tabs_init_text(ui_tabs_t *t, const ui_text_id_t *ids, int count,
56 gfx_rect_t row);
64bool ui_tabs_event(ui_tabs_t *t, const touch_event_t *evt);
81void ui_tabs_render(const ui_tabs_t *t, gfx_canvas_t *c);
82
90#define UI_TABS_LABEL_H 32
92#define UI_TABS_PAD 6
93
100const gfx_font_t *ui_tabs_font(const ui_tabs_t *t);
110void ui_tabs_render_locked(const ui_tabs_t *t, gfx_canvas_t *c, bool locked);
111
112#ifdef __cplusplus
113}
114#endif
gfx: an RGB565 (16-bit red, green, blue) rasteriser with no dependencies.
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 row of tabs: their labels, where they are, which is selected and the press under way.
Definition ui_tabs.h:27
const char * label[UI_TABS_MAX]
Definition ui_tabs.h:28
int count
Definition ui_tabs.h:31
int selected
Definition ui_tabs.h:32
uint8_t press_id
Definition ui_tabs.h:34
int pressed
Definition ui_tabs.h:33
gfx_rect_t rect[UI_TABS_MAX]
Definition ui_tabs.h:30
int16_t text[UI_TABS_MAX]
Definition ui_tabs.h:29
Plain data types shared by the touch controller driver, the coordinate mapper and the event tracker....
#define UI_TABS_MAX
The most tabs one row holds.
Definition ui_tabs.h:23
bool ui_tabs_event(ui_tabs_t *t, const touch_event_t *evt)
One touch event: a tab is selected on the release, as a tap, of the press that began on it.
Definition ui_tabs.c:73
void ui_tabs_cancel(ui_tabs_t *t)
Abandon a press in progress.
Definition ui_tabs.c:104
const gfx_font_t * ui_tabs_font(const ui_tabs_t *t)
The face the tabs' labels are drawn in now.
Definition ui_tabs.c:112
void ui_tabs_render(const ui_tabs_t *t, gfx_canvas_t *c)
The tabs' labels in the face of ui_tabs_font(), centred in each tab; the selected tab raised in a sun...
Definition ui_tabs.c:126
void ui_tabs_render_locked(const ui_tabs_t *t, gfx_canvas_t *c, bool locked)
The tabs as ui_tabs_render() draws them, or with locked as a control that takes no press: the trough ...
Definition ui_tabs.c:131
void ui_tabs_init_text(ui_tabs_t *t, const ui_text_id_t *ids, int count, gfx_rect_t row)
Tabs whose labels are looked up at every draw, so they follow the language.
Definition ui_tabs.c:45
void ui_tabs_init(ui_tabs_t *t, const char *const *labels, int count, gfx_rect_t row)
Tabs whose labels are drawn as given, in every language: row split into count tabs 4px apart,...
Definition ui_tabs.c:17
The interface's words, one table per language.
ui_text_id_t
The screens' strings, TX_<ID> for each UI_TEXT() of ui_text.def.
Definition ui_text.h:43