wgui_datetime.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:498k
源码类别:
MTK
开发平台:
C/C++
- * FUNCTION
- * close_sub_LCD_dt_display
- * DESCRIPTION
- * set all function pointer of date tiem display of sub lcd
- * to dummy functions
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void close_sub_LCD_dt_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_sub_LCD_dt_update_function = UI_dummy_function;
- MMI_sub_LCD_dt_display_function = UI_dummy_function;
- MMI_sub_LCD_dt_hide_function = UI_dummy_function;
- MMI_sub_LCD_dt_close_function();
- MMI_sub_LCD_dt_close_function = UI_dummy_function;
- MMI_sub_LCD_dt_date_hide_function = UI_dummy_hide_function;
- MMI_sub_LCD_dt_time_hide_function = UI_dummy_hide_function;
- MMI_sub_LCD_dt_duration_hide_function = UI_dummy_hide_function;
- }
- /* global variable store the call cost symbol */
- PU8 UI_call_cost_symbol = NULL;
- /* global variable store the call cost valeu */
- PU8 UI_call_cost_value = NULL;
- extern MMI_BOOL CM_call_cost_show;//102506 call cost
- /*****************************************************************************
- * FUNCTION
- * reset_call_cost_UI
- * DESCRIPTION
- * reset the call cost and call symbol to null
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void reset_call_cost_UI(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_call_cost_symbol = NULL;
- UI_call_cost_value = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * show_call_cost_UI
- * DESCRIPTION
- * show call cost on active calll screen
- * PARAMETERS
- * symbol [IN] Currency symbol
- * value [IN] Total cost
- * RETURNS
- * void
- *****************************************************************************/
- /* code added vandana mehtani AOC */
- void show_call_cost_UI(PU8 symbol, PU8 value)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 string_width, string_height;
- UI_character_type Buffer[30];
- S32 tx, ty, x;
- color c = *current_MMI_theme->datetime_bar_AOC_text_color;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_call_cost_symbol = symbol;
- UI_call_cost_value = value;
- PRINT_INFORMATION(("show_call_cost_UI: In show_call_cost_UI"));
- if ((NULL == symbol) || (NULL == value))
- {
- PRINT_INFORMATION(("show_call_cost_UI: Null symbol or Null Value"));
- return;
- }
- if (CM_call_cost_show == MMI_FALSE)//102506 call cost
- {
- return;//not in category 19 or 20
- }
- x = (UI_device_width >> 1) + 16;
- gui_set_font(&MMI_default_font);
- gui_strcpy(Buffer, (U16*) symbol);
- gui_strcat(Buffer, (UI_string_type) " ");
- gui_strcat(Buffer, (UI_string_type) value);
- string_width = gui_get_string_width(Buffer);
- string_height = gui_get_character_height();
- ty = main_LCD_dt_object.duration.y;
- main_LCD_dt_object.duration.hide_function(x, ty, UI_device_width - 1, ty + string_height - 1); /* call duration hide function */
- MMI_ASSERT(main_LCD_dt_object.duration.hide_function!=NULL);//102506 call cost
- tx = UI_device_width - string_width - 2;
- gdi_layer_reset_clip();
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(tx + string_width, ty);
- }
- else
- {
- gui_move_text_cursor(tx, ty);
- }
- gui_set_text_color(c);
- /* print callcost */
- gui_print_text(Buffer);
- gdi_layer_blt_previous((UI_device_width - 1) >> 1, ty, UI_device_width - 1, ty + string_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * redraw_call_cost_UI
- * DESCRIPTION
- * update cost value on active call screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void redraw_call_cost_UI(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- show_call_cost_UI(UI_call_cost_symbol, UI_call_cost_value);
- }
- /* code ended vandana mehtani */
- /* Theme data for formatted input objects. Should be obtained from theme resource */
- /* date time input box background color scheme */
- UI_filled_area date_time_input_background_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {255, 255, 255, 100},
- {0, 0, 0, 0},
- {0, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /* date time input box field color scheme */
- UI_filled_area date_time_input_field_filler = {UI_FILLED_AREA_TYPE_COLOR,
- UI_NULL_IMAGE,
- NULL,
- {255, 255, 255, 100},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- 0
- };
- UI_single_line_input_box_theme date_time_input_theme = { &date_time_input_field_filler,
- &date_time_input_field_filler,
- &date_time_input_field_filler,
- {0, 0, 0, 100},
- {128, 128, 128, 100},
- {0, 0, 0, 100},
- {255, 255, 255, 100},
- {51, 88, 171, 100},
- {255, 0, 0, 100},
- &UI_DEFAULT_FONT,
- 0,
- UI_SINGLE_LINE_INPUT_BOX_CENTER_Y,
- '*'
- };
- /*****************************************************************************
- * FUNCTION
- * max_num_of_days
- * DESCRIPTION
- *
- * PARAMETERS
- * y [IN]
- * m [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 max_num_of_days(S32 y, S32 m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
- {
- return 31;
- }
- else if (m == 4 || m == 6 || m == 9 || m == 11)
- {
- return 30;
- }
- else /* Feb */
- {
- U8 isLeap = 0;
- if (y % 400 == 0)
- {
- isLeap = 1;
- }
- else if (y % 100 == 0)
- {
- isLeap = 0;
- }
- else if (y % 4 == 0)
- {
- isLeap = 1;
- }
- else
- {
- isLeap = 0;
- }
- return 28 + isLeap;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * validMonth
- * DESCRIPTION
- *
- * PARAMETERS
- * y [IN]
- * m [IN]
- * d [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL validMonth(S32 y, S32 m, S32 d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) && d <= 31)
- {
- return TRUE;
- }
- else if ((m == 4 || m == 6 || m == 9 || m == 11) && d <= 30)
- {
- return TRUE;
- }
- else /* Feb */
- {
- /* U8 isLeap = 0; */
- if ((y % 400 == 0) && d <= 29)
- {
- return TRUE;
- }
- else if (y % 100 == 0 && d <= 28)
- {
- return TRUE;
- }
- else if (y % 4 == 0 && d <= 29)
- {
- return TRUE;
- }
- else if (d <= 28)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- }
- /* Default Date validation functions */
- /*****************************************************************************
- * FUNCTION
- * default_inline_date_day_validation
- * DESCRIPTION
- * validation function of day input of inline editing
- * PARAMETERS
- * text [IN] Text
- * cursor [IN]
- * text_length [IN] Text length
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_date_day_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = gui_atoi((UI_string_type) text);
- S32 l = gui_strlen((UI_string_type) text);
- S32 y = gui_atoi((UI_string_type) current_date_input->year_input_box.text);
- S32 m = gui_atoi((UI_string_type) current_date_input->month_input_box.text);
- U8 d = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d = max_num_of_days(y, m);
- if ((i < 1) && (l > 1))
- {
- i = 1;
- gui_sprintf((UI_string_type) text, "%02d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- else if (i > d)
- {
- i = d;
- gui_sprintf((UI_string_type) text, "%02d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * set_inline_date_boundary
- * DESCRIPTION
- * to set date setting boundary
- * PARAMETERS
- * date_year_max [IN]
- * date_year_min [IN]
- * date_month_max [IN]
- * date_month_min [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_inline_date_boundary(S32 date_year_max, S32 date_year_min, S32 date_month_max, S32 date_month_min)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_date_year_max = date_year_max;
- g_date_year_min = date_year_min;
- g_date_month_max = date_month_max;
- g_date_month_min = date_month_min;
- }
- /*****************************************************************************
- * FUNCTION
- * default_inline_date_month_validation
- * DESCRIPTION
- * validation function of month input of inline editing
- * PARAMETERS
- * text [IN] Text
- * cursor [IN]
- * text_length [IN] Text length
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_date_month_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = gui_atoi((UI_string_type) text);
- S32 l = gui_strlen((UI_string_type) text);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((i < g_date_month_min) && (l > 1))
- {
- i = g_date_month_min;
- gui_sprintf((UI_string_type) text, "%02d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- else if (i > g_date_month_max)
- {
- i = g_date_month_max;
- gui_sprintf((UI_string_type) text, "%02d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- default_inline_date_day_validation(
- current_date_input->day_input_box.text,
- current_date_input->day_input_box.current_text_p,
- (current_date_input->day_input_box.text_length >> 1) - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * default_inline_date_year_validation
- * DESCRIPTION
- * validation function of year input of inline editing
- * PARAMETERS
- * text [IN] Text
- * cursor [IN]
- * text_length [IN] Text length
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_date_year_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = gui_atoi((UI_string_type) text);
- S32 l = gui_strlen((UI_string_type) text);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((i < g_date_year_min) && (l > 3))
- {
- i = g_date_year_min;
- gui_sprintf((UI_string_type) text, "%04d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- else if (i > g_date_year_max)
- {
- i = g_date_year_max;
- gui_sprintf((UI_string_type) text, "%04d", i);
- /* Play error tone here */
- UI_editor_play_tone_invalid_data();
- }
- default_inline_date_month_validation(
- current_date_input->month_input_box.text,
- current_date_input->month_input_box.current_text_p,
- (current_date_input->month_input_box.text_length >> 1) - 1);
- default_inline_date_day_validation(
- current_date_input->day_input_box.text,
- current_date_input->day_input_box.current_text_p,
- (current_date_input->day_input_box.text_length >> 1) - 1);
- }
- /* Date input object */
- /*****************************************************************************
- * FUNCTION
- * date_input_show_background
- * DESCRIPTION
- * show the background color of date input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_show_background(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_reset_clip();
- x1 = d->x;
- y1 = d->y;
- x2 = x1 + d->width - 1;
- y2 = y1 + d->height - 1;
- gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_reset_focus
- * DESCRIPTION
- * reset focus of date input box to noram state
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_reset_focus(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_set_focus
- * DESCRIPTION
- * reset focus of date input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_set_focus(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((d->current_focus < 1) || (d->current_focus > 3))
- {
- return;
- }
- switch (d->focus_list[d->current_focus])
- {
- case DATE_INPUT_FOCUS_DAY:
- d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->day_input_box;
- break;
- case DATE_INPUT_FOCUS_MONTH:
- d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->month_input_box;
- break;
- case DATE_INPUT_FOCUS_YEAR:
- d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->year_input_box;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_set_default_focus
- * DESCRIPTION
- * set the defualt focus of date input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_set_default_focus(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (d->flags & DATE_INPUT_TYPE_DEFAULT_FOCUS_MASK)
- {
- case DATE_INPUT_TYPE_DEFAULT_FOCUS_DAY:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_DAY)
- {
- d->current_focus = i;
- }
- }
- break;
- case DATE_INPUT_TYPE_DEFAULT_FOCUS_MONTH:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_MONTH)
- {
- d->current_focus = i;
- }
- }
- break;
- case DATE_INPUT_TYPE_DEFAULT_FOCUS_YEAR:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_YEAR)
- {
- d->current_focus = i;
- }
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * create_date_input
- * DESCRIPTION
- * create date input box
- * PARAMETERS
- * d [IN] Date input box
- * x [IN] Start x position of date input box
- * y [IN] Styart y position of date input box
- * width [IN] Width of date iput box
- * height [IN] Height of date input box
- * flags [IN]
- * day_buffer [IN] Store day value
- * month_buffer [IN] Store month value
- * year_buffer [IN] Store year value
- * RETURNS
- * void
- *****************************************************************************/
- void create_date_input(
- date_input *d,
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- U32 flags,
- UI_buffer_type day_buffer,
- UI_buffer_type month_buffer,
- UI_buffer_type year_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w1, w2, w3, h, ox, oy, sw, tw, l;
- UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->x = x;
- d->y = y;
- d->width = width;
- d->height = height;
- d->flags = flags;
- w1 = DATE_INPUT_DAY_WIDTH;
- w2 = DATE_INPUT_MONTH_WIDTH;
- w3 = DATE_INPUT_YEAR_WIDTH;
- sw = DATE_INPUT_SEPERATOR_WIDTH;
- tw = w1 + sw + w2 + sw + w3;
- /* START VIJAY PMT 20060111...as menuitem height is one pixel less for this LCD size */
- #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
- if (IsInlineItemDefaultTextEnable())
- {
- h = DATE_INPUT_HEIGHT - 1;
- }
- else
- #endif /* defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__ */
- /* END VIJAY PMT 20060111 */
- h = DATE_INPUT_HEIGHT;
- oy = (height >> 1) - (h >> 1);
- switch (flags & DATE_INPUT_JUSTIFY_MASK)
- {
- case DATE_INPUT_RIGHT_JUSTIFY:
- ox = (width - tw);
- break;
- case DATE_INPUT_CENTER_JUSTIFY:
- ox = (width >> 1) - (tw >> 1);
- break;
- default:
- ox = 0;
- break;
- }
- /* 20051012 HIMANSHU START INLINE DATE */
- /* Inline item type Date must be left align in normal case and it must be right
- align in case of r2lMMIFlag is ON, when the default text effect is enabled */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- if (r2lMMIFlag)
- {
- ox = width - ox - tw - 1;
- }
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE DATE */
- d->focus_list[0] = DATE_INPUT_FOCUS_NONE;
- d->focus_list[4] = DATE_INPUT_FOCUS_NONE;
- switch (flags & DATE_INPUT_TYPE_MASK)
- {
- case DATE_INPUT_TYPE_DD_MM_YYYY:
- d->focus_list[1] = DATE_INPUT_FOCUS_DAY;
- d->focus_list[2] = DATE_INPUT_FOCUS_MONTH;
- d->focus_list[3] = DATE_INPUT_FOCUS_YEAR;
- d->day_x = ox;
- ox += w1 + sw;
- d->month_x = ox;
- ox += w2 + sw;
- d->year_x = ox;
- d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_DAY;
- break;
- case DATE_INPUT_TYPE_MM_DD_YYYY:
- d->focus_list[1] = DATE_INPUT_FOCUS_MONTH;
- d->focus_list[2] = DATE_INPUT_FOCUS_DAY;
- d->focus_list[3] = DATE_INPUT_FOCUS_YEAR;
- d->month_x = ox;
- ox += w2 + sw;
- d->day_x = ox;
- ox += w1 + sw;
- d->year_x = ox;
- d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_MONTH;
- break;
- case DATE_INPUT_TYPE_YYYY_MM_DD:
- d->focus_list[1] = DATE_INPUT_FOCUS_YEAR;
- d->focus_list[2] = DATE_INPUT_FOCUS_MONTH;
- d->focus_list[3] = DATE_INPUT_FOCUS_DAY;
- d->year_x = ox;
- ox += w3 + sw;
- d->month_x = ox;
- ox += w2 + sw;
- d->day_x = ox;
- d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_YEAR;
- break;
- }
- current_single_line_input_box_theme = &date_time_input_theme;
- d->day_y = oy;
- d->month_y = oy;
- d->year_y = oy;
- d->s1_y = oy;
- d->s2_y = oy;
- #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
- if (!IsInlineItemDefaultTextEnable())
- {
- #endif /* defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__ */
- if ((h + 2) > height)
- {
- h = height - 2;
- }
- #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
- }
- #endif
- l = gui_strlen((UI_string_type) day_buffer) /* +1 */ ;
- /* craete single inputbox of day */
- gui_create_single_line_input_box_set_buffer(
- &d->day_input_box,
- x + d->day_x,
- y + d->day_y,
- w1,
- h,
- (UI_string_type) day_buffer,
- DATE_INPUT_DAY_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->day_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->day_input_box);
- l = gui_strlen((UI_string_type) month_buffer) /* +1 */ ;
- /* craete single inputbox of month */
- gui_create_single_line_input_box_set_buffer(
- &d->month_input_box,
- x + d->month_x,
- y + d->month_y,
- w2,
- h,
- (UI_string_type) month_buffer,
- DATE_INPUT_MONTH_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->month_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->month_input_box);
- l = gui_strlen((UI_string_type) year_buffer) /* +1 */ ;
- /* craete single inputbox of year */
- gui_create_single_line_input_box_set_buffer(
- &d->year_input_box,
- x + d->year_x,
- y + d->year_y,
- w3,
- h,
- (UI_string_type) year_buffer,
- DATE_INPUT_YEAR_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- /* MTK end */
- d->year_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->year_input_box);
- date_input_reset_focus(d);
- date_input_set_default_focus(d);
- date_input_set_focus(d);
- /* set theme of input box */
- current_single_line_input_box_theme = t;
- /* Setup default validation functions */
- d->day_input_box.validation_callback = default_inline_date_day_validation; /* set function pointer of validation of day input */
- d->month_input_box.validation_callback = default_inline_date_month_validation; /* set function pointer of validation of month input */
- d->year_input_box.validation_callback = default_inline_date_year_validation; /* set function pointer of validation of year input */
- }
- /*****************************************************************************
- * FUNCTION
- * show_date_input
- * DESCRIPTION
- * shaow date input box
- * PARAMETERS
- * d [IN] Date input box
- * RETURNS
- * void
- *****************************************************************************/
- void show_date_input(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw = 0;
- UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_single_line_input_box_theme = &date_time_input_theme;
- gui_set_single_line_input_box_current_theme(&d->day_input_box);
- gui_set_single_line_input_box_current_theme(&d->month_input_box);
- gui_set_single_line_input_box_current_theme(&d->year_input_box);
- /* show day input box */
- gui_show_single_line_input_box(&d->day_input_box);
- /* show month input box */
- gui_show_single_line_input_box(&d->month_input_box);
- /* show day year box */
- gui_show_single_line_input_box(&d->year_input_box);
- gdi_layer_reset_clip();
- gui_set_font(d->day_input_box.text_font);
- gui_set_text_color(d->day_input_box.normal_text_color);
- if (r2lMMIFlag)
- {
- gui_set_font(d->day_input_box.text_font);
- sw = gui_get_character_width(d->seperator);
- gui_move_text_cursor(d->s1_x + sw, d->s1_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s1_x, d->s1_y + d->y);
- }
- gui_print_character(d->seperator);
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(d->s2_x + sw, d->s2_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s2_x, d->s2_y + d->y);
- }
- /* print separtor */
- gui_print_character(d->seperator);
- gdi_layer_blt_previous(d->x, d->y, d->x + d->width - 1, d->y + d->height - 1);
- current_single_line_input_box_theme = t;
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_set_next_focus
- * DESCRIPTION
- * set the fous to next box of date input box
- * PARAMETERS
- * d [IN] Date input box
- * RETURNS
- * byte
- *****************************************************************************/
- U8 date_input_set_next_focus(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus + 1] == DATE_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- date_input_reset_focus(d);
- d->current_focus++;
- date_input_set_focus(d);
- #if defined(__MMI_TOUCH_SCREEN__)
- gui_single_line_input_box_goto_first_character(d->focus_input_box);
- #endif
- return (1);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_set_previous_focus
- * DESCRIPTION
- * set the focus to previous box oof date input box
- * PARAMETERS
- * d [IN] Date input box
- * RETURNS
- * byte
- *****************************************************************************/
- U8 date_input_set_previous_focus(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus - 1] == DATE_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- date_input_reset_focus(d);
- d->current_focus--;
- date_input_set_focus(d);
- #if defined(__MMI_TOUCH_SCREEN__)
- gui_single_line_input_box_goto_last_character(d->focus_input_box);
- gui_single_line_input_box_previous(d->focus_input_box);
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- return (1);
- }
- }
- #if defined (__MMI_TOUCH_SCREEN__)
- /*****************************************************************************
- * FUNCTION
- * date_input_move_to_x_y
- * DESCRIPTION
- * set the cursor position to (x,y) position
- * PARAMETERS
- * d [IN] Date input box S32 x S32 y
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_move_to_x_y(date_input *d, S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND(x, y, d->x, d->y, d->width, d->height))
- {
- if (PEN_CHECK_BOUND
- (x, y, d->day_input_box.x, d->day_input_box.y, d->day_input_box.width, d->day_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(d->focus_input_box);
- date_input_reset_focus(d);
- for (;; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_DAY)
- {
- d->current_focus = i;
- break;
- }
- }
- date_input_set_focus(d);
- }
- else if (PEN_CHECK_BOUND
- (x, y, d->month_input_box.x, d->month_input_box.y, d->month_input_box.width,
- d->month_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(d->focus_input_box);
- date_input_reset_focus(d);
- for (;; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_MONTH)
- {
- d->current_focus = i;
- break;
- }
- }
- date_input_set_focus(d);
- }
- else if (PEN_CHECK_BOUND
- (x, y, d->year_input_box.x, d->year_input_box.y, d->year_input_box.width, d->year_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(d->focus_input_box);
- date_input_reset_focus(d);
- for (;; i++)
- {
- if (d->focus_list[i] == DATE_INPUT_FOCUS_YEAR)
- {
- d->current_focus = i;
- break;
- }
- }
- date_input_set_focus(d);
- }
- else
- {
- return;
- }
- gui_show_single_line_input_box_ext(d->focus_input_box, x, y);
- if (gui_single_line_input_box_test_last_character_position(d->focus_input_box))
- {
- gui_single_line_input_box_goto_last_character(d->focus_input_box);
- gui_single_line_input_box_previous(d->focus_input_box);
- }
- show_date_input(d);
- }
- }
- #endif /* defined (__MMI_TOUCH_SCREEN__) */
- /*****************************************************************************
- * FUNCTION
- * date_input_set_seperator
- * DESCRIPTION
- * set the mask of date input box
- * PARAMETERS
- * d [IN] Date input box
- * seperator [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_set_seperator(date_input *d, UI_character_type seperator)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw, x1, x2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->seperator = seperator;
- gui_set_font(d->day_input_box.text_font);
- sw = gui_get_character_width(d->seperator);
- switch (d->flags & DATE_INPUT_TYPE_MASK)
- {
- case DATE_INPUT_TYPE_DD_MM_YYYY:
- x1 = d->day_input_box.x + d->day_input_box.width - 1;
- x2 = d->month_input_box.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->month_input_box.x + d->month_input_box.width - 1;
- x2 = d->year_input_box.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- break;
- case DATE_INPUT_TYPE_MM_DD_YYYY:
- x1 = d->month_input_box.x + d->month_input_box.width - 1;
- x2 = d->day_input_box.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->day_input_box.x + d->day_input_box.width - 1;
- x2 = d->year_input_box.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- break;
- case DATE_INPUT_TYPE_YYYY_MM_DD:
- x1 = d->year_input_box.x + d->year_input_box.width - 1;
- x2 = d->month_input_box.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->month_input_box.x + d->month_input_box.width - 1;
- x2 = d->day_input_box.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- break;
- }
- }
- /* store the value of current date input */
- date_input *current_date_input = NULL;
- /*----------------------------------------------------------------------------
- Function: current_date_input_callback
- Description: a function pointer of current date input callback
- Input Parameters: none
- Output Parameters: none
- Returns: none
- ----------------------------------------------------------------------------*/
- void (*current_date_input_callback) (void) = UI_dummy_function;
- /*****************************************************************************
- * FUNCTION
- * set_current_date_input
- * DESCRIPTION
- * set current date input to global variable
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_date_input(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_date_input = d;
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_direct_input
- * DESCRIPTION
- * insert the character in date input box and redraw date input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_direct_input(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
- {
- if (date_input_set_next_focus(current_date_input))
- {
- gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
- {
- if (!date_input_set_next_focus(current_date_input))
- {
- gui_single_line_input_box_previous(current_date_input->focus_input_box);
- }
- }
- }
- /* show date input box */
- show_date_input(current_date_input);
- /* call daet input validation function */
- current_date_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_direct_input_nodraw
- * DESCRIPTION
- * insert the character in date input box and redraw date input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_direct_input_nodraw(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
- {
- if (date_input_set_next_focus(current_date_input))
- {
- gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
- {
- if (!date_input_set_next_focus(current_date_input))
- {
- gui_single_line_input_box_previous(current_date_input->focus_input_box);
- }
- }
- }
- current_date_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_test_last_position
- * DESCRIPTION
- * test current position is the last position or not
- * PARAMETERS
- * d [IN]
- * RETURNS
- * S32
- *****************************************************************************/
- S32 date_input_test_last_position(date_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus + 1] != DATE_INPUT_FOCUS_NONE)
- {
- return 0;
- }
- else
- {
- if (gui_single_line_input_box_test_last_character_position(d->focus_input_box))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_delete_character
- * DESCRIPTION
- * delete current character of date input box
- * PARAMETERS
- * void
- * nonoe(?) [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_delete_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
- {
- date_input_set_previous_focus(current_date_input);
- }
- else
- {
- gui_single_line_input_box_delete_character(current_date_input->focus_input_box);
- if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
- {
- date_input_set_previous_focus(current_date_input);
- }
- }
- /* show date input box */
- show_date_input(current_date_input);
- current_date_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_previous_character
- * DESCRIPTION
- * set the focus to previous caharacter of daet input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_previous_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
- {
- if (date_input_set_previous_focus(current_date_input))
- {
- gui_single_line_input_box_goto_last_character(current_date_input->focus_input_box);
- gui_single_line_input_box_previous(current_date_input->focus_input_box);
- }
- }
- else
- {
- gui_single_line_input_box_previous(current_date_input->focus_input_box);
- }
- /* show date input box */
- show_date_input(current_date_input);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_next_character
- * DESCRIPTION
- * set the focus to next caharacter of date input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_next_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_character_position(current_date_input->focus_input_box))
- {
- date_input_set_next_focus(current_date_input);
- }
- else
- {
- gui_single_line_input_box_next(current_date_input->focus_input_box);
- }
- /* show date input box */
- show_date_input(current_date_input);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_toggle_insert_mode
- * DESCRIPTION
- * toggle the insert mode of date input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_toggle_insert_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_toggle_insert_mode(current_date_input->focus_input_box);
- /* show date input box */
- show_date_input(current_date_input);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_delete_current_character
- * DESCRIPTION
- * delete the current character of date input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_delete_current_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_delete_current_character(current_date_input->focus_input_box);
- /* show date input box */
- show_date_input(current_date_input);
- current_date_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_delete_all_characters
- * DESCRIPTION
- * delete all characters of date input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_delete_all_characters(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_date_input == NULL)
- {
- return;
- }
- if (current_date_input->focus_input_box == NULL)
- {
- return;
- }
- /* delete all characters */
- gui_single_line_input_box_delete_all(current_date_input->focus_input_box);
- /* show date input box */
- show_date_input(current_date_input);
- current_date_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_numeric_keyboard_input_handler
- * DESCRIPTION
- * handle numeric key input of date input box
- * PARAMETERS
- * keyc [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_numeric_keyboard_input_handler(S32 keyc)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keyc >= '0' && keyc <= '9')
- {
- date_input_direct_input((U8) keyc);
- }
- else if (keyc == 0x08)
- {
- date_input_delete_character();
- }
- else if (keyc == 0x1b)
- {
- date_input_delete_all_characters();
- }
- else if (keyc == 0x0d);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_handle_key_down
- * DESCRIPTION
- * handle date input key down
- * PARAMETERS
- * k [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_handle_key_down(MMI_key_code_type k)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- date_input_direct_input((UI_character_type) ('0' + k));
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_key_handler
- * DESCRIPTION
- * register the key handler of date input box
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- date_input_previous_character();
- break;
- case 38: /* up */
- break;
- case 39:
- date_input_next_character();
- break;
- case 40: /* down */
- break;
- case 36: /* home */
- break;
- case 35: /* end */
- break;
- case 33: /* page up */
- break;
- case 34: /* page down */
- break;
- case 45:
- date_input_toggle_insert_mode();
- break;
- case 46:
- date_input_delete_current_character();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_register_keys
- * DESCRIPTION
- * register date input box key handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_register_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_MMI_key_input_handler();
- register_key_down_handler(date_input_handle_key_down);
- register_keyboard_input_handler(date_input_numeric_keyboard_input_handler);
- SetKeyHandler(date_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(date_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- register_keyboard_key_handler(date_input_key_handler);
- }
- /*****************************************************************************
- * FUNCTION
- * date_input_clear_keys
- * DESCRIPTION
- * clear all key handlers of date input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void date_input_clear_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- clear_MMI_key_input_handler();
- clear_key_down_handler();
- clear_keyboard_input_handler();
- ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- clear_keyboard_key_handler();
- }
- /*****************************************************************************
- * FUNCTION
- * register_date_input_callback
- * DESCRIPTION
- * register date input call back function
- * PARAMETERS
- * f [IN]
- * function(?) [IN] Pointer
- * RETURNS
- * void
- *****************************************************************************/
- void register_date_input_callback(void (*f) (void))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_date_input_callback = f;
- }
- /*****************************************************************************
- * FUNCTION
- * clear_date_input_callback
- * DESCRIPTION
- * clear date input callback
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void clear_date_input_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_date_input_callback = UI_dummy_function;
- }
- /* Default Time validation functions */
- /*****************************************************************************
- * FUNCTION
- * default_inline_time_minutes_validation
- * DESCRIPTION
- * deafult function of time mnutes validation
- * PARAMETERS
- * text [IN]
- * cursor [IN]
- * text_length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_time_minutes_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = gui_atoi((UI_string_type) text);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (i < 0)
- {
- i = 0;
- gui_sprintf((UI_string_type) text, "%02d", i);
- UI_editor_play_tone_invalid_data();
- }
- else if (i > 59)
- {
- i = 59;
- gui_sprintf((UI_string_type) text, "%02d", i);
- UI_editor_play_tone_invalid_data();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * default_inline_time_hours_validation
- * DESCRIPTION
- * deafult function of time hours validation
- * PARAMETERS
- * text [IN]
- * cursor [IN]
- * text_length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_time_hours_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = gui_atoi((UI_string_type) text);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (i < 0)
- {
- i = 0;
- gui_sprintf((UI_string_type) text, "%02d", i);
- UI_editor_play_tone_invalid_data();
- }
- else if (i > 23)
- {
- i = 23;
- gui_sprintf((UI_string_type) text, "%02d", i);
- UI_editor_play_tone_invalid_data();
- }
- }
- /* Time input object */
- /*****************************************************************************
- * FUNCTION
- * time_input_show_background
- * DESCRIPTION
- * show time input bkg color
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_show_background(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_reset_clip();
- x1 = d->x;
- y1 = d->y;
- x2 = x1 + d->width - 1;
- y2 = y1 + d->height - 1;
- gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_reset_focus
- * DESCRIPTION
- * reset teh foucs of time input
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_reset_focus(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_set_focus
- * DESCRIPTION
- * set the focus of time input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_set_focus(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((d->current_focus < 1) || (d->current_focus > 3))
- {
- return;
- }
- switch (d->focus_list[d->current_focus])
- {
- case TIME_INPUT_FOCUS_HOURS:
- d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->hours_input_box;
- break;
- case TIME_INPUT_FOCUS_MINUTES:
- d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->minutes_input_box;
- break;
- case TIME_INPUT_FOCUS_SECONDS:
- d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->seconds_input_box;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_set_default_focus
- * DESCRIPTION
- * set the default focus of time input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_set_default_focus(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (d->flags & TIME_INPUT_TYPE_DEFAULT_FOCUS_MASK)
- {
- case TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == TIME_INPUT_FOCUS_HOURS)
- {
- d->current_focus = i;
- }
- }
- break;
- case TIME_INPUT_TYPE_DEFAULT_FOCUS_MINUTES:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == TIME_INPUT_FOCUS_MINUTES)
- {
- d->current_focus = i;
- }
- }
- break;
- case TIME_INPUT_TYPE_DEFAULT_FOCUS_SECONDS:
- for (i = 0; i < 5; i++)
- {
- if (d->focus_list[i] == TIME_INPUT_FOCUS_SECONDS)
- {
- d->current_focus = i;
- }
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * create_time_input
- * DESCRIPTION
- * create time input box
- * PARAMETERS
- * d [IN] Time input box
- * x [IN] Start x position of time input box
- * y [IN] Strat y position of time input box
- * width [IN] Width of time input box
- * height [IN] Height of time input box
- * flags [IN]
- * hours_buffer [IN] Hours buffer
- * minutes_buffer [IN] Minutes buffer
- * seconds_buffer [IN] Seconds buffer
- * RETURNS
- * void
- *****************************************************************************/
- void create_time_input(
- time_input *d,
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- U32 flags,
- UI_buffer_type hours_buffer,
- UI_buffer_type minutes_buffer,
- UI_buffer_type seconds_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w1, w2, w3, h, ox, oy, sw, tw, l;
- UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->x = x;
- d->y = y;
- d->width = width;
- d->height = height;
- d->flags = flags;
- w1 = TIME_INPUT_HOURS_WIDTH;
- w2 = TIME_INPUT_MINUTES_WIDTH;
- w3 = TIME_INPUT_SECONDS_WIDTH;
- sw = TIME_INPUT_SEPERATOR_WIDTH;
- if ((flags & TIME_INPUT_TYPE_MASK) == TIME_INPUT_TYPE_HH_MM)
- {
- tw = w1 + sw + w2;
- }
- else
- {
- tw = w1 + sw + w2 + sw + w3;
- }
- h = TIME_INPUT_HEIGHT;
- oy = (height >> 1) - (h >> 1);
- switch (flags & TIME_INPUT_JUSTIFY_MASK)
- {
- case TIME_INPUT_RIGHT_JUSTIFY:
- ox = (width - tw);
- break;
- case TIME_INPUT_CENTER_JUSTIFY:
- ox = (width >> 1) - (tw >> 1);
- break;
- default:
- ox = 0;
- break;
- }
- /* 20051012 HIMANSHU START INLINE TIME */
- /* Inline item type Time must be left align in normal case and it must be right
- align in case of r2lMMIFlag is ON, when the default text effect is enabled */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- if (r2lMMIFlag)
- {
- ox = width - ox - tw - 1;
- }
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE TIME */
- d->focus_list[0] = TIME_INPUT_FOCUS_NONE;
- d->focus_list[4] = TIME_INPUT_FOCUS_NONE;
- switch (flags & TIME_INPUT_TYPE_MASK)
- {
- case TIME_INPUT_TYPE_HH_MM:
- d->focus_list[1] = TIME_INPUT_FOCUS_HOURS;
- d->focus_list[2] = TIME_INPUT_FOCUS_MINUTES;
- d->focus_list[3] = TIME_INPUT_FOCUS_NONE;
- d->hours_x = ox;
- ox += w1 + sw;
- d->minutes_x = ox;
- d->flags |= TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS;
- d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
- break;
- case TIME_INPUT_TYPE_HH_MM_SS:
- d->focus_list[1] = TIME_INPUT_FOCUS_HOURS;
- d->focus_list[2] = TIME_INPUT_FOCUS_MINUTES;
- d->focus_list[3] = TIME_INPUT_FOCUS_SECONDS;
- d->hours_x = ox;
- ox += w1 + sw;
- d->minutes_x = ox;
- ox += w2 + sw;
- d->seconds_x = ox;
- d->flags |= TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS;
- break;
- }
- current_single_line_input_box_theme = &date_time_input_theme;
- d->hours_y = oy;
- d->minutes_y = oy;
- d->seconds_y = oy;
- d->s1_y = oy;
- d->s2_y = oy;
- if ((h + 2) > height)
- {
- h = height - 2;
- }
- /* MTK Terry for Bidi Issue */
- l = gui_strlen((UI_string_type) hours_buffer);
- /* create single input box of hours */
- /* MTK Elvis for R2L characters */
- gui_create_single_line_input_box_set_buffer(
- &d->hours_input_box,
- x + d->hours_x,
- y + d->hours_y,
- w1,
- h,
- (UI_string_type) hours_buffer,
- TIME_INPUT_HOURS_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->hours_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->hours_input_box);
- l = gui_strlen((UI_string_type) minutes_buffer);
- /* create single input box of minutes */
- /* MTK Elvis for R2L characters */
- gui_create_single_line_input_box_set_buffer(
- &d->minutes_input_box,
- x + d->minutes_x,
- y + d->minutes_y,
- w2,
- h,
- (UI_string_type) minutes_buffer,
- TIME_INPUT_MINUTES_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->minutes_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->minutes_input_box);
- l = gui_strlen((UI_string_type) seconds_buffer);
- /* create single input box of seconds */
- /* MTK Elvis for R2L characters */
- gui_create_single_line_input_box_set_buffer(
- &d->seconds_input_box,
- x + d->seconds_x,
- y + d->seconds_y,
- w3,
- h,
- (UI_string_type) seconds_buffer,
- TIME_INPUT_SECONDS_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->seconds_input_box.flags |=
- (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
- UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
- gui_single_line_input_box_goto_first_character(&d->seconds_input_box);
- time_input_reset_focus(d);
- time_input_set_default_focus(d);
- time_input_set_focus(d);
- /* set theme of input box */
- current_single_line_input_box_theme = t;
- /* Setup default validation functions */
- d->hours_input_box.validation_callback = default_inline_time_hours_validation;
- d->minutes_input_box.validation_callback = default_inline_time_minutes_validation;
- d->seconds_input_box.validation_callback = default_inline_time_minutes_validation;
- }
- /*****************************************************************************
- * FUNCTION
- * show_time_input
- * DESCRIPTION
- * shoe time input box
- * PARAMETERS
- * d [IN] Time input box
- * RETURNS
- * void
- *****************************************************************************/
- void show_time_input(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
- S32 sw = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_single_line_input_box_theme = &date_time_input_theme;
- gui_set_single_line_input_box_current_theme(&d->hours_input_box);
- gui_set_single_line_input_box_current_theme(&d->minutes_input_box);
- /* show hours inout box */
- gui_show_single_line_input_box(&d->hours_input_box);
- /* show minutes input box */
- gui_show_single_line_input_box(&d->minutes_input_box);
- if ((d->flags & TIME_INPUT_TYPE_MASK) != TIME_INPUT_TYPE_HH_MM)
- {
- gui_show_single_line_input_box(&d->seconds_input_box); /* show seconds input box */
- }
- gdi_layer_reset_clip();
- gui_set_font(d->hours_input_box.text_font);
- gui_set_text_color(d->hours_input_box.normal_text_color);
- if (r2lMMIFlag)
- {
- gui_set_font(d->hours_input_box.text_font);
- sw = gui_get_character_width(d->seperator);
- gui_move_text_cursor(d->s1_x + sw, d->s1_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s1_x, d->s1_y + d->y);
- }
- gui_print_character(d->seperator);
- if ((d->flags & TIME_INPUT_TYPE_MASK) != TIME_INPUT_TYPE_HH_MM)
- {
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(d->s2_x + sw, d->s2_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s2_x, d->s2_y + d->y);
- }
- gui_print_character(d->seperator);
- }
- gdi_layer_blt_previous(d->x, d->y, d->x + d->width - 1, d->y + d->height - 1);
- current_single_line_input_box_theme = t;
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_set_next_focus
- * DESCRIPTION
- * set the focus of time input box to next box
- * PARAMETERS
- * d [IN] Time input box
- * RETURNS
- * byte
- *****************************************************************************/
- U8 time_input_set_next_focus(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus + 1] == TIME_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- time_input_reset_focus(d);
- d->current_focus++;
- time_input_set_focus(d);
- #if defined(__MMI_TOUCH_SCREEN__)
- gui_single_line_input_box_goto_first_character(d->focus_input_box);
- #endif
- return (1);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_set_previous_focus
- * DESCRIPTION
- * set the focus of time input box to previous box
- * PARAMETERS
- * d [IN] Time input box
- * RETURNS
- * byte
- *****************************************************************************/
- U8 time_input_set_previous_focus(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus - 1] == TIME_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- time_input_reset_focus(d);
- d->current_focus--;
- time_input_set_focus(d);
- #if defined(__MMI_TOUCH_SCREEN__)
- gui_single_line_input_box_goto_last_character(d->focus_input_box);
- gui_single_line_input_box_previous(d->focus_input_box);
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- return (1);
- }
- }
- #if defined (__MMI_TOUCH_SCREEN__)
- /*****************************************************************************
- * FUNCTION
- * time_input_move_to_x_y
- * DESCRIPTION
- * set the cursor position to (x,y) position
- * PARAMETERS
- * t [?]
- * x [IN]
- * y [IN]
- * tp(?) [IN] Time input box S32 x S32 y
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_move_to_x_y(time_input *t, S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND(x, y, t->x, t->y, t->width, t->height))
- {
- if (PEN_CHECK_BOUND
- (x, y, t->hours_input_box.x, t->hours_input_box.y, t->hours_input_box.width, t->hours_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(t->focus_input_box);
- time_input_reset_focus(t);
- for (;; i++)
- {
- if (t->focus_list[i] == TIME_INPUT_FOCUS_HOURS)
- {
- t->current_focus = i;
- break;
- }
- }
- time_input_set_focus(t);
- }
- else if (PEN_CHECK_BOUND
- (x, y, t->minutes_input_box.x, t->minutes_input_box.y, t->minutes_input_box.width,
- t->minutes_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(t->focus_input_box);
- time_input_reset_focus(t);
- for (;; i++)
- {
- if (t->focus_list[i] == TIME_INPUT_FOCUS_MINUTES)
- {
- t->current_focus = i;
- break;
- }
- }
- time_input_set_focus(t);
- }
- else if (PEN_CHECK_BOUND
- (x, y, t->seconds_input_box.x, t->seconds_input_box.y, t->seconds_input_box.width,
- t->seconds_input_box.height))
- {
- gui_single_line_input_box_goto_first_character(t->focus_input_box);
- time_input_reset_focus(t);
- for (;; i++)
- {
- if (t->focus_list[i] == TIME_INPUT_FOCUS_SECONDS)
- {
- t->current_focus = i;
- break;
- }
- }
- time_input_set_focus(t);
- }
- else
- {
- return;
- }
- gui_show_single_line_input_box_ext(t->focus_input_box, x, y);
- if (gui_single_line_input_box_test_last_character_position(t->focus_input_box))
- {
- gui_single_line_input_box_goto_last_character(t->focus_input_box);
- gui_single_line_input_box_previous(t->focus_input_box);
- }
- show_time_input(t);
- }
- }
- #endif /* defined (__MMI_TOUCH_SCREEN__) */
- /*****************************************************************************
- * FUNCTION
- * time_input_set_seperator
- * DESCRIPTION
- * set the mask of time input box
- * PARAMETERS
- * d [IN]
- * seperator [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_set_seperator(time_input *d, UI_character_type seperator)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw, x1, x2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->seperator = seperator;
- gui_set_font(d->hours_input_box.text_font);
- sw = gui_get_character_width(d->seperator);
- switch (d->flags & TIME_INPUT_TYPE_MASK)
- {
- case TIME_INPUT_TYPE_HH_MM:
- x1 = d->hours_input_box.x + d->hours_input_box.width - 1;
- x2 = d->minutes_input_box.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->minutes_input_box.x + d->minutes_input_box.width - 1;
- x2 = d->seconds_input_box.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- break;
- case TIME_INPUT_TYPE_HH_MM_SS:
- x1 = d->hours_input_box.x + d->hours_input_box.width - 1;
- x2 = d->minutes_input_box.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->minutes_input_box.x + d->minutes_input_box.width - 1;
- x2 = d->seconds_input_box.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- break;
- }
- }
- /* global variable store current time input */
- time_input *current_time_input = NULL;
- /*----------------------------------------------------------------------------
- Function: current_time_input_callback
- Description: a function pointer of current time input callback
- Input Parameters: none
- Output Parameters: none
- Returns: none
- ----------------------------------------------------------------------------*/
- void (*current_time_input_callback) (void) = UI_dummy_function;
- /*****************************************************************************
- * FUNCTION
- * set_current_time_input
- * DESCRIPTION
- * set the valeu of global variable store current
- * time input equal to valeu pass as parameter
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_time_input(time_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_input = d;
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_direct_input
- * DESCRIPTION
- * enter the current character in time input box and show the time input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_direct_input(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
- {
- if (time_input_set_next_focus(current_time_input))
- {
- gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
- {
- if (!time_input_set_next_focus(current_time_input))
- {
- gui_single_line_input_box_previous(current_time_input->focus_input_box);
- }
- }
- }
- /* show time input box */
- show_time_input(current_time_input);
- current_time_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_direct_input_nodraw
- * DESCRIPTION
- * insert the character in date input box and redraw date input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_direct_input_nodraw(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
- {
- if (time_input_set_next_focus(current_time_input))
- {
- gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
- {
- if (!time_input_set_next_focus(current_time_input))
- {
- gui_single_line_input_box_previous(current_time_input->focus_input_box);
- }
- }
- }
- current_time_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_test_last_position
- * DESCRIPTION
- * test current position is the last position or not
- * PARAMETERS
- * t [IN]
- * RETURNS
- * S32
- *****************************************************************************/
- S32 time_input_test_last_position(time_input *t)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (t->focus_list[t->current_focus + 1] != TIME_INPUT_FOCUS_NONE)
- {
- return 0;
- }
- else
- {
- if (gui_single_line_input_box_test_last_character_position(t->focus_input_box))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_delete_character
- * DESCRIPTION
- * delete character of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_delete_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
- {
- time_input_set_previous_focus(current_time_input);
- }
- else
- {
- gui_single_line_input_box_delete_character(current_time_input->focus_input_box);
- if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
- {
- time_input_set_previous_focus(current_time_input);
- }
- }
- /* show time input box */
- show_time_input(current_time_input);
- /* current time input callback fuc */
- current_time_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_previous_character
- * DESCRIPTION
- * delete previous cahracter of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_previous_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
- {
- if (time_input_set_previous_focus(current_time_input))
- {
- gui_single_line_input_box_goto_last_character(current_time_input->focus_input_box);
- gui_single_line_input_box_previous(current_time_input->focus_input_box);
- }
- }
- else
- {
- gui_single_line_input_box_previous(current_time_input->focus_input_box);
- }
- /* show time input box */
- show_time_input(current_time_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_next_character
- * DESCRIPTION
- * delete next cahracter of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_next_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_character_position(current_time_input->focus_input_box))
- {
- time_input_set_next_focus(current_time_input);
- }
- else
- {
- gui_single_line_input_box_next(current_time_input->focus_input_box);
- }
- /* show time input box */
- show_time_input(current_time_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_toggle_insert_mode
- * DESCRIPTION
- * toggle insert mode of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_toggle_insert_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_toggle_insert_mode(current_time_input->focus_input_box);
- /* show time input box */
- show_time_input(current_time_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_delete_current_character
- * DESCRIPTION
- * delete current character of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_delete_current_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_delete_current_character(current_time_input->focus_input_box);
- /* show time input box */
- show_time_input(current_time_input);
- current_time_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_delete_all_characters
- * DESCRIPTION
- * delete all characters of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_delete_all_characters(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_input == NULL)
- {
- return;
- }
- if (current_time_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_delete_all(current_time_input->focus_input_box);
- /* show time input box */
- show_time_input(current_time_input);
- current_time_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_numeric_keyboard_input_handler
- * DESCRIPTION
- * numeric key handle of time input box
- * PARAMETERS
- * keyc [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_numeric_keyboard_input_handler(S32 keyc)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keyc >= '0' && keyc <= '9')
- {
- time_input_direct_input((U8) keyc);
- }
- else if (keyc == 0x08)
- {
- time_input_delete_character();
- }
- else if (keyc == 0x1b)
- {
- time_input_delete_all_characters();
- }
- else if (keyc == 0x0d);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_handle_key_down
- * DESCRIPTION
- * handle key down of time input box
- * PARAMETERS
- * k [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_handle_key_down(MMI_key_code_type k)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- time_input_direct_input((UI_character_type) ('0' + k));
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_key_handler
- * DESCRIPTION
- * register key handlers of time input box
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- time_input_previous_character();
- break;
- case 38: /* up */
- break;
- case 39:
- time_input_next_character();
- break;
- case 40: /* down */
- break;
- case 36: /* home */
- break;
- case 35: /* end */
- break;
- case 33: /* page up */
- break;
- case 34: /* page down */
- break;
- case 45:
- time_input_toggle_insert_mode();
- break;
- case 46:
- time_input_delete_current_character();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_register_keys
- * DESCRIPTION
- * register key handlers of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_register_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_MMI_key_input_handler();
- register_key_down_handler(time_input_handle_key_down);
- register_keyboard_input_handler(time_input_numeric_keyboard_input_handler);
- SetKeyHandler(time_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(time_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- register_keyboard_key_handler(time_input_key_handler);
- }
- /*****************************************************************************
- * FUNCTION
- * time_input_clear_keys
- * DESCRIPTION
- * clear key handlers of time input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_input_clear_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- clear_MMI_key_input_handler();
- clear_key_down_handler();
- clear_keyboard_input_handler();
- ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- clear_keyboard_key_handler();
- }
- /*****************************************************************************
- * FUNCTION
- * register_time_input_callback
- * DESCRIPTION
- * register time input call back function
- * PARAMETERS
- * f [IN]
- * function(?) [IN] Pointer
- * RETURNS
- * void
- *****************************************************************************/
- void register_time_input_callback(void (*f) (void))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_input_callback = f;
- }
- /*****************************************************************************
- * FUNCTION
- * clear_time_input_callback
- * DESCRIPTION
- * clear time input call back function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void clear_time_input_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_input_callback = UI_dummy_function;
- }
- UI_filled_area DOW_normal_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {255, 255, 255, 100},
- {0, 0, 0, 0},
- {0, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /* theme when DOW is highlighted */
- UI_filled_area DOW_normal_highlighted_cell_filler = {UI_FILLED_AREA_TYPE_COLOR,
- UI_NULL_IMAGE,
- NULL,
- {9, 235, 253, 100},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- 0
- };
- /* theme when DOW is selected */
- UI_filled_area DOW_selected_highlighted_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {9, 235, 253, 100},
- {0, 0, 0, 0},
- {235, 247, 17, 100},
- {0, 0, 0, 0},
- 0
- };
- UI_filled_area DOW_selected_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {255, 240, 0, 100},
- {0, 0, 0, 0},
- {235, 247, 17, 100},
- {0, 0, 0, 0},
- 0
- };
- UI_filled_area list_menu_DOW_normal_BG_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND,
- UI_NULL_IMAGE,
- NULL,
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- 0
- };
- UI_filled_area list_menu_DOW_selected_cell_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER,
- UI_NULL_IMAGE,
- NULL,
- {0, 0, 0, 0},
- {0, 0, 0, 0},
- {255, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /*****************************************************************************
- * FUNCTION
- * create_DOW_select
- * DESCRIPTION
- * create DOW selct input box
- * PARAMETERS
- * d [IN] DOW input box
- * x [IN] Start x position of DOW
- * y [IN] Start y position of DOW
- * width [IN] Width of DOW box
- * height [IN] Height of DOW box
- * RETURNS
- * void
- *****************************************************************************/
- extern U8 get_menu_item_height(void);
- void create_DOW_select(DOW_select *d, S32 x, S32 y, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- color c1 = {235, 247, 17, 100};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DOW_normal_cell_filler = *MMI_fixed_icontext_menuitem.focussed_filler;
- DOW_normal_cell_filler.flags &= 0X00000FFF;
- DOW_selected_cell_filler = *MMI_fixed_icontext_menuitem.focussed_filler;
- DOW_selected_cell_filler.flags &= 0X00000FFF;
- DOW_selected_cell_filler.flags |= UI_FILLED_AREA_SINGLE_BORDER;
- DOW_selected_cell_filler.border_color = c1;
- d->background_filler = &DOW_normal_cell_filler;
- d->normal_cell_filler = &DOW_normal_cell_filler;
- d->normal_highlighted_cell_filler = &DOW_normal_highlighted_cell_filler;
- d->selected_highlighted_cell_filler = &DOW_selected_highlighted_cell_filler;
- d->selected_cell_filler = &DOW_selected_cell_filler;
- d->normal_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
- d->normal_highlighted_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
- d->selected_highlighted_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
- d->selected_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
- d->cell_width = DOW_CELL_WIDTH;
- d->cell_height = MMI_MENUITEM_HEIGHT;
- d->x = x;
- d->y = y;
- d->width = width;
- d->height = height;
- d->cell_gap = DOW_CELL_GAP;
- d->offset_x = (width >> 1) - ((7 * (d->cell_width + d->cell_gap)) >> 1);
- d->offset_y = (height >> 1) - (d->cell_height >> 1);
- d->highlighted_cell = 0;
- d->text_font = &MMI_medium_font;
- d->flags = 0;
- for (i = 0; i < 7; i++)
- {
- d->states[i] = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * set_DOW_select_list_menu_theme
- * DESCRIPTION
- * set color theme of DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void set_DOW_select_list_menu_theme(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- color c1 = {255, 0, 0, 100};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- list_menu_DOW_selected_cell_filler = *MMI_fixed_list_menu.normal_filler;
- list_menu_DOW_selected_cell_filler.flags = (UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER);
- list_menu_DOW_selected_cell_filler.border_color = c1;
- list_menu_DOW_normal_BG_filler = *MMI_fixed_list_menu.normal_filler;
- list_menu_DOW_normal_BG_filler.flags = UI_FILLED_AREA_TYPE_NO_BACKGROUND;
- d->background_filler = &list_menu_DOW_normal_BG_filler;
- d->normal_cell_filler = &list_menu_DOW_normal_BG_filler;
- d->normal_highlighted_cell_filler = &list_menu_DOW_normal_BG_filler;
- d->selected_highlighted_cell_filler = &list_menu_DOW_selected_cell_filler;
- d->selected_cell_filler = &list_menu_DOW_selected_cell_filler;
- d->normal_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
- d->normal_highlighted_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
- d->selected_highlighted_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
- d->selected_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
- }
- /*****************************************************************************
- * FUNCTION
- * set_DOW_select_states
- * DESCRIPTION
- * set staes of days in DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * states [IN] [] :- store teh states valeu
- * RETURNS
- * void
- *****************************************************************************/
- void set_DOW_select_states(DOW_select *d, U8 states[])
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < 7; i++)
- {
- d->states[i] = states[i];
- }
- }
- /*****************************************************************************
- * FUNCTION
- * show_DOW_select_background
- * DESCRIPTION
- * show DOW bkg
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void show_DOW_select_background(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- x1 = d->x;
- y1 = d->y;
- x2 = x1 + d->width - 1;
- y2 = y1 + d->height - 1;
- gdi_layer_reset_clip();
- gui_draw_filled_area(x1, y1, x2, y2, d->background_filler);
- }
- /*****************************************************************************
- * FUNCTION
- * show_DOW_select
- * DESCRIPTION
- * show DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void show_DOW_select(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 DOW_list[] = { 'S', 'M', 'T', 'W', 'T', 'F', 'S' };
- S32 i, x, y, character_width, character_height;
- color text_color;
- UI_filled_area *f;
- S32 x1, y1, x2, y2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_push_clip();
- gdi_layer_reset_clip();
- x = d->x + d->offset_x;
- y = d->y + d->offset_y;
- gui_set_font(d->text_font);
- character_height = gui_get_character_height();
- for (i = 0; i < 7; i++)
- {
- if (i == d->highlighted_cell)
- {
- if (d->states[i])
- {
- f = d->selected_highlighted_cell_filler;
- text_color = d->selected_highlighted_text_color;
- }
- else
- {
- f = d->normal_highlighted_cell_filler;
- text_color = d->normal_highlighted_text_color;
- }
- }
- else
- {
- if (d->states[i])
- {
- f = d->selected_cell_filler;
- text_color = d->selected_text_color;
- }
- else
- {
- f = d->normal_cell_filler;
- text_color = d->normal_text_color;
- }
- }
- x1 = x;
- y1 = y;
- x2 = x1 + d->cell_width - 1;
- y2 = y1 + d->cell_height - 1;
- gui_set_clip(x1, y1, x2, y2);
- gui_set_text_clip(x1, y1, x2, y2);
- gui_draw_filled_area(x1, y1, x2, y2, f);
- character_width = gui_get_character_width((UI_character_type) DOW_list[i]);
- gui_move_text_cursor(
- x + ((d->cell_width - character_width) / 2) + (r2lMMIFlag ? character_width : 0),
- y + ((d->cell_height - character_height) / 2));