wgui_datetime.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:498k
源码类别:
MTK
开发平台:
C/C++
- gui_set_text_color(text_color);
- gui_print_character((UI_character_type) DOW_list[i]);
- x += d->cell_width + d->cell_gap;
- }
- gdi_layer_pop_clip();
- }
- #ifdef __MMI_TOUCH_SCREEN__
- /*****************************************************************************
- * FUNCTION
- * DOW_translate_pen_position
- * DESCRIPTION
- * Translate pen events for DOW
- * PARAMETERS
- * d [IN] DOW input box
- * x [IN] X coordniate
- * cell_index [OUT] Corresponding cell index ( -1 for invalid position)
- * RETURNS
- * void
- *****************************************************************************/
- static void DOW_translate_pen_position(DOW_select *d, S32 x, S32 *cell_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, offset;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- offset = d->x + d->offset_x;
- if (x < offset)
- {
- *cell_index = -1;
- return;
- }
- for (i = 0; i < 7; i++)
- {
- offset += d->cell_width + d->cell_gap;
- if (x < offset)
- {
- *cell_index = i;
- return;
- }
- }
- *cell_index = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * DOW_translate_pen_event
- * DESCRIPTION
- * Translate pen events for DOW
- * PARAMETERS
- * d [IN] DOW input box
- * pen_event [IN]
- * x [IN]
- * y [IN]
- * DOW_event [?]
- * DOW_param [?]
- * RETURNS
- * void
- *****************************************************************************/
- BOOL DOW_translate_pen_event(
- DOW_select *d,
- mmi_pen_event_type_enum pen_event,
- S16 x,
- S16 y,
- DOW_pen_event_enum *DOW_event,
- gui_pen_event_param_struct *DOW_param)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret = MMI_TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *DOW_event = DOW_PEN_NONE;
- GUI_PEN_EVENT_PARAM_SET_VOID(DOW_param);
- /* Only react to pen down event */
- if (pen_event == MMI_PEN_EVENT_DOWN)
- {
- if (PEN_CHECK_BOUND(x, y, d->x, d->y, d->width, d->height))
- {
- S32 cell_index;
- DOW_translate_pen_position(d, x, &cell_index);
- if (cell_index >= 0)
- {
- if (d->highlighted_cell != cell_index)
- {
- *DOW_event = DOW_PEN_CHANGE_HIGHLIGHT_AND_TOGGLE_I;
- GUI_PEN_EVENT_PARAM_SET_INTEGER(DOW_param, cell_index);
- }
- else
- {
- *DOW_event = DOW_PEN_TOGGLE_CURRENT_ITEM;
- }
- }
- }
- else
- {
- ret = MMI_FALSE;
- }
- }
- return ret;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * DOW_select_previous
- * DESCRIPTION
- * set focus on previous select day of DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void DOW_select_previous(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((S32) d->highlighted_cell <= 0)
- {
- return;
- }
- d->highlighted_cell--;
- }
- /*****************************************************************************
- * FUNCTION
- * DOW_select_next
- * DESCRIPTION
- * set focus on next select day of DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void DOW_select_next(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->highlighted_cell >= 6)
- {
- return;
- }
- d->highlighted_cell++;
- }
- /*****************************************************************************
- * FUNCTION
- * DOW_select_toggle_item
- * DESCRIPTION
- * toggle the select or unslect day of DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * RETURNS
- * void
- *****************************************************************************/
- void DOW_select_toggle_item(DOW_select *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (((S32) d->highlighted_cell < 0) || (d->highlighted_cell > 6))
- {
- return;
- }
- if (d->states[d->highlighted_cell] == 1)
- {
- d->states[d->highlighted_cell] = 0;
- }
- else if (d->states[d->highlighted_cell] == 0)
- {
- d->states[d->highlighted_cell] = 1;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * DOW_select_highlight_item
- * DESCRIPTION
- * highlight particular day of DOW input box
- * PARAMETERS
- * d [IN] DOW input box
- * i [IN] Highlighted index
- * RETURNS
- * void
- *****************************************************************************/
- void DOW_select_highlight_item(DOW_select *d, S32 i)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((i < 0) || (i > 6))
- {
- return;
- }
- d->highlighted_cell = (U8) i;
- }
- /* Time period input object */
- /* color theme of time period input box */
- UI_filled_area time_period_input_background_filler = {UI_FILLED_AREA_TYPE_COLOR,
- UI_NULL_IMAGE,
- NULL,
- {255, 255, 255, 100},
- {0, 0, 0, 0},
- {0, 0, 0, 100},
- {0, 0, 0, 0},
- 0
- };
- /*****************************************************************************
- * FUNCTION
- * time_period_input_show_background
- * DESCRIPTION
- * show background of time period
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_show_background(time_period_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;
- //20051012 HIMANSHU START INLINE TIME PERIOD
- // for drawing the transparent background for highlighted Time-Period menu item.
- //PMT HIMANSHU INLINE TIME PERIOD START 20051022
- /* There is no need to draw white background now as the text now will not be
- shown because of the flag UI_MENUITEM_EXT_DISABLE_FOCUSSED_TEXT_DISPLAY */
- // if(wgui_is_wallpaper_on_bottom()==MMI_TRUE)
- // gdi_draw_solid_rect(x1,y1,x2,y2,GDI_COLOR_TRANSPARENT);
- // else
- // gui_draw_filled_area(x1,y1,x2,y2,&time_period_input_background_filler);
- //PMT HIMANSHU INLINE TIME PERIOD END 20051022
- //20051012 HIMANSHU END INLINE TIME PERIOD
- x1 = d->hours_input_box1.x;
- y1 = d->y;
- x2 = d->minutes_input_box1.x + d->minutes_input_box1.width - 1;
- y2 = y1 + d->height - 1;
- gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
- x1 = d->hours_input_box2.x;
- y1 = d->y;
- x2 = d->minutes_input_box2.x + d->minutes_input_box2.width - 1;
- y2 = y1 + d->height - 1;
- gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_reset_focus
- * DESCRIPTION
- * reset foucus of time period input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_reset_focus(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->hours_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->minutes_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->hours_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->minutes_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_set_focus
- * DESCRIPTION
- * set foucus of time period input box depend on current focus
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_set_focus(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((d->current_focus < 1) || (d->current_focus > 4))
- {
- return;
- }
- switch (d->focus_list[d->current_focus])
- {
- case TIME_PERIOD_INPUT_FOCUS_HOURS1:
- d->hours_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->hours_input_box1;
- break;
- case TIME_PERIOD_INPUT_FOCUS_MINUTES1:
- d->minutes_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->minutes_input_box1;
- break;
- case TIME_PERIOD_INPUT_FOCUS_HOURS2:
- d->hours_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->hours_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->hours_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->hours_input_box2;
- break;
- case TIME_PERIOD_INPUT_FOCUS_MINUTES2:
- d->minutes_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->minutes_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->minutes_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->minutes_input_box2;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_set_default_focus
- * DESCRIPTION
- * set defualt foucs of time period input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_set_default_focus(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (d->flags & TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_MASK)
- {
- case TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_HOURS1:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_HOURS1)
- {
- d->current_focus = i;
- }
- }
- break;
- case TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_MINUTES1:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_MINUTES1)
- {
- d->current_focus = i;
- }
- }
- break;
- case TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_HOURS2:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_HOURS2)
- {
- d->current_focus = i;
- }
- }
- break;
- case TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_MINUTES2:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_MINUTES2)
- {
- d->current_focus = i;
- }
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * create_time_period_input
- * DESCRIPTION
- * set defualt foucs of time period input box
- * PARAMETERS
- * d [IN]
- * x [IN] Start x position of time period input
- * y [IN] Start y position of time period input
- * width [IN] Width of time period input
- * height [IN] Height of time period input
- * flags [IN]
- * hours_buffer1 [IN] Hours buffer first range
- * minutes_buffer1 [IN] Minutes buffer first range
- * hours_buffer2 [IN] Hours buffer max range
- * minutes_buffer2 [IN] Minutes buffer max range
- * RETURNS
- * void
- *****************************************************************************/
- void create_time_period_input(
- time_period_input *d,
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- U32 flags,
- UI_buffer_type hours_buffer1,
- UI_buffer_type minutes_buffer1,
- UI_buffer_type hours_buffer2,
- UI_buffer_type minutes_buffer2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w1, w2, h, ox, oy, sw1, sw2, 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_PERIOD_INPUT_HOURS_WIDTH;
- w2 = TIME_PERIOD_INPUT_MINUTES_WIDTH;
- sw1 = TIME_PERIOD_INPUT_SEPERATOR_WIDTH1;
- sw2 = TIME_PERIOD_INPUT_SEPERATOR_WIDTH2;
- tw = w1 + sw1 + w2 + sw2 + w1 + sw1 + w2;
- h = TIME_PERIOD_INPUT_HEIGHT;
- oy = (height >> 1) - (h >> 1);
- switch (flags & TIME_PERIOD_INPUT_JUSTIFY_MASK)
- {
- case TIME_PERIOD_INPUT_RIGHT_JUSTIFY:
- ox = (width - tw);
- break;
- case TIME_PERIOD_INPUT_CENTER_JUSTIFY:
- ox = (width >> 1) - (tw >> 1);
- break;
- default:
- ox = 0;
- break;
- }
- d->focus_list[0] = TIME_PERIOD_INPUT_FOCUS_NONE;
- d->focus_list[5] = TIME_PERIOD_INPUT_FOCUS_NONE;
- d->focus_list[1] = TIME_PERIOD_INPUT_FOCUS_HOURS1;
- d->focus_list[2] = TIME_PERIOD_INPUT_FOCUS_MINUTES1;
- d->focus_list[3] = TIME_PERIOD_INPUT_FOCUS_HOURS2;
- d->focus_list[4] = TIME_PERIOD_INPUT_FOCUS_MINUTES2;
- d->hours1_x = ox;
- ox += w1 + sw1;
- d->minutes1_x = ox;
- ox += w2 + sw2;
- d->hours2_x = ox;
- ox += w1 + sw1;
- d->minutes2_x = ox;
- d->flags |= TIME_PERIOD_INPUT_TYPE_DEFAULT_FOCUS_HOURS1;
- current_single_line_input_box_theme = &date_time_input_theme;
- d->hours1_y = oy;
- d->minutes1_y = oy;
- d->hours2_y = oy;
- d->minutes2_y = oy;
- d->s1_y = oy;
- d->s2_y = oy;
- d->s3_y = oy;
- if ((h + 2) > height)
- {
- h = height - 2;
- }
- /* MTK Elvis for R2L characters */
- l = gui_strlen((UI_string_type) hours_buffer1) /* +1 */ ;
- /* create single input box of hours 1 */
- gui_create_single_line_input_box_set_buffer(
- &d->hours_input_box1,
- x + d->hours1_x,
- y + d->hours1_y,
- w1,
- h,
- (UI_string_type) hours_buffer1,
- TIME_PERIOD_INPUT_HOURS_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->hours_input_box1.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_box1);
- l = gui_strlen((UI_string_type) minutes_buffer1) /* +1 */ ;
- /* create single input box of minutes 1 */
- gui_create_single_line_input_box_set_buffer(
- &d->minutes_input_box1,
- x + d->minutes1_x,
- y + d->minutes1_y,
- w2,
- h,
- (UI_string_type) minutes_buffer1,
- TIME_PERIOD_INPUT_MINUTES_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->minutes_input_box1.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_box1);
- l = gui_strlen((UI_string_type) hours_buffer1) /* +1 */ ;
- /* create single input box of hours 2 */
- gui_create_single_line_input_box_set_buffer(
- &d->hours_input_box2,
- x + d->hours2_x,
- y + d->hours2_y,
- w1,
- h,
- (UI_string_type) hours_buffer2,
- TIME_PERIOD_INPUT_HOURS_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->hours_input_box2.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_box2);
- l = gui_strlen((UI_string_type) minutes_buffer2) /* +1 */ ;
- /* create single input box of minutes 2 */
- gui_create_single_line_input_box_set_buffer(
- &d->minutes_input_box2,
- x + d->minutes2_x,
- y + d->minutes2_y,
- w2,
- h,
- (UI_string_type) minutes_buffer2,
- TIME_PERIOD_INPUT_MINUTES_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->minutes_input_box2.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_box2);
- time_period_input_reset_focus(d);
- time_period_input_set_default_focus(d);
- time_period_input_set_focus(d);
- current_single_line_input_box_theme = t;
- /* MTK end */
- /* Setup default validation functions */
- d->hours_input_box1.validation_callback = default_inline_time_hours_validation;
- d->minutes_input_box1.validation_callback = default_inline_time_minutes_validation;
- d->hours_input_box2.validation_callback = default_inline_time_hours_validation;
- d->minutes_input_box2.validation_callback = default_inline_time_minutes_validation;
- }
- /*****************************************************************************
- * FUNCTION
- * show_time_period_input
- * DESCRIPTION
- * show time period input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void show_time_period_input(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
- S32 sw;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_single_line_input_box_theme = &date_time_input_theme;
- gui_set_single_line_input_box_current_theme(&d->hours_input_box1);
- gui_set_single_line_input_box_current_theme(&d->minutes_input_box1);
- gui_set_single_line_input_box_current_theme(&d->hours_input_box2);
- gui_set_single_line_input_box_current_theme(&d->minutes_input_box2);
- /* show single input box of hours 1 */
- gui_show_single_line_input_box(&d->hours_input_box1);
- /* show single input box of minutes 1 */
- gui_show_single_line_input_box(&d->minutes_input_box1);
- /* show single input box of hours2 */
- gui_show_single_line_input_box(&d->hours_input_box2);
- /* show single input box of minutes2 */
- gui_show_single_line_input_box(&d->minutes_input_box2);
- gdi_layer_reset_clip();
- gui_set_font(d->hours_input_box1.text_font);
- gui_set_text_color(d->hours_input_box1.normal_text_color);
- if (r2lMMIFlag)
- {
- gui_set_font(d->hours_input_box1.text_font);
- sw = gui_get_character_width(d->seperator1);
- 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->seperator1);
- if (r2lMMIFlag)
- {
- gui_set_font(d->hours_input_box1.text_font);
- sw = gui_get_character_width(d->seperator2);
- 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->seperator2);
- if (r2lMMIFlag)
- {
- gui_set_font(d->hours_input_box2.text_font);
- sw = gui_get_character_width(d->seperator1);
- gui_move_text_cursor(d->s3_x + sw, d->s3_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s3_x, d->s3_y + d->y);
- }
- gui_print_character(d->seperator1);
- 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_period_input_set_next_focus
- * DESCRIPTION
- * set fopcus to next box of time period input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * byte
- *****************************************************************************/
- U8 time_period_input_set_next_focus(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus + 1] == TIME_PERIOD_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- time_period_input_reset_focus(d);
- d->current_focus++;
- time_period_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_period_input_set_previous_focus
- * DESCRIPTION
- * set fopcus to previous box of time period input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * byte
- *****************************************************************************/
- U8 time_period_input_set_previous_focus(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus - 1] == TIME_PERIOD_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- time_period_input_reset_focus(d);
- d->current_focus--;
- time_period_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_period_input_move_to_x_y
- * DESCRIPTION
- * set the cursor position to (x,y) position
- * PARAMETERS
- * tp [IN] Time period input box S32 x S32 y
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_move_to_x_y(time_period_input *tp, S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND(x, y, tp->x, tp->y, tp->width, tp->height) &&
- !(PEN_CHECK_BOUND
- (x, y, tp->minutes_input_box1.x + tp->minutes_input_box1.width, tp->y,
- tp->hours_input_box1.x - (tp->minutes_input_box1.x + tp->minutes_input_box1.width), tp->height)))
- {
- if (PEN_CHECK_BOUND
- (x, y, tp->hours_input_box1.x, tp->hours_input_box1.y, tp->hours_input_box1.width,
- tp->hours_input_box1.height))
- {
- gui_single_line_input_box_goto_first_character(tp->focus_input_box);
- time_period_input_reset_focus(tp);
- for (;; i++)
- {
- if (tp->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_HOURS1)
- {
- tp->current_focus = i;
- break;
- }
- }
- time_period_input_set_focus(tp);
- }
- else if (PEN_CHECK_BOUND
- (x, y, tp->minutes_input_box1.x, tp->minutes_input_box1.y, tp->minutes_input_box1.width,
- tp->minutes_input_box1.height))
- {
- gui_single_line_input_box_goto_first_character(tp->focus_input_box);
- time_period_input_reset_focus(tp);
- for (;; i++)
- {
- if (tp->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_MINUTES1)
- {
- tp->current_focus = i;
- break;
- }
- }
- time_period_input_set_focus(tp);
- }
- else if (PEN_CHECK_BOUND
- (x, y, tp->hours_input_box2.x, tp->hours_input_box2.y, tp->hours_input_box2.width,
- tp->hours_input_box2.height))
- {
- gui_single_line_input_box_goto_first_character(tp->focus_input_box);
- time_period_input_reset_focus(tp);
- for (;; i++)
- {
- if (tp->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_HOURS2)
- {
- tp->current_focus = i;
- break;
- }
- }
- time_period_input_set_focus(tp);
- }
- else if (PEN_CHECK_BOUND
- (x, y, tp->minutes_input_box2.x, tp->minutes_input_box2.y, tp->minutes_input_box2.width,
- tp->minutes_input_box2.height))
- {
- gui_single_line_input_box_goto_first_character(tp->focus_input_box);
- time_period_input_reset_focus(tp);
- for (;; i++)
- {
- if (tp->focus_list[i] == TIME_PERIOD_INPUT_FOCUS_MINUTES2)
- {
- tp->current_focus = i;
- break;
- }
- }
- time_period_input_set_focus(tp);
- }
- else
- {
- return;
- }
- gui_show_single_line_input_box_ext(tp->focus_input_box, x, y);
- if (gui_single_line_input_box_test_last_character_position(tp->focus_input_box))
- {
- gui_single_line_input_box_goto_last_character(tp->focus_input_box);
- gui_single_line_input_box_previous(tp->focus_input_box);
- }
- show_time_period_input(tp);
- }
- }
- #endif /* defined (__MMI_TOUCH_SCREEN__) */
- /*****************************************************************************
- * FUNCTION
- * time_period_input_set_seperators
- * DESCRIPTION
- * set the mask of time period input box
- * PARAMETERS
- * d [IN]
- * seperator1 [IN] Separator of first time period
- * seperator2 [IN] Seperartor of second time period
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_set_seperators(time_period_input *d, UI_character_type seperator1, UI_character_type seperator2)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw1, sw2, x1, x2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->seperator1 = seperator1;
- d->seperator2 = seperator2;
- gui_set_font(d->hours_input_box1.text_font);
- sw1 = gui_get_character_width(d->seperator1);
- sw2 = gui_get_character_width(d->seperator2);
- x1 = d->hours_input_box1.x + d->hours_input_box1.width - 1;
- x2 = d->minutes_input_box1.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw1 >> 1);
- x1 = d->minutes_input_box1.x + d->minutes_input_box1.width - 1;
- x2 = d->hours_input_box2.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw2 >> 1);
- x1 = d->hours_input_box2.x + d->hours_input_box2.width - 1;
- x2 = d->minutes_input_box2.x;
- d->s3_x = x1 + ((x2 - x1) >> 1) - (sw1 >> 1);
- }
- /* glbal variable store value of current time period input box */
- time_period_input *current_time_period_input = NULL;
- /*----------------------------------------------------------------------------
- Function: current_time_period_input_callback
- Description: a function pointer of time period input callback
- Input Parameters: none
- Output Parameters: none
- Returns: none
- ----------------------------------------------------------------------------*/
- void (*current_time_period_input_callback) (void) = UI_dummy_function;
- /*****************************************************************************
- * FUNCTION
- * set_current_time_period_input
- * DESCRIPTION
- * set the valeu of global variable of current time period input
- * equal to value pass as parameter
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_time_period_input(time_period_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_period_input = d;
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_direct_input
- * DESCRIPTION
- * insert the character in time period input
- * and show the time period input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_direct_input(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_time_period_input->focus_input_box))
- {
- if (time_period_input_set_next_focus(current_time_period_input))
- {
- gui_single_line_input_box_insert_character(current_time_period_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_time_period_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_time_period_input->focus_input_box))
- {
- if (!time_period_input_set_next_focus(current_time_period_input))
- {
- gui_single_line_input_box_previous(current_time_period_input->focus_input_box);
- }
- }
- }
- show_time_period_input(current_time_period_input);
- current_time_period_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_direct_input_nodraw
- * DESCRIPTION
- * insert the character in date input box and redraw date input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_direct_input_nodraw(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_time_period_input->focus_input_box))
- {
- if (time_period_input_set_next_focus(current_time_period_input))
- {
- gui_single_line_input_box_insert_character(current_time_period_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_time_period_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_time_period_input->focus_input_box))
- {
- if (!time_period_input_set_next_focus(current_time_period_input))
- {
- gui_single_line_input_box_previous(current_time_period_input->focus_input_box);
- }
- }
- }
- current_time_period_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_test_last_position
- * DESCRIPTION
- * test current position is the last position or not
- * PARAMETERS
- * tp [?]
- * time_input(?) [IN] *t
- * RETURNS
- * S32
- *****************************************************************************/
- S32 time_period_input_test_last_position(time_period_input *tp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (tp->focus_list[tp->current_focus + 1] != TIME_PERIOD_INPUT_FOCUS_NONE)
- {
- return 0;
- }
- else
- {
- if (gui_single_line_input_box_test_last_character_position(tp->focus_input_box))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_delete_character
- * DESCRIPTION
- * delete caharcter of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_delete_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_time_period_input->focus_input_box))
- {
- time_period_input_set_previous_focus(current_time_period_input);
- }
- else
- {
- gui_single_line_input_box_delete_character(current_time_period_input->focus_input_box);
- if (gui_single_line_input_box_test_first_position(current_time_period_input->focus_input_box))
- {
- time_period_input_set_previous_focus(current_time_period_input);
- }
- }
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- current_time_period_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_previous_character
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_previous_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_time_period_input->focus_input_box))
- {
- if (time_period_input_set_previous_focus(current_time_period_input))
- {
- gui_single_line_input_box_goto_last_character(current_time_period_input->focus_input_box);
- gui_single_line_input_box_previous(current_time_period_input->focus_input_box);
- }
- }
- else
- {
- gui_single_line_input_box_previous(current_time_period_input->focus_input_box);
- }
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_next_character
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_next_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_character_position(current_time_period_input->focus_input_box))
- {
- time_period_input_set_next_focus(current_time_period_input);
- }
- else
- {
- gui_single_line_input_box_next(current_time_period_input->focus_input_box);
- }
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_toggle_insert_mode
- * DESCRIPTION
- * cahneg the insert mode of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_toggle_insert_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_toggle_insert_mode(current_time_period_input->focus_input_box);
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_delete_current_character
- * DESCRIPTION
- * delete current character of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_delete_current_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_delete_current_character(current_time_period_input->focus_input_box);
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- current_time_period_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_delete_all_characters
- * DESCRIPTION
- * delete all character of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_delete_all_characters(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_time_period_input == NULL)
- {
- return;
- }
- if (current_time_period_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_delete_all(current_time_period_input->focus_input_box);
- /* show time period input box */
- show_time_period_input(current_time_period_input);
- current_time_period_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_numeric_keyboard_input_handler
- * DESCRIPTION
- * handle time period numeric input
- * PARAMETERS
- * keyc [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_numeric_keyboard_input_handler(S32 keyc)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keyc >= '0' && keyc <= '9')
- {
- time_period_input_direct_input((U8) keyc);
- }
- else if (keyc == 0x08)
- {
- time_period_input_delete_character();
- }
- else if (keyc == 0x1b)
- {
- time_period_input_delete_all_characters();
- }
- else if (keyc == 0x0d);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_handle_key_down
- * DESCRIPTION
- * handle time periosd key down event
- * PARAMETERS
- * k [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_handle_key_down(MMI_key_code_type k)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- time_period_input_direct_input((UI_character_type) ('0' + k));
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_key_handler
- * DESCRIPTION
- * register key handlers of time period input box
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_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_period_input_previous_character();
- break;
- case 38: /* up */
- break;
- case 39:
- time_period_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_period_input_toggle_insert_mode();
- break;
- case 46:
- time_period_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_period_input_register_keys
- * DESCRIPTION
- * register all key handlers of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_input_register_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_MMI_key_input_handler();
- register_key_down_handler(time_period_input_handle_key_down);
- register_keyboard_input_handler(time_period_input_numeric_keyboard_input_handler);
- SetKeyHandler(time_period_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(time_period_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- register_keyboard_key_handler(time_period_input_key_handler);
- }
- /*****************************************************************************
- * FUNCTION
- * time_period_input_clear_keys
- * DESCRIPTION
- * clear all key handlers of time period input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_period_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_period_input_callback
- * DESCRIPTION
- * register current time period input callback function
- * PARAMETERS
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void register_time_period_input_callback(void (*f) (void))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_period_input_callback = f;
- }
- /*****************************************************************************
- * FUNCTION
- * clear_time_period_input_callback
- * DESCRIPTION
- * set current time period input callback to dummy function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void clear_time_period_input_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_time_period_input_callback = UI_dummy_function;
- }
- /* Default IP field validation functions */
- /*****************************************************************************
- * FUNCTION
- * default_inline_IP_field_validation
- * DESCRIPTION
- * validaion function of IP4 input box
- * PARAMETERS
- * text [IN]
- * cursor [IN]
- * text_length [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void default_inline_IP_field_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, "%03d", i);
- UI_editor_play_tone_invalid_data();
- }
- else if (i > 255)
- {
- i = 255;
- gui_sprintf((UI_string_type) text, "%03d", i);
- UI_editor_play_tone_invalid_data();
- }
- }
- /* IP4 input object */
- /*****************************************************************************
- * FUNCTION
- * IP4_input_show_background
- * DESCRIPTION
- * show background of Ip4 input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_show_background(IP4_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
- * IP4_input_reset_focus
- * DESCRIPTION
- * reset focus of IP4 input box to default
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_reset_focus(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->field_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->field_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->field_input_box3.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box3.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box3.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->field_input_box4.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box4.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box4.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_set_focus
- * DESCRIPTION
- * set focus to particaulr field depend on teh value
- * of current focus
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_set_focus(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((d->current_focus < 1) || (d->current_focus > 4))
- {
- return;
- }
- switch (d->focus_list[d->current_focus])
- {
- case IP4_INPUT_FOCUS_FIELD1:
- d->field_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box1.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box1.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->field_input_box1;
- break;
- case IP4_INPUT_FOCUS_FIELD2:
- d->field_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box2.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box2.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->field_input_box2;
- break;
- case IP4_INPUT_FOCUS_FIELD3:
- d->field_input_box3.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box3.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box3.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->field_input_box3;
- break;
- case IP4_INPUT_FOCUS_FIELD4:
- d->field_input_box4.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
- d->field_input_box4.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
- d->field_input_box4.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
- d->focus_input_box = &d->field_input_box4;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_set_default_focus
- * DESCRIPTION
- * set focus to default box of IP4
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_set_default_focus(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (d->flags & IP4_INPUT_TYPE_DEFAULT_FOCUS_MASK)
- {
- case IP4_INPUT_TYPE_DEFAULT_FOCUS_FIELD1:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == IP4_INPUT_FOCUS_FIELD1)
- {
- d->current_focus = i;
- }
- }
- break;
- case IP4_INPUT_TYPE_DEFAULT_FOCUS_FIELD2:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == IP4_INPUT_FOCUS_FIELD2)
- {
- d->current_focus = i;
- }
- }
- break;
- case IP4_INPUT_TYPE_DEFAULT_FOCUS_FIELD3:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == IP4_INPUT_FOCUS_FIELD3)
- {
- d->current_focus = i;
- }
- }
- break;
- case IP4_INPUT_TYPE_DEFAULT_FOCUS_FIELD4:
- for (i = 0; i < 6; i++)
- {
- if (d->focus_list[i] == IP4_INPUT_FOCUS_FIELD4)
- {
- d->current_focus = i;
- }
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * create_IP4_input
- * DESCRIPTION
- * create Ip4 input box
- * PARAMETERS
- * d [IN]
- * x [IN] Start x postion of ip4 input box
- * y [IN] Start y position of ip4 input box
- * width [IN] Width of ip4 input box
- * height [IN]
- * flags [IN]
- * b1 [IN] Buffer1 of ip4 input box
- * b2 [IN] Buffer 2 of ip4 input box
- * b3 [IN] Buffer 3o f ip4 input box
- * b4 [IN] Buffer 4 of ip4 input box
- * heighthight(?) [IN] Of ip4 input box
- * RETURNS
- * void
- *****************************************************************************/
- void create_IP4_input(
- IP4_input *d,
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- U32 flags,
- UI_buffer_type b1,
- UI_buffer_type b2,
- UI_buffer_type b3,
- UI_buffer_type b4)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, 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;
- if (((width >> 2) - 1) < IP4_INPUT_FIELD_WIDTH)
- {
- w = (width >> 2) - 1;
- }
- else
- {
- w = IP4_INPUT_FIELD_WIDTH;
- }
- sw = IP4_INPUT_SEPERATOR_WIDTH;
- tw = w + sw + w + sw + w + sw + w;
- h = IP4_INPUT_HEIGHT;
- oy = (height >> 1) - (h >> 1);
- switch (flags & IP4_INPUT_JUSTIFY_MASK)
- {
- case IP4_INPUT_RIGHT_JUSTIFY:
- ox = (width - tw - 2);
- break;
- case IP4_INPUT_CENTER_JUSTIFY:
- ox = (width >> 1) - (tw >> 1);
- break;
- default:
- ox = 2;
- break;
- }
- d->focus_list[0] = IP4_INPUT_FOCUS_NONE;
- d->focus_list[5] = IP4_INPUT_FOCUS_NONE;
- d->focus_list[1] = IP4_INPUT_FOCUS_FIELD1;
- d->focus_list[2] = IP4_INPUT_FOCUS_FIELD2;
- d->focus_list[3] = IP4_INPUT_FOCUS_FIELD3;
- d->focus_list[4] = IP4_INPUT_FOCUS_FIELD4;
- d->field1_x = ox;
- ox += w + sw;
- d->field2_x = ox;
- ox += w + sw;
- d->field3_x = ox;
- ox += w + sw;
- d->field4_x = ox;
- ox += w + sw;
- d->flags |= IP4_INPUT_TYPE_DEFAULT_FOCUS_FIELD1;
- current_single_line_input_box_theme = &date_time_input_theme;
- d->field1_y = oy;
- d->field2_y = oy;
- d->field3_y = oy;
- d->field4_y = oy;
- d->s1_y = oy;
- d->s2_y = oy;
- d->s3_y = oy;
- if ((h + 2) > height)
- {
- h = height - 2;
- }
- l = gui_strlen((UI_string_type) b1) /* +1 */ ;
- /* craete single inpyut box of field1 */
- gui_create_single_line_input_box_set_buffer(
- &d->field_input_box1,
- x + d->field1_x,
- y + d->field1_y,
- w,
- h,
- (UI_string_type) b1,
- IP4_INPUT_FIELD_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->field_input_box1.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->field_input_box1);
- l = gui_strlen((UI_string_type) b2) /* +1 */ ;
- /* craete single inpyut box of field2 */
- gui_create_single_line_input_box_set_buffer(
- &d->field_input_box2,
- x + d->field2_x,
- y + d->field2_y,
- w,
- h,
- (UI_string_type) b2,
- IP4_INPUT_FIELD_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->field_input_box2.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->field_input_box2);
- l = gui_strlen((UI_string_type) b3) /* +1 */ ;
- /* craete single inpyut box of field3 */
- gui_create_single_line_input_box_set_buffer(
- &d->field_input_box3,
- x + d->field3_x,
- y + d->field3_y,
- w,
- h,
- (UI_string_type) b3,
- IP4_INPUT_FIELD_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->field_input_box3.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->field_input_box3);
- l = gui_strlen((UI_string_type) b4) /* +1 */ ;
- /* craete single inpyut box of field4 */
- gui_create_single_line_input_box_set_buffer(
- &d->field_input_box4,
- x + d->field4_x,
- y + d->field4_y,
- w,
- h,
- (UI_string_type) b4,
- IP4_INPUT_FIELD_BUFFER_LENGTH,
- (l + 1) * ENCODING_LENGTH,
- 0);
- d->field_input_box4.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->field_input_box4);
- IP4_input_reset_focus(d);
- IP4_input_set_default_focus(d);
- IP4_input_set_focus(d);
- current_single_line_input_box_theme = t;
- /* MTK end */
- /* Setup default validation functions */
- d->field_input_box1.validation_callback = default_inline_IP_field_validation;
- d->field_input_box2.validation_callback = default_inline_IP_field_validation;
- d->field_input_box3.validation_callback = default_inline_IP_field_validation;
- d->field_input_box4.validation_callback = default_inline_IP_field_validation;
- }
- /*****************************************************************************
- * FUNCTION
- * show_IP4_input
- * DESCRIPTION
- * show Ip4 input box
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void show_IP4_input(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* show single input box field1 */
- gui_show_single_line_input_box(&d->field_input_box1);
- /* show single input box field2 */
- gui_show_single_line_input_box(&d->field_input_box2);
- /* show single input box field3 */
- gui_show_single_line_input_box(&d->field_input_box3);
- /* show single input box field4 */
- gui_show_single_line_input_box(&d->field_input_box4);
- gdi_layer_reset_clip();
- gui_set_font(d->field_input_box1.text_font);
- gui_set_text_color(d->field_input_box1.normal_text_color);
- if (r2lMMIFlag)
- {
- gui_set_font(d->field_input_box1.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);
- }
- gui_print_character(d->seperator);
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(d->s3_x + sw, d->s3_y + d->y);
- }
- else
- {
- gui_move_text_cursor(d->s3_x, d->s3_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);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_set_next_focus
- * DESCRIPTION
- * set focus to next character
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 IP4_input_set_next_focus(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus + 1] == IP4_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- IP4_input_reset_focus(d);
- d->current_focus++;
- IP4_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
- * IP4_input_set_previous_focus
- * DESCRIPTION
- * set focus to previous character
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 IP4_input_set_previous_focus(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (d->focus_list[d->current_focus - 1] == IP4_INPUT_FOCUS_NONE)
- {
- return (0);
- }
- else
- {
- IP4_input_reset_focus(d);
- d->current_focus--;
- IP4_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
- * IP4_input_move_to_x_y
- * DESCRIPTION
- * set the cursor position to (x,y) position
- * PARAMETERS
- * ip4 [IN] IP4 input box S32 x S32 y
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_move_to_x_y(IP4_input *ip4, S32 x, S32 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (PEN_CHECK_BOUND(x, y, ip4->x, ip4->y, ip4->width, ip4->height))
- {
- if (PEN_CHECK_BOUND
- (x, y, ip4->field_input_box1.x, ip4->field_input_box1.y, ip4->field_input_box1.width,
- ip4->field_input_box1.height))
- {
- gui_single_line_input_box_goto_first_character(ip4->focus_input_box);
- IP4_input_reset_focus(ip4);
- for (;; i++)
- {
- if (ip4->focus_list[i] == IP4_INPUT_FOCUS_FIELD1)
- {
- ip4->current_focus = i;
- break;
- }
- }
- IP4_input_set_focus(ip4);
- }
- else if (PEN_CHECK_BOUND
- (x, y, ip4->field_input_box2.x, ip4->field_input_box2.y, ip4->field_input_box2.width,
- ip4->field_input_box2.height))
- {
- gui_single_line_input_box_goto_first_character(ip4->focus_input_box);
- IP4_input_reset_focus(ip4);
- for (;; i++)
- {
- if (ip4->focus_list[i] == IP4_INPUT_FOCUS_FIELD2)
- {
- ip4->current_focus = i;
- break;
- }
- }
- IP4_input_set_focus(ip4);
- }
- else if (PEN_CHECK_BOUND
- (x, y, ip4->field_input_box3.x, ip4->field_input_box3.y, ip4->field_input_box3.width,
- ip4->field_input_box3.height))
- {
- gui_single_line_input_box_goto_first_character(ip4->focus_input_box);
- IP4_input_reset_focus(ip4);
- for (;; i++)
- {
- if (ip4->focus_list[i] == IP4_INPUT_FOCUS_FIELD3)
- {
- ip4->current_focus = i;
- break;
- }
- }
- IP4_input_set_focus(ip4);
- }
- else if (PEN_CHECK_BOUND
- (x, y, ip4->field_input_box4.x, ip4->field_input_box4.y, ip4->field_input_box4.width,
- ip4->field_input_box4.height))
- {
- gui_single_line_input_box_goto_first_character(ip4->focus_input_box);
- IP4_input_reset_focus(ip4);
- for (;; i++)
- {
- if (ip4->focus_list[i] == IP4_INPUT_FOCUS_FIELD4)
- {
- ip4->current_focus = i;
- break;
- }
- }
- IP4_input_set_focus(ip4);
- }
- else
- {
- /*
- * for(;;i++)
- * {
- * if (ip4->focus_list[i]==IP4_INPUT_FOCUS_NONE)
- * {
- * ip4->current_focus = i-1;
- * break;
- * }
- * }
- * IP4_input_set_focus(ip4);
- */
- return;
- }
- gui_show_single_line_input_box_ext(ip4->focus_input_box, x, y);
- if (gui_single_line_input_box_test_last_character_position(ip4->focus_input_box))
- {
- gui_single_line_input_box_goto_last_character(ip4->focus_input_box);
- gui_single_line_input_box_previous(ip4->focus_input_box);
- }
- show_IP4_input(ip4);
- }
- }
- #endif /* defined (__MMI_TOUCH_SCREEN__) */
- /*****************************************************************************
- * FUNCTION
- * IP4_input_set_seperator
- * DESCRIPTION
- *
- * PARAMETERS
- * d [IN]
- * seperator [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_set_seperator(IP4_input *d, UI_character_type seperator)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 sw, x1, x2;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- d->seperator = seperator;
- gui_set_font(d->field_input_box1.text_font);
- sw = gui_get_character_width(d->seperator);
- x1 = d->field_input_box1.x + d->field_input_box1.width - 1;
- x2 = d->field_input_box2.x;
- d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->field_input_box2.x + d->field_input_box2.width - 1;
- x2 = d->field_input_box3.x;
- d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- x1 = d->field_input_box3.x + d->field_input_box3.width - 1;
- x2 = d->field_input_box4.x;
- d->s3_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
- }
- /* a global variabel o ftype IP4_input */
- IP4_input *current_IP4_input = NULL;
- /*----------------------------------------------------------------------------
- Function: current_IP4_input_callback
- Description: a function pointer store the address of function
- of I4 input callback
- Input Parameters: none
- Output Parameters: none
- Returns: void
- ----------------------------------------------------------------------------*/
- void (*current_IP4_input_callback) (void) = UI_dummy_function;
- /*****************************************************************************
- * FUNCTION
- * set_current_IP4_input
- * DESCRIPTION
- * Set the global variable of IP4_input equal to valeu pass as parameter
- * PARAMETERS
- * d [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_IP4_input(IP4_input *d)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_IP4_input = d;
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_direct_input
- * DESCRIPTION
- * append the currentinsert character to IP4 text and show the Ip4 text box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_direct_input(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_IP4_input->focus_input_box))
- {
- if (IP4_input_set_next_focus(current_IP4_input))
- {
- gui_single_line_input_box_insert_character(current_IP4_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_IP4_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_IP4_input->focus_input_box))
- {
- if (!IP4_input_set_next_focus(current_IP4_input))
- {
- gui_single_line_input_box_previous(current_IP4_input->focus_input_box);
- }
- }
- }
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- current_IP4_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_direct_input_nodraw
- * DESCRIPTION
- * insert the character in date input box and redraw date input box
- * PARAMETERS
- * c [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_direct_input_nodraw(UI_character_type c)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_position_overflow(current_IP4_input->focus_input_box))
- {
- if (IP4_input_set_next_focus(current_IP4_input))
- {
- gui_single_line_input_box_insert_character(current_IP4_input->focus_input_box, c);
- }
- }
- else
- {
- gui_single_line_input_box_insert_character(current_IP4_input->focus_input_box, c);
- if (gui_single_line_input_box_test_last_position_overflow(current_IP4_input->focus_input_box))
- {
- if (!IP4_input_set_next_focus(current_IP4_input))
- {
- gui_single_line_input_box_previous(current_IP4_input->focus_input_box);
- }
- }
- }
- current_IP4_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_test_last_position
- * DESCRIPTION
- * test current position is the last position or not
- * PARAMETERS
- * ip4 [IN]
- * RETURNS
- * S32
- *****************************************************************************/
- S32 IP4_input_test_last_position(IP4_input *ip4)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ip4->focus_list[ip4->current_focus + 1] != IP4_INPUT_FOCUS_NONE)
- {
- return 0;
- }
- else
- {
- if (gui_single_line_input_box_test_last_character_position(ip4->focus_input_box))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_delete_character
- * DESCRIPTION
- * delete character of IP4 input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_delete_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_IP4_input->focus_input_box))
- {
- IP4_input_set_previous_focus(current_IP4_input);
- }
- else
- {
- gui_single_line_input_box_delete_character(current_IP4_input->focus_input_box);
- if (gui_single_line_input_box_test_first_position(current_IP4_input->focus_input_box))
- {
- IP4_input_set_previous_focus(current_IP4_input);
- }
- }
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- current_IP4_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_previous_character
- * DESCRIPTION
- * set focus to previous character
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_previous_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_first_position(current_IP4_input->focus_input_box))
- {
- if (IP4_input_set_previous_focus(current_IP4_input))
- {
- gui_single_line_input_box_goto_last_character(current_IP4_input->focus_input_box);
- gui_single_line_input_box_previous(current_IP4_input->focus_input_box);
- }
- }
- else
- {
- gui_single_line_input_box_previous(current_IP4_input->focus_input_box);
- }
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_next_character
- * DESCRIPTION
- * set focus to next caharacter
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_next_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- if (gui_single_line_input_box_test_last_character_position(current_IP4_input->focus_input_box))
- {
- IP4_input_set_next_focus(current_IP4_input);
- }
- else
- {
- gui_single_line_input_box_next(current_IP4_input->focus_input_box);
- }
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_toggle_insert_mode
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_toggle_insert_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- gui_single_line_input_box_toggle_insert_mode(current_IP4_input->focus_input_box);
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_delete_current_character
- * DESCRIPTION
- * delete current charactert of IP4 input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_delete_current_character(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- /* delete current caharcter of IP4 input box */
- gui_single_line_input_box_delete_current_character(current_IP4_input->focus_input_box);
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- current_IP4_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_delete_all_characters
- * DESCRIPTION
- * delete all characterts of IP4 input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_delete_all_characters(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_IP4_input == NULL)
- {
- return;
- }
- if (current_IP4_input->focus_input_box == NULL)
- {
- return;
- }
- /* delete all charcters of IP4 input box */
- gui_single_line_input_box_delete_all(current_IP4_input->focus_input_box);
- /* show IP4 input box */
- show_IP4_input(current_IP4_input);
- current_IP4_input_callback();
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_numeric_keyboard_input_handler
- * DESCRIPTION
- * handle numeric key input of IP4 input box
- * PARAMETERS
- * keyc [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_numeric_keyboard_input_handler(S32 keyc)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keyc >= '0' && keyc <= '9')
- {
- IP4_input_direct_input((U8) keyc);
- }
- else if (keyc == 0x08)
- {
- IP4_input_delete_character();
- }
- else if (keyc == 0x1b)
- {
- IP4_input_delete_all_characters();
- }
- else if (keyc == 0x0d);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_handle_key_down
- * DESCRIPTION
- * funtion handle key down event of IP4 input box
- * PARAMETERS
- * k [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_handle_key_down(MMI_key_code_type k)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IP4_input_direct_input((UI_character_type) ('0' + k));
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_key_handler
- * DESCRIPTION
- * regsiter key handlers of IP4 input box
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_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:
- IP4_input_previous_character();
- break;
- case 38: /* up */
- break;
- case 39:
- IP4_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:
- IP4_input_toggle_insert_mode();
- break;
- case 46:
- IP4_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
- * IP4_input_register_keys
- * DESCRIPTION
- * regsiter key handlers of IP4 input box
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_input_register_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_MMI_key_input_handler();
- register_key_down_handler(IP4_input_handle_key_down);
- register_keyboard_input_handler(IP4_input_numeric_keyboard_input_handler);
- SetKeyHandler(IP4_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(IP4_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- register_keyboard_key_handler(IP4_input_key_handler);
- }
- /*****************************************************************************
- * FUNCTION
- * IP4_input_clear_keys
- * DESCRIPTION
- * clear all key events of IP4 input
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void IP4_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_IP4_input_callback
- * DESCRIPTION
- * registe IP4 input callback function
- * PARAMETERS
- * f [IN]
- * function(?) [IN] Pointer
- * RETURNS
- * void
- *****************************************************************************/
- void register_IP4_input_callback(void (*f) (void))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_IP4_input_callback = f;
- }
- /*****************************************************************************
- * FUNCTION
- * clear_IP4_input_callback
- * DESCRIPTION
- * clear ip4 input callback to dummy function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void clear_IP4_input_callback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- current_IP4_input_callback = UI_dummy_function;
- }
- /* global variable of main lcd time objet */
- UI_date_time_display main_LCD_time_object;
- void (*MMI_main_LCD_time_duration_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
- /*****************************************************************************
- * FUNCTION
- * set_main_LCD_time_duration_hide_function
- * DESCRIPTION
- * set hide time duration function for main lcd
- * PARAMETERS
- * f [IN]
- * function(?) [IN] Ptr f
- * RETURNS
- * void
- *****************************************************************************/
- void set_main_LCD_time_duration_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_main_LCD_time_duration_hide_function = f;
- }
- /*****************************************************************************
- * FUNCTION
- * set_time_duration
- * DESCRIPTION
- * set main lcd time duration object
- * PARAMETERS
- * t [IN]
- * duration [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_time_duration(UI_time *t, U32 duration)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_LCD_time_object.duration.t = *t; /* set the duration value */
- kal_get_time(&last_duration_ticks);
- last_duration = duration;
- }
- /*****************************************************************************
- * FUNCTION
- * get_time_duration
- * DESCRIPTION
- * get main lcd time duration object
- * PARAMETERS
- * t [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_time_duration(UI_time *t)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *t = main_LCD_time_object.duration.t; /* get the duration value */
- }
- /*****************************************************************************
- * FUNCTION
- * get_duration_string
- * DESCRIPTION
- * get main lcd time duration string
- * PARAMETERS
- * t [IN]
- * s [IN]
- * flags [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_duration_string(UI_time *t, UI_string_type s, U32 flags)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 hours, minutes, seconds;
- S8 ts[32];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hours = get_hours(t);
- minutes = get_minutes(t);
- seconds = get_seconds(t);
- sprintf((S8*) ts, "%02d:%02d:%02d", hours, minutes, seconds);
- AnsiiToUnicodeString((S8*) s, ts);
- }
- /*****************************************************************************
- * FUNCTION
- * time_display_duration
- * DESCRIPTION
- * display time duration
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_display_duration(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UI_character_type s[64];
- S32 x1, y1, x2, y2;
- S32 w;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- x1 = main_LCD_time_object.duration.x;
- y1 = main_LCD_time_object.duration.y;
- x2 = main_LCD_time_object.duration.width + x1 - 1;
- y2 = main_LCD_time_object.duration.height + y1 - 1;
- main_LCD_time_object.duration.hide_function(x1, y1, x2, y2); /* call hide function of call duration */
- gui_set_font(main_LCD_time_object.duration.font);
- /* get call duration in string fromat */
- get_duration_string(&main_LCD_time_object.duration.t, (UI_string_type) s, main_LCD_time_object.flags);
- gui_set_text_color(main_LCD_time_object.duration.text_color);
- w = gui_get_string_width(s);
- if (r2lMMIFlag)
- {
- //gui_move_text_cursor(x1 + w, y1);
- gui_move_text_cursor(x1+((main_LCD_time_object.duration.width-w)>>1)+w, y1);
- }
- else
- {
- //gui_move_text_cursor(x1, y1);
- gui_move_text_cursor(x1+((main_LCD_time_object.duration.width-w)>>1), y1);
- }
- gui_set_text_clip(x1, y1, x2, y2);
- /* print call duration */
- gui_print_text(s);
- gdi_layer_blt_previous(x1, y1, x2, y2);
- }
- /*****************************************************************************
- * FUNCTION
- * time_update_duration
- * DESCRIPTION
- * update time duration
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void time_update_duration(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- increment_ticks(&main_LCD_time_object.duration.t); /* increment secods by 1 */
- time_display_duration();
- gui_start_timer(300, time_update_duration);
- }
- /*****************************************************************************
- * FUNCTION
- * set_time_display
- * DESCRIPTION
- * set time duration object properties
- * PARAMETERS
- * flags [IN]
- * x [IN]
- * y [IN]
- * width [IN]
- * height [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_time_display(U32 flags, S32 x, S32 y, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- main_LCD_time_object.flags = (flags & DT_FLAGS_TYPE);
- main_LCD_time_object.duration.hide_function = MMI_main_LCD_time_duration_hide_function;
- main_LCD_time_object.duration.font = &MMI_large_font;
- main_LCD_time_object.duration.text_color = *current_MMI_theme->datetime_bar_duration_text_color;
- main_LCD_time_object.duration.x = x;
- main_LCD_time_object.duration.y = y;
- main_LCD_time_object.duration.width = width;
- main_LCD_time_object.duration.height = height;
- gui_cancel_timer(time_update_duration);
- if (flags != 0)
- {
- gui_start_timer(300, time_update_duration);
- }
- gdi_layer_unlock_frame_buffer();
- }
- /*****************************************************************************
- * FUNCTION
- * close_main_LCD_time_display
- * DESCRIPTION
- * disable main lcd time display
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void close_main_LCD_time_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_cancel_timer(time_update_duration);
- }
- /*****************************************************************************
- * FUNCTION
- * enactive_main_lcd_update_date_time
- * DESCRIPTION
- * enable update date time for main lcd
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void enactive_main_lcd_update_date_time(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_lcd_update_date_time = MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * deactive_main_lcd_update_date_time
- * DESCRIPTION
- * disable update date time for main lcd
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void deactive_main_lcd_update_date_time(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_lcd_update_date_time = MMI_FALSE;
- }
- #ifdef __MMI_SUBLCD__
- /*****************************************************************************
- * FUNCTION
- * enactive_sub_lcd_update_date_time
- * DESCRIPTION
- * enable update date time display for sublcd
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void enactive_sub_lcd_update_date_time(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sub_lcd_update_date_time = MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * deactive_sub_lcd_update_date_time
- * DESCRIPTION
- * disable update date time display for sublcd
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void deactive_sub_lcd_update_date_time(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sub_lcd_update_date_time = MMI_FALSE;
- }
- #endif /* __MMI_SUBLCD__ */
- /*****************************************************************************
- * FUNCTION
- * set_main_lcd_duration_position
- * DESCRIPTION
- * set the position of duration display on main lcd
- * PARAMETERS
- * x [IN]
- * y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void set_main_lcd_duration_position(U16 x, U16 y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_LCD_dt_object.duration.x = x;
- main_LCD_dt_object.duration.y = y;
- }
- /* PMT HIMANSHU START 20050721 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- /*****************************************************************************
- * FUNCTION
- * wgui_set_clock_type
- * DESCRIPTION
- * set the value of the current clock to be displayed.
- * PARAMETERS
- * clock_type [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_set_clock_type(U8 clock_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (clock_type)
- {
- case ANALOG:
- g_clock_type = ANALOG;
- //idlescreen_bar_id = IMG_TECHNO_ANALOG_CLOCK;//070306 Alpha layer //KP Jerry disable for separate display IMG_TECHNO_IDLESCREEN_BAR and IMG_TECHNO_ANALOG_CLOCK/IMG_TECHNO_DIGITAL_CLOCK on 2007-3-9
- break;
- case DIGITAL:
- g_clock_type = DIGITAL;
- //idlescreen_bar_id = IMG_TECHNO_DIGITAL_CLOCK; //KP Jerry disable for separate display IMG_TECHNO_IDLESCREEN_BAR and IMG_TECHNO_ANALOG_CLOCK/IMG_TECHNO_DIGITAL_CLOCK on 2007-3-9
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * set_day_display
- * DESCRIPTION
- * set the pointer to point to the current day string
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void set_day_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- day_string = get_string((U16) (STR_IDLESCREEN_SUNDAY + main_LCD_dt_object.date.t.DayIndex));
- }
- /*****************************************************************************
- * FUNCTION
- * show_main_LCD_day_display
- * DESCRIPTION
- * show the day string on main lcd in techon idlescreeen
- * bar
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void show_main_LCD_day_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 x1, y1, x2, y2;
- S32 w, h;
- stFontAttribute *font;
- color text_color, text_border_color;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- text_color = gui_color(255, 255, 255);
- #ifdef __MMI_MAINLCD_240X320__
- font = (&MMI_medium_font);
- text_border_color = gui_color(18, 114, 175);
- #else /* __MMI_MAINLCD_240X320__ */
- font = (&MMI_small_font);
- text_border_color = gui_color(0, 0, 0);
- #endif /* __MMI_MAINLCD_240X320__ */
- gui_set_font(font);
- gui_measure_string(day_string, &w, &h);
- gui_set_text_color(text_color);
- gui_set_text_border_color(text_border_color);
- x1 = ANALOG_BACKGROUND_X + ANALOG_BACKGROUND_WIDTH +1;
- y1 = MMI_status_bar_height + ((MMI_IDLESCREEN_BAR_HEIGHT + (MMI_IDLESCREEN_BAR_HEIGHT >> 1) - h) >> 1)-30; //设置星期几显示y位置
- x2 = UI_device_width - MMI_SIGNAL_WIDTH;
- y2 = y1 + h - 1;
- gdi_layer_push_clip();
- gui_set_clip(x1, y1-1, x2, y2+1);//091206 idlescreen day
- /* PMT HIMANSHU START 20051012 */
- /* Day string is not coming at right location in case of r2lMMIFlag is ON.
- So move the cursor at correct position. */
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(x2 - 2, y1);
- }
- else
- {
- gui_move_text_cursor(((x2 - 2) - w)-15, y1);
- }
- /* PMT HIMANSHU END 20051012 */
- gui_print_bordered_text(day_string);
- gdi_layer_pop_clip();
- }
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END 20050721 */