#include "include.h" #include "func.h" #include "func_menu.h" #if TRACE_EN #define TRACE(...) printf(__VA_ARGS__) #else #define TRACE(...) #endif //创建主菜单窗体,创建窗体中不要使用功能结构体 func_cb.f_cb compo_form_t *func_menu_form_create(void) { switch (func_cb.menu_style) { case MENU_STYLE_HONEYCOMB: return func_menu_sub_honeycomb_form_create(); case MENU_STYLE_LIST: return func_menu_sub_list_form_create(); default: halt(HALT_FUNC_MENU_SUBSTA); return NULL; } } //切换菜单样式 static void func_menu_switch_style(void) { func_cb.menu_idx = 0; switch (func_cb.menu_style) { case MENU_STYLE_HONEYCOMB: func_cb.menu_style = MENU_STYLE_LIST; break; default: func_cb.menu_style = MENU_STYLE_HONEYCOMB; break; } } //菜单样式公用消息 void func_menu_sub_message(size_msg_t msg) { switch (msg) { case KU_BACK: //不响应 break; case KD_BACK: if (tick_check_expire(func_cb.enter_tick, TICK_IGNORE_KEY)) { func_menu_switch_style(); } break; default: break; } } //退出菜单样式 void func_menu_sub_exit(void) { compo_form_destroy(func_cb.frm_main); func_free(func_cb.f_cb); func_cb.frm_main = NULL; func_cb.f_cb = NULL; } //进入主菜单功能 static void func_menu_enter(void) { } //退出主菜单功能 static void func_menu_exit(void) { func_cb.last = FUNC_MENU; } //主菜单功能 void func_menu(void) { printf("%s\n", __func__); func_menu_enter(); while (func_cb.sta == FUNC_MENU) { switch (func_cb.menu_style) { case MENU_STYLE_HONEYCOMB: func_menu_sub_honeycomb(); break; case MENU_STYLE_LIST: func_menu_sub_list(); break; default: halt(HALT_FUNC_MENU_SUBSTA); break; } } func_menu_exit(); }