[FL-1497] GUI textbox element and widget (#792)

* canvas: add font parameters
* elements: add text box element
* widget: add text box element
* nfc: rework delete and info scene with text box widget
* gui: update documentation
* gui: fix canvas_get_font_params return

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-10-27 21:55:03 +03:00
committed by GitHub
parent 26c53f3dfd
commit 146cd51894
10 changed files with 470 additions and 40 deletions

View File

@@ -6,6 +6,13 @@
#include <furi-hal.h>
#include <u8g2_glue.h>
const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
[FontPrimary] = {.leading_default = 12, .leading_min = 11, .height = 8, .descender = 2},
[FontSecondary] = {.leading_default = 11, .leading_min = 9, .height = 7, .descender = 2},
[FontKeyboard] = {.leading_default = 11, .leading_min = 9, .height = 7, .descender = 2},
[FontBigNumbers] = {.leading_default = 18, .leading_min = 16, .height = 15, .descender = 0},
};
Canvas* canvas_init() {
Canvas* canvas = furi_alloc(sizeof(Canvas));
@@ -92,6 +99,12 @@ uint8_t canvas_current_font_height(Canvas* canvas) {
return font_height;
}
CanvasFontParameters* canvas_get_font_params(Canvas* canvas, Font font) {
furi_assert(canvas);
furi_assert(font < FontTotalNumber);
return (CanvasFontParameters*)&canvas_font_params[font];
}
void canvas_clear(Canvas* canvas) {
furi_assert(canvas);
u8g2_ClearBuffer(&canvas->fb);