wgui_datetime.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:498k
源码类别:

MTK

开发平台:

C/C++

  1.  * FUNCTION
  2.  *  close_sub_LCD_dt_display
  3.  * DESCRIPTION
  4.  *  set all function pointer of date tiem display of sub  lcd
  5.  *  to dummy functions
  6.  * PARAMETERS
  7.  *  void
  8.  * RETURNS
  9.  *  void
  10.  *****************************************************************************/
  11. void close_sub_LCD_dt_display(void)
  12. {
  13.     /*----------------------------------------------------------------*/
  14.     /* Local Variables                                                */
  15.     /*----------------------------------------------------------------*/
  16.     /*----------------------------------------------------------------*/
  17.     /* Code Body                                                      */
  18.     /*----------------------------------------------------------------*/
  19.     MMI_sub_LCD_dt_update_function = UI_dummy_function;
  20.     MMI_sub_LCD_dt_display_function = UI_dummy_function;
  21.     MMI_sub_LCD_dt_hide_function = UI_dummy_function;
  22.     MMI_sub_LCD_dt_close_function();
  23.     MMI_sub_LCD_dt_close_function = UI_dummy_function;
  24.     MMI_sub_LCD_dt_date_hide_function = UI_dummy_hide_function;
  25.     MMI_sub_LCD_dt_time_hide_function = UI_dummy_hide_function;
  26.     MMI_sub_LCD_dt_duration_hide_function = UI_dummy_hide_function;
  27. }
  28. /* global variable store the call cost symbol */
  29. PU8 UI_call_cost_symbol = NULL;
  30. /* global variable store the call cost valeu */
  31. PU8 UI_call_cost_value = NULL;
  32. extern MMI_BOOL CM_call_cost_show;//102506 call cost
  33. /*****************************************************************************
  34.  * FUNCTION
  35.  *  reset_call_cost_UI
  36.  * DESCRIPTION
  37.  *  reset the call cost and call symbol to null
  38.  * PARAMETERS
  39.  *  void
  40.  * RETURNS
  41.  *  void
  42.  *****************************************************************************/
  43. void reset_call_cost_UI(void)
  44. {
  45.     /*----------------------------------------------------------------*/
  46.     /* Local Variables                                                */
  47.     /*----------------------------------------------------------------*/
  48.     /*----------------------------------------------------------------*/
  49.     /* Code Body                                                      */
  50.     /*----------------------------------------------------------------*/
  51.     UI_call_cost_symbol = NULL;
  52.     UI_call_cost_value = NULL;
  53. }
  54. /*****************************************************************************
  55.  * FUNCTION
  56.  *  show_call_cost_UI
  57.  * DESCRIPTION
  58.  *  show call cost on active calll screen
  59.  * PARAMETERS
  60.  *  symbol      [IN]        Currency symbol
  61.  *  value       [IN]        Total cost
  62.  * RETURNS
  63.  *  void
  64.  *****************************************************************************/
  65. /* code added vandana mehtani AOC   */
  66. void show_call_cost_UI(PU8 symbol, PU8 value)
  67. {
  68.     /*----------------------------------------------------------------*/
  69.     /* Local Variables                                                */
  70.     /*----------------------------------------------------------------*/
  71.     S32 string_width, string_height;
  72.     UI_character_type Buffer[30];
  73.     S32 tx, ty, x;
  74.     color c = *current_MMI_theme->datetime_bar_AOC_text_color;
  75.     /*----------------------------------------------------------------*/
  76.     /* Code Body                                                      */
  77.     /*----------------------------------------------------------------*/
  78.     UI_call_cost_symbol = symbol;
  79.     UI_call_cost_value = value;
  80.     PRINT_INFORMATION(("show_call_cost_UI: In show_call_cost_UI"));
  81.     if ((NULL == symbol) || (NULL == value))
  82.     {
  83.         PRINT_INFORMATION(("show_call_cost_UI: Null symbol or Null Value"));
  84.         return;
  85.     }
  86.     if (CM_call_cost_show == MMI_FALSE)//102506 call cost
  87.     {
  88.         return;//not in category 19 or 20
  89.     }
  90.     x = (UI_device_width >> 1) + 16;
  91.     gui_set_font(&MMI_default_font);
  92.     gui_strcpy(Buffer, (U16*) symbol);
  93.     gui_strcat(Buffer, (UI_string_type) " ");
  94.     gui_strcat(Buffer, (UI_string_type) value);
  95.     string_width = gui_get_string_width(Buffer);
  96.     string_height = gui_get_character_height();
  97.     ty = main_LCD_dt_object.duration.y;
  98.     main_LCD_dt_object.duration.hide_function(x, ty, UI_device_width - 1, ty + string_height - 1);      /* call duration hide function */
  99.     MMI_ASSERT(main_LCD_dt_object.duration.hide_function!=NULL);//102506 call cost
  100.     tx = UI_device_width - string_width - 2;
  101.     gdi_layer_reset_clip();
  102.     if (r2lMMIFlag)
  103.     {
  104.         gui_move_text_cursor(tx + string_width, ty);
  105.     }
  106.     else
  107.     {
  108.         gui_move_text_cursor(tx, ty);
  109.     }
  110.     gui_set_text_color(c);
  111.     /* print callcost */
  112.     gui_print_text(Buffer);
  113.     gdi_layer_blt_previous((UI_device_width - 1) >> 1, ty, UI_device_width - 1, ty + string_height - 1);
  114. }
  115. /*****************************************************************************
  116.  * FUNCTION
  117.  *  redraw_call_cost_UI
  118.  * DESCRIPTION
  119.  *  update cost value on active call screen
  120.  * PARAMETERS
  121.  *  void
  122.  * RETURNS
  123.  *  void
  124.  *****************************************************************************/
  125. void redraw_call_cost_UI(void)
  126. {
  127.     /*----------------------------------------------------------------*/
  128.     /* Local Variables                                                */
  129.     /*----------------------------------------------------------------*/
  130.     /*----------------------------------------------------------------*/
  131.     /* Code Body                                                      */
  132.     /*----------------------------------------------------------------*/
  133.     show_call_cost_UI(UI_call_cost_symbol, UI_call_cost_value);
  134. }
  135. /* code ended vandana mehtani */
  136. /* Theme data for formatted input objects. Should be obtained from theme resource   */
  137. /* date time input box background color scheme */
  138. UI_filled_area date_time_input_background_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
  139.     UI_NULL_IMAGE,
  140.     NULL,
  141.     {255, 255, 255, 100},
  142.     {0, 0, 0, 0},
  143.     {0, 0, 0, 100},
  144.     {0, 0, 0, 0},
  145.     0
  146. };
  147. /* date time input box field color scheme */
  148. UI_filled_area date_time_input_field_filler = {UI_FILLED_AREA_TYPE_COLOR,
  149.     UI_NULL_IMAGE,
  150.     NULL,
  151.     {255, 255, 255, 100},
  152.     {0, 0, 0, 0},
  153.     {0, 0, 0, 0},
  154.     {0, 0, 0, 0},
  155.     0
  156. };
  157. UI_single_line_input_box_theme date_time_input_theme = { &date_time_input_field_filler,
  158.     &date_time_input_field_filler,
  159.     &date_time_input_field_filler,
  160.     {0, 0, 0, 100},
  161.     {128, 128, 128, 100},
  162.     {0, 0, 0, 100},
  163.     {255, 255, 255, 100},
  164.     {51, 88, 171, 100},
  165.     {255, 0, 0, 100},
  166.     &UI_DEFAULT_FONT,
  167.     0,
  168.     UI_SINGLE_LINE_INPUT_BOX_CENTER_Y,
  169.     '*'
  170. };
  171. /*****************************************************************************
  172.  * FUNCTION
  173.  *  max_num_of_days
  174.  * DESCRIPTION
  175.  *  
  176.  * PARAMETERS
  177.  *  y       [IN]        
  178.  *  m       [IN]        
  179.  * RETURNS
  180.  *  
  181.  *****************************************************************************/
  182. U8 max_num_of_days(S32 y, S32 m)
  183. {
  184.     /*----------------------------------------------------------------*/
  185.     /* Local Variables                                                */
  186.     /*----------------------------------------------------------------*/
  187.     /*----------------------------------------------------------------*/
  188.     /* Code Body                                                      */
  189.     /*----------------------------------------------------------------*/
  190.     if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
  191.     {
  192.         return 31;
  193.     }
  194.     else if (m == 4 || m == 6 || m == 9 || m == 11)
  195.     {
  196.         return 30;
  197.     }
  198.     else    /* Feb */
  199.     {
  200.         U8 isLeap = 0;
  201.         if (y % 400 == 0)
  202.         {
  203.             isLeap = 1;
  204.         }
  205.         else if (y % 100 == 0)
  206.         {
  207.             isLeap = 0;
  208.         }
  209.         else if (y % 4 == 0)
  210.         {
  211.             isLeap = 1;
  212.         }
  213.         else
  214.         {
  215.             isLeap = 0;
  216.         }
  217.         return 28 + isLeap;
  218.     }
  219. }
  220. /*****************************************************************************
  221.  * FUNCTION
  222.  *  validMonth
  223.  * DESCRIPTION
  224.  *  
  225.  * PARAMETERS
  226.  *  y       [IN]        
  227.  *  m       [IN]        
  228.  *  d       [IN]        
  229.  * RETURNS
  230.  *  
  231.  *****************************************************************************/
  232. BOOL validMonth(S32 y, S32 m, S32 d)
  233. {
  234.     /*----------------------------------------------------------------*/
  235.     /* Local Variables                                                */
  236.     /*----------------------------------------------------------------*/
  237.     /*----------------------------------------------------------------*/
  238.     /* Code Body                                                      */
  239.     /*----------------------------------------------------------------*/
  240.     if ((m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) && d <= 31)
  241.     {
  242.         return TRUE;
  243.     }
  244.     else if ((m == 4 || m == 6 || m == 9 || m == 11) && d <= 30)
  245.     {
  246.         return TRUE;
  247.     }
  248.     else    /* Feb */
  249.     {
  250.         /* U8 isLeap = 0; */
  251.         if ((y % 400 == 0) && d <= 29)
  252.         {
  253.             return TRUE;
  254.         }
  255.         else if (y % 100 == 0 && d <= 28)
  256.         {
  257.             return TRUE;
  258.         }
  259.         else if (y % 4 == 0 && d <= 29)
  260.         {
  261.             return TRUE;
  262.         }
  263.         else if (d <= 28)
  264.         {
  265.             return TRUE;
  266.         }
  267.         else
  268.         {
  269.             return FALSE;
  270.         }
  271.     }
  272. }
  273. /* Default Date validation functions   */
  274. /*****************************************************************************
  275.  * FUNCTION
  276.  *  default_inline_date_day_validation
  277.  * DESCRIPTION
  278.  *  validation function of day input of inline editing
  279.  * PARAMETERS
  280.  *  text            [IN]        Text
  281.  *  cursor          [IN]        
  282.  *  text_length     [IN]        Text length
  283.  * RETURNS
  284.  *  void
  285.  *****************************************************************************/
  286. void default_inline_date_day_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
  287. {
  288.     /*----------------------------------------------------------------*/
  289.     /* Local Variables                                                */
  290.     /*----------------------------------------------------------------*/
  291.     S32 i = gui_atoi((UI_string_type) text);
  292.     S32 l = gui_strlen((UI_string_type) text);
  293.     S32 y = gui_atoi((UI_string_type) current_date_input->year_input_box.text);
  294.     S32 m = gui_atoi((UI_string_type) current_date_input->month_input_box.text);
  295.     U8 d = 0;
  296.     /*----------------------------------------------------------------*/
  297.     /* Code Body                                                      */
  298.     /*----------------------------------------------------------------*/
  299.     d = max_num_of_days(y, m);
  300.     if ((i < 1) && (l > 1))
  301.     {
  302.         i = 1;
  303.         gui_sprintf((UI_string_type) text, "%02d", i);
  304.         /* Play error tone here */
  305.         UI_editor_play_tone_invalid_data();
  306.     }
  307.     else if (i > d)
  308.     {
  309.         i = d;
  310.         gui_sprintf((UI_string_type) text, "%02d", i);
  311.         /* Play error tone here */
  312.         UI_editor_play_tone_invalid_data();
  313.     }
  314. }
  315. /*****************************************************************************
  316.  * FUNCTION
  317.  *  set_inline_date_boundary
  318.  * DESCRIPTION
  319.  *  to set date setting boundary
  320.  * PARAMETERS
  321.  *  date_year_max       [IN]        
  322.  *  date_year_min       [IN]        
  323.  *  date_month_max      [IN]        
  324.  *  date_month_min      [IN]        
  325.  * RETURNS
  326.  *  void
  327.  *****************************************************************************/
  328. void set_inline_date_boundary(S32 date_year_max, S32 date_year_min, S32 date_month_max, S32 date_month_min)
  329. {
  330.     /*----------------------------------------------------------------*/
  331.     /* Local Variables                                                */
  332.     /*----------------------------------------------------------------*/
  333.     /*----------------------------------------------------------------*/
  334.     /* Code Body                                                      */
  335.     /*----------------------------------------------------------------*/
  336.     g_date_year_max = date_year_max;
  337.     g_date_year_min = date_year_min;
  338.     g_date_month_max = date_month_max;
  339.     g_date_month_min = date_month_min;
  340. }
  341. /*****************************************************************************
  342.  * FUNCTION
  343.  *  default_inline_date_month_validation
  344.  * DESCRIPTION
  345.  *  validation function of month input of inline editing
  346.  * PARAMETERS
  347.  *  text            [IN]        Text
  348.  *  cursor          [IN]        
  349.  *  text_length     [IN]        Text length
  350.  * RETURNS
  351.  *  void
  352.  *****************************************************************************/
  353. void default_inline_date_month_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
  354. {
  355.     /*----------------------------------------------------------------*/
  356.     /* Local Variables                                                */
  357.     /*----------------------------------------------------------------*/
  358.     S32 i = gui_atoi((UI_string_type) text);
  359.     S32 l = gui_strlen((UI_string_type) text);
  360.     /*----------------------------------------------------------------*/
  361.     /* Code Body                                                      */
  362.     /*----------------------------------------------------------------*/
  363.     if ((i < g_date_month_min) && (l > 1))
  364.     {
  365.         i = g_date_month_min;
  366.         gui_sprintf((UI_string_type) text, "%02d", i);
  367.         /* Play error tone here */
  368.         UI_editor_play_tone_invalid_data();
  369.     }
  370.     else if (i > g_date_month_max)
  371.     {
  372.         i = g_date_month_max;
  373.         gui_sprintf((UI_string_type) text, "%02d", i);
  374.         /* Play error tone here */
  375.         UI_editor_play_tone_invalid_data();
  376.     }
  377.     default_inline_date_day_validation(
  378.         current_date_input->day_input_box.text,
  379.         current_date_input->day_input_box.current_text_p,
  380.         (current_date_input->day_input_box.text_length >> 1) - 1);
  381. }
  382. /*****************************************************************************
  383.  * FUNCTION
  384.  *  default_inline_date_year_validation
  385.  * DESCRIPTION
  386.  *  validation function of year input of inline editing
  387.  * PARAMETERS
  388.  *  text            [IN]        Text
  389.  *  cursor          [IN]        
  390.  *  text_length     [IN]        Text length
  391.  * RETURNS
  392.  *  void
  393.  *****************************************************************************/
  394. void default_inline_date_year_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
  395. {
  396.     /*----------------------------------------------------------------*/
  397.     /* Local Variables                                                */
  398.     /*----------------------------------------------------------------*/
  399.     S32 i = gui_atoi((UI_string_type) text);
  400.     S32 l = gui_strlen((UI_string_type) text);
  401.     /*----------------------------------------------------------------*/
  402.     /* Code Body                                                      */
  403.     /*----------------------------------------------------------------*/
  404.     if ((i < g_date_year_min) && (l > 3))
  405.     {
  406.         i = g_date_year_min;
  407.         gui_sprintf((UI_string_type) text, "%04d", i);
  408.         /* Play error tone here */
  409.         UI_editor_play_tone_invalid_data();
  410.     }
  411.     else if (i > g_date_year_max)
  412.     {
  413.         i = g_date_year_max;
  414.         gui_sprintf((UI_string_type) text, "%04d", i);
  415.         /* Play error tone here */
  416.         UI_editor_play_tone_invalid_data();
  417.     }
  418.     default_inline_date_month_validation(
  419.         current_date_input->month_input_box.text,
  420.         current_date_input->month_input_box.current_text_p,
  421.         (current_date_input->month_input_box.text_length >> 1) - 1);
  422.     default_inline_date_day_validation(
  423.         current_date_input->day_input_box.text,
  424.         current_date_input->day_input_box.current_text_p,
  425.         (current_date_input->day_input_box.text_length >> 1) - 1);
  426. }
  427. /* Date input object */
  428. /*****************************************************************************
  429.  * FUNCTION
  430.  *  date_input_show_background
  431.  * DESCRIPTION
  432.  *  show the background color of date input box
  433.  * PARAMETERS
  434.  *  d       [IN]        
  435.  * RETURNS
  436.  *  void
  437.  *****************************************************************************/
  438. void date_input_show_background(date_input *d)
  439. {
  440.     /*----------------------------------------------------------------*/
  441.     /* Local Variables                                                */
  442.     /*----------------------------------------------------------------*/
  443.     S32 x1, y1, x2, y2;
  444.     /*----------------------------------------------------------------*/
  445.     /* Code Body                                                      */
  446.     /*----------------------------------------------------------------*/
  447.     gdi_layer_reset_clip();
  448.     x1 = d->x;
  449.     y1 = d->y;
  450.     x2 = x1 + d->width - 1;
  451.     y2 = y1 + d->height - 1;
  452.     gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
  453. }
  454. /*****************************************************************************
  455.  * FUNCTION
  456.  *  date_input_reset_focus
  457.  * DESCRIPTION
  458.  *  reset focus of date input box to noram state
  459.  * PARAMETERS
  460.  *  d       [IN]        
  461.  * RETURNS
  462.  *  void
  463.  *****************************************************************************/
  464. void date_input_reset_focus(date_input *d)
  465. {
  466.     /*----------------------------------------------------------------*/
  467.     /* Local Variables                                                */
  468.     /*----------------------------------------------------------------*/
  469.     /*----------------------------------------------------------------*/
  470.     /* Code Body                                                      */
  471.     /*----------------------------------------------------------------*/
  472.     d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  473.     d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  474.     d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  475.     d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  476.     d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  477.     d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  478.     d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  479.     d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  480.     d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  481.     d->focus_input_box = NULL;
  482. }
  483. /*****************************************************************************
  484.  * FUNCTION
  485.  *  date_input_set_focus
  486.  * DESCRIPTION
  487.  *  reset focus of date input box
  488.  * PARAMETERS
  489.  *  d       [IN]        
  490.  * RETURNS
  491.  *  void
  492.  *****************************************************************************/
  493. void date_input_set_focus(date_input *d)
  494. {
  495.     /*----------------------------------------------------------------*/
  496.     /* Local Variables                                                */
  497.     /*----------------------------------------------------------------*/
  498.     /*----------------------------------------------------------------*/
  499.     /* Code Body                                                      */
  500.     /*----------------------------------------------------------------*/
  501.     if ((d->current_focus < 1) || (d->current_focus > 3))
  502.     {
  503.         return;
  504.     }
  505.     switch (d->focus_list[d->current_focus])
  506.     {
  507.         case DATE_INPUT_FOCUS_DAY:
  508.             d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  509.             d->day_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  510.             d->day_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  511.             d->focus_input_box = &d->day_input_box;
  512.             break;
  513.         case DATE_INPUT_FOCUS_MONTH:
  514.             d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  515.             d->month_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  516.             d->month_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  517.             d->focus_input_box = &d->month_input_box;
  518.             break;
  519.         case DATE_INPUT_FOCUS_YEAR:
  520.             d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  521.             d->year_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  522.             d->year_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  523.             d->focus_input_box = &d->year_input_box;
  524.             break;
  525.     }
  526. }
  527. /*****************************************************************************
  528.  * FUNCTION
  529.  *  date_input_set_default_focus
  530.  * DESCRIPTION
  531.  *  set the defualt focus of date input box
  532.  * PARAMETERS
  533.  *  d       [IN]        
  534.  * RETURNS
  535.  *  void
  536.  *****************************************************************************/
  537. void date_input_set_default_focus(date_input *d)
  538. {
  539.     /*----------------------------------------------------------------*/
  540.     /* Local Variables                                                */
  541.     /*----------------------------------------------------------------*/
  542.     S32 i;
  543.     /*----------------------------------------------------------------*/
  544.     /* Code Body                                                      */
  545.     /*----------------------------------------------------------------*/
  546.     switch (d->flags & DATE_INPUT_TYPE_DEFAULT_FOCUS_MASK)
  547.     {
  548.         case DATE_INPUT_TYPE_DEFAULT_FOCUS_DAY:
  549.             for (i = 0; i < 5; i++)
  550.             {
  551.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_DAY)
  552.                 {
  553.                     d->current_focus = i;
  554.                 }
  555.             }
  556.             break;
  557.         case DATE_INPUT_TYPE_DEFAULT_FOCUS_MONTH:
  558.             for (i = 0; i < 5; i++)
  559.             {
  560.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_MONTH)
  561.                 {
  562.                     d->current_focus = i;
  563.                 }
  564.             }
  565.             break;
  566.         case DATE_INPUT_TYPE_DEFAULT_FOCUS_YEAR:
  567.             for (i = 0; i < 5; i++)
  568.             {
  569.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_YEAR)
  570.                 {
  571.                     d->current_focus = i;
  572.                 }
  573.             }
  574.             break;
  575.     }
  576. }
  577. /*****************************************************************************
  578.  * FUNCTION
  579.  *  create_date_input
  580.  * DESCRIPTION
  581.  *  create date input box
  582.  * PARAMETERS
  583.  *  d                   [IN]        Date input box
  584.  *  x                   [IN]        Start x position of date input box
  585.  *  y                   [IN]        Styart y position of date input box
  586.  *  width               [IN]        Width of date iput box
  587.  *  height              [IN]        Height of date input box
  588.  *  flags               [IN]        
  589.  *  day_buffer          [IN]        Store day value
  590.  *  month_buffer        [IN]        Store month value
  591.  *  year_buffer         [IN]        Store year value
  592.  * RETURNS
  593.  *  void
  594.  *****************************************************************************/
  595. void create_date_input(
  596.         date_input *d,
  597.         S32 x,
  598.         S32 y,
  599.         S32 width,
  600.         S32 height,
  601.         U32 flags,
  602.         UI_buffer_type day_buffer,
  603.         UI_buffer_type month_buffer,
  604.         UI_buffer_type year_buffer)
  605. {
  606.     /*----------------------------------------------------------------*/
  607.     /* Local Variables                                                */
  608.     /*----------------------------------------------------------------*/
  609.     S32 w1, w2, w3, h, ox, oy, sw, tw, l;
  610.     UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
  611.     /*----------------------------------------------------------------*/
  612.     /* Code Body                                                      */
  613.     /*----------------------------------------------------------------*/
  614.     d->x = x;
  615.     d->y = y;
  616.     d->width = width;
  617.     d->height = height;
  618.     d->flags = flags;
  619.     w1 = DATE_INPUT_DAY_WIDTH;
  620.     w2 = DATE_INPUT_MONTH_WIDTH;
  621.     w3 = DATE_INPUT_YEAR_WIDTH;
  622.     sw = DATE_INPUT_SEPERATOR_WIDTH;
  623.     tw = w1 + sw + w2 + sw + w3;
  624.     /* START VIJAY PMT 20060111...as menuitem height is one pixel less for this LCD size */
  625. #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
  626.     if (IsInlineItemDefaultTextEnable())
  627.     {
  628.         h = DATE_INPUT_HEIGHT - 1;
  629.     }
  630.     else
  631. #endif /* defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__ */ 
  632.         /* END VIJAY PMT 20060111 */
  633.         h = DATE_INPUT_HEIGHT;
  634.     oy = (height >> 1) - (h >> 1);
  635.     switch (flags & DATE_INPUT_JUSTIFY_MASK)
  636.     {
  637.         case DATE_INPUT_RIGHT_JUSTIFY:
  638.             ox = (width - tw);
  639.             break;
  640.         case DATE_INPUT_CENTER_JUSTIFY:
  641.             ox = (width >> 1) - (tw >> 1);
  642.             break;
  643.         default:
  644.             ox = 0;
  645.             break;
  646.     }
  647.     /* 20051012 HIMANSHU START INLINE DATE */
  648.     /* Inline item type Date must be left align in normal case and it must be right
  649.        align in case of r2lMMIFlag is ON, when the default text effect is enabled */
  650. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  651.     if (IsInlineItemDefaultTextEnable())
  652.     {
  653.         if (r2lMMIFlag)
  654.         {
  655.             ox = width - ox - tw - 1;
  656.         }
  657.     }
  658. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  659.     /* 20051012 HIMANSHU END INLINE DATE */
  660.     d->focus_list[0] = DATE_INPUT_FOCUS_NONE;
  661.     d->focus_list[4] = DATE_INPUT_FOCUS_NONE;
  662.     switch (flags & DATE_INPUT_TYPE_MASK)
  663.     {
  664.         case DATE_INPUT_TYPE_DD_MM_YYYY:
  665.             d->focus_list[1] = DATE_INPUT_FOCUS_DAY;
  666.             d->focus_list[2] = DATE_INPUT_FOCUS_MONTH;
  667.             d->focus_list[3] = DATE_INPUT_FOCUS_YEAR;
  668.             d->day_x = ox;
  669.             ox += w1 + sw;
  670.             d->month_x = ox;
  671.             ox += w2 + sw;
  672.             d->year_x = ox;
  673.             d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_DAY;
  674.             break;
  675.         case DATE_INPUT_TYPE_MM_DD_YYYY:
  676.             d->focus_list[1] = DATE_INPUT_FOCUS_MONTH;
  677.             d->focus_list[2] = DATE_INPUT_FOCUS_DAY;
  678.             d->focus_list[3] = DATE_INPUT_FOCUS_YEAR;
  679.             d->month_x = ox;
  680.             ox += w2 + sw;
  681.             d->day_x = ox;
  682.             ox += w1 + sw;
  683.             d->year_x = ox;
  684.             d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_MONTH;
  685.             break;
  686.         case DATE_INPUT_TYPE_YYYY_MM_DD:
  687.             d->focus_list[1] = DATE_INPUT_FOCUS_YEAR;
  688.             d->focus_list[2] = DATE_INPUT_FOCUS_MONTH;
  689.             d->focus_list[3] = DATE_INPUT_FOCUS_DAY;
  690.             d->year_x = ox;
  691.             ox += w3 + sw;
  692.             d->month_x = ox;
  693.             ox += w2 + sw;
  694.             d->day_x = ox;
  695.             d->flags |= DATE_INPUT_TYPE_DEFAULT_FOCUS_YEAR;
  696.             break;
  697.     }
  698.     current_single_line_input_box_theme = &date_time_input_theme;
  699.     d->day_y = oy;
  700.     d->month_y = oy;
  701.     d->year_y = oy;
  702.     d->s1_y = oy;
  703.     d->s2_y = oy;
  704. #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
  705.     if (!IsInlineItemDefaultTextEnable())
  706.     {
  707. #endif /* defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__ */ 
  708.         if ((h + 2) > height)
  709.         {
  710.             h = height - 2;
  711.         }
  712.     #if defined __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ && defined __MMI_MAINLCD_128X160__
  713.     }
  714.     #endif 
  715.     l = gui_strlen((UI_string_type) day_buffer) /* +1 */ ;
  716.     /* craete single inputbox of day */
  717.     gui_create_single_line_input_box_set_buffer(
  718.         &d->day_input_box,
  719.         x + d->day_x,
  720.         y + d->day_y,
  721.         w1,
  722.         h,
  723.         (UI_string_type) day_buffer,
  724.         DATE_INPUT_DAY_BUFFER_LENGTH,
  725.         (l + 1) * ENCODING_LENGTH,
  726.         0);
  727.     d->day_input_box.flags |=
  728.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  729.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  730.     gui_single_line_input_box_goto_first_character(&d->day_input_box);
  731.     l = gui_strlen((UI_string_type) month_buffer) /* +1 */ ;
  732.     /* craete single inputbox of month  */
  733.     gui_create_single_line_input_box_set_buffer(
  734.         &d->month_input_box,
  735.         x + d->month_x,
  736.         y + d->month_y,
  737.         w2,
  738.         h,
  739.         (UI_string_type) month_buffer,
  740.         DATE_INPUT_MONTH_BUFFER_LENGTH,
  741.         (l + 1) * ENCODING_LENGTH,
  742.         0);
  743.     d->month_input_box.flags |=
  744.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  745.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  746.     gui_single_line_input_box_goto_first_character(&d->month_input_box);
  747.     l = gui_strlen((UI_string_type) year_buffer) /* +1 */ ;
  748.     /* craete single inputbox of year */
  749.     gui_create_single_line_input_box_set_buffer(
  750.         &d->year_input_box,
  751.         x + d->year_x,
  752.         y + d->year_y,
  753.         w3,
  754.         h,
  755.         (UI_string_type) year_buffer,
  756.         DATE_INPUT_YEAR_BUFFER_LENGTH,
  757.         (l + 1) * ENCODING_LENGTH,
  758.         0);
  759.     /* MTK end */
  760.     d->year_input_box.flags |=
  761.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  762.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  763.     gui_single_line_input_box_goto_first_character(&d->year_input_box);
  764.     date_input_reset_focus(d);
  765.     date_input_set_default_focus(d);
  766.     date_input_set_focus(d);
  767.     /* set theme of input box */
  768.     current_single_line_input_box_theme = t;
  769.     /* Setup default validation functions  */
  770.     d->day_input_box.validation_callback = default_inline_date_day_validation;  /* set function pointer of validation of day input */
  771.     d->month_input_box.validation_callback = default_inline_date_month_validation;      /* set function pointer of validation of month input */
  772.     d->year_input_box.validation_callback = default_inline_date_year_validation;        /* set function pointer of validation of year input */
  773. }
  774. /*****************************************************************************
  775.  * FUNCTION
  776.  *  show_date_input
  777.  * DESCRIPTION
  778.  *  shaow date input box
  779.  * PARAMETERS
  780.  *  d       [IN]        Date input box
  781.  * RETURNS
  782.  *  void
  783.  *****************************************************************************/
  784. void show_date_input(date_input *d)
  785. {
  786.     /*----------------------------------------------------------------*/
  787.     /* Local Variables                                                */
  788.     /*----------------------------------------------------------------*/
  789.     S32 sw = 0;
  790.     UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
  791.     /*----------------------------------------------------------------*/
  792.     /* Code Body                                                      */
  793.     /*----------------------------------------------------------------*/
  794.     current_single_line_input_box_theme = &date_time_input_theme;
  795.     gui_set_single_line_input_box_current_theme(&d->day_input_box);
  796.     gui_set_single_line_input_box_current_theme(&d->month_input_box);
  797.     gui_set_single_line_input_box_current_theme(&d->year_input_box);
  798.     /* show day input box */
  799.     gui_show_single_line_input_box(&d->day_input_box);
  800.     /* show month input box */
  801.     gui_show_single_line_input_box(&d->month_input_box);
  802.     /* show day year box */
  803.     gui_show_single_line_input_box(&d->year_input_box);
  804.     gdi_layer_reset_clip();
  805.     gui_set_font(d->day_input_box.text_font);
  806.     gui_set_text_color(d->day_input_box.normal_text_color);
  807.     if (r2lMMIFlag)
  808.     {
  809.         gui_set_font(d->day_input_box.text_font);
  810.         sw = gui_get_character_width(d->seperator);
  811.         gui_move_text_cursor(d->s1_x + sw, d->s1_y + d->y);
  812.     }
  813.     else
  814.     {
  815.         gui_move_text_cursor(d->s1_x, d->s1_y + d->y);
  816.     }
  817.     gui_print_character(d->seperator);
  818.     if (r2lMMIFlag)
  819.     {
  820.         gui_move_text_cursor(d->s2_x + sw, d->s2_y + d->y);
  821.     }
  822.     else
  823.     {
  824.         gui_move_text_cursor(d->s2_x, d->s2_y + d->y);
  825.     }
  826.     /* print separtor */
  827.     gui_print_character(d->seperator);
  828.     gdi_layer_blt_previous(d->x, d->y, d->x + d->width - 1, d->y + d->height - 1);
  829.     current_single_line_input_box_theme = t;
  830. }
  831. /*****************************************************************************
  832.  * FUNCTION
  833.  *  date_input_set_next_focus
  834.  * DESCRIPTION
  835.  *  set the fous to next box of date input box
  836.  * PARAMETERS
  837.  *  d       [IN]        Date input box
  838.  * RETURNS
  839.  *  byte
  840.  *****************************************************************************/
  841. U8 date_input_set_next_focus(date_input *d)
  842. {
  843.     /*----------------------------------------------------------------*/
  844.     /* Local Variables                                                */
  845.     /*----------------------------------------------------------------*/
  846.     /*----------------------------------------------------------------*/
  847.     /* Code Body                                                      */
  848.     /*----------------------------------------------------------------*/
  849.     if (d->focus_list[d->current_focus + 1] == DATE_INPUT_FOCUS_NONE)
  850.     {
  851.         return (0);
  852.     }
  853.     else
  854.     {
  855.         date_input_reset_focus(d);
  856.         d->current_focus++;
  857.         date_input_set_focus(d);
  858.     #if defined(__MMI_TOUCH_SCREEN__)
  859.         gui_single_line_input_box_goto_first_character(d->focus_input_box);
  860.     #endif 
  861.         return (1);
  862.     }
  863. }
  864. /*****************************************************************************
  865.  * FUNCTION
  866.  *  date_input_set_previous_focus
  867.  * DESCRIPTION
  868.  *  set the focus to previous box oof date input box
  869.  * PARAMETERS
  870.  *  d       [IN]        Date input box
  871.  * RETURNS
  872.  *  byte
  873.  *****************************************************************************/
  874. U8 date_input_set_previous_focus(date_input *d)
  875. {
  876.     /*----------------------------------------------------------------*/
  877.     /* Local Variables                                                */
  878.     /*----------------------------------------------------------------*/
  879.     /*----------------------------------------------------------------*/
  880.     /* Code Body                                                      */
  881.     /*----------------------------------------------------------------*/
  882.     if (d->focus_list[d->current_focus - 1] == DATE_INPUT_FOCUS_NONE)
  883.     {
  884.         return (0);
  885.     }
  886.     else
  887.     {
  888.         date_input_reset_focus(d);
  889.         d->current_focus--;
  890.         date_input_set_focus(d);
  891.     #if defined(__MMI_TOUCH_SCREEN__)
  892.         gui_single_line_input_box_goto_last_character(d->focus_input_box);
  893.         gui_single_line_input_box_previous(d->focus_input_box);
  894.     #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  895.         return (1);
  896.     }
  897. }
  898. #if defined (__MMI_TOUCH_SCREEN__)
  899. /*****************************************************************************
  900.  * FUNCTION
  901.  *  date_input_move_to_x_y
  902.  * DESCRIPTION
  903.  *  set the cursor position to (x,y) position
  904.  * PARAMETERS
  905.  *  d       [IN]        Date input box S32 x S32 y
  906.  *  x       [IN]        
  907.  *  y       [IN]        
  908.  * RETURNS
  909.  *  void
  910.  *****************************************************************************/
  911. void date_input_move_to_x_y(date_input *d, S32 x, S32 y)
  912. {
  913.     /*----------------------------------------------------------------*/
  914.     /* Local Variables                                                */
  915.     /*----------------------------------------------------------------*/
  916.     int i = 1;
  917.     /*----------------------------------------------------------------*/
  918.     /* Code Body                                                      */
  919.     /*----------------------------------------------------------------*/
  920.     if (PEN_CHECK_BOUND(x, y, d->x, d->y, d->width, d->height))
  921.     {
  922.         if (PEN_CHECK_BOUND
  923.             (x, y, d->day_input_box.x, d->day_input_box.y, d->day_input_box.width, d->day_input_box.height))
  924.         {
  925.             gui_single_line_input_box_goto_first_character(d->focus_input_box);
  926.             date_input_reset_focus(d);
  927.             for (;; i++)
  928.             {
  929.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_DAY)
  930.                 {
  931.                     d->current_focus = i;
  932.                     break;
  933.                 }
  934.             }
  935.             date_input_set_focus(d);
  936.         }
  937.         else if (PEN_CHECK_BOUND
  938.                  (x, y, d->month_input_box.x, d->month_input_box.y, d->month_input_box.width,
  939.                   d->month_input_box.height))
  940.         {
  941.             gui_single_line_input_box_goto_first_character(d->focus_input_box);
  942.             date_input_reset_focus(d);
  943.             for (;; i++)
  944.             {
  945.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_MONTH)
  946.                 {
  947.                     d->current_focus = i;
  948.                     break;
  949.                 }
  950.             }
  951.             date_input_set_focus(d);
  952.         }
  953.         else if (PEN_CHECK_BOUND
  954.                  (x, y, d->year_input_box.x, d->year_input_box.y, d->year_input_box.width, d->year_input_box.height))
  955.         {
  956.             gui_single_line_input_box_goto_first_character(d->focus_input_box);
  957.             date_input_reset_focus(d);
  958.             for (;; i++)
  959.             {
  960.                 if (d->focus_list[i] == DATE_INPUT_FOCUS_YEAR)
  961.                 {
  962.                     d->current_focus = i;
  963.                     break;
  964.                 }
  965.             }
  966.             date_input_set_focus(d);
  967.         }
  968.         else
  969.         {
  970.             return;
  971.         }
  972.         gui_show_single_line_input_box_ext(d->focus_input_box, x, y);
  973.         if (gui_single_line_input_box_test_last_character_position(d->focus_input_box))
  974.         {
  975.             gui_single_line_input_box_goto_last_character(d->focus_input_box);
  976.             gui_single_line_input_box_previous(d->focus_input_box);
  977.         }
  978.         show_date_input(d);
  979.     }
  980. }
  981. #endif /* defined (__MMI_TOUCH_SCREEN__) */ 
  982. /*****************************************************************************
  983.  * FUNCTION
  984.  *  date_input_set_seperator
  985.  * DESCRIPTION
  986.  *  set the mask of date input box
  987.  * PARAMETERS
  988.  *  d               [IN]        Date input box
  989.  *  seperator       [IN]        
  990.  * RETURNS
  991.  *  void
  992.  *****************************************************************************/
  993. void date_input_set_seperator(date_input *d, UI_character_type seperator)
  994. {
  995.     /*----------------------------------------------------------------*/
  996.     /* Local Variables                                                */
  997.     /*----------------------------------------------------------------*/
  998.     S32 sw, x1, x2;
  999.     /*----------------------------------------------------------------*/
  1000.     /* Code Body                                                      */
  1001.     /*----------------------------------------------------------------*/
  1002.     d->seperator = seperator;
  1003.     gui_set_font(d->day_input_box.text_font);
  1004.     sw = gui_get_character_width(d->seperator);
  1005.     switch (d->flags & DATE_INPUT_TYPE_MASK)
  1006.     {
  1007.         case DATE_INPUT_TYPE_DD_MM_YYYY:
  1008.             x1 = d->day_input_box.x + d->day_input_box.width - 1;
  1009.             x2 = d->month_input_box.x;
  1010.             d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1011.             x1 = d->month_input_box.x + d->month_input_box.width - 1;
  1012.             x2 = d->year_input_box.x;
  1013.             d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1014.             break;
  1015.         case DATE_INPUT_TYPE_MM_DD_YYYY:
  1016.             x1 = d->month_input_box.x + d->month_input_box.width - 1;
  1017.             x2 = d->day_input_box.x;
  1018.             d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1019.             x1 = d->day_input_box.x + d->day_input_box.width - 1;
  1020.             x2 = d->year_input_box.x;
  1021.             d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1022.             break;
  1023.         case DATE_INPUT_TYPE_YYYY_MM_DD:
  1024.             x1 = d->year_input_box.x + d->year_input_box.width - 1;
  1025.             x2 = d->month_input_box.x;
  1026.             d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1027.             x1 = d->month_input_box.x + d->month_input_box.width - 1;
  1028.             x2 = d->day_input_box.x;
  1029.             d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  1030.             break;
  1031.     }
  1032. }
  1033. /* store the value of current date input */
  1034. date_input *current_date_input = NULL;
  1035. /*----------------------------------------------------------------------------
  1036. Function:         current_date_input_callback
  1037. Description:      a function pointer of current date input callback
  1038. Input Parameters: none
  1039. Output Parameters:   none
  1040. Returns:       none
  1041. ----------------------------------------------------------------------------*/
  1042. void (*current_date_input_callback) (void) = UI_dummy_function;
  1043. /*****************************************************************************
  1044.  * FUNCTION
  1045.  *  set_current_date_input
  1046.  * DESCRIPTION
  1047.  *  set current date input to global variable
  1048.  * PARAMETERS
  1049.  *  d       [IN]        
  1050.  * RETURNS
  1051.  *  void
  1052.  *****************************************************************************/
  1053. void set_current_date_input(date_input *d)
  1054. {
  1055.     /*----------------------------------------------------------------*/
  1056.     /* Local Variables                                                */
  1057.     /*----------------------------------------------------------------*/
  1058.     /*----------------------------------------------------------------*/
  1059.     /* Code Body                                                      */
  1060.     /*----------------------------------------------------------------*/
  1061.     current_date_input = d;
  1062. }
  1063. /*****************************************************************************
  1064.  * FUNCTION
  1065.  *  date_input_direct_input
  1066.  * DESCRIPTION
  1067.  *  insert the character in date input box and redraw date input box
  1068.  * PARAMETERS
  1069.  *  c       [IN]        
  1070.  * RETURNS
  1071.  *  void
  1072.  *****************************************************************************/
  1073. void date_input_direct_input(UI_character_type c)
  1074. {
  1075.     /*----------------------------------------------------------------*/
  1076.     /* Local Variables                                                */
  1077.     /*----------------------------------------------------------------*/
  1078.     /*----------------------------------------------------------------*/
  1079.     /* Code Body                                                      */
  1080.     /*----------------------------------------------------------------*/
  1081.     if (current_date_input == NULL)
  1082.     {
  1083.         return;
  1084.     }
  1085.     if (current_date_input->focus_input_box == NULL)
  1086.     {
  1087.         return;
  1088.     }
  1089.     if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
  1090.     {
  1091.         if (date_input_set_next_focus(current_date_input))
  1092.         {
  1093.             gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
  1094.         }
  1095.     }
  1096.     else
  1097.     {
  1098.         gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
  1099.         if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
  1100.         {
  1101.             if (!date_input_set_next_focus(current_date_input))
  1102.             {
  1103.                 gui_single_line_input_box_previous(current_date_input->focus_input_box);
  1104.             }
  1105.         }
  1106.     }
  1107.     /* show date input box */
  1108.     show_date_input(current_date_input);
  1109.     /* call daet input validation function */
  1110.     current_date_input_callback();
  1111. }
  1112. /*****************************************************************************
  1113.  * FUNCTION
  1114.  *  date_input_direct_input_nodraw
  1115.  * DESCRIPTION
  1116.  *  insert the character in date input box and redraw date input box
  1117.  * PARAMETERS
  1118.  *  c       [IN]        
  1119.  * RETURNS
  1120.  *  void
  1121.  *****************************************************************************/
  1122. void date_input_direct_input_nodraw(UI_character_type c)
  1123. {
  1124.     /*----------------------------------------------------------------*/
  1125.     /* Local Variables                                                */
  1126.     /*----------------------------------------------------------------*/
  1127.     /*----------------------------------------------------------------*/
  1128.     /* Code Body                                                      */
  1129.     /*----------------------------------------------------------------*/
  1130.     if (current_date_input == NULL)
  1131.     {
  1132.         return;
  1133.     }
  1134.     if (current_date_input->focus_input_box == NULL)
  1135.     {
  1136.         return;
  1137.     }
  1138.     if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
  1139.     {
  1140.         if (date_input_set_next_focus(current_date_input))
  1141.         {
  1142.             gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
  1143.         }
  1144.     }
  1145.     else
  1146.     {
  1147.         gui_single_line_input_box_insert_character(current_date_input->focus_input_box, c);
  1148.         if (gui_single_line_input_box_test_last_position_overflow(current_date_input->focus_input_box))
  1149.         {
  1150.             if (!date_input_set_next_focus(current_date_input))
  1151.             {
  1152.                 gui_single_line_input_box_previous(current_date_input->focus_input_box);
  1153.             }
  1154.         }
  1155.     }
  1156.     current_date_input_callback();
  1157. }
  1158. /*****************************************************************************
  1159.  * FUNCTION
  1160.  *  date_input_test_last_position
  1161.  * DESCRIPTION
  1162.  *  test current position is the last position or not
  1163.  * PARAMETERS
  1164.  *  d       [IN]        
  1165.  * RETURNS
  1166.  *  S32
  1167.  *****************************************************************************/
  1168. S32 date_input_test_last_position(date_input *d)
  1169. {
  1170.     /*----------------------------------------------------------------*/
  1171.     /* Local Variables                                                */
  1172.     /*----------------------------------------------------------------*/
  1173.     /*----------------------------------------------------------------*/
  1174.     /* Code Body                                                      */
  1175.     /*----------------------------------------------------------------*/
  1176.     if (d->focus_list[d->current_focus + 1] != DATE_INPUT_FOCUS_NONE)
  1177.     {
  1178.         return 0;
  1179.     }
  1180.     else
  1181.     {
  1182.         if (gui_single_line_input_box_test_last_character_position(d->focus_input_box))
  1183.         {
  1184.             return 1;
  1185.         }
  1186.         else
  1187.         {
  1188.             return 0;
  1189.         }
  1190.     }
  1191. }
  1192. /*****************************************************************************
  1193.  * FUNCTION
  1194.  *  date_input_delete_character
  1195.  * DESCRIPTION
  1196.  *  delete current character of date input box
  1197.  * PARAMETERS
  1198.  *  void
  1199.  *  nonoe(?)        [IN]        
  1200.  * RETURNS
  1201.  *  void
  1202.  *****************************************************************************/
  1203. void date_input_delete_character(void)
  1204. {
  1205.     /*----------------------------------------------------------------*/
  1206.     /* Local Variables                                                */
  1207.     /*----------------------------------------------------------------*/
  1208.     /*----------------------------------------------------------------*/
  1209.     /* Code Body                                                      */
  1210.     /*----------------------------------------------------------------*/
  1211.     if (current_date_input == NULL)
  1212.     {
  1213.         return;
  1214.     }
  1215.     if (current_date_input->focus_input_box == NULL)
  1216.     {
  1217.         return;
  1218.     }
  1219.     if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
  1220.     {
  1221.         date_input_set_previous_focus(current_date_input);
  1222.     }
  1223.     else
  1224.     {
  1225.         gui_single_line_input_box_delete_character(current_date_input->focus_input_box);
  1226.         if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
  1227.         {
  1228.             date_input_set_previous_focus(current_date_input);
  1229.         }
  1230.     }
  1231.     /* show date input box */
  1232.     show_date_input(current_date_input);
  1233.     current_date_input_callback();
  1234. }
  1235. /*****************************************************************************
  1236.  * FUNCTION
  1237.  *  date_input_previous_character
  1238.  * DESCRIPTION
  1239.  *  set the focus to previous caharacter  of daet input box
  1240.  * PARAMETERS
  1241.  *  void
  1242.  * RETURNS
  1243.  *  void
  1244.  *****************************************************************************/
  1245. void date_input_previous_character(void)
  1246. {
  1247.     /*----------------------------------------------------------------*/
  1248.     /* Local Variables                                                */
  1249.     /*----------------------------------------------------------------*/
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Code Body                                                      */
  1252.     /*----------------------------------------------------------------*/
  1253.     if (current_date_input == NULL)
  1254.     {
  1255.         return;
  1256.     }
  1257.     if (current_date_input->focus_input_box == NULL)
  1258.     {
  1259.         return;
  1260.     }
  1261.     if (gui_single_line_input_box_test_first_position(current_date_input->focus_input_box))
  1262.     {
  1263.         if (date_input_set_previous_focus(current_date_input))
  1264.         {
  1265.             gui_single_line_input_box_goto_last_character(current_date_input->focus_input_box);
  1266.             gui_single_line_input_box_previous(current_date_input->focus_input_box);
  1267.         }
  1268.     }
  1269.     else
  1270.     {
  1271.         gui_single_line_input_box_previous(current_date_input->focus_input_box);
  1272.     }
  1273.     /* show date input box */
  1274.     show_date_input(current_date_input);
  1275. }
  1276. /*****************************************************************************
  1277.  * FUNCTION
  1278.  *  date_input_next_character
  1279.  * DESCRIPTION
  1280.  *  set the focus to next caharacter  of date input box
  1281.  * PARAMETERS
  1282.  *  void
  1283.  * RETURNS
  1284.  *  void
  1285.  *****************************************************************************/
  1286. void date_input_next_character(void)
  1287. {
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Local Variables                                                */
  1290.     /*----------------------------------------------------------------*/
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Code Body                                                      */
  1293.     /*----------------------------------------------------------------*/
  1294.     if (current_date_input == NULL)
  1295.     {
  1296.         return;
  1297.     }
  1298.     if (current_date_input->focus_input_box == NULL)
  1299.     {
  1300.         return;
  1301.     }
  1302.     if (gui_single_line_input_box_test_last_character_position(current_date_input->focus_input_box))
  1303.     {
  1304.         date_input_set_next_focus(current_date_input);
  1305.     }
  1306.     else
  1307.     {
  1308.         gui_single_line_input_box_next(current_date_input->focus_input_box);
  1309.     }
  1310.     /* show date input box */
  1311.     show_date_input(current_date_input);
  1312. }
  1313. /*****************************************************************************
  1314.  * FUNCTION
  1315.  *  date_input_toggle_insert_mode
  1316.  * DESCRIPTION
  1317.  *  toggle the insert mode of date input box
  1318.  * PARAMETERS
  1319.  *  void
  1320.  * RETURNS
  1321.  *  void
  1322.  *****************************************************************************/
  1323. void date_input_toggle_insert_mode(void)
  1324. {
  1325.     /*----------------------------------------------------------------*/
  1326.     /* Local Variables                                                */
  1327.     /*----------------------------------------------------------------*/
  1328.     /*----------------------------------------------------------------*/
  1329.     /* Code Body                                                      */
  1330.     /*----------------------------------------------------------------*/
  1331.     if (current_date_input == NULL)
  1332.     {
  1333.         return;
  1334.     }
  1335.     if (current_date_input->focus_input_box == NULL)
  1336.     {
  1337.         return;
  1338.     }
  1339.     gui_single_line_input_box_toggle_insert_mode(current_date_input->focus_input_box);
  1340.     /* show date input box */
  1341.     show_date_input(current_date_input);
  1342. }
  1343. /*****************************************************************************
  1344.  * FUNCTION
  1345.  *  date_input_delete_current_character
  1346.  * DESCRIPTION
  1347.  *  delete the current character of date input box
  1348.  * PARAMETERS
  1349.  *  void
  1350.  * RETURNS
  1351.  *  void
  1352.  *****************************************************************************/
  1353. void date_input_delete_current_character(void)
  1354. {
  1355.     /*----------------------------------------------------------------*/
  1356.     /* Local Variables                                                */
  1357.     /*----------------------------------------------------------------*/
  1358.     /*----------------------------------------------------------------*/
  1359.     /* Code Body                                                      */
  1360.     /*----------------------------------------------------------------*/
  1361.     if (current_date_input == NULL)
  1362.     {
  1363.         return;
  1364.     }
  1365.     if (current_date_input->focus_input_box == NULL)
  1366.     {
  1367.         return;
  1368.     }
  1369.     gui_single_line_input_box_delete_current_character(current_date_input->focus_input_box);
  1370.     /* show date input box */
  1371.     show_date_input(current_date_input);
  1372.     current_date_input_callback();
  1373. }
  1374. /*****************************************************************************
  1375.  * FUNCTION
  1376.  *  date_input_delete_all_characters
  1377.  * DESCRIPTION
  1378.  *  delete all characters of date input box
  1379.  * PARAMETERS
  1380.  *  void
  1381.  * RETURNS
  1382.  *  void
  1383.  *****************************************************************************/
  1384. void date_input_delete_all_characters(void)
  1385. {
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Local Variables                                                */
  1388.     /*----------------------------------------------------------------*/
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Code Body                                                      */
  1391.     /*----------------------------------------------------------------*/
  1392.     if (current_date_input == NULL)
  1393.     {
  1394.         return;
  1395.     }
  1396.     if (current_date_input->focus_input_box == NULL)
  1397.     {
  1398.         return;
  1399.     }
  1400.     /* delete all characters */
  1401.     gui_single_line_input_box_delete_all(current_date_input->focus_input_box);
  1402.     /* show date input box */
  1403.     show_date_input(current_date_input);
  1404.     current_date_input_callback();
  1405. }
  1406. /*****************************************************************************
  1407.  * FUNCTION
  1408.  *  date_input_numeric_keyboard_input_handler
  1409.  * DESCRIPTION
  1410.  *  handle numeric key input of date input box
  1411.  * PARAMETERS
  1412.  *  keyc        [IN]        
  1413.  * RETURNS
  1414.  *  void
  1415.  *****************************************************************************/
  1416. void date_input_numeric_keyboard_input_handler(S32 keyc)
  1417. {
  1418.     /*----------------------------------------------------------------*/
  1419.     /* Local Variables                                                */
  1420.     /*----------------------------------------------------------------*/
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Code Body                                                      */
  1423.     /*----------------------------------------------------------------*/
  1424.     if (keyc >= '0' && keyc <= '9')
  1425.     {
  1426.         date_input_direct_input((U8) keyc);
  1427.     }
  1428.     else if (keyc == 0x08)
  1429.     {
  1430.         date_input_delete_character();
  1431.     }
  1432.     else if (keyc == 0x1b)
  1433.     {
  1434.         date_input_delete_all_characters();
  1435.     }
  1436.     else if (keyc == 0x0d);
  1437. }
  1438. /*****************************************************************************
  1439.  * FUNCTION
  1440.  *  date_input_handle_key_down
  1441.  * DESCRIPTION
  1442.  *  handle date input key down
  1443.  * PARAMETERS
  1444.  *  k       [IN]        
  1445.  * RETURNS
  1446.  *  void
  1447.  *****************************************************************************/
  1448. void date_input_handle_key_down(MMI_key_code_type k)
  1449. {
  1450.     /*----------------------------------------------------------------*/
  1451.     /* Local Variables                                                */
  1452.     /*----------------------------------------------------------------*/
  1453.     /*----------------------------------------------------------------*/
  1454.     /* Code Body                                                      */
  1455.     /*----------------------------------------------------------------*/
  1456.     date_input_direct_input((UI_character_type) ('0' + k));
  1457. }
  1458. /*****************************************************************************
  1459.  * FUNCTION
  1460.  *  date_input_key_handler
  1461.  * DESCRIPTION
  1462.  *  register the key handler of date input box
  1463.  * PARAMETERS
  1464.  *  vkey_code       [IN]        
  1465.  *  key_state       [IN]        
  1466.  * RETURNS
  1467.  *  void
  1468.  *****************************************************************************/
  1469. void date_input_key_handler(S32 vkey_code, S32 key_state)
  1470. {
  1471. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1472.     /*----------------------------------------------------------------*/
  1473.     /* Local Variables                                                */
  1474.     /*----------------------------------------------------------------*/
  1475.     /*----------------------------------------------------------------*/
  1476.     /* Code Body                                                      */
  1477.     /*----------------------------------------------------------------*/
  1478.     if (key_state)
  1479.     {
  1480.         switch (vkey_code)
  1481.         {
  1482.             case 37:
  1483.                 date_input_previous_character();
  1484.                 break;
  1485.             case 38:    /* up */
  1486.                 break;
  1487.             case 39:
  1488.                 date_input_next_character();
  1489.                 break;
  1490.             case 40:    /* down */
  1491.                 break;
  1492.             case 36:    /* home */
  1493.                 break;
  1494.             case 35:    /* end */
  1495.                 break;
  1496.             case 33:    /* page up */
  1497.                 break;
  1498.             case 34:    /* page down */
  1499.                 break;
  1500.             case 45:
  1501.                 date_input_toggle_insert_mode();
  1502.                 break;
  1503.             case 46:
  1504.                 date_input_delete_current_character();
  1505.                 break;
  1506.         }
  1507.     }
  1508. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1509.     UI_UNUSED_PARAMETER(vkey_code);
  1510.     UI_UNUSED_PARAMETER(key_state);
  1511. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1512. }
  1513. /*****************************************************************************
  1514.  * FUNCTION
  1515.  *  date_input_register_keys
  1516.  * DESCRIPTION
  1517.  *  register date input box key handlers
  1518.  * PARAMETERS
  1519.  *  void
  1520.  * RETURNS
  1521.  *  void
  1522.  *****************************************************************************/
  1523. void date_input_register_keys(void)
  1524. {
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Local Variables                                                */
  1527.     /*----------------------------------------------------------------*/
  1528.     /*----------------------------------------------------------------*/
  1529.     /* Code Body                                                      */
  1530.     /*----------------------------------------------------------------*/
  1531.     register_MMI_key_input_handler();
  1532.     register_key_down_handler(date_input_handle_key_down);
  1533.     register_keyboard_input_handler(date_input_numeric_keyboard_input_handler);
  1534.     SetKeyHandler(date_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1535.     SetKeyHandler(date_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1536.     register_keyboard_key_handler(date_input_key_handler);
  1537. }
  1538. /*****************************************************************************
  1539.  * FUNCTION
  1540.  *  date_input_clear_keys
  1541.  * DESCRIPTION
  1542.  *  clear all key handlers of date input box
  1543.  * PARAMETERS
  1544.  *  void
  1545.  * RETURNS
  1546.  *  void
  1547.  *****************************************************************************/
  1548. void date_input_clear_keys(void)
  1549. {
  1550.     /*----------------------------------------------------------------*/
  1551.     /* Local Variables                                                */
  1552.     /*----------------------------------------------------------------*/
  1553.     /*----------------------------------------------------------------*/
  1554.     /* Code Body                                                      */
  1555.     /*----------------------------------------------------------------*/
  1556.     clear_MMI_key_input_handler();
  1557.     clear_key_down_handler();
  1558.     clear_keyboard_input_handler();
  1559.     ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1560.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1561.     clear_keyboard_key_handler();
  1562. }
  1563. /*****************************************************************************
  1564.  * FUNCTION
  1565.  *  register_date_input_callback
  1566.  * DESCRIPTION
  1567.  *  register date input call back function
  1568.  * PARAMETERS
  1569.  *  f               [IN]        
  1570.  *  function(?)     [IN]        Pointer
  1571.  * RETURNS
  1572.  *  void
  1573.  *****************************************************************************/
  1574. void register_date_input_callback(void (*f) (void))
  1575. {
  1576.     /*----------------------------------------------------------------*/
  1577.     /* Local Variables                                                */
  1578.     /*----------------------------------------------------------------*/
  1579.     /*----------------------------------------------------------------*/
  1580.     /* Code Body                                                      */
  1581.     /*----------------------------------------------------------------*/
  1582.     current_date_input_callback = f;
  1583. }
  1584. /*****************************************************************************
  1585.  * FUNCTION
  1586.  *  clear_date_input_callback
  1587.  * DESCRIPTION
  1588.  *  clear date input callback
  1589.  * PARAMETERS
  1590.  *  void
  1591.  * RETURNS
  1592.  *  void
  1593.  *****************************************************************************/
  1594. void clear_date_input_callback(void)
  1595. {
  1596.     /*----------------------------------------------------------------*/
  1597.     /* Local Variables                                                */
  1598.     /*----------------------------------------------------------------*/
  1599.     /*----------------------------------------------------------------*/
  1600.     /* Code Body                                                      */
  1601.     /*----------------------------------------------------------------*/
  1602.     current_date_input_callback = UI_dummy_function;
  1603. }
  1604. /* Default Time validation functions   */
  1605. /*****************************************************************************
  1606.  * FUNCTION
  1607.  *  default_inline_time_minutes_validation
  1608.  * DESCRIPTION
  1609.  *  deafult function of time mnutes validation
  1610.  * PARAMETERS
  1611.  *  text            [IN]        
  1612.  *  cursor          [IN]        
  1613.  *  text_length     [IN]        
  1614.  * RETURNS
  1615.  *  void
  1616.  *****************************************************************************/
  1617. void default_inline_time_minutes_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
  1618. {
  1619.     /*----------------------------------------------------------------*/
  1620.     /* Local Variables                                                */
  1621.     /*----------------------------------------------------------------*/
  1622.     S32 i = gui_atoi((UI_string_type) text);
  1623.     /*----------------------------------------------------------------*/
  1624.     /* Code Body                                                      */
  1625.     /*----------------------------------------------------------------*/
  1626.     if (i < 0)
  1627.     {
  1628.         i = 0;
  1629.         gui_sprintf((UI_string_type) text, "%02d", i);
  1630.         UI_editor_play_tone_invalid_data();
  1631.     }
  1632.     else if (i > 59)
  1633.     {
  1634.         i = 59;
  1635.         gui_sprintf((UI_string_type) text, "%02d", i);
  1636.         UI_editor_play_tone_invalid_data();
  1637.     }
  1638. }
  1639. /*****************************************************************************
  1640.  * FUNCTION
  1641.  *  default_inline_time_hours_validation
  1642.  * DESCRIPTION
  1643.  *  deafult function of time hours validation
  1644.  * PARAMETERS
  1645.  *  text            [IN]        
  1646.  *  cursor          [IN]        
  1647.  *  text_length     [IN]        
  1648.  * RETURNS
  1649.  *  void
  1650.  *****************************************************************************/
  1651. void default_inline_time_hours_validation(UI_buffer_type text, UI_buffer_type cursor, S32 text_length)
  1652. {
  1653.     /*----------------------------------------------------------------*/
  1654.     /* Local Variables                                                */
  1655.     /*----------------------------------------------------------------*/
  1656.     S32 i = gui_atoi((UI_string_type) text);
  1657.     /*----------------------------------------------------------------*/
  1658.     /* Code Body                                                      */
  1659.     /*----------------------------------------------------------------*/
  1660.     if (i < 0)
  1661.     {
  1662.         i = 0;
  1663.         gui_sprintf((UI_string_type) text, "%02d", i);
  1664.         UI_editor_play_tone_invalid_data();
  1665.     }
  1666.     else if (i > 23)
  1667.     {
  1668.         i = 23;
  1669.         gui_sprintf((UI_string_type) text, "%02d", i);
  1670.         UI_editor_play_tone_invalid_data();
  1671.     }
  1672. }
  1673. /* Time input object */
  1674. /*****************************************************************************
  1675.  * FUNCTION
  1676.  *  time_input_show_background
  1677.  * DESCRIPTION
  1678.  *  show time input bkg color
  1679.  * PARAMETERS
  1680.  *  d       [IN]        
  1681.  * RETURNS
  1682.  *  void
  1683.  *****************************************************************************/
  1684. void time_input_show_background(time_input *d)
  1685. {
  1686.     /*----------------------------------------------------------------*/
  1687.     /* Local Variables                                                */
  1688.     /*----------------------------------------------------------------*/
  1689.     S32 x1, y1, x2, y2;
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Code Body                                                      */
  1692.     /*----------------------------------------------------------------*/
  1693.     gdi_layer_reset_clip();
  1694.     x1 = d->x;
  1695.     y1 = d->y;
  1696.     x2 = x1 + d->width - 1;
  1697.     y2 = y1 + d->height - 1;
  1698.     gui_draw_filled_area(x1, y1, x2, y2, &date_time_input_background_filler);
  1699. }
  1700. /*****************************************************************************
  1701.  * FUNCTION
  1702.  *  time_input_reset_focus
  1703.  * DESCRIPTION
  1704.  *  reset teh foucs of time input
  1705.  * PARAMETERS
  1706.  *  d       [IN]        
  1707.  * RETURNS
  1708.  *  void
  1709.  *****************************************************************************/
  1710. void time_input_reset_focus(time_input *d)
  1711. {
  1712.     /*----------------------------------------------------------------*/
  1713.     /* Local Variables                                                */
  1714.     /*----------------------------------------------------------------*/
  1715.     /*----------------------------------------------------------------*/
  1716.     /* Code Body                                                      */
  1717.     /*----------------------------------------------------------------*/
  1718.     d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1719.     d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1720.     d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1721.     d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1722.     d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1723.     d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1724.     d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1725.     d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1726.     d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1727.     d->focus_input_box = NULL;
  1728. }
  1729. /*****************************************************************************
  1730.  * FUNCTION
  1731.  *  time_input_set_focus
  1732.  * DESCRIPTION
  1733.  *  set the focus of time input box
  1734.  * PARAMETERS
  1735.  *  d       [IN]        
  1736.  * RETURNS
  1737.  *  void
  1738.  *****************************************************************************/
  1739. void time_input_set_focus(time_input *d)
  1740. {
  1741.     /*----------------------------------------------------------------*/
  1742.     /* Local Variables                                                */
  1743.     /*----------------------------------------------------------------*/
  1744.     /*----------------------------------------------------------------*/
  1745.     /* Code Body                                                      */
  1746.     /*----------------------------------------------------------------*/
  1747.     if ((d->current_focus < 1) || (d->current_focus > 3))
  1748.     {
  1749.         return;
  1750.     }
  1751.     switch (d->focus_list[d->current_focus])
  1752.     {
  1753.         case TIME_INPUT_FOCUS_HOURS:
  1754.             d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1755.             d->hours_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1756.             d->hours_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1757.             d->focus_input_box = &d->hours_input_box;
  1758.             break;
  1759.         case TIME_INPUT_FOCUS_MINUTES:
  1760.             d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1761.             d->minutes_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1762.             d->minutes_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1763.             d->focus_input_box = &d->minutes_input_box;
  1764.             break;
  1765.         case TIME_INPUT_FOCUS_SECONDS:
  1766.             d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_STATE_NORMAL;
  1767.             d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_STATE_SELECTED;
  1768.             d->seconds_input_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW;
  1769.             d->focus_input_box = &d->seconds_input_box;
  1770.             break;
  1771.     }
  1772. }
  1773. /*****************************************************************************
  1774.  * FUNCTION
  1775.  *  time_input_set_default_focus
  1776.  * DESCRIPTION
  1777.  *  set the default  focus of time input box
  1778.  * PARAMETERS
  1779.  *  d       [IN]        
  1780.  * RETURNS
  1781.  *  void
  1782.  *****************************************************************************/
  1783. void time_input_set_default_focus(time_input *d)
  1784. {
  1785.     /*----------------------------------------------------------------*/
  1786.     /* Local Variables                                                */
  1787.     /*----------------------------------------------------------------*/
  1788.     S32 i;
  1789.     /*----------------------------------------------------------------*/
  1790.     /* Code Body                                                      */
  1791.     /*----------------------------------------------------------------*/
  1792.     switch (d->flags & TIME_INPUT_TYPE_DEFAULT_FOCUS_MASK)
  1793.     {
  1794.         case TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS:
  1795.             for (i = 0; i < 5; i++)
  1796.             {
  1797.                 if (d->focus_list[i] == TIME_INPUT_FOCUS_HOURS)
  1798.                 {
  1799.                     d->current_focus = i;
  1800.                 }
  1801.             }
  1802.             break;
  1803.         case TIME_INPUT_TYPE_DEFAULT_FOCUS_MINUTES:
  1804.             for (i = 0; i < 5; i++)
  1805.             {
  1806.                 if (d->focus_list[i] == TIME_INPUT_FOCUS_MINUTES)
  1807.                 {
  1808.                     d->current_focus = i;
  1809.                 }
  1810.             }
  1811.             break;
  1812.         case TIME_INPUT_TYPE_DEFAULT_FOCUS_SECONDS:
  1813.             for (i = 0; i < 5; i++)
  1814.             {
  1815.                 if (d->focus_list[i] == TIME_INPUT_FOCUS_SECONDS)
  1816.                 {
  1817.                     d->current_focus = i;
  1818.                 }
  1819.             }
  1820.             break;
  1821.     }
  1822. }
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  create_time_input
  1826.  * DESCRIPTION
  1827.  *  create time input box
  1828.  * PARAMETERS
  1829.  *  d                   [IN]        Time input box
  1830.  *  x                   [IN]        Start x position of time input box
  1831.  *  y                   [IN]        Strat y position of time input box
  1832.  *  width               [IN]        Width of time input box
  1833.  *  height              [IN]        Height of time input box
  1834.  *  flags               [IN]        
  1835.  *  hours_buffer        [IN]        Hours buffer
  1836.  *  minutes_buffer      [IN]        Minutes buffer
  1837.  *  seconds_buffer      [IN]        Seconds buffer
  1838.  * RETURNS
  1839.  *  void
  1840.  *****************************************************************************/
  1841. void create_time_input(
  1842.         time_input *d,
  1843.         S32 x,
  1844.         S32 y,
  1845.         S32 width,
  1846.         S32 height,
  1847.         U32 flags,
  1848.         UI_buffer_type hours_buffer,
  1849.         UI_buffer_type minutes_buffer,
  1850.         UI_buffer_type seconds_buffer)
  1851. {
  1852.     /*----------------------------------------------------------------*/
  1853.     /* Local Variables                                                */
  1854.     /*----------------------------------------------------------------*/
  1855.     S32 w1, w2, w3, h, ox, oy, sw, tw, l;
  1856.     UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
  1857.     /*----------------------------------------------------------------*/
  1858.     /* Code Body                                                      */
  1859.     /*----------------------------------------------------------------*/
  1860.     d->x = x;
  1861.     d->y = y;
  1862.     d->width = width;
  1863.     d->height = height;
  1864.     d->flags = flags;
  1865.     w1 = TIME_INPUT_HOURS_WIDTH;
  1866.     w2 = TIME_INPUT_MINUTES_WIDTH;
  1867.     w3 = TIME_INPUT_SECONDS_WIDTH;
  1868.     sw = TIME_INPUT_SEPERATOR_WIDTH;
  1869.     if ((flags & TIME_INPUT_TYPE_MASK) == TIME_INPUT_TYPE_HH_MM)
  1870.     {
  1871.         tw = w1 + sw + w2;
  1872.     }
  1873.     else
  1874.     {
  1875.         tw = w1 + sw + w2 + sw + w3;
  1876.     }
  1877.     h = TIME_INPUT_HEIGHT;
  1878.     oy = (height >> 1) - (h >> 1);
  1879.     switch (flags & TIME_INPUT_JUSTIFY_MASK)
  1880.     {
  1881.         case TIME_INPUT_RIGHT_JUSTIFY:
  1882.             ox = (width - tw);
  1883.             break;
  1884.         case TIME_INPUT_CENTER_JUSTIFY:
  1885.             ox = (width >> 1) - (tw >> 1);
  1886.             break;
  1887.         default:
  1888.             ox = 0;
  1889.             break;
  1890.     }
  1891.     /* 20051012 HIMANSHU START INLINE TIME */
  1892.     /* Inline item type Time must be left align in normal case and it must be right
  1893.        align in case of r2lMMIFlag is ON, when the default text effect is enabled */
  1894. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1895.     if (IsInlineItemDefaultTextEnable())
  1896.     {
  1897.         if (r2lMMIFlag)
  1898.         {
  1899.             ox = width - ox - tw - 1;
  1900.         }
  1901.     }
  1902. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  1903.     /* 20051012 HIMANSHU END INLINE TIME */
  1904.     d->focus_list[0] = TIME_INPUT_FOCUS_NONE;
  1905.     d->focus_list[4] = TIME_INPUT_FOCUS_NONE;
  1906.     switch (flags & TIME_INPUT_TYPE_MASK)
  1907.     {
  1908.         case TIME_INPUT_TYPE_HH_MM:
  1909.             d->focus_list[1] = TIME_INPUT_FOCUS_HOURS;
  1910.             d->focus_list[2] = TIME_INPUT_FOCUS_MINUTES;
  1911.             d->focus_list[3] = TIME_INPUT_FOCUS_NONE;
  1912.             d->hours_x = ox;
  1913.             ox += w1 + sw;
  1914.             d->minutes_x = ox;
  1915.             d->flags |= TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS;
  1916.             d->seconds_input_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_DRAW;
  1917.             break;
  1918.         case TIME_INPUT_TYPE_HH_MM_SS:
  1919.             d->focus_list[1] = TIME_INPUT_FOCUS_HOURS;
  1920.             d->focus_list[2] = TIME_INPUT_FOCUS_MINUTES;
  1921.             d->focus_list[3] = TIME_INPUT_FOCUS_SECONDS;
  1922.             d->hours_x = ox;
  1923.             ox += w1 + sw;
  1924.             d->minutes_x = ox;
  1925.             ox += w2 + sw;
  1926.             d->seconds_x = ox;
  1927.             d->flags |= TIME_INPUT_TYPE_DEFAULT_FOCUS_HOURS;
  1928.             break;
  1929.     }
  1930.     current_single_line_input_box_theme = &date_time_input_theme;
  1931.     d->hours_y = oy;
  1932.     d->minutes_y = oy;
  1933.     d->seconds_y = oy;
  1934.     d->s1_y = oy;
  1935.     d->s2_y = oy;
  1936.     if ((h + 2) > height)
  1937.     {
  1938.         h = height - 2;
  1939.     }
  1940.     /* MTK Terry for Bidi Issue */
  1941.     l = gui_strlen((UI_string_type) hours_buffer);
  1942.     /* create single input box of hours */
  1943.     /* MTK Elvis for R2L characters */
  1944.     gui_create_single_line_input_box_set_buffer(
  1945.         &d->hours_input_box,
  1946.         x + d->hours_x,
  1947.         y + d->hours_y,
  1948.         w1,
  1949.         h,
  1950.         (UI_string_type) hours_buffer,
  1951.         TIME_INPUT_HOURS_BUFFER_LENGTH,
  1952.         (l + 1) * ENCODING_LENGTH,
  1953.         0);
  1954.     d->hours_input_box.flags |=
  1955.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  1956.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  1957.     gui_single_line_input_box_goto_first_character(&d->hours_input_box);
  1958.     l = gui_strlen((UI_string_type) minutes_buffer);
  1959.     /* create single input box of minutes */
  1960.     /* MTK Elvis for R2L characters */
  1961.     gui_create_single_line_input_box_set_buffer(
  1962.         &d->minutes_input_box,
  1963.         x + d->minutes_x,
  1964.         y + d->minutes_y,
  1965.         w2,
  1966.         h,
  1967.         (UI_string_type) minutes_buffer,
  1968.         TIME_INPUT_MINUTES_BUFFER_LENGTH,
  1969.         (l + 1) * ENCODING_LENGTH,
  1970.         0);
  1971.     d->minutes_input_box.flags |=
  1972.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  1973.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  1974.     gui_single_line_input_box_goto_first_character(&d->minutes_input_box);
  1975.     l = gui_strlen((UI_string_type) seconds_buffer);
  1976.     /* create single input box of seconds */
  1977.     /* MTK Elvis for R2L characters */
  1978.     gui_create_single_line_input_box_set_buffer(
  1979.         &d->seconds_input_box,
  1980.         x + d->seconds_x,
  1981.         y + d->seconds_y,
  1982.         w3,
  1983.         h,
  1984.         (UI_string_type) seconds_buffer,
  1985.         TIME_INPUT_SECONDS_BUFFER_LENGTH,
  1986.         (l + 1) * ENCODING_LENGTH,
  1987.         0);
  1988.     d->seconds_input_box.flags |=
  1989.         (UI_SINGLE_LINE_INPUT_BOX_OVERWRITE_MODE | UI_SINGLE_LINE_INPUT_BOX_SHOW_BLOCK_CURSOR |
  1990.          UI_SINGLE_LINE_INPUT_BOX_NO_BORDER);
  1991.     gui_single_line_input_box_goto_first_character(&d->seconds_input_box);
  1992.     time_input_reset_focus(d);
  1993.     time_input_set_default_focus(d);
  1994.     time_input_set_focus(d);
  1995.     /* set theme of input box */
  1996.     current_single_line_input_box_theme = t;
  1997.     /* Setup default validation functions  */
  1998.     d->hours_input_box.validation_callback = default_inline_time_hours_validation;
  1999.     d->minutes_input_box.validation_callback = default_inline_time_minutes_validation;
  2000.     d->seconds_input_box.validation_callback = default_inline_time_minutes_validation;
  2001. }
  2002. /*****************************************************************************
  2003.  * FUNCTION
  2004.  *  show_time_input
  2005.  * DESCRIPTION
  2006.  *  shoe time input box
  2007.  * PARAMETERS
  2008.  *  d       [IN]        Time input box
  2009.  * RETURNS
  2010.  *  void
  2011.  *****************************************************************************/
  2012. void show_time_input(time_input *d)
  2013. {
  2014.     /*----------------------------------------------------------------*/
  2015.     /* Local Variables                                                */
  2016.     /*----------------------------------------------------------------*/
  2017.     UI_single_line_input_box_theme *t = current_single_line_input_box_theme;
  2018.     S32 sw = 0;
  2019.     /*----------------------------------------------------------------*/
  2020.     /* Code Body                                                      */
  2021.     /*----------------------------------------------------------------*/
  2022.     current_single_line_input_box_theme = &date_time_input_theme;
  2023.     gui_set_single_line_input_box_current_theme(&d->hours_input_box);
  2024.     gui_set_single_line_input_box_current_theme(&d->minutes_input_box);
  2025.     /* show hours inout box */
  2026.     gui_show_single_line_input_box(&d->hours_input_box);
  2027.     /* show minutes input box */
  2028.     gui_show_single_line_input_box(&d->minutes_input_box);
  2029.     if ((d->flags & TIME_INPUT_TYPE_MASK) != TIME_INPUT_TYPE_HH_MM)
  2030.     {
  2031.         gui_show_single_line_input_box(&d->seconds_input_box);  /* show seconds input box */
  2032.     }
  2033.     gdi_layer_reset_clip();
  2034.     gui_set_font(d->hours_input_box.text_font);
  2035.     gui_set_text_color(d->hours_input_box.normal_text_color);
  2036.     if (r2lMMIFlag)
  2037.     {
  2038.         gui_set_font(d->hours_input_box.text_font);
  2039.         sw = gui_get_character_width(d->seperator);
  2040.         gui_move_text_cursor(d->s1_x + sw, d->s1_y + d->y);
  2041.     }
  2042.     else
  2043.     {
  2044.         gui_move_text_cursor(d->s1_x, d->s1_y + d->y);
  2045.     }
  2046.     gui_print_character(d->seperator);
  2047.     if ((d->flags & TIME_INPUT_TYPE_MASK) != TIME_INPUT_TYPE_HH_MM)
  2048.     {
  2049.         if (r2lMMIFlag)
  2050.         {
  2051.             gui_move_text_cursor(d->s2_x + sw, d->s2_y + d->y);
  2052.         }
  2053.         else
  2054.         {
  2055.             gui_move_text_cursor(d->s2_x, d->s2_y + d->y);
  2056.         }
  2057.         gui_print_character(d->seperator);
  2058.     }
  2059.     gdi_layer_blt_previous(d->x, d->y, d->x + d->width - 1, d->y + d->height - 1);
  2060.     current_single_line_input_box_theme = t;
  2061. }
  2062. /*****************************************************************************
  2063.  * FUNCTION
  2064.  *  time_input_set_next_focus
  2065.  * DESCRIPTION
  2066.  *  set the focus of time input box to next box
  2067.  * PARAMETERS
  2068.  *  d       [IN]        Time input box
  2069.  * RETURNS
  2070.  *  byte
  2071.  *****************************************************************************/
  2072. U8 time_input_set_next_focus(time_input *d)
  2073. {
  2074.     /*----------------------------------------------------------------*/
  2075.     /* Local Variables                                                */
  2076.     /*----------------------------------------------------------------*/
  2077.     /*----------------------------------------------------------------*/
  2078.     /* Code Body                                                      */
  2079.     /*----------------------------------------------------------------*/
  2080.     if (d->focus_list[d->current_focus + 1] == TIME_INPUT_FOCUS_NONE)
  2081.     {
  2082.         return (0);
  2083.     }
  2084.     else
  2085.     {
  2086.         time_input_reset_focus(d);
  2087.         d->current_focus++;
  2088.         time_input_set_focus(d);
  2089.     #if defined(__MMI_TOUCH_SCREEN__)
  2090.         gui_single_line_input_box_goto_first_character(d->focus_input_box);
  2091.     #endif 
  2092.         return (1);
  2093.     }
  2094. }
  2095. /*****************************************************************************
  2096.  * FUNCTION
  2097.  *  time_input_set_previous_focus
  2098.  * DESCRIPTION
  2099.  *  set the focus of time input box to previous box
  2100.  * PARAMETERS
  2101.  *  d       [IN]        Time input box
  2102.  * RETURNS
  2103.  *  byte
  2104.  *****************************************************************************/
  2105. U8 time_input_set_previous_focus(time_input *d)
  2106. {
  2107.     /*----------------------------------------------------------------*/
  2108.     /* Local Variables                                                */
  2109.     /*----------------------------------------------------------------*/
  2110.     /*----------------------------------------------------------------*/
  2111.     /* Code Body                                                      */
  2112.     /*----------------------------------------------------------------*/
  2113.     if (d->focus_list[d->current_focus - 1] == TIME_INPUT_FOCUS_NONE)
  2114.     {
  2115.         return (0);
  2116.     }
  2117.     else
  2118.     {
  2119.         time_input_reset_focus(d);
  2120.         d->current_focus--;
  2121.         time_input_set_focus(d);
  2122.     #if defined(__MMI_TOUCH_SCREEN__)
  2123.         gui_single_line_input_box_goto_last_character(d->focus_input_box);
  2124.         gui_single_line_input_box_previous(d->focus_input_box);
  2125.     #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  2126.         return (1);
  2127.     }
  2128. }
  2129. #if defined (__MMI_TOUCH_SCREEN__)
  2130. /*****************************************************************************
  2131.  * FUNCTION
  2132.  *  time_input_move_to_x_y
  2133.  * DESCRIPTION
  2134.  *  set the cursor position to (x,y) position
  2135.  * PARAMETERS
  2136.  *  t           [?]         
  2137.  *  x           [IN]        
  2138.  *  y           [IN]        
  2139.  *  tp(?)       [IN]        Time input box S32 x S32 y
  2140.  * RETURNS
  2141.  *  void
  2142.  *****************************************************************************/
  2143. void time_input_move_to_x_y(time_input *t, S32 x, S32 y)
  2144. {
  2145.     /*----------------------------------------------------------------*/
  2146.     /* Local Variables                                                */
  2147.     /*----------------------------------------------------------------*/
  2148.     int i = 1;
  2149.     /*----------------------------------------------------------------*/
  2150.     /* Code Body                                                      */
  2151.     /*----------------------------------------------------------------*/
  2152.     if (PEN_CHECK_BOUND(x, y, t->x, t->y, t->width, t->height))
  2153.     {
  2154.         if (PEN_CHECK_BOUND
  2155.             (x, y, t->hours_input_box.x, t->hours_input_box.y, t->hours_input_box.width, t->hours_input_box.height))
  2156.         {
  2157.             gui_single_line_input_box_goto_first_character(t->focus_input_box);
  2158.             time_input_reset_focus(t);
  2159.             for (;; i++)
  2160.             {
  2161.                 if (t->focus_list[i] == TIME_INPUT_FOCUS_HOURS)
  2162.                 {
  2163.                     t->current_focus = i;
  2164.                     break;
  2165.                 }
  2166.             }
  2167.             time_input_set_focus(t);
  2168.         }
  2169.         else if (PEN_CHECK_BOUND
  2170.                  (x, y, t->minutes_input_box.x, t->minutes_input_box.y, t->minutes_input_box.width,
  2171.                   t->minutes_input_box.height))
  2172.         {
  2173.             gui_single_line_input_box_goto_first_character(t->focus_input_box);
  2174.             time_input_reset_focus(t);
  2175.             for (;; i++)
  2176.             {
  2177.                 if (t->focus_list[i] == TIME_INPUT_FOCUS_MINUTES)
  2178.                 {
  2179.                     t->current_focus = i;
  2180.                     break;
  2181.                 }
  2182.             }
  2183.             time_input_set_focus(t);
  2184.         }
  2185.         else if (PEN_CHECK_BOUND
  2186.                  (x, y, t->seconds_input_box.x, t->seconds_input_box.y, t->seconds_input_box.width,
  2187.                   t->seconds_input_box.height))
  2188.         {
  2189.             gui_single_line_input_box_goto_first_character(t->focus_input_box);
  2190.             time_input_reset_focus(t);
  2191.             for (;; i++)
  2192.             {
  2193.                 if (t->focus_list[i] == TIME_INPUT_FOCUS_SECONDS)
  2194.                 {
  2195.                     t->current_focus = i;
  2196.                     break;
  2197.                 }
  2198.             }
  2199.             time_input_set_focus(t);
  2200.         }
  2201.         else
  2202.         {
  2203.             return;
  2204.         }
  2205.         gui_show_single_line_input_box_ext(t->focus_input_box, x, y);
  2206.         if (gui_single_line_input_box_test_last_character_position(t->focus_input_box))
  2207.         {
  2208.             gui_single_line_input_box_goto_last_character(t->focus_input_box);
  2209.             gui_single_line_input_box_previous(t->focus_input_box);
  2210.         }
  2211.         show_time_input(t);
  2212.     }
  2213. }
  2214. #endif /* defined (__MMI_TOUCH_SCREEN__) */ 
  2215. /*****************************************************************************
  2216.  * FUNCTION
  2217.  *  time_input_set_seperator
  2218.  * DESCRIPTION
  2219.  *  set the mask of time input box
  2220.  * PARAMETERS
  2221.  *  d               [IN]        
  2222.  *  seperator       [IN]        
  2223.  * RETURNS
  2224.  *  void
  2225.  *****************************************************************************/
  2226. void time_input_set_seperator(time_input *d, UI_character_type seperator)
  2227. {
  2228.     /*----------------------------------------------------------------*/
  2229.     /* Local Variables                                                */
  2230.     /*----------------------------------------------------------------*/
  2231.     S32 sw, x1, x2;
  2232.     /*----------------------------------------------------------------*/
  2233.     /* Code Body                                                      */
  2234.     /*----------------------------------------------------------------*/
  2235.     d->seperator = seperator;
  2236.     gui_set_font(d->hours_input_box.text_font);
  2237.     sw = gui_get_character_width(d->seperator);
  2238.     switch (d->flags & TIME_INPUT_TYPE_MASK)
  2239.     {
  2240.         case TIME_INPUT_TYPE_HH_MM:
  2241.             x1 = d->hours_input_box.x + d->hours_input_box.width - 1;
  2242.             x2 = d->minutes_input_box.x;
  2243.             d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  2244.             x1 = d->minutes_input_box.x + d->minutes_input_box.width - 1;
  2245.             x2 = d->seconds_input_box.x;
  2246.             d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  2247.             break;
  2248.         case TIME_INPUT_TYPE_HH_MM_SS:
  2249.             x1 = d->hours_input_box.x + d->hours_input_box.width - 1;
  2250.             x2 = d->minutes_input_box.x;
  2251.             d->s1_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  2252.             x1 = d->minutes_input_box.x + d->minutes_input_box.width - 1;
  2253.             x2 = d->seconds_input_box.x;
  2254.             d->s2_x = x1 + ((x2 - x1) >> 1) - (sw >> 1);
  2255.             break;
  2256.     }
  2257. }
  2258. /* global variable store current time input */
  2259. time_input *current_time_input = NULL;
  2260. /*----------------------------------------------------------------------------
  2261. Function:         current_time_input_callback
  2262. Description:      a function pointer of current time input callback 
  2263. Input Parameters: none
  2264. Output Parameters:   none
  2265. Returns:       none
  2266. ----------------------------------------------------------------------------*/
  2267. void (*current_time_input_callback) (void) = UI_dummy_function;
  2268. /*****************************************************************************
  2269.  * FUNCTION
  2270.  *  set_current_time_input
  2271.  * DESCRIPTION
  2272.  *  set the valeu of global variable store current
  2273.  *  time input equal to valeu pass as parameter
  2274.  * PARAMETERS
  2275.  *  d       [IN]        
  2276.  * RETURNS
  2277.  *  void
  2278.  *****************************************************************************/
  2279. void set_current_time_input(time_input *d)
  2280. {
  2281.     /*----------------------------------------------------------------*/
  2282.     /* Local Variables                                                */
  2283.     /*----------------------------------------------------------------*/
  2284.     /*----------------------------------------------------------------*/
  2285.     /* Code Body                                                      */
  2286.     /*----------------------------------------------------------------*/
  2287.     current_time_input = d;
  2288. }
  2289. /*****************************************************************************
  2290.  * FUNCTION
  2291.  *  time_input_direct_input
  2292.  * DESCRIPTION
  2293.  *  enter the current character in time input box and show the time input box
  2294.  * PARAMETERS
  2295.  *  c       [IN]        
  2296.  * RETURNS
  2297.  *  void
  2298.  *****************************************************************************/
  2299. void time_input_direct_input(UI_character_type c)
  2300. {
  2301.     /*----------------------------------------------------------------*/
  2302.     /* Local Variables                                                */
  2303.     /*----------------------------------------------------------------*/
  2304.     /*----------------------------------------------------------------*/
  2305.     /* Code Body                                                      */
  2306.     /*----------------------------------------------------------------*/
  2307.     if (current_time_input == NULL)
  2308.     {
  2309.         return;
  2310.     }
  2311.     if (current_time_input->focus_input_box == NULL)
  2312.     {
  2313.         return;
  2314.     }
  2315.     if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
  2316.     {
  2317.         if (time_input_set_next_focus(current_time_input))
  2318.         {
  2319.             gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
  2320.         }
  2321.     }
  2322.     else
  2323.     {
  2324.         gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
  2325.         if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
  2326.         {
  2327.             if (!time_input_set_next_focus(current_time_input))
  2328.             {
  2329.                 gui_single_line_input_box_previous(current_time_input->focus_input_box);
  2330.             }
  2331.         }
  2332.     }
  2333.     /* show time input box */
  2334.     show_time_input(current_time_input);
  2335.     current_time_input_callback();
  2336. }
  2337. /*****************************************************************************
  2338.  * FUNCTION
  2339.  *  time_input_direct_input_nodraw
  2340.  * DESCRIPTION
  2341.  *  insert the character in date input box and redraw date input box
  2342.  * PARAMETERS
  2343.  *  c       [IN]        
  2344.  * RETURNS
  2345.  *  void
  2346.  *****************************************************************************/
  2347. void time_input_direct_input_nodraw(UI_character_type c)
  2348. {
  2349.     /*----------------------------------------------------------------*/
  2350.     /* Local Variables                                                */
  2351.     /*----------------------------------------------------------------*/
  2352.     /*----------------------------------------------------------------*/
  2353.     /* Code Body                                                      */
  2354.     /*----------------------------------------------------------------*/
  2355.     if (current_time_input == NULL)
  2356.     {
  2357.         return;
  2358.     }
  2359.     if (current_time_input->focus_input_box == NULL)
  2360.     {
  2361.         return;
  2362.     }
  2363.     if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
  2364.     {
  2365.         if (time_input_set_next_focus(current_time_input))
  2366.         {
  2367.             gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
  2368.         }
  2369.     }
  2370.     else
  2371.     {
  2372.         gui_single_line_input_box_insert_character(current_time_input->focus_input_box, c);
  2373.         if (gui_single_line_input_box_test_last_position_overflow(current_time_input->focus_input_box))
  2374.         {
  2375.             if (!time_input_set_next_focus(current_time_input))
  2376.             {
  2377.                 gui_single_line_input_box_previous(current_time_input->focus_input_box);
  2378.             }
  2379.         }
  2380.     }
  2381.     current_time_input_callback();
  2382. }
  2383. /*****************************************************************************
  2384.  * FUNCTION
  2385.  *  time_input_test_last_position
  2386.  * DESCRIPTION
  2387.  *  test current position is the last position or not
  2388.  * PARAMETERS
  2389.  *  t       [IN]        
  2390.  * RETURNS
  2391.  *  S32
  2392.  *****************************************************************************/
  2393. S32 time_input_test_last_position(time_input *t)
  2394. {
  2395.     /*----------------------------------------------------------------*/
  2396.     /* Local Variables                                                */
  2397.     /*----------------------------------------------------------------*/
  2398.     /*----------------------------------------------------------------*/
  2399.     /* Code Body                                                      */
  2400.     /*----------------------------------------------------------------*/
  2401.     if (t->focus_list[t->current_focus + 1] != TIME_INPUT_FOCUS_NONE)
  2402.     {
  2403.         return 0;
  2404.     }
  2405.     else
  2406.     {
  2407.         if (gui_single_line_input_box_test_last_character_position(t->focus_input_box))
  2408.         {
  2409.             return 1;
  2410.         }
  2411.         else
  2412.         {
  2413.             return 0;
  2414.         }
  2415.     }
  2416. }
  2417. /*****************************************************************************
  2418.  * FUNCTION
  2419.  *  time_input_delete_character
  2420.  * DESCRIPTION
  2421.  *  delete character of time input box
  2422.  * PARAMETERS
  2423.  *  void
  2424.  * RETURNS
  2425.  *  void
  2426.  *****************************************************************************/
  2427. void time_input_delete_character(void)
  2428. {
  2429.     /*----------------------------------------------------------------*/
  2430.     /* Local Variables                                                */
  2431.     /*----------------------------------------------------------------*/
  2432.     /*----------------------------------------------------------------*/
  2433.     /* Code Body                                                      */
  2434.     /*----------------------------------------------------------------*/
  2435.     if (current_time_input == NULL)
  2436.     {
  2437.         return;
  2438.     }
  2439.     if (current_time_input->focus_input_box == NULL)
  2440.     {
  2441.         return;
  2442.     }
  2443.     if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
  2444.     {
  2445.         time_input_set_previous_focus(current_time_input);
  2446.     }
  2447.     else
  2448.     {
  2449.         gui_single_line_input_box_delete_character(current_time_input->focus_input_box);
  2450.         if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
  2451.         {
  2452.             time_input_set_previous_focus(current_time_input);
  2453.         }
  2454.     }
  2455.     /* show time input box */
  2456.     show_time_input(current_time_input);
  2457.     /* current time input callback fuc */
  2458.     current_time_input_callback();
  2459. }
  2460. /*****************************************************************************
  2461.  * FUNCTION
  2462.  *  time_input_previous_character
  2463.  * DESCRIPTION
  2464.  *  delete previous cahracter of time input box
  2465.  * PARAMETERS
  2466.  *  void
  2467.  * RETURNS
  2468.  *  void
  2469.  *****************************************************************************/
  2470. void time_input_previous_character(void)
  2471. {
  2472.     /*----------------------------------------------------------------*/
  2473.     /* Local Variables                                                */
  2474.     /*----------------------------------------------------------------*/
  2475.     /*----------------------------------------------------------------*/
  2476.     /* Code Body                                                      */
  2477.     /*----------------------------------------------------------------*/
  2478.     if (current_time_input == NULL)
  2479.     {
  2480.         return;
  2481.     }
  2482.     if (current_time_input->focus_input_box == NULL)
  2483.     {
  2484.         return;
  2485.     }
  2486.     if (gui_single_line_input_box_test_first_position(current_time_input->focus_input_box))
  2487.     {
  2488.         if (time_input_set_previous_focus(current_time_input))
  2489.         {
  2490.             gui_single_line_input_box_goto_last_character(current_time_input->focus_input_box);
  2491.             gui_single_line_input_box_previous(current_time_input->focus_input_box);
  2492.         }
  2493.     }
  2494.     else
  2495.     {
  2496.         gui_single_line_input_box_previous(current_time_input->focus_input_box);
  2497.     }
  2498.     /* show time input box */
  2499.     show_time_input(current_time_input);
  2500. }
  2501. /*****************************************************************************
  2502.  * FUNCTION
  2503.  *  time_input_next_character
  2504.  * DESCRIPTION
  2505.  *  delete next  cahracter of time input box
  2506.  * PARAMETERS
  2507.  *  void
  2508.  * RETURNS
  2509.  *  void
  2510.  *****************************************************************************/
  2511. void time_input_next_character(void)
  2512. {
  2513.     /*----------------------------------------------------------------*/
  2514.     /* Local Variables                                                */
  2515.     /*----------------------------------------------------------------*/
  2516.     /*----------------------------------------------------------------*/
  2517.     /* Code Body                                                      */
  2518.     /*----------------------------------------------------------------*/
  2519.     if (current_time_input == NULL)
  2520.     {
  2521.         return;
  2522.     }
  2523.     if (current_time_input->focus_input_box == NULL)
  2524.     {
  2525.         return;
  2526.     }
  2527.     if (gui_single_line_input_box_test_last_character_position(current_time_input->focus_input_box))
  2528.     {
  2529.         time_input_set_next_focus(current_time_input);
  2530.     }
  2531.     else
  2532.     {
  2533.         gui_single_line_input_box_next(current_time_input->focus_input_box);
  2534.     }
  2535.     /* show time input box */
  2536.     show_time_input(current_time_input);
  2537. }
  2538. /*****************************************************************************
  2539.  * FUNCTION
  2540.  *  time_input_toggle_insert_mode
  2541.  * DESCRIPTION
  2542.  *  toggle insert mode of time input box
  2543.  * PARAMETERS
  2544.  *  void
  2545.  * RETURNS
  2546.  *  void
  2547.  *****************************************************************************/
  2548. void time_input_toggle_insert_mode(void)
  2549. {
  2550.     /*----------------------------------------------------------------*/
  2551.     /* Local Variables                                                */
  2552.     /*----------------------------------------------------------------*/
  2553.     /*----------------------------------------------------------------*/
  2554.     /* Code Body                                                      */
  2555.     /*----------------------------------------------------------------*/
  2556.     if (current_time_input == NULL)
  2557.     {
  2558.         return;
  2559.     }
  2560.     if (current_time_input->focus_input_box == NULL)
  2561.     {
  2562.         return;
  2563.     }
  2564.     gui_single_line_input_box_toggle_insert_mode(current_time_input->focus_input_box);
  2565.     /* show time input box */
  2566.     show_time_input(current_time_input);
  2567. }
  2568. /*****************************************************************************
  2569.  * FUNCTION
  2570.  *  time_input_delete_current_character
  2571.  * DESCRIPTION
  2572.  *  delete current character of time input box
  2573.  * PARAMETERS
  2574.  *  void
  2575.  * RETURNS
  2576.  *  void
  2577.  *****************************************************************************/
  2578. void time_input_delete_current_character(void)
  2579. {
  2580.     /*----------------------------------------------------------------*/
  2581.     /* Local Variables                                                */
  2582.     /*----------------------------------------------------------------*/
  2583.     /*----------------------------------------------------------------*/
  2584.     /* Code Body                                                      */
  2585.     /*----------------------------------------------------------------*/
  2586.     if (current_time_input == NULL)
  2587.     {
  2588.         return;
  2589.     }
  2590.     if (current_time_input->focus_input_box == NULL)
  2591.     {
  2592.         return;
  2593.     }
  2594.     gui_single_line_input_box_delete_current_character(current_time_input->focus_input_box);
  2595.     /* show time input box */
  2596.     show_time_input(current_time_input);
  2597.     current_time_input_callback();
  2598. }
  2599. /*****************************************************************************
  2600.  * FUNCTION
  2601.  *  time_input_delete_all_characters
  2602.  * DESCRIPTION
  2603.  *  delete all characters of time input box
  2604.  * PARAMETERS
  2605.  *  void
  2606.  * RETURNS
  2607.  *  void
  2608.  *****************************************************************************/
  2609. void time_input_delete_all_characters(void)
  2610. {
  2611.     /*----------------------------------------------------------------*/
  2612.     /* Local Variables                                                */
  2613.     /*----------------------------------------------------------------*/
  2614.     /*----------------------------------------------------------------*/
  2615.     /* Code Body                                                      */
  2616.     /*----------------------------------------------------------------*/
  2617.     if (current_time_input == NULL)
  2618.     {
  2619.         return;
  2620.     }
  2621.     if (current_time_input->focus_input_box == NULL)
  2622.     {
  2623.         return;
  2624.     }
  2625.     gui_single_line_input_box_delete_all(current_time_input->focus_input_box);
  2626.     /* show time input box */
  2627.     show_time_input(current_time_input);
  2628.     current_time_input_callback();
  2629. }
  2630. /*****************************************************************************
  2631.  * FUNCTION
  2632.  *  time_input_numeric_keyboard_input_handler
  2633.  * DESCRIPTION
  2634.  *  numeric key handle of time input box
  2635.  * PARAMETERS
  2636.  *  keyc        [IN]        
  2637.  * RETURNS
  2638.  *  void
  2639.  *****************************************************************************/
  2640. void time_input_numeric_keyboard_input_handler(S32 keyc)
  2641. {
  2642.     /*----------------------------------------------------------------*/
  2643.     /* Local Variables                                                */
  2644.     /*----------------------------------------------------------------*/
  2645.     /*----------------------------------------------------------------*/
  2646.     /* Code Body                                                      */
  2647.     /*----------------------------------------------------------------*/
  2648.     if (keyc >= '0' && keyc <= '9')
  2649.     {
  2650.         time_input_direct_input((U8) keyc);
  2651.     }
  2652.     else if (keyc == 0x08)
  2653.     {
  2654.         time_input_delete_character();
  2655.     }
  2656.     else if (keyc == 0x1b)
  2657.     {
  2658.         time_input_delete_all_characters();
  2659.     }
  2660.     else if (keyc == 0x0d);
  2661. }
  2662. /*****************************************************************************
  2663.  * FUNCTION
  2664.  *  time_input_handle_key_down
  2665.  * DESCRIPTION
  2666.  *  handle key down of time input box
  2667.  * PARAMETERS
  2668.  *  k       [IN]        
  2669.  * RETURNS
  2670.  *  void
  2671.  *****************************************************************************/
  2672. void time_input_handle_key_down(MMI_key_code_type k)
  2673. {
  2674.     /*----------------------------------------------------------------*/
  2675.     /* Local Variables                                                */
  2676.     /*----------------------------------------------------------------*/
  2677.     /*----------------------------------------------------------------*/
  2678.     /* Code Body                                                      */
  2679.     /*----------------------------------------------------------------*/
  2680.     time_input_direct_input((UI_character_type) ('0' + k));
  2681. }
  2682. /*****************************************************************************
  2683.  * FUNCTION
  2684.  *  time_input_key_handler
  2685.  * DESCRIPTION
  2686.  *  register key handlers of time input box
  2687.  * PARAMETERS
  2688.  *  vkey_code       [IN]        
  2689.  *  key_state       [IN]        
  2690.  * RETURNS
  2691.  *  void
  2692.  *****************************************************************************/
  2693. void time_input_key_handler(S32 vkey_code, S32 key_state)
  2694. {
  2695. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  2696.     /*----------------------------------------------------------------*/
  2697.     /* Local Variables                                                */
  2698.     /*----------------------------------------------------------------*/
  2699.     /*----------------------------------------------------------------*/
  2700.     /* Code Body                                                      */
  2701.     /*----------------------------------------------------------------*/
  2702.     if (key_state)
  2703.     {
  2704.         switch (vkey_code)
  2705.         {
  2706.             case 37:
  2707.                 time_input_previous_character();
  2708.                 break;
  2709.             case 38:    /* up */
  2710.                 break;
  2711.             case 39:
  2712.                 time_input_next_character();
  2713.                 break;
  2714.             case 40:    /* down */
  2715.                 break;
  2716.             case 36:    /* home */
  2717.                 break;
  2718.             case 35:    /* end */
  2719.                 break;
  2720.             case 33:    /* page up */
  2721.                 break;
  2722.             case 34:    /* page down */
  2723.                 break;
  2724.             case 45:
  2725.                 time_input_toggle_insert_mode();
  2726.                 break;
  2727.             case 46:
  2728.                 time_input_delete_current_character();
  2729.                 break;
  2730.         }
  2731.     }
  2732. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  2733.     UI_UNUSED_PARAMETER(vkey_code);
  2734.     UI_UNUSED_PARAMETER(key_state);
  2735. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  2736. }
  2737. /*****************************************************************************
  2738.  * FUNCTION
  2739.  *  time_input_register_keys
  2740.  * DESCRIPTION
  2741.  *  register key handlers of time input box
  2742.  * PARAMETERS
  2743.  *  void
  2744.  * RETURNS
  2745.  *  void
  2746.  *****************************************************************************/
  2747. void time_input_register_keys(void)
  2748. {
  2749.     /*----------------------------------------------------------------*/
  2750.     /* Local Variables                                                */
  2751.     /*----------------------------------------------------------------*/
  2752.     /*----------------------------------------------------------------*/
  2753.     /* Code Body                                                      */
  2754.     /*----------------------------------------------------------------*/
  2755.     register_MMI_key_input_handler();
  2756.     register_key_down_handler(time_input_handle_key_down);
  2757.     register_keyboard_input_handler(time_input_numeric_keyboard_input_handler);
  2758.     SetKeyHandler(time_input_previous_character, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2759.     SetKeyHandler(time_input_next_character, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2760.     register_keyboard_key_handler(time_input_key_handler);
  2761. }
  2762. /*****************************************************************************
  2763.  * FUNCTION
  2764.  *  time_input_clear_keys
  2765.  * DESCRIPTION
  2766.  *  clear key handlers of time input box
  2767.  * PARAMETERS
  2768.  *  void
  2769.  * RETURNS
  2770.  *  void
  2771.  *****************************************************************************/
  2772. void time_input_clear_keys(void)
  2773. {
  2774.     /*----------------------------------------------------------------*/
  2775.     /* Local Variables                                                */
  2776.     /*----------------------------------------------------------------*/
  2777.     /*----------------------------------------------------------------*/
  2778.     /* Code Body                                                      */
  2779.     /*----------------------------------------------------------------*/
  2780.     clear_MMI_key_input_handler();
  2781.     clear_key_down_handler();
  2782.     clear_keyboard_input_handler();
  2783.     ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2784.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2785.     clear_keyboard_key_handler();
  2786. }
  2787. /*****************************************************************************
  2788.  * FUNCTION
  2789.  *  register_time_input_callback
  2790.  * DESCRIPTION
  2791.  *  register time input call back function
  2792.  * PARAMETERS
  2793.  *  f               [IN]        
  2794.  *  function(?)     [IN]        Pointer
  2795.  * RETURNS
  2796.  *  void
  2797.  *****************************************************************************/
  2798. void register_time_input_callback(void (*f) (void))
  2799. {
  2800.     /*----------------------------------------------------------------*/
  2801.     /* Local Variables                                                */
  2802.     /*----------------------------------------------------------------*/
  2803.     /*----------------------------------------------------------------*/
  2804.     /* Code Body                                                      */
  2805.     /*----------------------------------------------------------------*/
  2806.     current_time_input_callback = f;
  2807. }
  2808. /*****************************************************************************
  2809.  * FUNCTION
  2810.  *  clear_time_input_callback
  2811.  * DESCRIPTION
  2812.  *  clear  time input call back function
  2813.  * PARAMETERS
  2814.  *  void
  2815.  * RETURNS
  2816.  *  void
  2817.  *****************************************************************************/
  2818. void clear_time_input_callback(void)
  2819. {
  2820.     /*----------------------------------------------------------------*/
  2821.     /* Local Variables                                                */
  2822.     /*----------------------------------------------------------------*/
  2823.     /*----------------------------------------------------------------*/
  2824.     /* Code Body                                                      */
  2825.     /*----------------------------------------------------------------*/
  2826.     current_time_input_callback = UI_dummy_function;
  2827. }
  2828. UI_filled_area DOW_normal_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
  2829.     UI_NULL_IMAGE,
  2830.     NULL,
  2831.     {255, 255, 255, 100},
  2832.     {0, 0, 0, 0},
  2833.     {0, 0, 0, 100},
  2834.     {0, 0, 0, 0},
  2835.     0
  2836. };
  2837. /* theme when DOW is highlighted */
  2838. UI_filled_area DOW_normal_highlighted_cell_filler = {UI_FILLED_AREA_TYPE_COLOR,
  2839.     UI_NULL_IMAGE,
  2840.     NULL,
  2841.     {9, 235, 253, 100},
  2842.     {0, 0, 0, 0},
  2843.     {0, 0, 0, 0},
  2844.     {0, 0, 0, 0},
  2845.     0
  2846. };
  2847. /* theme when DOW is selected */
  2848. UI_filled_area DOW_selected_highlighted_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
  2849.     UI_NULL_IMAGE,
  2850.     NULL,
  2851.     {9, 235, 253, 100},
  2852.     {0, 0, 0, 0},
  2853.     {235, 247, 17, 100},
  2854.     {0, 0, 0, 0},
  2855.     0
  2856. };
  2857. UI_filled_area DOW_selected_cell_filler = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
  2858.     UI_NULL_IMAGE,
  2859.     NULL,
  2860.     {255, 240, 0, 100},
  2861.     {0, 0, 0, 0},
  2862.     {235, 247, 17, 100},
  2863.     {0, 0, 0, 0},
  2864.     0
  2865. };
  2866. UI_filled_area list_menu_DOW_normal_BG_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND,
  2867.     UI_NULL_IMAGE,
  2868.     NULL,
  2869.     {0, 0, 0, 0},
  2870.     {0, 0, 0, 0},
  2871.     {0, 0, 0, 0},
  2872.     {0, 0, 0, 0},
  2873.     0
  2874. };
  2875. UI_filled_area list_menu_DOW_selected_cell_filler = {UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER,
  2876.     UI_NULL_IMAGE,
  2877.     NULL,
  2878.     {0, 0, 0, 0},
  2879.     {0, 0, 0, 0},
  2880.     {255, 0, 0, 100},
  2881.     {0, 0, 0, 0},
  2882.     0
  2883. };
  2884. /*****************************************************************************
  2885.  * FUNCTION
  2886.  *  create_DOW_select
  2887.  * DESCRIPTION
  2888.  *  create DOW selct input box
  2889.  * PARAMETERS
  2890.  *  d           [IN]        DOW input box
  2891.  *  x           [IN]        Start x position of DOW
  2892.  *  y           [IN]        Start y position of DOW
  2893.  *  width       [IN]        Width of DOW box
  2894.  *  height      [IN]        Height of DOW box
  2895.  * RETURNS
  2896.  *  void
  2897.  *****************************************************************************/
  2898. extern U8 get_menu_item_height(void);
  2899. void create_DOW_select(DOW_select *d, S32 x, S32 y, S32 width, S32 height)
  2900. {
  2901.     /*----------------------------------------------------------------*/
  2902.     /* Local Variables                                                */
  2903.     /*----------------------------------------------------------------*/
  2904.     S32 i;
  2905.     color c1 = {235, 247, 17, 100};
  2906.     /*----------------------------------------------------------------*/
  2907.     /* Code Body                                                      */
  2908.     /*----------------------------------------------------------------*/
  2909.     DOW_normal_cell_filler = *MMI_fixed_icontext_menuitem.focussed_filler;
  2910.     DOW_normal_cell_filler.flags &= 0X00000FFF;
  2911.     DOW_selected_cell_filler = *MMI_fixed_icontext_menuitem.focussed_filler;
  2912.     DOW_selected_cell_filler.flags &= 0X00000FFF;
  2913.     DOW_selected_cell_filler.flags |= UI_FILLED_AREA_SINGLE_BORDER;
  2914.     DOW_selected_cell_filler.border_color = c1;
  2915.     d->background_filler = &DOW_normal_cell_filler;
  2916.     d->normal_cell_filler = &DOW_normal_cell_filler;
  2917.     d->normal_highlighted_cell_filler = &DOW_normal_highlighted_cell_filler;
  2918.     d->selected_highlighted_cell_filler = &DOW_selected_highlighted_cell_filler;
  2919.     d->selected_cell_filler = &DOW_selected_cell_filler;
  2920.     d->normal_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
  2921.     d->normal_highlighted_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
  2922.     d->selected_highlighted_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
  2923.     d->selected_text_color = MMI_fixed_icontext_menuitem.focussed_text_color;
  2924.     d->cell_width = DOW_CELL_WIDTH;
  2925.     d->cell_height = MMI_MENUITEM_HEIGHT;
  2926.     d->x = x;
  2927.     d->y = y;
  2928.     d->width = width;
  2929.     d->height = height;
  2930.     d->cell_gap = DOW_CELL_GAP;
  2931.     d->offset_x = (width >> 1) - ((7 * (d->cell_width + d->cell_gap)) >> 1);
  2932.     d->offset_y = (height >> 1) - (d->cell_height >> 1);
  2933.     d->highlighted_cell = 0;
  2934.     d->text_font = &MMI_medium_font;
  2935.     d->flags = 0;
  2936.     for (i = 0; i < 7; i++)
  2937.     {
  2938.         d->states[i] = 0;
  2939.     }
  2940. }
  2941. /*****************************************************************************
  2942.  * FUNCTION
  2943.  *  set_DOW_select_list_menu_theme
  2944.  * DESCRIPTION
  2945.  *  set color theme of DOW input box
  2946.  * PARAMETERS
  2947.  *  d       [IN]        DOW input box
  2948.  * RETURNS
  2949.  *  void
  2950.  *****************************************************************************/
  2951. void set_DOW_select_list_menu_theme(DOW_select *d)
  2952. {
  2953.     /*----------------------------------------------------------------*/
  2954.     /* Local Variables                                                */
  2955.     /*----------------------------------------------------------------*/
  2956.     color c1 = {255, 0, 0, 100};
  2957.     /*----------------------------------------------------------------*/
  2958.     /* Code Body                                                      */
  2959.     /*----------------------------------------------------------------*/
  2960.     list_menu_DOW_selected_cell_filler = *MMI_fixed_list_menu.normal_filler;
  2961.     list_menu_DOW_selected_cell_filler.flags = (UI_FILLED_AREA_TYPE_NO_BACKGROUND | UI_FILLED_AREA_SINGLE_BORDER);
  2962.     list_menu_DOW_selected_cell_filler.border_color = c1;
  2963.     list_menu_DOW_normal_BG_filler = *MMI_fixed_list_menu.normal_filler;
  2964.     list_menu_DOW_normal_BG_filler.flags = UI_FILLED_AREA_TYPE_NO_BACKGROUND;
  2965.     d->background_filler = &list_menu_DOW_normal_BG_filler;
  2966.     d->normal_cell_filler = &list_menu_DOW_normal_BG_filler;
  2967.     d->normal_highlighted_cell_filler = &list_menu_DOW_normal_BG_filler;
  2968.     d->selected_highlighted_cell_filler = &list_menu_DOW_selected_cell_filler;
  2969.     d->selected_cell_filler = &list_menu_DOW_selected_cell_filler;
  2970.     d->normal_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
  2971.     d->normal_highlighted_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
  2972.     d->selected_highlighted_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
  2973.     d->selected_text_color = MMI_fixed_icontext_menuitem.normal_text_color;
  2974. }
  2975. /*****************************************************************************
  2976.  * FUNCTION
  2977.  *  set_DOW_select_states
  2978.  * DESCRIPTION
  2979.  *  set staes of days in DOW input box
  2980.  * PARAMETERS
  2981.  *  d           [IN]        DOW input box
  2982.  *  states      [IN]        []  :- store teh states valeu
  2983.  * RETURNS
  2984.  *  void
  2985.  *****************************************************************************/
  2986. void set_DOW_select_states(DOW_select *d, U8 states[])
  2987. {
  2988.     /*----------------------------------------------------------------*/
  2989.     /* Local Variables                                                */
  2990.     /*----------------------------------------------------------------*/
  2991.     S32 i;
  2992.     /*----------------------------------------------------------------*/
  2993.     /* Code Body                                                      */
  2994.     /*----------------------------------------------------------------*/
  2995.     for (i = 0; i < 7; i++)
  2996.     {
  2997.         d->states[i] = states[i];
  2998.     }
  2999. }
  3000. /*****************************************************************************
  3001.  * FUNCTION
  3002.  *  show_DOW_select_background
  3003.  * DESCRIPTION
  3004.  *  show DOW bkg
  3005.  * PARAMETERS
  3006.  *  d       [IN]        DOW input box
  3007.  * RETURNS
  3008.  *  void
  3009.  *****************************************************************************/
  3010. void show_DOW_select_background(DOW_select *d)
  3011. {
  3012.     /*----------------------------------------------------------------*/
  3013.     /* Local Variables                                                */
  3014.     /*----------------------------------------------------------------*/
  3015.     S32 x1, y1, x2, y2;
  3016.     /*----------------------------------------------------------------*/
  3017.     /* Code Body                                                      */
  3018.     /*----------------------------------------------------------------*/
  3019.     x1 = d->x;
  3020.     y1 = d->y;
  3021.     x2 = x1 + d->width - 1;
  3022.     y2 = y1 + d->height - 1;
  3023.     gdi_layer_reset_clip();
  3024.     gui_draw_filled_area(x1, y1, x2, y2, d->background_filler);
  3025. }
  3026. /*****************************************************************************
  3027.  * FUNCTION
  3028.  *  show_DOW_select
  3029.  * DESCRIPTION
  3030.  *  show DOW input box
  3031.  * PARAMETERS
  3032.  *  d       [IN]        DOW input box
  3033.  * RETURNS
  3034.  *  void
  3035.  *****************************************************************************/
  3036. void show_DOW_select(DOW_select *d)
  3037. {
  3038.     /*----------------------------------------------------------------*/
  3039.     /* Local Variables                                                */
  3040.     /*----------------------------------------------------------------*/
  3041.     S32 DOW_list[] = { 'S', 'M', 'T', 'W', 'T', 'F', 'S' };
  3042.     S32 i, x, y, character_width, character_height;
  3043.     color text_color;
  3044.     UI_filled_area *f;
  3045.     S32 x1, y1, x2, y2;
  3046.     /*----------------------------------------------------------------*/
  3047.     /* Code Body                                                      */
  3048.     /*----------------------------------------------------------------*/
  3049.     gdi_layer_push_clip();
  3050.     gdi_layer_reset_clip();
  3051.     x = d->x + d->offset_x;
  3052.     y = d->y + d->offset_y;
  3053.     gui_set_font(d->text_font);
  3054.     character_height = gui_get_character_height();
  3055.     for (i = 0; i < 7; i++)
  3056.     {
  3057.         if (i == d->highlighted_cell)
  3058.         {
  3059.             if (d->states[i])
  3060.             {
  3061.                 f = d->selected_highlighted_cell_filler;
  3062.                 text_color = d->selected_highlighted_text_color;
  3063.             }
  3064.             else
  3065.             {
  3066.                 f = d->normal_highlighted_cell_filler;
  3067.                 text_color = d->normal_highlighted_text_color;
  3068.             }
  3069.         }
  3070.         else
  3071.         {
  3072.             if (d->states[i])
  3073.             {
  3074.                 f = d->selected_cell_filler;
  3075.                 text_color = d->selected_text_color;
  3076.             }
  3077.             else
  3078.             {
  3079.                 f = d->normal_cell_filler;
  3080.                 text_color = d->normal_text_color;
  3081.             }
  3082.         }
  3083.         x1 = x;
  3084.         y1 = y;
  3085.         x2 = x1 + d->cell_width - 1;
  3086.         y2 = y1 + d->cell_height - 1;
  3087.         gui_set_clip(x1, y1, x2, y2);
  3088.         gui_set_text_clip(x1, y1, x2, y2);
  3089.         gui_draw_filled_area(x1, y1, x2, y2, f);
  3090.         character_width = gui_get_character_width((UI_character_type) DOW_list[i]);
  3091.         gui_move_text_cursor(
  3092.             x + ((d->cell_width - character_width) / 2) + (r2lMMIFlag ? character_width : 0),
  3093.             y + ((d->cell_height - character_height) / 2));