205 lines
6.3 KiB
C
205 lines
6.3 KiB
C
#include "include.h"
|
|
#include "func.h"
|
|
|
|
#if TRACE_EN
|
|
#define TRACE(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define TRACE(...)
|
|
#endif
|
|
|
|
#define CALL_LIST_CNT ((int)(sizeof(tbl_call_list) / sizeof(tbl_call_list[0])))
|
|
|
|
enum {
|
|
COMPO_ID_BTN_YELLOW = 1,
|
|
COMPO_ID_BTN_GREEN,
|
|
COMPO_ID_BTN_RED,
|
|
};
|
|
|
|
typedef struct f_call_list_t_ {
|
|
page_tp_move_t *ptm;
|
|
} f_call_list_t;
|
|
|
|
// static const compo_listbox_item_t tbl_call_list[] = {
|
|
// {STR_CALL_RECENT, UI_BUF_ICON_CALL_BIN, .func_sta = FUNC_CALL_SUB_RECORD},
|
|
// {STR_CALL_LINK, UI_BUF_ICON_ADDRESS_BOOK_BIN, .func_sta = FUNC_CALL_SUB_LINKMAN},
|
|
// {STR_CALL_DIAL, UI_BUF_ICON_MENU_BIN, .func_sta = FUNC_CALL_SUB_DIAL},
|
|
// };
|
|
|
|
|
|
//电话页面
|
|
compo_form_t *func_call_form_create(void)
|
|
{
|
|
//新建窗体
|
|
compo_form_t *frm = compo_form_create(true);
|
|
//设置标题栏
|
|
compo_form_set_mode(frm, COMPO_FORM_MODE_SHOW_TITLE | COMPO_FORM_MODE_SHOW_TIME);
|
|
compo_form_set_title(frm, i18n[STR_PHONE]);
|
|
|
|
compo_shape_t *shape ;
|
|
compo_button_t *btn;
|
|
compo_textbox_t *txt;
|
|
/*黄色圆角矩形*/
|
|
shape = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE,33);
|
|
compo_shape_set_location(shape, GUI_SCREEN_CENTER_X, 81+33, 236, 66);
|
|
compo_shape_set_color(shape, make_color(255, 188, 1));
|
|
btn = compo_button_create(frm);
|
|
compo_setid(btn, COMPO_ID_BTN_YELLOW);
|
|
compo_button_set_location(btn, GUI_SCREEN_CENTER_X, 81+33, 236, 66);
|
|
|
|
/*通话记录图标*/
|
|
compo_form_add_image(frm, UI_BUF_CALL_ICON_HISTORY_BIN, 12 + 16, 81+33);
|
|
/*通话记录文字*/
|
|
txt = compo_textbox_create(frm,50);
|
|
compo_textbox_set_align_center(txt,false);
|
|
compo_textbox_set_location(txt, 58, 81+33 -10, 180, 25);
|
|
compo_textbox_set(txt,i18n[STR_CALL_RECENT]);
|
|
|
|
/*绿色圆角矩形*/
|
|
shape = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE,33);
|
|
compo_shape_set_location(shape, GUI_SCREEN_CENTER_X, 155+33, 236, 66);
|
|
compo_shape_set_color(shape, make_color(1, 215, 164));
|
|
btn = compo_button_create(frm);
|
|
compo_setid(btn, COMPO_ID_BTN_GREEN);
|
|
compo_button_set_location(btn, GUI_SCREEN_CENTER_X, 155+33, 236, 66);
|
|
|
|
/*联系人图标*/
|
|
compo_form_add_image(frm, UI_BUF_CALL_ICON_CONTACTS_BIN, 12 + 16, 155+33);
|
|
/*联系人文字*/
|
|
txt = compo_textbox_create(frm,50);
|
|
compo_textbox_set_align_center(txt,false);
|
|
compo_textbox_set_location(txt, 58, 155+33 -10, 180, 25);
|
|
compo_textbox_set_right_align(txt,false);
|
|
compo_textbox_set(txt,i18n[STR_CALL_LINK]);
|
|
/*红色圆角矩形*/
|
|
shape = compo_radius_shape_create(frm, COMPO_SHAPE_TYPE_ROUNDED_RECTANGLE,33);
|
|
compo_shape_set_location(shape, GUI_SCREEN_CENTER_X, 230+33, 236, 66);
|
|
compo_shape_set_color(shape, make_color(255, 50, 103));
|
|
btn = compo_button_create(frm);
|
|
compo_setid(btn, COMPO_ID_BTN_RED);
|
|
compo_button_set_location(btn, GUI_SCREEN_CENTER_X, 230+33, 236, 66);
|
|
|
|
/*拨号键盘图标*/
|
|
compo_form_add_image(frm, UI_BUF_CALL_ICON_DIAL_BIN, 12 + 16, 230+33);
|
|
/*拨号文字*/
|
|
txt = compo_textbox_create(frm,50);
|
|
compo_textbox_set_align_center(txt,false);
|
|
compo_textbox_set_location(txt, 58, 230+33 -10, 180, 25);
|
|
compo_textbox_set_right_align(txt,false);
|
|
compo_textbox_set(txt,i18n[STR_CALL_DIAL]);
|
|
return frm;
|
|
}
|
|
|
|
//点进图标进入应用
|
|
void func_call_icon_click(void)
|
|
{
|
|
compo_shape_t *shape_yello = compo_getobj_byid(COMPO_ID_BTN_YELLOW);
|
|
compo_shape_t *shape_grenn = compo_getobj_byid(COMPO_ID_BTN_GREEN);
|
|
compo_shape_t *shape_red = compo_getobj_byid(COMPO_ID_BTN_RED);
|
|
|
|
int id = compo_get_button_id();
|
|
|
|
switch (id) {
|
|
case COMPO_ID_BTN_YELLOW:
|
|
func_switch_to_assign_screen(FUNC_CALL_SUB_RECORD, false);
|
|
break;
|
|
case COMPO_ID_BTN_GREEN:
|
|
func_switch_to_assign_screen(FUNC_CALL_SUB_LINKMAN, false);
|
|
break;
|
|
case COMPO_ID_BTN_RED:
|
|
func_switch_to_assign_screen(FUNC_CALL_SUB_DIAL, false);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
//电话功能消息处理
|
|
static void func_call_list_message(size_msg_t msg)
|
|
{
|
|
f_call_list_t *f_call_list = (f_call_list_t *)func_cb.f_cb;
|
|
|
|
switch (msg) {
|
|
case MSG_CTP_TOUCH:
|
|
compo_page_move_touch_handler(f_call_list->ptm);
|
|
break;
|
|
case MSG_QDEC_BACKWARD:
|
|
if (func_cb.flag_sort) { //快捷应用状态下不滚动页面
|
|
func_message(msg);
|
|
} else {
|
|
compo_page_move_set_by_pages(f_call_list->ptm, -1);
|
|
}
|
|
break;
|
|
|
|
case MSG_QDEC_FORWARD:
|
|
if (func_cb.flag_sort) {
|
|
func_message(msg);
|
|
} else {
|
|
compo_page_move_set_by_pages(f_call_list->ptm, 1);
|
|
}
|
|
break;
|
|
|
|
case MSG_CTP_CLICK:
|
|
func_call_icon_click(); //单击图标
|
|
break;
|
|
|
|
|
|
case MSG_CTP_LONG:
|
|
break;
|
|
|
|
default:
|
|
func_message(msg);
|
|
break;
|
|
}
|
|
}
|
|
|
|
//电话事件处理
|
|
static void func_call_process(void)
|
|
{
|
|
f_call_list_t *f_call_list = (f_call_list_t *)func_cb.f_cb;
|
|
compo_page_move_process(f_call_list->ptm);
|
|
func_process();
|
|
}
|
|
|
|
//进入电话功能
|
|
static void func_call_enter(void)
|
|
{
|
|
func_cb.f_cb = func_zalloc(sizeof(f_call_list_t));
|
|
func_cb.frm_main = func_call_form_create();
|
|
|
|
f_call_list_t *f_call_list = (f_call_list_t *)func_cb.f_cb;
|
|
f_call_list->ptm = (page_tp_move_t *)func_zalloc(sizeof(page_tp_move_t));
|
|
|
|
page_move_info_t info = {
|
|
.title_used = FALSE,
|
|
.page_size = 352 , //除标题外页面总长度
|
|
.page_count = 1,
|
|
.up_over_perc = 10,
|
|
.down_over_perc = 10,
|
|
};
|
|
compo_page_move_init(f_call_list->ptm, func_cb.frm_main->page_body, &info);
|
|
|
|
func_cb.enter_tick = tick_get();
|
|
}
|
|
|
|
//退出电话功能
|
|
static void func_call_exit(void)
|
|
{
|
|
func_cb.last = FUNC_CALL;
|
|
f_call_list_t *f_call_list = (f_call_list_t *)func_cb.f_cb;
|
|
if (f_call_list->ptm) {
|
|
func_free(f_call_list->ptm);
|
|
}
|
|
}
|
|
|
|
//电话功能
|
|
void func_call(void)
|
|
{
|
|
printf("%s\n", __func__);
|
|
func_call_enter();
|
|
while (func_cb.sta == FUNC_CALL) {
|
|
func_call_process();
|
|
func_call_list_message(msg_dequeue());
|
|
}
|
|
func_call_exit();
|
|
}
|