wgui_calendar.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:258k
源码类别:
MTK
开发平台:
C/C++
- static S32 cat83_popup_y;
- static color cat83_title_fg = {0, 0, 0, 255};
- static color cat83_horizontal_select_fg = {8, 93, 189, 255};
- static color cat83_horizontal_select_border = {255, 255, 255, 255};
- static color cat83_vertical_select_fg = {255, 255, 255, 255};
- static color cat83_horizontal_string_fg = {0, 0, 0, 255};
- static color cat83_cell_bg[CAT83_COLOR_TOTAL] = { {0, 0, 0, 255},
- {79, 249, 155, 255},
- {30, 49, 131, 255},
- {255, 70, 144, 255},
- {255, 126, 0, 255},
- {255, 234, 0, 255},
- {200, 200, 200, 255} };
- static color cat83_cell_valid_fg = {30, 49, 131, 255};
- static color cat83_cell_invalid_fg = {192, 192, 192, 255};
- static color cat83_cell_highlight = {255, 0, 0, 255};
- static stFontAttribute *cat83_horizontal_string_font;
- static stFontAttribute *cat83_cell_font;
- static U32 cat83_row_num;
- static U32 cat83_column_num;
- static U32 cat83_current_row;
- static U32 cat83_current_column;
- static U32 cat83_highlighted_row;
- static U32 cat83_highlighted_column;
- static U32 cat83_highlighted_row_old;
- static U32 cat83_highlighted_column_old;
- static UI_image_ID_type cat83_bg_id;
- static U8 cat83_bg_updated = TRUE;
- static U8* cat83_cell_cache_buf = NULL;
- static U8* cat83_popup_cache_buf = NULL;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- typedef struct
- {
- UI_image_ID_type *icon_list;
- U8 **string_list;
- U8 num_of_entry;
- U8 is_updated;
- } wgui_cat83_infobox_struct;
- void wgui_cat83_set_infobox(UI_image_ID_type *icon_list, U8 **string_list, U8 entry_num);
- static void wgui_cat83_redraw_infobox(void);
- static wgui_cat83_infobox_struct cat83_infobox;
- static S32 cat83_infobox_x;
- static S32 cat83_infobox_y;
- static S32 cat83_infobox_width;
- static S32 cat83_infobox_height;
- static color cat83_infobox_bg = {218, 229, 245, 255};
- static color cat83_infobox_entry_bg = {184, 207, 240, 255};
- static color cat83_infobox_fg = {166, 27, 50, 255};
- static stFontAttribute *cat83_infobox_font;
- #endif
- #ifdef __GDI_MEMORY_PROFILE_2__
- GDI_HANDLE cat83_layer = GDI_LAYER_EMPTY_HANDLE;
- #endif
- /*****************************************************************************
- * FUNCTION
- * wgui_cat83_init
- * DESCRIPTION
- * initialize the settings of calendar
- * PARAMETERS
- * calendar_type [IN] calendar type <- CAT83_INIT_TYPE
- * row_num [IN] number of row
- * column_num [IN] number of column
- * cell_buf [IN] buffer for cache 1 cell
- * popup_buf [IN] buffer for cache 1 popup
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_calendar_init(U32 calendar_type, U32 row_num, U32 column_num, U8* cell_buf, U8* popup_buf)
- {
- switch (calendar_type)
- {
- case CAT83_CALENDAR_NORMAL:
- cat83_vertical_select_display = MMI_TRUE;
- cat83_content_x = 0;
- cat83_content_y = 0;
- cat83_content_width = UI_device_width;
- cat83_content_height = UI_device_height;
- cat83_frame_line_pixel = CAT83_FRAME_LINE_PIXEL;
- cat83_horizontal_select_x = CAT83_FRAME_START_X;
- cat83_horizontal_select_y = MMI_status_bar_height;
- cat83_horizontal_select_width = CAT83_FRAME_WIDTH;
- cat83_horizontal_select_height = CAT83_FRAME_START_Y - cat83_horizontal_select_y;
- cat83_title_x = CAT83_FRAME_START_X + cat83_frame_line_pixel;
- cat83_title_y = CAT83_FRAME_START_Y + cat83_frame_line_pixel;
- cat83_title_width = CAT83_FRAME_WIDTH - cat83_frame_line_pixel * 2;
- cat83_title_height = CAT83_TITLE_HEIGHT;
- cat83_vertical_select_x = CAT83_FRAME_START_X + cat83_frame_line_pixel;
- cat83_vertical_select_y = cat83_title_y + cat83_title_height + cat83_frame_line_pixel;
- cat83_vertical_select_width = CAT83_VERTICAL_SELECT_WIDTH;
- cat83_vertical_select_height = CAT83_FRAME_HEIGHT - cat83_title_height - cat83_frame_line_pixel * 3;
- cat83_horizontal_string_x = cat83_vertical_select_x + cat83_vertical_select_width + cat83_frame_line_pixel;
- cat83_horizontal_string_y = cat83_vertical_select_y;
- cat83_horizontal_string_width = CAT83_FRAME_WIDTH - cat83_vertical_select_width - cat83_frame_line_pixel * 3;
- cat83_horizontal_string_height = CAT83_HORIZONTAL_STRING_HEIGHT;
- cat83_cell_array_x = cat83_horizontal_string_x;
- cat83_cell_array_y = cat83_horizontal_string_y + cat83_horizontal_string_height + cat83_frame_line_pixel;
- cat83_cell_array_width = cat83_horizontal_string_width;
- cat83_cell_array_height = cat83_vertical_select_height - cat83_horizontal_string_height - cat83_frame_line_pixel;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- cat83_infobox_x = CAT83_INFOBOX_START_X;
- cat83_infobox_y = CAT83_INFOBOX_START_Y;
- cat83_infobox_width = CAT83_INFOBOX_WIDTH;
- cat83_infobox_height = CAT83_INFOBOX_HEIGHT;
- #ifdef __MMI_MAINLCD_240X320__
- cat83_infobox_font = &MMI_medium_font;
- #else
- cat83_infobox_font = &MMI_small_font;
- #endif
- #endif
- #ifdef __MMI_MAINLCD_240X320__
- cat83_horizontal_string_font = &MMI_sublcd_font;
- cat83_cell_font = &MMI_sublcd_font;
- #else
- cat83_horizontal_string_font = &MMI_small_font;
- cat83_cell_font = &MMI_small_font;
- #endif
- break;
- case CAT83_CALENDAR_SMALL:
- cat83_vertical_select_display = MMI_FALSE;
- cat83_content_x = 0;
- cat83_content_y = 0;
- cat83_content_width = UI_device_width;
- cat83_content_height = UI_device_height - MMI_button_bar_height;
- cat83_frame_line_pixel = CAT83_FRAME_LINE_PIXEL;
- cat83_horizontal_select_x = CAT83_FRAME_START_X;
- cat83_horizontal_select_y = 0;
- cat83_horizontal_select_width = CAT83_FRAME_WIDTH;
- cat83_horizontal_select_height = CAT83_FRAME_START_Y - cat83_horizontal_select_y;
- cat83_title_x = CAT83_FRAME_START_X + cat83_frame_line_pixel;
- cat83_title_y = CAT83_FRAME_START_Y + cat83_frame_line_pixel;
- cat83_title_width = CAT83_FRAME_WIDTH - cat83_frame_line_pixel * 2;
- cat83_title_height = CAT83_TITLE_HEIGHT;
- //cat83_vertical_select_x = CAT83_FRAME_START_X + cat83_frame_line_pixel;
- //cat83_vertical_select_y = cat83_title_y + cat83_title_height + cat83_frame_line_pixel;
- //cat83_vertical_select_width = CAT83_VERTICAL_SELECT_WIDTH;
- //cat83_vertical_select_height = CAT83_FRAME_HEIGHT - cat83_title_height - cat83_frame_line_pixel * 3;
- cat83_horizontal_string_x = CAT83_FRAME_START_X + cat83_frame_line_pixel;
- cat83_horizontal_string_y = cat83_title_y + cat83_title_height + cat83_frame_line_pixel;
- cat83_horizontal_string_width = CAT83_FRAME_WIDTH - cat83_frame_line_pixel * 2;
- cat83_horizontal_string_height = CAT83_HORIZONTAL_STRING_HEIGHT;
- cat83_cell_array_x = cat83_horizontal_string_x;
- cat83_cell_array_y = cat83_horizontal_string_y + cat83_horizontal_string_height + cat83_frame_line_pixel;
- cat83_cell_array_width = cat83_horizontal_string_width;
- cat83_cell_array_height = cat83_vertical_select_height - cat83_horizontal_string_height - cat83_frame_line_pixel;
- cat83_horizontal_string_font = &MMI_small_font;
- cat83_cell_font = &MMI_small_font;
- break;
- case IDLE_NORMAL:
- break;
- default:
- MMI_ASSERT(0);
- break;
- }
- cat83_row_num = row_num;
- cat83_column_num = column_num;
- cat83_cell_width = (cat83_cell_array_width-(cat83_column_num-1)*cat83_frame_line_pixel)/cat83_column_num;
- cat83_cell_height = (cat83_cell_array_height-(cat83_row_num-1)*cat83_frame_line_pixel)/cat83_row_num;
- cat83_cell_cache.buf_ptr = cell_buf;
- cat83_popup_cache.buf_ptr = popup_buf;
- cat83_cell_bg[CAT83_COLOR_CURRENT] = current_UI_theme->fixed_text_menuitem_theme->selected_filler->c;
- cat83_highlighted_row = 0xffffffff;
- cat83_highlighted_column = 0xffffffff;
- cat83_highlighted_row_old = 0xffffffff;
- cat83_highlighted_column_old = 0xffffffff;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_cat83_bg
- * DESCRIPTION
- * set the background image id
- * PARAMETERS
- * bg_id [IN] background image id
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_cat83_set_bg(UI_image_ID_type bg_id)
- {
- cat83_bg_id = bg_id;
- cat83_bg_updated = TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_cat83_set_select_horizontal1
- * DESCRIPTION
- * set the horizontal select 1
- * PARAMETERS
- * left_up [IN] left image during up state
- * left_up [IN] left image during down state
- * left_up [IN] right image during up state
- * left_up [IN] right image during down state
- * string [IN] text string
- * align_type [IN] alignment type: CAT83_SELECT_ALIGN_CENTER | CAT83_SELECT_ALIGN_LEFT
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_cat83_set_select_horizontal1(UI_image_ID_type left_up, UI_image_ID_type left_down, UI_image_ID_type right_up, UI_image_ID_type right_down, U8 *string, U32 align_type)
- {
- cat83_horizontal_select[0].left_up = left_up;
- cat83_horizontal_select[0].left_down = left_down;
- cat83_horizontal_select[0].right_up = right_up;
- cat83_horizontal_select[0].right_down = right_down;
- cat83_horizontal_select[0].string = string;
- cat83_horizontal_select[0].align_type = align_type;
- cat83_horizontal_select[0].left_pressed = 0;
- cat83_horizontal_select[0].right_pressed = 0;
- cat83_horizontal_select[0].is_updated = TRUE;
- if (left_up != 0)
- {
- gdi_image_get_dimension_id((U16)left_up, &cat83_horizontal_select[0].left_width, &cat83_horizontal_select[0].left_height);
- }
- else
- {
- cat83_horizontal_select[0].left_width = cat83_horizontal_select[0].left_height = 0;
- }
- if (right_up != 0)
- {
- gdi_image_get_dimension_id((U16)right_up, &cat83_horizontal_select[0].right_width, &cat83_horizontal_select[0].right_height);
- }
- else
- {
- cat83_horizontal_select[0].right_width = cat83_horizontal_select[0].right_height = 0;
- }
- }
- void wgui_cat83_set_select_horizontal1_string(U8 *string)
- {
- cat83_horizontal_select[0].string = string;
- cat83_horizontal_select[0].is_updated = TRUE;
- }
- void wgui_cat83_set_select_horizontal1_handler(Cat83EventFuncPtr left_handler, Cat83EventFuncPtr right_handler)
- {
- cat83_horizontal_select[0].left_handler = left_handler;
- cat83_horizontal_select[0].right_handler = right_handler;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_cat83_set_select_horizontal2
- * DESCRIPTION
- * set the horizontal select 2
- * PARAMETERS
- * left_up [IN] left image during up state
- * left_up [IN] left image during down state
- * left_up [IN] right image during up state
- * left_up [IN] right image during down state
- * string [IN] text string
- * align_type [IN] alignment type: CAT83_SELECT_ALIGN_CENTER | CAT83_SELECT_ALIGN_LEFT
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_cat83_set_select_horizontal2(UI_image_ID_type left_up, UI_image_ID_type left_down, UI_image_ID_type right_up, UI_image_ID_type right_down, U8 *string, U32 align_type)
- {
- cat83_horizontal_select[1].left_up = left_up;
- cat83_horizontal_select[1].left_down = left_down;
- cat83_horizontal_select[1].right_up = right_up;
- cat83_horizontal_select[1].right_down = right_down;
- cat83_horizontal_select[1].string = string;
- cat83_horizontal_select[1].align_type = align_type;
- cat83_horizontal_select[1].left_pressed = 0;
- cat83_horizontal_select[1].right_pressed = 0;
- cat83_horizontal_select[1].is_updated = TRUE;
- if (left_up != 0)
- {
- gdi_image_get_dimension_id((U16)left_up, &cat83_horizontal_select[1].left_width, &cat83_horizontal_select[1].left_height);
- }
- else
- {
- cat83_horizontal_select[1].left_width = cat83_horizontal_select[1].left_height = 0;
- }
- if (right_up != 0)
- {
- gdi_image_get_dimension_id((U16)right_up, &cat83_horizontal_select[1].right_width, &cat83_horizontal_select[1].right_height);
- }
- else
- {
- cat83_horizontal_select[1].right_width = cat83_horizontal_select[1].right_height = 0;
- }
- }
- void wgui_cat83_set_select_horizontal2_string(U8 *string)
- {
- cat83_horizontal_select[1].string = string;
- cat83_horizontal_select[1].is_updated = TRUE;
- }
- void wgui_cat83_set_select_horizontal2_handler(Cat83EventFuncPtr left_handler, Cat83EventFuncPtr right_handler)
- {
- cat83_horizontal_select[1].left_handler = left_handler;
- cat83_horizontal_select[1].right_handler = right_handler;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_cat83_set_select_vertical
- * DESCRIPTION
- * set the vertical select
- * PARAMETERS
- * top_up [IN] top image during up state
- * top_down [IN] top image during down state
- * bottom_up [IN] bottom image during up state
- * bottom_down [IN] bottom image during down state
- * string_list [IN] text string list
- * align_type [IN] alignment type: CAT83_SELECT_ALIGN_LINE | CAT83_SELECT_ALIGN_CELL
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_cat83_set_select_vertical(UI_image_ID_type top_up, UI_image_ID_type top_down, UI_image_ID_type bottom_up, UI_image_ID_type bottom_down, U8 **string_list, U32 align_type)
- {
- cat83_vertical_select.top_up = top_up;
- cat83_vertical_select.top_down = top_down;
- cat83_vertical_select.bottom_up = bottom_up;
- cat83_vertical_select.bottom_down = bottom_down;
- cat83_vertical_select.string_list = string_list;
- cat83_vertical_select.align_type = align_type;
- cat83_vertical_select.top_pressed = 0;
- cat83_vertical_select.bottom_pressed = 0;
- cat83_vertical_select.is_updated = TRUE;
- if (top_up != 0)
- {
- gdi_image_get_dimension_id((U16)top_up, &cat83_vertical_select.top_width, &cat83_vertical_select.top_height);
- }
- else
- {
- cat83_vertical_select.top_width = cat83_vertical_select.top_height = 0;
- }
- if (bottom_up != 0)
- {
- gdi_image_get_dimension_id((U16)top_up, &cat83_vertical_select.bottom_width, &cat83_vertical_select.bottom_height);
- }
- else
- {
- cat83_vertical_select.bottom_width = cat83_vertical_select.bottom_height = 0;
- }
- }
- void wgui_cat83_set_select_vertical_string(U8 **string_list)
- {
- cat83_vertical_select.string_list = string_list;
- cat83_vertical_select.is_updated = TRUE;
- }
- void wgui_cat83_set_select_vertical_handler(Cat83EventFuncPtr top_handler, Cat83EventFuncPtr bottom_handler)
- {
- cat83_vertical_select.top_handler = top_handler;
- cat83_vertical_select.bottom_handler = bottom_handler;
- }
- void wgui_cat83_set_normal_title(U8 *string)
- {
- cat83_title.string1 = string;
- cat83_title.show_title= wgui_cat83_redraw_normal_title;
- cat83_title.is_updated = TRUE;
- }
- void wgui_cat83_set_menstrual_title(U8 color_index1, U8 *string1, U8 color_index2, U8 *string2)
- {
- cat83_title.color_index1 = color_index1;
- cat83_title.string1 = string1;
- cat83_title.color_index2 = color_index2;
- cat83_title.string2 = string2;
- cat83_title.show_title= wgui_cat83_redraw_menstrual_title;
- cat83_title.is_updated = TRUE;
- }
- void wgui_cat83_set_horizontal_string(U8 **string_list)
- {
- cat83_horizontal_string.string_list = string_list;
- cat83_horizontal_string.is_updated = TRUE;
- }
- void wgui_cat83_set_cell_array(wgui_cat83_cell_struct *cell, U8 cell_bg_fill_type, U8 cell_text_display_type, U8 cell_icon_display_type)
- {
- cat83_cell_array.cell = cell;
- cat83_cell_array.bg_fill_type= cell_bg_fill_type;
- cat83_cell_array.text_display_type = cell_text_display_type;
- cat83_cell_array.icon_display_type = cell_icon_display_type;
- cat83_cell_array.is_updated = TRUE;
- #ifdef __MMI_TOUCH_SCREEN__
- cat83_cell_array.pen_on_highlighted = FALSE;
- #endif
- }
- void wgui_cat83_set_current(U32 current_row, U32 current_column)
- {
- cat83_current_row = current_row;
- cat83_current_column = current_column;
- cat83_cell_array.is_updated = TRUE;
- }
- void wgui_cat83_set_highlight(U32 highlighted_row, U32 highlighted_column)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = highlighted_row;
- cat83_highlighted_column = highlighted_column;
- }
- void wgui_cat83_set_popup(U8 *message1, U8 *message2, U8 *message3)
- {
- cat83_popup.message1 = message1;
- cat83_popup.message2 = message2;
- cat83_popup.message3 = message3;
- cat83_popup.need_popup = TRUE;
- }
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- void wgui_cat83_set_infobox(UI_image_ID_type *icon_list, U8 **string_list, U8 entry_num)
- {
- cat83_infobox.icon_list = icon_list;
- cat83_infobox.string_list = string_list;
- MMI_ASSERT(entry_num <= CAT83_MAX_INFOBOX);
- cat83_infobox.num_of_entry = entry_num;
- cat83_infobox.is_updated = TRUE;
- }
- #endif
- void wgui_cat83_register_cell_highlight_handler(MMI_BOOL (*app_cell_highlight_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppCellHighlightHanlder = app_cell_highlight_handler;
- }
- void wgui_cat83_register_left_arrow_key_handler(MMI_BOOL (*app_left_arrow_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppLeftArrowKeyHanlder = app_left_arrow_key_handler;
- }
- void wgui_cat83_register_right_arrow_key_handler(MMI_BOOL (*app_right_arrow_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppRightArrowKeyHanlder = app_right_arrow_key_handler;
- }
- void wgui_cat83_register_up_arrow_key_handler(MMI_BOOL (*app_up_arrow_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppUpArrowKeyHanlder = app_up_arrow_key_handler;
- }
- void wgui_cat83_register_down_arrow_key_handler(MMI_BOOL (*app_down_arrow_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppDownArrowKeyHanlder = app_down_arrow_key_handler;
- }
- void wgui_cat83_register_up_side_key_handler(MMI_BOOL (*app_up_side_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppUpSideKeyHanlder = app_up_side_key_handler;
- }
- void wgui_cat83_register_down_side_key_handler(MMI_BOOL (*app_down_side_key_handler)(U32 highlighted_row, U32 highlighted_column))
- {
- Cat83AppDownSideKeyHanlder = app_down_side_key_handler;
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleKeyRight
- * DESCRIPTION
- * Right arrow key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleKeyRight(void)
- {
- U32 temp_row = cat83_highlighted_row;
- U32 temp_column = cat83_highlighted_column + 1;
- //if(temp_column == cat83_column_num)
- //{
- // temp_column = 0;
- // temp_row++;
- //}
- if ((temp_row < cat83_row_num) && (temp_column < cat83_column_num) &&
- (wgui_cat83_cell_struct*)(cat83_cell_array.cell+temp_row*cat83_column_num+temp_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = temp_row;
- cat83_highlighted_column = temp_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- /* Infobox */
- }
- else
- {
- if (Cat83AppRightArrowKeyHanlder)
- {
- if (Cat83AppRightArrowKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- }
- }
- }
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleKeyLeft
- * DESCRIPTION
- * Left arrow key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleKeyLeft(void)
- {
- U32 temp_row = cat83_highlighted_row;
- U32 temp_column = cat83_highlighted_column - 1;
- //if(temp_column >= cat83_column_num)
- //{
- // temp_column = cat83_column_num - 1;
- // temp_row--;
- //}
- if ((temp_row < cat83_row_num) && (temp_column < cat83_column_num) &&
- (wgui_cat83_cell_struct*)(cat83_cell_array.cell+temp_row*cat83_column_num+temp_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = temp_row;
- cat83_highlighted_column = temp_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- /* Infobox */
- }
- else
- {
- if (Cat83AppLeftArrowKeyHanlder)
- {
- if (Cat83AppLeftArrowKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- }
- }
- }
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleKeyUp
- * DESCRIPTION
- * Up arrow key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleKeyUp(void)
- {
- U32 temp_row = cat83_highlighted_row - 1;
- U32 temp_column = cat83_highlighted_column;
- //if(temp_row >= cat83_row_num)
- //{
- // temp_row = cat83_row_num - 1;
- //}
- if ((temp_row < cat83_row_num) && (temp_column < cat83_column_num) &&
- (wgui_cat83_cell_struct*)(cat83_cell_array.cell+temp_row*cat83_column_num+temp_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = temp_row;
- cat83_highlighted_column = temp_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- /* Infobox */
- }
- else
- {
- if (Cat83AppUpArrowKeyHanlder)
- {
- if (Cat83AppUpArrowKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- }
- }
- }
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleKeyDown
- * DESCRIPTION
- * Down arrow key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleKeyDown(void)
- {
- U32 temp_row = cat83_highlighted_row + 1;
- U32 temp_column = cat83_highlighted_column;
- //if(temp_row == cat83_row_num)
- //{
- // temp_row = 0;
- //}
- if ((temp_row < cat83_row_num) && (temp_column < cat83_column_num) &&
- (wgui_cat83_cell_struct*)(cat83_cell_array.cell+temp_row*cat83_column_num+temp_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = temp_row;
- cat83_highlighted_column = temp_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- /* Infobox */
- }
- else
- {
- if (Cat83AppDownArrowKeyHanlder)
- {
- if (Cat83AppDownArrowKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- }
- }
- }
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleSideKeyUp
- * DESCRIPTION
- * Up side key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleSideKeyUp(void)
- {
- if (Cat83AppUpSideKeyHanlder)
- {
- if (Cat83AppUpSideKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * Cat83HandleSideKeyDown
- * DESCRIPTION
- * Down side key handler of Cat83.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void Cat83HandleSideKeyDown(void)
- {
- if (Cat83AppDownSideKeyHanlder)
- {
- if (Cat83AppDownSideKeyHanlder(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- #ifdef __MMI_TOUCH_SCREEN__
- static void wgui_calendar_translate_pen_position(S32 x, S32 y, U32* pen_row, U32* pen_column)
- {
- if ((x-cat83_cell_array_x+1) % (cat83_cell_width+cat83_frame_line_pixel) != 0)
- {
- *pen_column = (x-cat83_cell_array_x+1) / (cat83_cell_width+cat83_frame_line_pixel);
- }
- if ((y-cat83_cell_array_y+1) % (cat83_cell_height+cat83_frame_line_pixel) != 0)
- {
- *pen_row = (y-cat83_cell_array_y+1) / (cat83_cell_height+cat83_frame_line_pixel);
- }
- }
- static MMI_BOOL Cat83PenDownHandler(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* horizontal select 1 */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x, cat83_horizontal_select_y, cat83_horizontal_select_width>>1, cat83_horizontal_select_height))
- {
- /* left arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x+CAT83_HORIZONTAL_SELECT_GAP_BORDER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[0].left_height)>>1), cat83_horizontal_select[0].left_width, cat83_horizontal_select[0].left_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_horizontal_select[0].left_pressed = 1;
- wgui_cat83_redraw_select_horizontal1();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_horizontal_select_x, cat83_horizontal_select_y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- cat83_horizontal_select[0].left_pressed = 0;
- cat83_horizontal_select[0].is_updated = 1;
- if(cat83_horizontal_select[0].left_handler)
- {
- if(cat83_horizontal_select[0].left_handler(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- /* right arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-cat83_horizontal_select[0].right_width-CAT83_HORIZONTAL_SELECT_GAP_OTHER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[0].right_height)>>1), cat83_horizontal_select[0].right_width, cat83_horizontal_select[0].right_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_horizontal_select[0].right_pressed = 1;
- wgui_cat83_redraw_select_horizontal1();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_horizontal_select_x, cat83_horizontal_select_y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- cat83_horizontal_select[0].right_pressed = 0;
- cat83_horizontal_select[0].is_updated = 1;
- if(cat83_horizontal_select[0].right_handler)
- {
- if(cat83_horizontal_select[0].right_handler(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- }
- /* horizontal select 2 */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1), cat83_horizontal_select_y, cat83_horizontal_select_width>>1, cat83_horizontal_select_height))
- {
- /* left arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)+CAT83_HORIZONTAL_SELECT_GAP_OTHER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[1].left_height)>>1), cat83_horizontal_select[1].left_width, cat83_horizontal_select[1].left_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_horizontal_select[1].left_pressed = 1;
- wgui_cat83_redraw_select_horizontal2();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1), cat83_horizontal_select_y, cat83_horizontal_select_x+cat83_horizontal_select_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- cat83_horizontal_select[1].left_pressed = 0;
- cat83_horizontal_select[1].is_updated = 1;
- if(cat83_horizontal_select[1].left_handler)
- {
- if(cat83_horizontal_select[1].left_handler(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- /* right arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_horizontal_select_x+cat83_horizontal_select_width-cat83_horizontal_select[0].right_width-CAT83_HORIZONTAL_SELECT_GAP_BORDER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[1].right_height)>>1), cat83_horizontal_select[1].right_width, cat83_horizontal_select[1].right_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_horizontal_select[1].right_pressed = 1;
- wgui_cat83_redraw_select_horizontal2();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1), cat83_horizontal_select_y, cat83_horizontal_select_x+cat83_horizontal_select_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- cat83_horizontal_select[1].right_pressed = 0;
- cat83_horizontal_select[1].is_updated = 1;
- if(cat83_horizontal_select[1].right_handler)
- {
- if(cat83_horizontal_select[1].right_handler(cat83_highlighted_row, cat83_highlighted_column))
- {
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- }
- /* vertical select */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_vertical_select_x, cat83_vertical_select_y, cat83_vertical_select_width, cat83_vertical_select_height))
- {
- /* top arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_vertical_select_x+((cat83_vertical_select_width-cat83_vertical_select.top_width)>>1), cat83_vertical_select_y + 1, cat83_vertical_select.top_width, cat83_vertical_select.top_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_vertical_select.top_pressed = 1;
- wgui_cat83_redraw_select_vertical();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_vertical_select_x, cat83_vertical_select_y, cat83_vertical_select_x+cat83_vertical_select_width-1, cat83_vertical_select_y+cat83_vertical_select_height-1);
- cat83_vertical_select.top_pressed = 0;
- cat83_vertical_select.is_updated = 1;
- if(cat83_vertical_select.top_handler)
- {
- cat83_vertical_select.top_handler(cat83_highlighted_row, cat83_highlighted_column);
- }
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- /* bottom arrow */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_vertical_select_x+((cat83_vertical_select_width-cat83_vertical_select.top_width)>>1), cat83_vertical_select_y+cat83_vertical_select_height-cat83_vertical_select.bottom_height-1, cat83_vertical_select.bottom_width, cat83_vertical_select.bottom_height))
- {
- gdi_layer_lock_frame_buffer();
- cat83_vertical_select.bottom_pressed = 1;
- wgui_cat83_redraw_select_vertical();
- gdi_layer_unlock_frame_buffer();
- gdi_layer_blt_previous(cat83_vertical_select_x, cat83_vertical_select_y, cat83_vertical_select_x+cat83_vertical_select_width-1, cat83_vertical_select_y+cat83_vertical_select_height-1);
- cat83_vertical_select.bottom_pressed = 0;
- cat83_vertical_select.is_updated = 1;
- if(cat83_vertical_select.bottom_handler)
- {
- cat83_vertical_select.bottom_handler(cat83_highlighted_row, cat83_highlighted_column);
- }
- RedrawCategory83Screen();
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- /* cell array */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_cell_array_x, cat83_cell_array_y, cat83_cell_array_width, cat83_cell_array_height))
- {
- U32 pen_row = 0xffffffff;
- U32 pen_column = 0xffffffff;
- wgui_calendar_translate_pen_position(pos.x, pos.y, &pen_row, &pen_column);
- if ((pen_row != 0xffffffff) && (pen_column != 0xffffffff))
- {
- if ((cat83_highlighted_row == pen_row) && (cat83_highlighted_column == pen_column))
- {
- cat83_cell_array.pen_on_highlighted = TRUE;
- }
- else if((wgui_cat83_cell_struct*)(cat83_cell_array.cell+pen_row*cat83_column_num+pen_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = pen_row;
- cat83_highlighted_column = pen_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- return MMI_TRUE;
- }
- static MMI_BOOL Cat83PenUpHandler(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* cell array */
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_cell_array_x, cat83_cell_array_y, cat83_cell_array_width, cat83_cell_array_height))
- {
- U32 pen_row = 0xffffffff;
- U32 pen_column = 0xffffffff;
- wgui_calendar_translate_pen_position(pos.x, pos.y, &pen_row, &pen_column);
- if ((pen_row != 0xffffffff) && (pen_column != 0xffffffff))
- {
- if ((cat83_highlighted_row == pen_row) && (cat83_highlighted_column == pen_column))
- {
- if (cat83_cell_array.pen_on_highlighted == TRUE)
- {
- cat83_cell_array.pen_on_highlighted = FALSE;
- if (GetKeyHandler(KEY_LSK, KEY_EVENT_UP))
- {
- /* Some softkey handlers use GetkeyInfo() */
- SetkeyInfo(KEY_LSK, KEY_EVENT_UP);
- execute_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
- }
- }
- }
- }
- }
- return MMI_TRUE;
- }
- static MMI_BOOL Cat83PenMoveHandler(mmi_pen_point_struct pos)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND(pos.x, pos.y, cat83_cell_array_x, cat83_cell_array_y, cat83_cell_array_width, cat83_cell_array_height))
- {
- U32 pen_row = 0xffffffff;
- U32 pen_column = 0xffffffff;
- wgui_calendar_translate_pen_position(pos.x, pos.y, &pen_row, &pen_column);
- if ((cat83_highlighted_row == pen_row) && (cat83_highlighted_column == pen_column) && (cat83_cell_array.pen_on_highlighted == TRUE))
- {
- cat83_cell_array.pen_on_highlighted = TRUE;
- }
- else
- {
- if ((pen_row != 0xffffffff) && (pen_column != 0xffffffff))
- {
- if ((cat83_highlighted_row != pen_row) || (cat83_highlighted_column != pen_column))
- {
- if((wgui_cat83_cell_struct*)(cat83_cell_array.cell+pen_row*cat83_column_num+pen_column)->valid)
- {
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- cat83_highlighted_row = pen_row;
- cat83_highlighted_column = pen_column;
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- gdi_layer_blt_previous(0, 0, UI_device_width-1, UI_device_height-1);
- }
- }
- }
- cat83_cell_array.pen_on_highlighted = FALSE;
- }
- }
- else
- {
- }
- return MMI_TRUE;
- }
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * ExitCategory83Screen
- * DESCRIPTION
- * exit function of category83
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitCategory83Screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- reset_softkeys();
- if (cat83_cell_cache_buf != NULL)
- {
- mmi_frm_scrmem_free(cat83_cell_cache_buf);
- cat83_cell_cache_buf = NULL;
- }
- if (cat83_popup_cache_buf != NULL)
- {
- mmi_frm_scrmem_free(cat83_popup_cache_buf);
- cat83_popup_cache_buf = NULL;
- }
- if (cat83_popup.need_popup)
- {
- gui_cancel_timer(wgui_calendar_redraw_popup); /* stop the timer */
- }
- /* ToDo: clean up selector */
- memset((U8*) &cat83_horizontal_select[0], 0, sizeof(cat83_horizontal_select[0]));
- memset((U8*) &cat83_horizontal_select[1], 0, sizeof(cat83_horizontal_select[1]));
- memset((U8*) &cat83_vertical_select, 0, sizeof(cat83_vertical_select));
- memset((U8*) &cat83_popup, 0, sizeof(cat83_popup));
- Cat83AppCellHighlightHanlder = NULL;
- Cat83AppLeftArrowKeyHanlder = NULL;
- Cat83AppRightArrowKeyHanlder = NULL;
- Cat83AppUpArrowKeyHanlder = NULL;
- Cat83AppDownArrowKeyHanlder = NULL;
- Cat83AppUpSideKeyHanlder = NULL;
- Cat83AppDownSideKeyHanlder = NULL;
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- cat83_infobox.icon_list = NULL;
- cat83_infobox.string_list = NULL;
- cat83_infobox.num_of_entry = 0;
- cat83_infobox.is_updated = FALSE;
- #endif
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_layer_multi_layer_disable();
- cat83_layer = GDI_LAYER_EMPTY_HANDLE;
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * GetCategory83HistorySize
- * DESCRIPTION
- * Gets the history buffer size of category 83
- * PARAMETERS
- * void
- * RETURNS
- * size in U8s of the history buffer
- *****************************************************************************/
- S32 GetCategory83HistorySize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * GetCategory83History
- * DESCRIPTION
- * Gets the history buffer of category 83
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- * return history buffer
- *****************************************************************************/
- U8 *GetCategory83History(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return history_buffer;
- }
- static void wgui_cat83_redraw_bg(void)
- {
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_layer_multi_layer_enable();
- if (cat83_layer == GDI_LAYER_EMPTY_HANDLE)
- {
- dm_create_layer(cat83_content_x, cat83_content_y, cat83_content_width, cat83_content_height, &cat83_layer, DM_LAYER_BOTTOM);
- gdi_layer_push_and_set_active(cat83_layer);
- gdi_layer_set_source_key(FALSE, GDI_COLOR_TRANSPARENT);
- gdi_layer_clear(GDI_COLOR_TRANSPARENT);
- gdi_layer_pop_and_restore_active();
- }
- #endif
- if(cat83_bg_updated)
- {
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_layer_push_and_set_active(cat83_layer);
- #endif
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_content_x, cat83_content_y, cat83_content_x+cat83_content_width-1, cat83_content_y+cat83_content_height-1);
- gdi_image_draw_id(cat83_content_x, cat83_content_y, cat83_bg_id);
- gdi_layer_pop_clip();
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_layer_pop_and_restore_active();
- #endif
- cat83_bg_updated = FALSE;
- #ifndef __GDI_MEMORY_PROFILE_2__
- cat83_horizontal_select[0].is_updated = TRUE;
- cat83_horizontal_select[1].is_updated = TRUE;
- cat83_vertical_select.is_updated = TRUE;
- cat83_title.is_updated = TRUE;
- cat83_horizontal_string.is_updated = TRUE;
- cat83_cell_array.is_updated = TRUE;
- cat83_highlighted_row_old = 0xffffffff;
- cat83_highlighted_column_old = 0xffffffff;
- #endif
- }
- }
- static void wgui_cat83_redraw_select_horizontal1(void)
- {
- S32 cell_x, cell_width;
- S32 string_width, string_height;
- UI_image_ID_type icon_id;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_horizontal_select_x, cat83_horizontal_select_y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_horizontal_select_x, cat83_horizontal_select_y, cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- /* left arrow */
- if (cat83_horizontal_select[0].left_pressed == 0)
- {
- icon_id = cat83_horizontal_select[0].left_up;
- }
- else
- {
- icon_id = cat83_horizontal_select[0].left_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_horizontal_select_x+CAT83_HORIZONTAL_SELECT_GAP_BORDER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[0].left_height)>>1), (U16)icon_id);
- }
- /* right arrow */
- if (cat83_horizontal_select[0].right_pressed == 0)
- {
- icon_id = cat83_horizontal_select[0].right_up;
- }
- else
- {
- icon_id = cat83_horizontal_select[0].right_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)-cat83_horizontal_select[0].right_width-CAT83_HORIZONTAL_SELECT_GAP_OTHER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[0].right_height)>>1), (U16)icon_id);
- }
- /* text */
- cell_x = cat83_horizontal_select_x+CAT83_HORIZONTAL_SELECT_GAP_BORDER+cat83_horizontal_select[0].left_width+1;
- cell_width = (cat83_horizontal_select_width>>1)-CAT83_HORIZONTAL_SELECT_GAP_BORDER-cat83_horizontal_select[0].left_width-cat83_horizontal_select[0].right_width-CAT83_HORIZONTAL_SELECT_GAP_OTHER-2;
- gdi_layer_set_clip(cell_x, cat83_horizontal_select_y, cell_x+cell_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- gui_set_font(&MMI_medium_font);
- gui_set_text_color(cat83_horizontal_select_fg);
- gui_set_text_border_color(cat83_horizontal_select_border);
- gui_measure_string((UI_string_type)cat83_horizontal_select[0].string, &string_width, &string_height);
- if (cat83_horizontal_select[0].align_type == CAT83_SELECT_ALIGN_CENTER)
- {
- gui_move_text_cursor(cell_x+((cell_width-string_width)>>1), cat83_horizontal_select_y+((cat83_horizontal_select_height-string_height)>>1));
- }
- else if (cat83_horizontal_select[0].align_type == CAT83_SELECT_ALIGN_LEFT)
- {
- gui_move_text_cursor(cell_x, cat83_horizontal_select_y+((cat83_horizontal_select_height-string_height)>>1));
- }
- else
- {
- MMI_ASSERT(0);
- }
- gui_print_bordered_text((UI_string_type)cat83_horizontal_select[0].string);
- cat83_horizontal_select[0].is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_cat83_redraw_select_horizontal2(void)
- {
- S32 cell_x, cell_width;
- S32 string_width, string_height;
- UI_image_ID_type icon_id;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1), cat83_horizontal_select_y, cat83_horizontal_select_x+cat83_horizontal_select_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1), cat83_horizontal_select_y, cat83_horizontal_select_x+cat83_horizontal_select_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- /* left arrow */
- if (cat83_horizontal_select[1].left_pressed == 0)
- {
- icon_id = cat83_horizontal_select[1].left_up;
- }
- else
- {
- icon_id = cat83_horizontal_select[1].left_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)+CAT83_HORIZONTAL_SELECT_GAP_OTHER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[1].left_height)>>1), (U16)icon_id);
- }
- /* right arrow */
- if (cat83_horizontal_select[1].right_pressed == 0)
- {
- icon_id = cat83_horizontal_select[1].right_up;
- }
- else
- {
- icon_id = cat83_horizontal_select[1].right_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_horizontal_select_x+cat83_horizontal_select_width-cat83_horizontal_select[0].right_width-CAT83_HORIZONTAL_SELECT_GAP_BORDER, cat83_horizontal_select_y+((cat83_horizontal_select_height-cat83_horizontal_select[1].right_height)>>1), (U16)icon_id);
- }
- /* text */
- cell_x = cat83_horizontal_select_x+(cat83_horizontal_select_width>>1)+CAT83_HORIZONTAL_SELECT_GAP_OTHER+cat83_horizontal_select[1].left_width+1;
- cell_width = (cat83_horizontal_select_width>>1)-CAT83_HORIZONTAL_SELECT_GAP_BORDER-cat83_horizontal_select[1].left_width-cat83_horizontal_select[1].right_width-CAT83_HORIZONTAL_SELECT_GAP_OTHER-2;
- gdi_layer_set_clip(cell_x, cat83_horizontal_select_y, cell_x+cell_width-1, cat83_horizontal_select_y+cat83_horizontal_select_height-1);
- gui_set_font(&MMI_medium_font);
- gui_set_text_color(cat83_horizontal_select_fg);
- gui_set_text_border_color(cat83_horizontal_select_border);
- gui_measure_string((UI_string_type)cat83_horizontal_select[1].string, &string_width, &string_height);
- gui_move_text_cursor(cell_x+((cell_width-string_width)>>1), cat83_horizontal_select_y+((cat83_horizontal_select_height-string_height)>>1));
- gui_print_bordered_text((UI_string_type)cat83_horizontal_select[1].string);
- cat83_horizontal_select[1].is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_cat83_redraw_horizontal_string(void)
- {
- S32 cell_x, cell_y, cell_width, cell_height;
- S32 string_width, string_height;
- U32 i;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_horizontal_string_x, cat83_horizontal_string_y, cat83_horizontal_string_x+cat83_horizontal_string_width-1, cat83_horizontal_string_y+cat83_horizontal_string_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_horizontal_string_x, cat83_horizontal_string_y, cat83_horizontal_string_x+cat83_horizontal_string_width-1, cat83_horizontal_string_y+cat83_horizontal_string_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- cell_x = cat83_horizontal_string_x;
- cell_y = cat83_horizontal_string_y;
- cell_width = (cat83_horizontal_string_width-(cat83_column_num-1)*cat83_frame_line_pixel)/cat83_column_num;
- cell_height = cat83_horizontal_string_height;
- gui_set_font(cat83_horizontal_string_font);
- gui_set_text_color(cat83_horizontal_string_fg);
- for(i = 0; i < cat83_column_num; i++)
- {
- gui_measure_string((UI_string_type)cat83_horizontal_string.string_list[i], &string_width, &string_height);
- gui_move_text_cursor(cell_x+((cell_width-string_width)>>1), cell_y+((cell_height-string_height)>>1));
- gui_print_text((UI_string_type)cat83_horizontal_string.string_list[i]);
- cell_x += (cell_width+cat83_frame_line_pixel);
- }
- cat83_horizontal_string.is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_cat83_redraw_select_vertical(void)
- {
- S32 cell_x, cell_y = 0, cell_width, cell_height;//120406 warning remove
- S32 string_width, string_height;
- U32 i;
- UI_image_ID_type icon_id;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_vertical_select_x, cat83_vertical_select_y, cat83_vertical_select_x+cat83_vertical_select_width-1, cat83_vertical_select_y+cat83_vertical_select_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_vertical_select_x, cat83_vertical_select_y, cat83_vertical_select_x+cat83_vertical_select_width-1, cat83_vertical_select_y+cat83_vertical_select_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- /* top arrow */
- if (cat83_vertical_select.top_pressed == 0)
- {
- icon_id = cat83_vertical_select.top_up;
- }
- else
- {
- icon_id = cat83_vertical_select.top_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_vertical_select_x+((cat83_vertical_select_width-cat83_vertical_select.top_width)>>1), cat83_vertical_select_y + 1, (U16)icon_id);
- }
- /* bottom arrow */
- if (cat83_vertical_select.bottom_pressed == 0)
- {
- icon_id = cat83_vertical_select.bottom_up;
- }
- else
- {
- icon_id = cat83_vertical_select.bottom_down;
- }
- if(icon_id != 0)
- {
- gdi_image_draw_id(cat83_vertical_select_x+((cat83_vertical_select_width-cat83_vertical_select.top_width)>>1), cat83_vertical_select_y+cat83_vertical_select_height-cat83_vertical_select.bottom_height-1, (U16)icon_id);
- }
- /* text */
- cell_x = cat83_vertical_select_x;
- cell_width = cat83_vertical_select_width;
- cell_height = (cat83_cell_array_height-(cat83_row_num-1)*cat83_frame_line_pixel)/cat83_row_num;
- if(cat83_vertical_select.align_type == CAT83_SELECT_ALIGN_CELL)
- {
- cell_y = cat83_cell_array_y;
- }
- else if(cat83_vertical_select.align_type == CAT83_SELECT_ALIGN_LINE)
- {
- cell_y = cat83_cell_array_y - (cell_height>>1);
- }
- else
- {
- MMI_ASSERT(0);
- }
- gui_set_font(cat83_cell_font);
- gui_set_text_color(cat83_vertical_select_fg);
- for(i = 0; i < cat83_row_num; i++)
- {
- gui_measure_string((UI_string_type)cat83_vertical_select.string_list[i], &string_width, &string_height);
- gui_move_text_cursor(cell_x+((cell_width-string_width)>>1), cell_y+((cell_height-string_height)>>1));
- gui_print_text((UI_string_type)cat83_vertical_select.string_list[i]);
- cell_y += (cell_height+cat83_frame_line_pixel);
- }
- cat83_vertical_select.is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_cat83_redraw_normal_title(void)
- {
- S32 string_width, string_height;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_title_x, cat83_title_y, cat83_title_x+cat83_title_width-1, cat83_title_y+cat83_title_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_title_x, cat83_title_y, cat83_title_x+cat83_title_width-1, cat83_title_y+cat83_title_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- gui_set_font(&MMI_medium_font);
- gui_set_text_color(cat83_title_fg);
- gui_measure_string((UI_string_type)cat83_title.string1, &string_width, &string_height);
- gui_move_text_cursor(cat83_title_x+((cat83_title_width-string_width)>>1), cat83_title_y+((cat83_title_height-string_height)>>1));
- gui_print_text((UI_string_type)cat83_title.string1);
- cat83_title.is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_cat83_redraw_menstrual_title(void)
- {
- }
- void wgui_calendar_redraw_cell_array(void)
- {
- S32 cell_x, cell_y, cell_width, cell_height;
- S32 current_cell_x, current_cell_y;
- //S32 highlighted_cell_x, highlighted_cell_y;
- U32 i, j;
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_cell_array_x, cat83_cell_array_y, cat83_cell_array_x+cat83_cell_array_width-1, cat83_cell_array_y+cat83_cell_array_height-1);
- #ifdef __GDI_MEMORY_PROFILE_2__
- gdi_draw_solid_rect(cat83_cell_array_x, cat83_cell_array_y, cat83_cell_array_x+cat83_cell_array_width-1, cat83_cell_array_y+cat83_cell_array_height-1, GDI_COLOR_TRANSPARENT);
- #endif
- cell_x = cat83_cell_array_x;
- cell_y = cat83_cell_array_y;
- cell_width = cat83_cell_width;
- cell_height = cat83_cell_height;
- /* current cell bg */
- if ((cat83_current_row<cat83_row_num) && (cat83_current_column<cat83_column_num))
- {
- current_cell_x = cell_x + (cell_width+cat83_frame_line_pixel)*cat83_current_column;
- current_cell_y = cell_y + (cell_height+cat83_frame_line_pixel)*cat83_current_row;
- gdi_draw_solid_rect(current_cell_x, current_cell_y, current_cell_x+cell_width-1, current_cell_y+cell_height-1, gdi_act_color_from_rgb(cat83_cell_bg[CAT83_COLOR_CURRENT].alpha, cat83_cell_bg[CAT83_COLOR_CURRENT].r, cat83_cell_bg[CAT83_COLOR_CURRENT].g, cat83_cell_bg[CAT83_COLOR_CURRENT].b));
- }
- /* each cell */
- for(i = 0; i < cat83_row_num; i ++)
- {
- cell_x = cat83_cell_array_x;
- for(j = 0; j < cat83_column_num; j++)
- {
- wgui_calendar_redraw_cell(cell_x, cell_y, cell_width, cell_height, cat83_cell_array.cell+i*cat83_column_num+j);
- cell_x += (cell_width+cat83_frame_line_pixel);
- }
- cell_y += (cell_height+cat83_frame_line_pixel);
- }
- cat83_cell_array.is_updated = FALSE;
- gdi_layer_pop_clip();
- }
- static void wgui_calendar_redraw_cell(S32 cell_x, S32 cell_y, S32 cell_width, S32 cell_height, wgui_cat83_cell_struct *cell)
- {
- S32 fill_bg_x = 0, fill_bg_y = 0, fill_bg_width = 0, fill_bg_height = 0;//120406 warning remove
- S32 text_x = 0, text_y = 0, text_width, text_height;
- S32 icon_x = 0, icon_y = 0, icon_width, icon_height;
- /* fill bg */
- if (cat83_cell_array.bg_fill_type == CAT83_CELL_BG_FILL_HORIZONTAL)
- {
- fill_bg_x = cell_x;
- fill_bg_y = cell_y + cell_height - (cell_height>>1);
- fill_bg_width = cell_width;
- fill_bg_height = cell_height>>1;
- }
- else if(cat83_cell_array.bg_fill_type == CAT83_CELL_BG_FILL_VERTICAL)
- {
- fill_bg_x = cell_x + (cell_width>>2);
- fill_bg_y = cell_y;
- fill_bg_width = cell_width>>1;
- fill_bg_height = cell_height;
- }
- else
- {
- MMI_ASSERT(0);
- }
- if (cell->bg_index != CAT83_COLOR_NONE)
- {
- gdi_draw_solid_rect(fill_bg_x, fill_bg_y, fill_bg_x+fill_bg_width-1, fill_bg_y+fill_bg_height-1, gdi_act_color_from_rgb(cat83_cell_bg[cell->bg_index].alpha, cat83_cell_bg[cell->bg_index].r, cat83_cell_bg[cell->bg_index].g, cat83_cell_bg[cell->bg_index].b));
- }
- /* draw icon */
- if ((cat83_cell_array.icon_display_type != CAT83_CELL_ICON_DISPLAY_DISABLE) && (cell->icon_id != 0))
- {
- gdi_image_get_dimension_id((U16)cell->icon_id, &icon_width, &icon_height);
- if (cat83_cell_array.icon_display_type == CAT83_CELL_ICON_DISPLAY_RIGHT_TOP)
- {
- icon_x = cell_x + cell_width - icon_width - 1;
- icon_y = cell_y + 1;
- }
- else if (cat83_cell_array.icon_display_type == CAT83_CELL_ICON_DISPLAY_CENTER)
- {
- icon_x = cell_x + ((cell_width-icon_width)>>1);
- icon_y = cell_y + ((cell_height-icon_height)>>1);
- }
- else
- {
- MMI_ASSERT(0);
- }
- gdi_image_draw_id(icon_x, icon_y, (U16) cell->icon_id);
- }
- /* draw text */
- if (cat83_cell_array.text_display_type != CAT83_CELL_TEXT_DISPLAY_DISABLE)
- {
- gui_measure_string(cell->text, &text_width, &text_height);
- if (cat83_cell_array.text_display_type == CAT83_CELL_TEXT_DISPLAY_LEFT_BOTTOM)
- {
- text_x = cell_x;
- text_y = cell_y + cell_height - text_height + 1;
- }
- else if(cat83_cell_array.text_display_type == CAT83_CELL_TEXT_DISPLAY_CENTER)
- {
- text_x = cell_x + ((cell_width-text_width)>>1);
- text_y = cell_y + ((cell_height-text_height)>>1);
- }
- else
- {
- MMI_ASSERT(0);
- }
- gui_set_font(cat83_cell_font);
- if (cell->valid)
- {
- gui_set_text_color(cat83_cell_valid_fg);
- }
- else
- {
- gui_set_text_color(cat83_cell_invalid_fg);
- }
- gui_move_text_cursor(text_x, text_y);
- gui_print_text((UI_string_type)cell->text);
- }
- }
- static void wgui_calendar_redraw_popup(void)
- {
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #else
- /* These can be obtained from theme data */
- const UI_filled_area popup_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {47, 55, 143, 80},
- {0, 0, 0, 0},
- {0, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- color tc = *(current_MMI_theme->UI_white_color);
- UI_font_type text_font = &MMI_medium_font;
- S32 x1 = cat83_cell_array_x + (cat83_cell_width+cat83_frame_line_pixel)*cat83_highlighted_column;
- S32 y1 = cat83_cell_array_y + (cat83_cell_height+cat83_frame_line_pixel)*cat83_highlighted_row;
- S32 x2 = x1 + cat83_cell_width - 1;
- //S32 y2 = y1 + cat83_cell_height - 1;
- S32 px1, py1, px2, py2;
- S32 width, height, y;
- S32 w1, w2, w3, h1, h2, h3;
- /* set message 1 of popup */
- UI_string_type msg1 = (UI_string_type) cat83_popup.message1;
- /* set message 2 of popup */
- UI_string_type msg2 = (UI_string_type) cat83_popup.message2;
- /* set message 3 of popup */
- UI_string_type msg3 = (UI_string_type) cat83_popup.message3;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* set font of popup */
- gui_set_font(text_font);
- if ((msg1 == NULL) && (msg2 == NULL) && (msg3 == NULL))
- {
- cat83_popup.is_drawed = FALSE;
- return;
- }
- if (msg1 == NULL)
- {
- h1 = 0;
- w1 = 0;
- }
- else
- {
- gui_measure_string(msg1, &w1, &h1); /* measue width and height of msg1 */
- }
- if (msg2 == NULL)
- {
- h2 = 0;
- w2 = 0;
- }
- else
- {
- gui_measure_string(msg2, &w2, &h2); /* measue width and height of msg1 */
- }
- if (msg3 == NULL)
- {
- h3 = 0;
- w3 = 0;
- }
- else
- {
- gui_measure_string(msg3, &w3, &h3); /* measue width and height of msg1 */
- }
- height = h1 + h2 + h3 + 8;
- width = w1;
- if (w2 > width)
- {
- width = w2;
- }
- if (w3 > width)
- {
- width = w3;
- }
- width += 8;
- if (width > (CAT83_FRAME_WIDTH>>1))
- {
- width = (CAT83_FRAME_WIDTH>>1);
- }
- if (height > (CAT83_FRAME_HEIGHT>>1))
- {
- height = (CAT83_FRAME_HEIGHT>>1);
- }
- px1 = x2 + cat83_frame_line_pixel;
- py1 = y1;// + cat83_frame_line_pixel;
- if ((px1 + width - 1) > cat83_cell_array_x + cat83_cell_array_width - 1)
- {
- px1 = x1 - width - cat83_frame_line_pixel;
- if (px1 < cat83_cell_array_x)
- {
- px1 = cat83_cell_array_x;
- }
- }
- if ((py1 + height - 1) > cat83_cell_array_y + cat83_cell_array_height - 1)
- {
- py1 = cat83_cell_array_y + cat83_cell_array_height - height;
- if (py1 < cat83_cell_array_y)
- {
- py1 = cat83_cell_array_y;
- }
- }
- px2 = px1 + width - 1;
- py2 = py1 + height - 1;
- gdi_layer_push_clip();
- gdi_layer_set_clip(px1, py1, px2, py2);
- gdi_image_cache_bmp_get(px1, py1, px2, py2, &cat83_popup_cache);
- cat83_popup.is_drawed = TRUE;
- cat83_popup_x = px1;
- cat83_popup_y = py1;
- /* fill the color of popup */
- gui_draw_filled_area(px1, py1, px2, py2, (UI_filled_area*)&popup_filler);
- /* set text color */
- gui_set_text_color(tc);
- y = py1 + 4;
- if (msg1 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w1, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg1);
- y += h1;
- }
- if (msg2 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w2, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg2);
- y += h2;
- }
- if (msg3 != NULL)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(px1 + 4 + w3, y);
- }
- else
- {
- gui_move_text_cursor(px1 + 4, y);
- }
- gui_print_text(msg3);
- y += h3;
- }
- gdi_layer_pop_clip();
- gdi_layer_blt_previous(px1, py1, px2, py2);
- #endif
- }
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- static void wgui_cat83_redraw_infobox(void)
- {
- S32 entry_x, entry_y, entry_width, entry_height;
- S32 icon_x, icon_width, icon_height;
- S32 string_x, string_width, string_height;
- S32 i;
- entry_width = CAT83_INFOBOX_WIDTH - CAT83_INFOBOX_GAP*2;
- entry_height = CAT83_INFOBOX_ENTRY_HEIGHT;
- entry_x = cat83_infobox_x + CAT83_INFOBOX_GAP;
- entry_y = cat83_infobox_y + CAT83_INFOBOX_GAP;
- icon_x = entry_x;
- if(cat83_infobox.icon_list)
- {
- string_x = entry_x + CAT83_INFOBOX_ENTRY_HEIGHT;
- }
- else
- {
- string_x = entry_x;
- }
- gui_set_font(cat83_infobox_font);
- gui_set_text_color(cat83_infobox_fg);
- gdi_layer_push_clip();
- gdi_layer_set_clip(cat83_infobox_x, cat83_infobox_y, cat83_infobox_x+cat83_infobox_width-1, cat83_infobox_y+cat83_infobox_height-1);
- gdi_draw_solid_rect(cat83_infobox_x, cat83_infobox_y, cat83_infobox_x+cat83_infobox_width-1, cat83_infobox_y+cat83_infobox_height-1, gdi_act_color_from_rgb(cat83_infobox_bg.alpha, cat83_infobox_bg.r, cat83_infobox_bg.g, cat83_infobox_bg.b));
- for (i = 0; i < cat83_infobox.num_of_entry; i++)
- {
- gdi_layer_push_clip();
- gdi_layer_set_clip(entry_x, entry_y, entry_x+entry_width-1, entry_y+entry_height-1);
- gdi_draw_solid_rect(entry_x, entry_y, entry_x+entry_width-1, entry_y+entry_height-1, gdi_act_color_from_rgb(cat83_infobox_entry_bg.alpha, cat83_infobox_entry_bg.r, cat83_infobox_entry_bg.g, cat83_infobox_entry_bg.b));
- if(cat83_infobox.icon_list)
- {
- if(cat83_infobox.icon_list[i] != 0)
- {
- gdi_image_get_dimension_id((U16)cat83_infobox.icon_list[i], &icon_width, &icon_height);
- gdi_image_draw_id(icon_x+((CAT83_INFOBOX_ENTRY_HEIGHT-icon_width)>>1), entry_y+((CAT83_INFOBOX_ENTRY_HEIGHT-icon_width)>>1), (U16)cat83_infobox.icon_list[i]);
- }
- }
- if(cat83_infobox.string_list)
- {
- if(cat83_infobox.string_list[i] != NULL)
- {
- gui_measure_string((UI_string_type)cat83_infobox.string_list[i], &string_width, &string_height);
- //gui_move_text_cursor(string_x, entry_y+((CAT83_INFOBOX_ENTRY_HEIGHT-string_height)>>1));
- //gui_print_text((UI_string_type)cat83_infobox.string_list[i]);
- gui_print_truncated_text(
- string_x,
- entry_y + ((CAT83_INFOBOX_ENTRY_HEIGHT - string_height) >> 1),
- entry_x + entry_width - string_x,
- (UI_string_type)cat83_infobox.string_list[i]);
- }
- }
- entry_y += entry_height + CAT83_INFOBOX_GAP;
- gdi_layer_pop_clip();
- }
- gdi_layer_pop_clip();
- }
- #endif
- static void wgui_calendar_highlight_cell(U32 highlighted_row, U32 highlighted_column)
- {
- S32 cell_x, cell_y, cell_width, cell_height;
- S32 highlighted_cell_x, highlighted_cell_y;
- cell_x = cat83_cell_array_x;
- cell_y = cat83_cell_array_y;
- cell_width = cat83_cell_width;
- cell_height = cat83_cell_height;
- highlighted_cell_x = cell_x + (cell_width+cat83_frame_line_pixel)*cat83_highlighted_column;
- highlighted_cell_y = cell_y + (cell_height+cat83_frame_line_pixel)*cat83_highlighted_row;
- gdi_layer_push_clip();
- gdi_layer_set_clip(highlighted_cell_x, highlighted_cell_y, highlighted_cell_x+cell_width-1, highlighted_cell_y+cell_height-1);
- if ((cat83_highlighted_row_old != cat83_highlighted_row) || (cat83_highlighted_column_old != cat83_highlighted_column))
- {
- gdi_image_cache_bmp_get(highlighted_cell_x, highlighted_cell_y, highlighted_cell_x+cell_width-1, highlighted_cell_y+cell_height-1, &cat83_cell_cache);
- }
- gdi_draw_rect(highlighted_cell_x, highlighted_cell_y, highlighted_cell_x+cell_width-1, highlighted_cell_y+cell_height-1, gdi_act_color_from_rgb(cat83_cell_highlight.alpha, cat83_cell_highlight.r, cat83_cell_highlight.g, cat83_cell_highlight.b));
- gdi_layer_pop_clip();
- if (Cat83AppCellHighlightHanlder)
- {
- Cat83AppCellHighlightHanlder(highlighted_row, highlighted_column);
- }
- cat83_highlighted_row_old = cat83_highlighted_row;
- cat83_highlighted_column_old = cat83_highlighted_column;
- /* draw left horizontal select */
- if(cat83_horizontal_select[0].is_updated)
- {
- wgui_cat83_redraw_select_horizontal1();
- }
- /* draw right horizontal select */
- if(cat83_horizontal_select[1].is_updated)
- {
- wgui_cat83_redraw_select_horizontal2();
- }
- if(cat83_title.is_updated)
- {
- cat83_title.show_title();
- }
- #ifdef __MMI_UI_CALENDAR_WITH_INFO_BOX__
- if (cat83_infobox.is_updated)
- {
- wgui_cat83_redraw_infobox();
- }
- #endif
- if (cat83_popup.need_popup)
- {
- gui_cancel_timer(wgui_calendar_redraw_popup);
- gui_start_timer(CAT83_POPUP_WAIT_TIME, wgui_calendar_redraw_popup);
- }
- }
- static void wgui_calendar_unhighlight_cell(U32 highlighted_row, U32 highlighted_column)
- {
- S32 cell_x, cell_y, cell_width, cell_height;
- S32 highlighted_cell_x, highlighted_cell_y;
- cell_x = cat83_cell_array_x;
- cell_y = cat83_cell_array_y;
- cell_width = cat83_cell_width;
- cell_height = cat83_cell_height;
- highlighted_cell_x = cell_x + (cell_width+cat83_frame_line_pixel)*highlighted_column;
- highlighted_cell_y = cell_y + (cell_height+cat83_frame_line_pixel)*highlighted_row;
- if (cat83_popup.need_popup && cat83_popup.is_drawed)
- {
- gdi_image_cache_bmp_draw(cat83_popup_x, cat83_popup_y, &cat83_popup_cache);
- cat83_popup.is_drawed = FALSE;
- }
- gdi_layer_push_clip();
- gdi_layer_set_clip(highlighted_cell_x, highlighted_cell_y, highlighted_cell_x+cell_width-1, highlighted_cell_y+cell_height-1);
- gdi_image_cache_bmp_draw(highlighted_cell_x, highlighted_cell_y, &cat83_cell_cache);
- gdi_layer_pop_clip();
- if (cat83_popup.need_popup)
- {
- gui_cancel_timer(wgui_calendar_redraw_popup); /* stop the timer */
- }
- }
- static void RedrawCategory83Screen(void)
- {
- /* draw calendar background image */
- wgui_cat83_redraw_bg();
- /* draw left horizontal select */
- if(cat83_horizontal_select[0].is_updated)
- {
- wgui_cat83_redraw_select_horizontal1();
- }
- /* draw right horizontal select */
- if(cat83_horizontal_select[1].is_updated)
- {
- wgui_cat83_redraw_select_horizontal2();
- }
- /* draw title */
- if(cat83_title.is_updated)
- {
- cat83_title.show_title();
- }
- /* draw horizontal string */
- if(cat83_horizontal_string.is_updated)
- {
- wgui_cat83_redraw_horizontal_string();
- }
- /* draw vertical select */
- if(cat83_vertical_select_display)
- {
- if(cat83_vertical_select.is_updated)
- {
- wgui_cat83_redraw_select_vertical();
- }
- }
- /* draw calendar cells */
- if(cat83_cell_array.is_updated)
- {
- wgui_calendar_redraw_cell_array();
- cat83_highlighted_row_old = 0xffffffff;
- cat83_highlighted_column_old = 0xffffffff;
- }
- /* unhighlighted and highlighted cell */
- if ((cat83_highlighted_row_old<cat83_row_num) && (cat83_highlighted_column<cat83_column_num))
- {
- if ((cat83_highlighted_row_old!=cat83_highlighted_row) || (cat83_highlighted_column_old<cat83_highlighted_column))
- {
- wgui_calendar_unhighlight_cell(cat83_highlighted_row_old, cat83_highlighted_column_old);
- }
- }
- if ((cat83_highlighted_row<cat83_row_num) && (cat83_highlighted_column<cat83_column_num))
- {
- wgui_calendar_highlight_cell(cat83_highlighted_row, cat83_highlighted_column);
- }
- /* Infobox */
- }
- /*****************************************************************************
- * FUNCTION
- * RedrawCategoryControlledArea83Screen
- * DESCRIPTION
- * redraw category83
- * PARAMETERS
- * coordinate [?]
- * RETURNS
- * void
- *****************************************************************************/
- void RedrawCategoryControlledArea83Screen(dm_coordinates *coordinate)
- {
- RedrawCategory83Screen();
- }
- /*****************************************************************************
- * FUNCTION
- * ShowCategory83Screen
- * DESCRIPTION
- * category screen of integrated calendar (monthly/weekly and menstral)
- * PARAMETERS
- * title [IN] Title string
- * horizon_string_list [IN] horizontal string list
- * cell [IN] 2 dimension cell array
- * num_of_row [IN] number of row
- * num_of_column [IN] number of column
- * current_row [IN] row of current time
- * current_column [IN] column of current time
- * highlighted_row [IN] highlighted row
- * highlighted_column [IN] highlighted column
- * cell_fill_type [IN] cell bg color fill type
- * RETURNS
- * void
- *****************************************************************************/
- void ShowCategory83Screen(
- UI_image_ID_type bg_id,
- U8 **horizon_string_list,
- wgui_cat83_cell_struct *cell,
- U32 num_of_row,
- U32 num_of_column,
- U32 current_row,
- U32 current_column,
- U32 highlighted_row,
- U32 highlighted_column,
- U8 cell_bg_fill_type,
- U8 cell_text_display_type,
- U8 cell_icon_display_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_data_struct dm_data;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetupCategoryKeyHandlers();
- cat83_cell_cache_buf = (U8*)mmi_frm_scrmem_alloc(CALENDAR_CACHE_CELL_SIZE);
- cat83_popup_cache_buf = (U8*)mmi_frm_scrmem_alloc(CALENDAR_CACHE_POPUP_SIZE);
- #if defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)
- wgui_calendar_init(CAT83_CALENDAR_NORMAL, num_of_row, num_of_column, cat83_cell_cache_buf, cat83_popup_cache_buf);
- wgui_set_wallpaper_on_bottom(MMI_TRUE);
- #else
- wgui_calendar_init(CAT83_CALENDAR_SMALL, num_of_row, num_of_column, cat83_cell_cache_buf, cat83_popup_cache_buf);
- #endif
- wgui_cat83_set_bg(bg_id);
- wgui_cat83_set_horizontal_string(horizon_string_list);
- wgui_cat83_set_cell_array(cell, cell_bg_fill_type, cell_text_display_type, cell_icon_display_type);
- cat83_current_row = current_row;
- cat83_current_column = current_column;
- cat83_highlighted_row = highlighted_row;
- cat83_highlighted_column = highlighted_column;
- dm_register_category_controlled_callback(RedrawCategoryControlledArea83Screen);
- SetKeyHandler(Cat83HandleKeyLeft, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleKeyLeft, KEY_LEFT_ARROW, KEY_LONG_PRESS);
- SetKeyHandler(Cat83HandleKeyRight, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleKeyRight, KEY_RIGHT_ARROW, KEY_LONG_PRESS);
- SetKeyHandler(Cat83HandleKeyUp, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleKeyUp, KEY_UP_ARROW, KEY_LONG_PRESS);
- SetKeyHandler(Cat83HandleKeyDown, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleKeyDown, KEY_DOWN_ARROW, KEY_LONG_PRESS);
- SetKeyHandler(Cat83HandleSideKeyUp, KEY_VOL_UP, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleSideKeyUp, KEY_VOL_UP, KEY_LONG_PRESS);
- SetKeyHandler(Cat83HandleSideKeyDown, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- SetKeyHandler(Cat83HandleSideKeyDown, KEY_VOL_DOWN, KEY_LONG_PRESS);
- #ifdef __MMI_TOUCH_SCREEN__
- wgui_register_category_screen_control_area_pen_handlers(Cat83PenDownHandler, MMI_PEN_EVENT_DOWN);
- wgui_register_category_screen_control_area_pen_handlers(Cat83PenUpHandler, MMI_PEN_EVENT_UP);
- wgui_register_category_screen_control_area_pen_handlers(Cat83PenMoveHandler, MMI_PEN_EVENT_MOVE);
- //wgui_register_category_screen_control_area_pen_handlers(Cat83PenRepeatHandler, MMI_PEN_EVENT_REPEAT);
- #endif /* __MMI_TOUCH_SCREEN__ */
- ExitCategoryFunction = ExitCategory83Screen;
- RedrawCategoryFunction = dm_redraw_category_screen;
- GetCategoryHistory = GetCategory83History;
- GetCategoryHistorySize = GetCategory83HistorySize;
- dm_data.s32CatId = MMI_CATEGORY83_ID;
- dm_data.s32ScrId = GetActiveScreenId();
- dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
- dm_setup_data(&dm_data);
- dm_redraw_category_screen();
- }
- /*----------------------------Async Dynamic Multi Row List-----------------------------*/
- // *************************************************************************************//
- extern S32 gui_asyncdynamic_list_error;
- extern U16 title_bg_id;
- /*****************************************************************************
- * FUNCTION
- * cat85_clear_icon_bg
- * DESCRIPTION
- * Clear button background function
- * PARAMETERS
- * button [IN] Button pointer
- * RETURNS
- * void
- *****************************************************************************/
- void cat85_clear_icon_bg(void *button)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- icontext_button *b = (icontext_button*) button;
- S32 x1 = b->x;
- S32 y1 = b->y;
- S32 x2 = b->x + b->width - 1;
- S32 y2 = b->y + b->height - 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_push_clip();
- //gdi_layer_set_clip(x1, y1, x2, y2);
- //gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
- //gdi_layer_pop_clip();
- gdi_layer_set_clip(x1, y1, x2 + 1, y2 + 1);
- gdi_draw_solid_rect(MMI_title_x, MMI_title_y, MMI_title_x + MMI_title_width - 1, MMI_title_y + MMI_title_height - 1, GDI_COLOR_TRANSPARENT); /* 061705 Calvin added */
- if (title_bg_id != 0)
- {
- gdi_image_draw_id(MMI_title_x, MMI_title_y, title_bg_id);
- }
- else
- {
- gui_draw_filled_area(
- MMI_title_x,
- MMI_title_y,
- MMI_title_x + MMI_title_width - 1,
- MMI_title_y + MMI_title_height - 1,
- current_UI_theme->window_title_theme->active_filler);
- }
- gdi_layer_pop_clip();
- }
- /*****************************************************************************
- * FUNCTION
- * ExitCategory85Screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ExitCategory85Screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- title_bg_id = 0;
- MMI_disable_title_shortcut_display = 0;
- disable_menu_shortcut_box_display = 0;
- wgui_reset_touch_title_bar_buttons();
- ClearHighlightHandler();
- reset_softkeys();
- reset_menu_shortcut_handler();
- reset_asyncdynamic_list();
- reset_pop_up_descriptions();
- }
- // *************************************************************************************//
- /*****************************************************************************
- * FUNCTION
- * ShowCategory85Screen
- * DESCRIPTION
- * category screen of integrated calendar (daily)
- * PARAMETERS
- * title [IN]
- * title_icon [IN]
- * left_softkey [IN]
- * left_softkey_icon [IN]
- * right_softkey [IN]
- * right_softkey_icon [IN]
- * number_of_items [IN]
- * get_item_func [IN]
- * get_hint_func [IN]
- * highlighted_item [IN]
- * main_icon [IN]
- * sub_icon [IN]
- * history_buffer [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ShowCategory85Screen(
- U8 *title,
- U16 title_icon,
- U16 left_softkey,
- U16 left_softkey_icon,
- U16 right_softkey,
- U16 right_softkey_icon,
- S32 number_of_items,
- GetAsyncItemFuncPtr get_item_func,
- GetAsyncHintFuncPtr get_hint_func,
- S32 highlighted_item,
- U16 main_icon,
- U16 sub_icon,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- dm_data_struct dm_data;
- S32 shortcut_width;
- U8 h_flag;
- PU8 img;
- S32 h, w, h1, w1, text_width, text_width1;
- S32 font_height_m;
- //S32 font_height_s;
- UI_fixed_icontext_list_menuitem_theme theme;
- U16 btn_prev_item_id = 0, btn_next_item_id = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Reset The Error Variable */
- gui_asyncdynamic_list_error = 0;
- /* Set The Application Side Variable To True */
- gdi_layer_lock_frame_buffer();
- MMI_menu_shortcut_number = -1;
- change_left_softkey(left_softkey, left_softkey_icon);
- change_right_softkey(right_softkey, right_softkey_icon);
- SetupCategoryKeyHandlers();
- create_fixed_icontext_list_menuitems(2, 2);
- img = (U8*) GetImage(main_icon);
- gui_measure_image(img, &w, &h);
- if (w == 0)
- {
- w = CAT85_MAIN_IMAGE_WIDTH;
- }
- if (h == 0)
- {
- h = CAT85_MAIN_IMAGE_HEIGHT;
- }
- img = (U8*) GetImage(sub_icon);
- gui_measure_image(img, &w1, &h1);
- if (w1 == 0)
- {
- w1 = CAT85_SUB_IMAGE_WIDTH;
- }
- if (h1 == 0)
- {
- h1 = CAT85_SUB_IMAGE_HEIGHT;
- }
- text_width = UI_device_width - MMI_fixed_list_menu.vbar.width - w1 - CAT85_MENUITEM_OFFSET*3 - 3;
- text_width1 = UI_device_width - MMI_fixed_list_menu.vbar.width - w - CAT85_MENUITEM_OFFSET*3 - 3;
- //gui_set_font(&MMI_small_font);
- //font_height_s = gui_get_character_height();
- gui_set_font(&MMI_medium_font);
- /* It may contain non-alphanumeric characters like Chinese */
- font_height_m = Get_CharHeightOfAllLang(MEDIUM_FONT);
- set_fixed_icontext_list_text_coordinates(0, CAT85_MENUITEM_OFFSET, CAT85_MENUITEM_OFFSET, text_width, font_height_m);
- set_fixed_icontext_list_icon_coordinates(0, UI_device_width-MMI_fixed_list_menu.vbar.width-CAT85_MENUITEM_OFFSET-w1-3, CAT85_MENUITEM_OFFSET, w1, h1);
- set_fixed_icontext_list_icon_coordinates(1, CAT85_MENUITEM_OFFSET, MMI_MULTIROW_MENUITEM_HEIGHT-CAT85_MENUITEM_OFFSET-h, w, h);
- set_fixed_icontext_list_text_coordinates(1, CAT85_MENUITEM_OFFSET+w+CAT85_MENUITEM_OFFSET, MMI_MULTIROW_MENUITEM_HEIGHT-CAT85_MENUITEM_OFFSET-font_height_m, text_width1, font_height_m);
- associate_fixed_multirow_list_list(MMI_MULTIROW_MENUITEM_HEIGHT);
- memcpy((U8*)&theme, (U8*)current_fixed_icontext_list_menuitem_theme, sizeof(UI_fixed_icontext_list_menuitem_theme));
- theme.text_fonts[0] = &MMI_small_font;
- theme.text_fonts[1] = &MMI_default_font;
- fixed_icontext_list_menuitem_apply_theme(&theme);
- MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_AUTO_CHOOSE_MARQUEE;//111306 scrolling
- MMI_current_menu_type = LIST_MENU;
- MMI_fixed_list_menu.n_items = number_of_items;
- if (!init_asyncdynamic_item_buffer(number_of_items, get_item_func, get_hint_func))
- {
- gdi_layer_unlock_frame_buffer();
- return;
- }
- register_asyncdynamic_list_keys();
- register_fixed_list_highlight_handler(asyncdynamic_list_highlight_handler);
- if (wgui_is_touch_title_bar_buttons())
- {
- dm_data.s32CatId = MMI_CATEGORY85_ID;
- }
- else
- {
- dm_data.s32CatId = MMI_CATEGORY85_NO_BUTTON_ID;
- }
- h_flag = set_list_menu_category_history(dm_data.s32CatId, history_buffer);
- asyncdynamic_list_goto_item_no_redraw(h_flag ? MMI_fixed_list_menu.highlighted_item : highlighted_item);
- if (gui_asyncdynamic_list_error)
- {
- gdi_layer_unlock_frame_buffer();
- return;
- }
- MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_RIGHT_JUSTIFY;
- MMI_title_string = (UI_string_type) title;
- MMI_title_icon = (PU8) get_image(title_icon);
- if (wgui_is_touch_title_bar_buttons())
- {
- MMI_disable_title_shortcut_display = 1;
- disable_menu_shortcut_box_display = 1;
- btn_prev_item_id = dm_add_button(
- NULL,
- get_image(LEFT_RED_ARROW),
- get_image(LEFT_RED_ARROW),
- cat85_clear_icon_bg);
- btn_next_item_id = dm_add_button(
- NULL,
- get_image(RIGHT_RED_ARROW),
- get_image(RIGHT_RED_ARROW),
- cat85_clear_icon_bg);
- title_bg_id = IMAGE_VIEW_TITLEBAR_BG; /* for showing different title bar. */
- }
- else
- {
- register_asyncdynamic_list_shortcut_handler();
- shortcut_width = set_menu_item_count(number_of_items) + 7;
- resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
- move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
- register_hide_menu_shortcut(draw_title);
- }
- #if defined(__MMI_TOUCH_SCREEN__)
- if (wgui_is_touch_title_bar_buttons())
- {
- /* register the handler for pen event down istead of pen event up */
- dm_register_button_functions(btn_prev_item_id, KEY_EVENT_UP, gMMI_touch_title_button1_up_handler);
- dm_register_button_functions(btn_next_item_id, KEY_EVENT_UP, gMMI_touch_title_button2_up_handler);
- }
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- resize_asyncdynamic_icontext_menuitems_to_list_width();
- set_asyncdynamic_pop_up_descriptions(h_flag ? MMI_fixed_list_menu.highlighted_item : highlighted_item);
- gdi_layer_unlock_frame_buffer();
- ExitCategoryFunction = ExitCategory85Screen;
- dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
- dm_data.s32ScrId = (S32) GetActiveScreenId();
- dm_data.s32flags = 0;
- dm_setup_data(&dm_data);
- dm_redraw_category_screen();
- }
- #endif
- /* 072406 new calendar End */