SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (ModusToolbox)
Loading...
Searching...
No Matches
ui_widget_defaults.h
Go to the documentation of this file.
1/*******************************************************************************
2 * File Name: ui_widget_defaults.h
3 *
4 * Description: Default style constants for MicroPython Playground widgets.
5 * Centralizes magic numbers so they're easy to tweak without
6 * hunting through ui_widget_mgr.c.
7 *
8 * These apply ONLY to widgets created from MicroPython via IPC.
9 * SensorHub / BentoClaw native pages are not affected.
10 *
11 *******************************************************************************/
12
13#ifndef UI_WIDGET_DEFAULTS_H
14#define UI_WIDGET_DEFAULTS_H
15
16/*******************************************************************************
17 * Font Sizes
18 *
19 * Default font for widgets when the user does not specify `value=` (font size).
20 * On the 4.3" 800x480 display, 16px is readable but small; 20px is comfortable.
21 *
22 * Available Montserrat: 14, 16, 20, 24, 28
23 * Available Noto Thai: 14, 16, 20, 24, 28
24 *
25 * Per-widget defaults allow fine-grained control:
26 * Button — 20px (needs to be readable inside a tappable area)
27 * Label — 20px (body text, comfortable reading distance)
28 * Checkbox — 16px (compact control, typically short text)
29 * Dropdown — 16px (compact control with popup list)
30 * Textarea — 16px (multi-line input, fits more text)
31 * Fallback — 20px (anything else)
32 ******************************************************************************/
33#define UI_DEFAULT_FONT_SIZE 20 /* fallback for unlisted widget types */
34#define UI_DEF_BUTTON_FONT_SIZE 20
35#define UI_DEF_LABEL_FONT_SIZE 20
36#define UI_DEF_CHECKBOX_FONT_SIZE 16
37#define UI_DEF_DROPDOWN_FONT_SIZE 16
38#define UI_DEF_TEXTAREA_FONT_SIZE 16
39
40/*******************************************************************************
41 * Screen Defaults — ui.screen() without arguments
42 *
43 * Waveshare 4.3" DSI LCD: 800x480 physical.
44 * Usable area for Playground widgets = 792x398 (after status bar + margins).
45 ******************************************************************************/
46#define UI_DEF_SCREEN_W 792
47#define UI_DEF_SCREEN_H 398
48
49/*******************************************************************************
50 * Widget Dimensions (used when w= / h= not specified)
51 ******************************************************************************/
52#define UI_DEF_SLIDER_W 200
53#define UI_DEF_BAR_W 200
54#define UI_DEF_TEXTAREA_W 200
55#define UI_DEF_ARC_SIZE 150 /* width = height */
56#define UI_DEF_CHART_W 250
57#define UI_DEF_CHART_H 150
58#define UI_DEF_CHART_POINTS 50
59#define UI_DEF_IMAGE_SIZE 48 /* icon canvas w/h (2x scale of 24x24) */
60
61/*******************************************************************************
62 * Auto-Layout Grid (when x=-1, y=-1)
63 ******************************************************************************/
64#define UI_AUTO_ROW_H 60
65#define UI_AUTO_COL_W 200
66
67/*******************************************************************************
68 * Range Defaults (slider, arc, bar, chart)
69 ******************************************************************************/
70#define UI_DEF_RANGE_MAX 100
71
72/*******************************************************************************
73 * Color Defaults (hex 0xRRGGBB)
74 ******************************************************************************/
75#define UI_DEF_SEG7_COLOR 0x00FF00 /* 7-segment display */
76#define UI_DEF_CHART_LINE_COLOR 0x00BFFF /* chart series line */
77#define UI_DEF_ICON_COLOR 0xFFFFFF /* built-in icon fill */
78#define UI_DEF_PANEL_BG_COLOR 0x1a1a2e /* Panel background */
79#define UI_DEF_PANEL_BORDER_COLOR 0x16213e /* Panel border */
80#define UI_DEF_DOTMATRIX_ON_COLOR 0x00FF00 /* DotMatrix lit pixel */
81#define UI_DEF_DOTMATRIX_OFF_COLOR 0x003300 /* DotMatrix dim pixel */
82#define UI_DEF_DOTMATRIX_BG_COLOR 0x111111 /* DotMatrix background */
83#define UI_DEF_DOTMATRIX_GRID_COLOR 0x333333 /* DotMatrix grid lines */
84
85/*******************************************************************************
86 * Compass Defaults
87 ******************************************************************************/
88#define UI_DEF_COMPASS_NEEDLE_COLOR 0xFF4444 /* needle (North label + line) */
89#define UI_DEF_COMPASS_LABEL_COLOR 0xCCCCCC /* E/S/W labels */
90#define UI_DEF_COMPASS_HDG_COLOR 0xFFFFFF /* heading degrees text */
91
92#endif /* UI_WIDGET_DEFAULTS_H */