- 添加新的UI页面基础架构(ui_page.h),包含页面操作接口 - 创建设置页面控制器(ui_settings_controller.h/.c)来管理页面导航 - 实现具体的设置页面类型:根页面、BLE页面、主题页面 - 修改display_module.c以使用新的页面系统替代旧的状态机 - 移除过时的settings_ui.h头文件和相关状态结构 - 更新事件处理逻辑以使用页面指针而非状态数据传递 - 修改主界面实现以适配统一的页面接口标准
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
#ifndef BLINKY_UI_SETTINGS_PAGE_H_
|
|
#define BLINKY_UI_SETTINGS_PAGE_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <lvgl.h>
|
|
|
|
#include "ui_page.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct ui_settings_page;
|
|
struct ui_settings_item;
|
|
|
|
typedef void (*ui_settings_item_draw_fn)(const struct ui_settings_item *item,
|
|
lv_obj_t *container);
|
|
|
|
struct ui_settings_item {
|
|
const char *icon;
|
|
const char *title;
|
|
const char *value;
|
|
ui_settings_item_draw_fn draw;
|
|
void *user_data;
|
|
};
|
|
|
|
struct ui_settings_page_ops {
|
|
struct ui_page_ops base;
|
|
|
|
uint8_t (*get_count)(struct ui_settings_page *page);
|
|
void (*get_item)(struct ui_settings_page *page, uint8_t index,
|
|
struct ui_settings_item *item);
|
|
void (*on_enter)(struct ui_settings_page *page);
|
|
void (*on_select)(struct ui_settings_page *page, uint8_t index);
|
|
void (*on_back)(struct ui_settings_page *page);
|
|
};
|
|
|
|
struct ui_settings_page {
|
|
struct ui_page base;
|
|
const struct ui_settings_page_ops *ops;
|
|
const char *title;
|
|
const char *hint;
|
|
uint8_t selected;
|
|
};
|
|
|
|
static inline struct ui_settings_page *ui_page_to_settings(struct ui_page *page)
|
|
{
|
|
return (struct ui_settings_page *)page;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* BLINKY_UI_SETTINGS_PAGE_H_ */
|