85 lines
1.8 KiB
C
85 lines
1.8 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
|
|
#if TRACE_EN
|
|
#define TRACE(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define TRACE(...)
|
|
#endif
|
|
|
|
typedef struct f_sleep_t_ {
|
|
|
|
} f_sleep_t;
|
|
|
|
//创建睡眠窗体,创建窗体中不要使用功能结构体 func_cb.f_cb
|
|
compo_form_t *func_sleep_form_create(void)
|
|
{
|
|
//新建窗体和背景
|
|
compo_form_t *frm = compo_form_create(true);
|
|
compo_form_add_image(frm, UI_BUF_SLEEP_SLEEP_BIN, 160, 175);
|
|
compo_form_add_image(frm, UI_BUF_SLEEP_DEEP_ALEEP_BIN, 82, 277);
|
|
compo_form_add_image(frm, UI_BUF_SLEEP_LIGHT_SLEEP_BIN, 241, 277);
|
|
|
|
//创建文本
|
|
compo_textbox_t *txt_title = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_location(txt_title, 30, 22, 80, 40);
|
|
compo_textbox_set(txt_title, "睡眠");
|
|
|
|
func_text_time_create(frm); //时间文本框
|
|
|
|
return frm;
|
|
}
|
|
|
|
//睡眠功能事件处理
|
|
static void func_sleep_process(void)
|
|
{
|
|
func_process();
|
|
}
|
|
|
|
//睡眠功能消息处理
|
|
static void func_sleep_message(size_msg_t msg)
|
|
{
|
|
switch (msg) {
|
|
case MSG_CTP_CLICK:
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_UP:
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_DOWN:
|
|
break;
|
|
|
|
case MSG_CTP_LONG:
|
|
break;
|
|
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//进入睡眠功能
|
|
static void func_sleep_enter(void)
|
|
{
|
|
func_cb.f_cb = func_zalloc(sizeof(f_sleep_t));
|
|
func_cb.frm_main = func_sleep_form_create();
|
|
}
|
|
|
|
//退出睡眠功能
|
|
static void func_sleep_exit(void)
|
|
{
|
|
func_cb.last = FUNC_SLEEP;
|
|
}
|
|
|
|
//睡眠功能
|
|
void func_sleep(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_sleep_enter();
|
|
while (func_cb.sta == FUNC_SLEEP) {
|
|
func_sleep_process();
|
|
func_sleep_message(msg_dequeue());
|
|
}
|
|
func_sleep_exit();
|
|
}
|