The TARGET row: its box, its touch, its look and its text. See ui_target_row.h.
More...
#include "ui_target_row.h"
#include <stdio.h>
#include <string.h>
#include "ui_pinlist.h"
#include "ui_theme.h"
|
| void | ui_target_row_init (ui_target_row_t *t, gfx_rect_t row) |
| | The row at row, with no press.
|
| static bool | row_tall (const ui_target_row_t *t) |
| | Whether the row is tall enough for the 10 x 20 face.
|
| gfx_rect_t | ui_target_row_value_rect (const ui_target_row_t *t) |
| | The value box: the row less the label's share.
|
| const gfx_font_t * | ui_target_row_font (const ui_target_row_t *t) |
| | The face the row draws its label and its value in.
|
| unsigned | ui_target_row_cells (const ui_target_row_t *t) |
| | How many cells of text the value box holds, in the row's face.
|
| ui_target_ev_t | ui_target_row_event (ui_target_row_t *t, const touch_event_t *evt, bool locked) |
| | A touch event.
|
| void | ui_target_row_cancel (ui_target_row_t *t) |
| | Drop a press under way, as touch events went missing.
|
| void | ui_target_row_render (const ui_target_row_t *t, gfx_canvas_t *c, const char *label, const char *value, bool warn, bool locked) |
| | The row: label at the left, value centred in its box, both in ui_target_row_font().
|
| size_t | ui_target_text (char *out, size_t size, const char *protocol, uint64_t pins, unsigned cells) |
| | protocol pins into out: "SERVO PWM GPIO 2 GPIO 4", with as many pins as fit after the protocol and a space, then "+N" (ui_pinlist()).
|
The TARGET row: its box, its touch, its look and its text. See ui_target_row.h.
SPDX-License-Identifier: MIT
◆ row_tall()
Whether the row is tall enough for the 10 x 20 face.
- Parameters
-
- Returns
- True from UI_TARGET_TALL_H on.
◆ ui_target_row_cancel()
Drop a press under way, as touch events went missing.
- Parameters
-
| t | The row; NULL does nothing. |
◆ ui_target_row_cells()
How many cells of text the value box holds, in the row's face.
- Parameters
-
- Returns
- The box's width less 8px each side over the face's cell width; 0 for NULL or a box narrower than the padding.
◆ ui_target_row_event()
A touch event.
A DOWN on the value box while not locked starts the row's press; its UP is a tap when it lands on the box as a tap (touch_event_is_tap_up()) and the row is still not locked. A DOWN while locked is taken and does nothing, so no control under the row sees it. A second contact does not take over a press under way.
- Parameters
-
| t | The row. |
| evt | The event. |
| locked | The row takes no press now. |
- Returns
- What the event was to the row; UI_TARGET_NONE for a NULL.
◆ ui_target_row_font()
The face the row draws its label and its value in.
- Parameters
-
- Returns
- The 10 x 20 face from UI_TARGET_TALL_H on, UI_FONT_LABEL under it and for NULL.
◆ ui_target_row_init()
The row at row, with no press.
- Parameters
-
| t | The row; NULL does nothing. |
| row | Where it is: the label at the left, the box the rest. |
◆ ui_target_row_render()
| void ui_target_row_render |
( |
const ui_target_row_t * | t, |
|
|
gfx_canvas_t * | c, |
|
|
const char * | label, |
|
|
const char * | value, |
|
|
bool | warn, |
|
|
bool | locked ) |
The row: label at the left, value centred in its box, both in ui_target_row_font().
- Parameters
-
| t | The row. |
| c | Canvas. |
| label | The label, or NULL for none. |
| value | The value, or NULL for none. |
| warn | The label and the value in the warning colour. |
| locked | The box as a control that takes no press, the value still legible. |
◆ ui_target_row_value_rect()
The value box: the row less the label's share.
- Parameters
-
- Returns
- The row less UI_TARGET_LABEL_W px at its left, or UI_TARGET_LABEL_W_TALL from UI_TARGET_TALL_H on; an empty rectangle for NULL or a row no wider than the label.
◆ ui_target_text()
| size_t ui_target_text |
( |
char * | out, |
|
|
size_t | size, |
|
|
const char * | protocol, |
|
|
uint64_t | pins, |
|
|
unsigned | cells ) |
protocol pins into out: "SERVO PWM GPIO 2 GPIO 4", with as many pins as fit after the protocol and a space, then "+N" (ui_pinlist()).
With no pin, or no room for one after the protocol, the protocol alone; with a NULL or empty protocol, the pins alone.
- Parameters
-
| out | Where the text goes; NULL writes nothing. |
| size | The bytes at out; 0 writes nothing. |
| protocol | The protocol's name. |
| pins | The pins, bit n for GPIO n. |
| cells | The most characters, ui_target_row_cells(). |
- Returns
- The length written.