175 lines
4.8 KiB
C
175 lines
4.8 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
|
|
enum{
|
|
COMPO_ID_BTN_MONTH_INC = 1,
|
|
COMPO_ID_BTN_MONTH_REDU,
|
|
COMPO_ID_BTN_DAY_INC,
|
|
COMPO_ID_BTN_DAY_REDU,
|
|
COMPO_ID_BTN_YEAR_INC,
|
|
COMPO_ID_BTN_YEAR_REDU,
|
|
COMPO_ID_BTN_SELECT,
|
|
};
|
|
|
|
//创建日份时间文本框功能
|
|
compo_textbox_t *func_calendar_time_day_create(compo_form_t *frm)
|
|
{
|
|
char time_str[8];
|
|
|
|
compo_textbox_t *txt_time_day = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_location(txt_time_day, 50, 170, 60, 30);
|
|
sprintf(time_str, "%02d", compo_cb.tm.day);
|
|
compo_textbox_set(txt_time_day, time_str);
|
|
|
|
return txt_time_day;
|
|
}
|
|
|
|
//创建月份时间文本框功能
|
|
compo_textbox_t *func_calendar_time_mon_create(compo_form_t *frm)
|
|
{
|
|
char time_str[8];
|
|
|
|
compo_textbox_t *txt_time_mon = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_location(txt_time_mon, 139, 170, 60, 30);
|
|
sprintf(time_str, "%02d", compo_cb.tm.mon);
|
|
compo_textbox_set(txt_time_mon, time_str);
|
|
|
|
return txt_time_mon;
|
|
}
|
|
|
|
//创建年份时间文本框功能
|
|
compo_textbox_t *func_calendar_time_year_create(compo_form_t *frm)
|
|
{
|
|
char time_str[10];
|
|
|
|
compo_textbox_t *txt_time_year = compo_textbox_create(frm, 6);
|
|
compo_textbox_set_location(txt_time_year, 218, 168, 60, 30);
|
|
sprintf(time_str, "%05d", compo_cb.tm.year);
|
|
compo_textbox_set(txt_time_year, time_str);
|
|
|
|
return txt_time_year;
|
|
}
|
|
|
|
//日期设置页面
|
|
compo_form_t *func_calender_form_create(void)
|
|
{
|
|
compo_button_t *btn;
|
|
|
|
//新建窗体
|
|
compo_form_t *frm = compo_form_create(true);
|
|
|
|
//创建文本
|
|
compo_textbox_t *txt = compo_textbox_create(frm, 4);
|
|
compo_textbox_set_location(txt,30,22,200,60);
|
|
compo_textbox_set(txt,"日期设置");
|
|
|
|
//按钮
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_INCREASE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_MONTH_INC);
|
|
compo_button_set_pos(btn, 62, 97);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_INCREASE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_DAY_INC);
|
|
compo_button_set_pos(btn, 151, 97);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_INCREASE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_YEAR_INC);
|
|
compo_button_set_pos(btn, 254, 97);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_REDUCE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_DAY_REDU);
|
|
compo_button_set_pos(btn, 62, 236);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_REDUCE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_MONTH_REDU);
|
|
compo_button_set_pos(btn, 151, 236);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_REDUCE_CLICK_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_YEAR_REDU);
|
|
compo_button_set_pos(btn, 254, 236);
|
|
|
|
btn = compo_button_create_by_image(frm, UI_BUF_COMMON_BUTTON_BIN);
|
|
compo_setid(btn, COMPO_ID_BTN_SELECT);
|
|
compo_button_set_pos(btn, 160, 336);
|
|
|
|
//OK文本框
|
|
compo_textbox_t *txt_sel = compo_textbox_create(frm, 2);
|
|
compo_textbox_set_location(txt_sel, 130, 315, 60, 30);
|
|
compo_textbox_set(txt_sel, "OK");
|
|
|
|
func_text_time_create(frm); //时间文本框
|
|
func_calendar_time_day_create(frm); //日份文本框
|
|
func_calendar_time_mon_create(frm); //月份文本框
|
|
func_calendar_time_year_create(frm); //年份文本框
|
|
|
|
return frm;
|
|
}
|
|
|
|
//日历功能事件处理
|
|
static void func_calendar_process(void)
|
|
{
|
|
func_process();
|
|
}
|
|
|
|
//日历功能消息处理
|
|
static void func_calendar_message(size_msg_t msg)
|
|
{
|
|
compo_form_t *frm = NULL;
|
|
bool res = false;
|
|
switch (msg) {
|
|
case MSG_CTP_CLICK:
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_UP:
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_DOWN:
|
|
break;
|
|
|
|
case MSG_CTP_LONG:
|
|
break;
|
|
|
|
case MSG_CTP_SHORT_RIGHT:
|
|
if(func_cb.last == FUNC_SETTING) {
|
|
frm = func_create_form(FUNC_SETTING);
|
|
res = func_switching(FUNC_SWITCH_LR_ZOOM_RIGHT,NULL);
|
|
compo_form_destroy(frm); //切换完成或取消,销毁窗体
|
|
if (res) {
|
|
func_cb.sta = FUNC_SETTING;
|
|
}
|
|
}else {
|
|
func_switching_to_menu(); //右滑缓慢退出任务
|
|
}
|
|
break;
|
|
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//进入日历功能
|
|
static void func_calendar_enter(void)
|
|
{
|
|
func_cb.frm_main = func_calender_form_create();
|
|
}
|
|
|
|
//退出日历功能
|
|
static void func_calendar_exit(void)
|
|
{
|
|
func_cb.last = FUNC_CALENDAER;
|
|
}
|
|
|
|
//日历功能
|
|
void func_calendar(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_calendar_enter();
|
|
while (func_cb.sta == FUNC_CALENDAER) {
|
|
func_calendar_process();
|
|
func_calendar_message(msg_dequeue());
|
|
}
|
|
func_calendar_exit();
|
|
}
|
|
|