mirror of
https://github.com/skoelle/wt32sc01-dashboard.git
synced 2026-09-18 01:40:24 +00:00
Phase 3: reusable UI widgets (tile_button, back_button) + screen_base lifecycle
- tile_button: large touch tile with accent bg + title + icon + value, fires LV_EVENT_CLICKED (for home screen tiles) - back_button: fixed bottom-left Zurueck button (LV_SYMBOL_LEFT), large touch target, reused on all detail screens - screen_base.h: Screen struct with create/show/hide/refresh/tick lifecycle around an lv_obj_t root (replaces old ScreenId-only header) - lv_conf.h: enable Montserrat 16/20/24 fonts used by the widgets
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <lvgl.h>
|
||||
#include <theme.h>
|
||||
|
||||
// Reusable large touch tile for the home screen. Icon + title + optional
|
||||
// value/preview lines, accent background per category. Fires a callback on tap.
|
||||
struct TileButton {
|
||||
lv_obj_t *btn = nullptr;
|
||||
lv_obj_t *icon = nullptr;
|
||||
lv_obj_t *title = nullptr;
|
||||
lv_obj_t *value = nullptr;
|
||||
};
|
||||
|
||||
// Create a tile button inside `parent` at (x,y) with given size and accent.
|
||||
// title: heading text (e.g. "Wetter"); on_click + user_data wired to LV_EVENT_CLICKED.
|
||||
TileButton tile_button_create(lv_obj_t *parent, lv_coord_t x, lv_coord_t y,
|
||||
lv_coord_t w, lv_coord_t h, lv_color_t accent,
|
||||
const char *title, lv_event_cb_t on_click,
|
||||
void *user_data);
|
||||
|
||||
// Set the big value/preview text on the tile (may be multi-line).
|
||||
void tile_button_set_value(TileButton &t, const char *text);
|
||||
|
||||
// Set the icon text (single glyph/symbol). Icons are rendered as text labels
|
||||
// using LVGL's built-in font until bitmap icons land in Phase 6.
|
||||
void tile_button_set_icon(TileButton &t, const char *text);
|
||||
Reference in New Issue
Block a user