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

MTK

开发平台:

C/C++

  1.         }
  2.         else
  3.         {
  4.             xx = MMI_fixed_icontext_menuitem.text_x;
  5.         }
  6.     }
  7.     else
  8.     {
  9.         xx = 1;
  10.     }
  11.     /* MTK end */
  12.     if (flags & INLINE_ITEM_LEFT_ALIGN)
  13.     {
  14.         xx = -1;
  15.     }
  16.     clear_inline_item_keys = clear_inline_select_menu_keys;
  17.     current_wgui_inline_select_item = i;
  18.     current_wgui_inline_select_text_p = text_p;
  19.     /* MTK Elvis for R2L characters */
  20.     if (!r2lMMIFlag)
  21.     {
  22.         initialize_inline_select_menu_items(
  23.             x + xx,
  24.             y,
  25.             width - xx,
  26.             height,
  27.             i->n_items,
  28.             i->list_of_strings,
  29.             i->highlighted_item,
  30.             current_inline_select_highlight_handler);
  31.     }
  32.     else
  33.     {
  34.         if (flags & INLINE_ITEM_LEFT_ALIGN)
  35.         {
  36.             initialize_inline_select_menu_items(
  37.                 x + xx,
  38.                 y,
  39.                 width - 1 - xx,
  40.                 height,
  41.                 i->n_items,
  42.                 i->list_of_strings,
  43.                 i->highlighted_item,
  44.                 current_inline_select_highlight_handler);
  45.         }
  46.         else
  47.         {
  48.             initialize_inline_select_menu_items(
  49.                 x + xx,
  50.                 y,
  51.                 width - 1 - MMI_fixed_icontext_menuitem.text_x,
  52.                 height,
  53.                 i->n_items,
  54.                 i->list_of_strings,
  55.                 i->highlighted_item,
  56.                 current_inline_select_highlight_handler);
  57.         }
  58.     }
  59.     /* MTK end */
  60.     register_inline_select_menu_keys();
  61.     if (current_wgui_inline_select_highlighted_item == NULL)
  62.     {
  63.         current_wgui_inline_select_highlighted_item = i->highlighted_item;
  64.         current_inline_select_highlight_handler(*i->highlighted_item);
  65.     }
  66.     else
  67.     {
  68.         current_wgui_inline_select_highlighted_item = i->highlighted_item;
  69.     }
  70.     show_inline_select_menu();
  71.     complete_inline_item_edit = inline_select_menu_change_complete;
  72.     redraw_current_inline_item = redraw_inline_select;
  73. #ifdef __MMI_TOUCH_SCREEN__
  74.     wgui_current_inline_item_pen_function = inline_select_pen_handler;
  75. #endif 
  76. }
  77. /*****************************************************************************
  78.  * FUNCTION
  79.  *  SetInlineItemSelect
  80.  * DESCRIPTION
  81.  *  
  82.  * PARAMETERS
  83.  *  item                    [?]         
  84.  *  n_items                 [IN]        
  85.  *  list_of_items           [IN]        
  86.  *  highlighted_item        [?]         
  87.  * RETURNS
  88.  *  void
  89.  *****************************************************************************/
  90. void SetInlineItemSelect(InlineItem *item, S32 n_items, U8 **list_of_items, S32 *highlighted_item)
  91. {
  92.     /*----------------------------------------------------------------*/
  93.     /* Local Variables                                                */
  94.     /*----------------------------------------------------------------*/
  95.     wgui_inline_item_select *i;
  96.     /*----------------------------------------------------------------*/
  97.     /* Code Body                                                      */
  98.     /*----------------------------------------------------------------*/
  99.     if (n_inline_select_items >= MAX_INLINE_SELECT_ITEMS)
  100.     {
  101.         return;
  102.     }
  103.     item->item = (void*)&wgui_inline_select_items[n_inline_select_items];
  104.     item->flags = INLINE_ITEM_TYPE_SELECT;
  105.     n_inline_select_items++;
  106.     i = (wgui_inline_item_select*) item->item;
  107.     i->flags = 0;
  108.     i->list_of_strings = list_of_items;
  109.     i->n_items = n_items;
  110.     i->item_highlighted = UI_dummy_function_s32;
  111.     if (highlighted_item == NULL)
  112.     {
  113.         i->highlighted_item = NULL;
  114.         item->text_p = list_of_items[0];
  115.     }
  116.     else
  117.     {
  118.         if (*highlighted_item < 0 || *highlighted_item >= n_items)
  119.         {
  120.             MMI_DBG_ASSERT(0);
  121.             *highlighted_item = 0;
  122.         }
  123.         i->highlighted_item = highlighted_item;
  124.         item->text_p = list_of_items[*highlighted_item];
  125.     }
  126.     item->handler = handle_inline_select;
  127. }
  128. /*****************************************************************************
  129.  * FUNCTION
  130.  *  ReConfigureInlineItemSelect
  131.  * DESCRIPTION
  132.  *  
  133.  * PARAMETERS
  134.  *  item                    [?]         
  135.  *  n_items                 [IN]        
  136.  *  list_of_items           [IN]        
  137.  *  highlighted_item        [?]         
  138.  * RETURNS
  139.  *  void
  140.  *****************************************************************************/
  141. void ReConfigureInlineItemSelect(InlineItem *item, S32 n_items, U8 **list_of_items, S32 *highlighted_item)
  142. {
  143.     /*----------------------------------------------------------------*/
  144.     /* Local Variables                                                */
  145.     /*----------------------------------------------------------------*/
  146.     wgui_inline_item_select *i;
  147.     /*----------------------------------------------------------------*/
  148.     /* Code Body                                                      */
  149.     /*----------------------------------------------------------------*/
  150.     if ((item->flags & 0xff) != INLINE_ITEM_TYPE_SELECT)
  151.     {
  152.         return;
  153.     }
  154.     i = (wgui_inline_item_select*) item->item;
  155.     i->flags = 0;
  156.     i->list_of_strings = list_of_items;
  157.     i->n_items = n_items;
  158.     i->item_highlighted = UI_dummy_function_s32;
  159.     if (highlighted_item == NULL)
  160.     {
  161.         i->highlighted_item = NULL;
  162.         item->text_p = list_of_items[0];
  163.     }
  164.     else
  165.     {
  166.         if (*highlighted_item < 0 || *highlighted_item >= n_items)
  167.         {
  168.             MMI_DBG_ASSERT(0);
  169.             *highlighted_item = 0;
  170.         }
  171.         i->highlighted_item = highlighted_item;
  172.         item->text_p = list_of_items[*highlighted_item];
  173.     }
  174. }
  175. /*****************************************************************************
  176.  * FUNCTION
  177.  *  RegisterInlineSelectHighlightHandler
  178.  * DESCRIPTION
  179.  *  
  180.  * PARAMETERS
  181.  *  item        [?]         
  182.  *  f           [IN]        
  183.  * RETURNS
  184.  *  void
  185.  *****************************************************************************/
  186. void RegisterInlineSelectHighlightHandler(InlineItem *item, void (*f) (S32 item_index))
  187. {
  188.     /*----------------------------------------------------------------*/
  189.     /* Local Variables                                                */
  190.     /*----------------------------------------------------------------*/
  191.     wgui_inline_item_select *i;
  192.     /*----------------------------------------------------------------*/
  193.     /* Code Body                                                      */
  194.     /*----------------------------------------------------------------*/
  195.     i = (wgui_inline_item_select*) item->item;
  196.     if (f != NULL)
  197.     {
  198.         i->item_highlighted = f;
  199.     }
  200. }
  201. /*****************************************************************************
  202.  * FUNCTION
  203.  *  GetInlineSelectHighlightedItem
  204.  * DESCRIPTION
  205.  *  
  206.  * PARAMETERS
  207.  *  void
  208.  * RETURNS
  209.  *  
  210.  *****************************************************************************/
  211. S32 GetInlineSelectHighlightedItem(void)
  212. {
  213.     /*----------------------------------------------------------------*/
  214.     /* Local Variables                                                */
  215.     /*----------------------------------------------------------------*/
  216.     /*----------------------------------------------------------------*/
  217.     /* Code Body                                                      */
  218.     /*----------------------------------------------------------------*/
  219.     return (*current_wgui_inline_select_item->highlighted_item);
  220. }
  221. /*----------------------------------------------------------------------------
  222.    Inline date edit implementation
  223. ----------------------------------------------------------------------------*/
  224. #define MAX_INLINE_DATE_ITEMS                   4
  225. #define MAX_INLINE_DATE_DISPLAY_STRING_SIZE     26   /* 12 chars with null terminator */
  226. S32 n_inline_date_items = 0;
  227. wgui_inline_item_date wgui_inline_date_items[MAX_INLINE_DATE_ITEMS];
  228. U8 wgui_inline_date_display_strings[MAX_INLINE_DATE_ITEMS][MAX_INLINE_DATE_DISPLAY_STRING_SIZE];
  229. wgui_inline_item_date *current_wgui_inline_date_item;
  230. U8 **current_wgui_inline_date_text_p;
  231. U8 wgui_inline_date_edit_day_buffer[3 * ENCODING_LENGTH];
  232. U8 wgui_inline_date_edit_month_buffer[3 * ENCODING_LENGTH];
  233. U8 wgui_inline_date_edit_year_buffer[5 * ENCODING_LENGTH];
  234. date_input wgui_inline_date_input;
  235. /*****************************************************************************
  236.  * FUNCTION
  237.  *  handle_inline_date_edit_complete
  238.  * DESCRIPTION
  239.  *  
  240.  * PARAMETERS
  241.  *  void
  242.  * RETURNS
  243.  *  void
  244.  *****************************************************************************/
  245. void handle_inline_date_edit_complete(void)
  246. {
  247.     /*----------------------------------------------------------------*/
  248.     /* Local Variables                                                */
  249.     /*----------------------------------------------------------------*/
  250.     /*----------------------------------------------------------------*/
  251.     /* Code Body                                                      */
  252.     /*----------------------------------------------------------------*/
  253.     register_inline_fixed_list_keys();
  254.     gui_strcpy(
  255.         (UI_string_type) current_wgui_inline_date_item->day_buffer,
  256.         (UI_string_type) wgui_inline_date_edit_day_buffer);
  257.     gui_strcpy(
  258.         (UI_string_type) current_wgui_inline_date_item->month_buffer,
  259.         (UI_string_type) wgui_inline_date_edit_month_buffer);
  260.     gui_strcpy(
  261.         (UI_string_type) current_wgui_inline_date_item->year_buffer,
  262.         (UI_string_type) wgui_inline_date_edit_year_buffer);
  263.     current_wgui_inline_date_item->string_construct_callback(
  264.                                     *current_wgui_inline_date_text_p,
  265.                                     current_wgui_inline_date_item->day_buffer,
  266.                                     current_wgui_inline_date_item->month_buffer,
  267.                                     current_wgui_inline_date_item->year_buffer);
  268.     MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text =
  269.         (UI_string_type) * current_wgui_inline_date_text_p;
  270.     clear_left_softkey();
  271.     clear_right_softkey();
  272. #if(0)
  273. set_left_softkey_label(inline_full_screen_edit_saved_LSK_label);
  274. set_left_softkey_icon(inline_full_screen_edit_saved_LSK_icon);
  275. set_right_softkey_label(inline_full_screen_edit_saved_RSK_label);
  276. set_right_softkey_icon(inline_full_screen_edit_saved_RSK_icon);
  277. #endif /* (0) */ 
  278.     register_left_softkey_handler();
  279.     register_right_softkey_handler();
  280. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  281.     mmi_pen_editor_close_input_box();
  282. #endif 
  283.     wgui_inline_item_handled = 0;
  284.     wgui_text_menuitem_restart_scrolling();
  285.     inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
  286.     redraw_current_inline_item = UI_dummy_function;
  287.     complete_inline_item_edit = UI_dummy_function;
  288.     set_current_date_input(NULL);
  289.     clear_date_input_callback();
  290. #if defined(__MMI_TOUCH_SCREEN__)
  291.     wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
  292.     //W06.09 Draw Center Softkey when entering new screen
  293.     //But in in-line editor, redrawing is needed when completing in-line item
  294. #ifdef __MMI_WGUI_CSK_ENABLE__
  295.     redraw_softkey(MMI_CENTER_SOFTKEY);
  296. #endif 
  297. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  298. }
  299. /*****************************************************************************
  300.  * FUNCTION
  301.  *  handle_inline_date_edit_cancel
  302.  * DESCRIPTION
  303.  *  
  304.  * PARAMETERS
  305.  *  void
  306.  * RETURNS
  307.  *  void
  308.  *****************************************************************************/
  309. void handle_inline_date_edit_cancel(void)
  310. {
  311.     /*----------------------------------------------------------------*/
  312.     /* Local Variables                                                */
  313.     /*----------------------------------------------------------------*/
  314.     /*----------------------------------------------------------------*/
  315.     /* Code Body                                                      */
  316.     /*----------------------------------------------------------------*/
  317.     register_inline_fixed_list_keys();
  318.     clear_left_softkey();
  319.     clear_right_softkey();
  320. #if(0)
  321. set_left_softkey_label(inline_full_screen_edit_saved_LSK_label);
  322. set_left_softkey_icon(inline_full_screen_edit_saved_LSK_icon);
  323. set_right_softkey_label(inline_full_screen_edit_saved_RSK_label);
  324. set_right_softkey_icon(inline_full_screen_edit_saved_RSK_icon);
  325. #endif /* (0) */ 
  326.     register_left_softkey_handler();
  327.     register_right_softkey_handler();
  328. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  329.     mmi_pen_editor_close_input_box();
  330. #endif 
  331.     wgui_inline_item_handled = 0;
  332.     wgui_text_menuitem_restart_scrolling();
  333.     inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
  334.     redraw_current_inline_item = UI_dummy_function;
  335.     complete_inline_item_edit = UI_dummy_function;
  336.     set_current_date_input(NULL);
  337.     clear_date_input_callback();
  338. #if defined(__MMI_TOUCH_SCREEN__)
  339.     wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
  340.     //W06.09 Draw Center Softkey when entering new screen
  341.     //But in in-line editor, redrawing is needed when completing in-line item
  342. #ifdef __MMI_WGUI_CSK_ENABLE__
  343.     redraw_softkey(MMI_CENTER_SOFTKEY);
  344. #endif 
  345. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  346. }
  347. /*****************************************************************************
  348.  * FUNCTION
  349.  *  redraw_inline_date_edit
  350.  * DESCRIPTION
  351.  *  
  352.  * PARAMETERS
  353.  *  void
  354.  * RETURNS
  355.  *  void
  356.  *****************************************************************************/
  357. void redraw_inline_date_edit(void)
  358. {
  359.     /*----------------------------------------------------------------*/
  360.     /* Local Variables                                                */
  361.     /*----------------------------------------------------------------*/
  362.     /*----------------------------------------------------------------*/
  363.     /* Code Body                                                      */
  364.     /*----------------------------------------------------------------*/
  365.     date_input_show_background(&wgui_inline_date_input);
  366.     show_date_input(&wgui_inline_date_input);
  367. }
  368. /*****************************************************************************
  369.  * FUNCTION
  370.  *  inline_date_edit_handle_down_arrow
  371.  * DESCRIPTION
  372.  *  
  373.  * PARAMETERS
  374.  *  void
  375.  * RETURNS
  376.  *  void
  377.  *****************************************************************************/
  378. void inline_date_edit_handle_down_arrow(void)
  379. {
  380.     /*----------------------------------------------------------------*/
  381.     /* Local Variables                                                */
  382.     /*----------------------------------------------------------------*/
  383.     /*----------------------------------------------------------------*/
  384.     /* Code Body                                                      */
  385.     /*----------------------------------------------------------------*/
  386.     handle_inline_date_edit_complete();
  387.     inline_fixed_list_goto_next_item();
  388. }
  389. /*****************************************************************************
  390.  * FUNCTION
  391.  *  inline_date_edit_handle_up_arrow
  392.  * DESCRIPTION
  393.  *  
  394.  * PARAMETERS
  395.  *  void
  396.  * RETURNS
  397.  *  void
  398.  *****************************************************************************/
  399. void inline_date_edit_handle_up_arrow(void)
  400. {
  401.     /*----------------------------------------------------------------*/
  402.     /* Local Variables                                                */
  403.     /*----------------------------------------------------------------*/
  404.     /*----------------------------------------------------------------*/
  405.     /* Code Body                                                      */
  406.     /*----------------------------------------------------------------*/
  407.     handle_inline_date_edit_complete();
  408.     inline_fixed_list_goto_previous_item();
  409. }
  410. /*****************************************************************************
  411.  * FUNCTION
  412.  *  inline_date_input_key_handler
  413.  * DESCRIPTION
  414.  *  
  415.  * PARAMETERS
  416.  *  vkey_code       [IN]        
  417.  *  key_state       [IN]        
  418.  * RETURNS
  419.  *  void
  420.  *****************************************************************************/
  421. void inline_date_input_key_handler(S32 vkey_code, S32 key_state)
  422. {
  423. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  424.     /*----------------------------------------------------------------*/
  425.     /* Local Variables                                                */
  426.     /*----------------------------------------------------------------*/
  427.     /*----------------------------------------------------------------*/
  428.     /* Code Body                                                      */
  429.     /*----------------------------------------------------------------*/
  430.     if (key_state)
  431.     {
  432.         switch (vkey_code)
  433.         {
  434.             case 37:
  435.                 date_input_previous_character();
  436.                 break;
  437.             case 38:
  438.                 inline_date_edit_handle_up_arrow();
  439.                 break;
  440.             case 39:
  441.                 date_input_next_character();
  442.                 break;
  443.             case 40:
  444.                 inline_date_edit_handle_down_arrow();
  445.                 break;
  446.             case 36:    /* home */
  447.                 break;
  448.             case 35:    /* end */
  449.                 break;
  450.             case 33:    /* page up */
  451.                 break;
  452.             case 34:    /* page down */
  453.                 break;
  454.             case 45:
  455.                 date_input_toggle_insert_mode();
  456.                 break;
  457.             case 46:
  458.                 date_input_delete_current_character();
  459.                 break;
  460.         }
  461.     }
  462. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  463.     UI_UNUSED_PARAMETER(vkey_code);
  464.     UI_UNUSED_PARAMETER(key_state);
  465. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  466. }
  467. /*****************************************************************************
  468.  * FUNCTION
  469.  *  handle_inline_date_edit_input
  470.  * DESCRIPTION
  471.  *  
  472.  * PARAMETERS
  473.  *  void
  474.  * RETURNS
  475.  *  void
  476.  *****************************************************************************/
  477. void handle_inline_date_edit_input(void)
  478. {
  479.     /*----------------------------------------------------------------*/
  480.     /* Local Variables                                                */
  481.     /*----------------------------------------------------------------*/
  482.     /*----------------------------------------------------------------*/
  483.     /* Code Body                                                      */
  484.     /*----------------------------------------------------------------*/
  485.     set_wgui_inline_list_menu_changed();
  486. }
  487. /* History implementation for inline date edit  */
  488. typedef struct _inline_date_edit_history
  489. {
  490.     U16 history_ID;
  491.     S16 current_focus;
  492.     S16 current_position;
  493.     S16 dummy;  /* Added for history issue on hardware */
  494.     U32 flags;
  495. } inline_date_edit_history;
  496. /*****************************************************************************
  497.  * FUNCTION
  498.  *  inline_date_edit_get_history
  499.  * DESCRIPTION
  500.  *  
  501.  * PARAMETERS
  502.  *  history_buffer      [?]     
  503.  * RETURNS
  504.  *  
  505.  *****************************************************************************/
  506. U8 *inline_date_edit_get_history(U8 *history_buffer)
  507. {
  508.     /*----------------------------------------------------------------*/
  509.     /* Local Variables                                                */
  510.     /*----------------------------------------------------------------*/
  511.     /*----------------------------------------------------------------*/
  512.     /* Code Body                                                      */
  513.     /*----------------------------------------------------------------*/
  514.     if (history_buffer != NULL)
  515.     {
  516.         U16 hID = (U16) (INLINE_DATE_HISTORY_ID | 0x8000);
  517.         inline_date_edit_history *h = (inline_date_edit_history*) history_buffer;
  518.         h->history_ID = hID;
  519.         h->current_focus = (S16) wgui_inline_date_input.current_focus;
  520.         if (wgui_inline_date_input.focus_input_box != NULL)
  521.         {
  522.             h->current_position =
  523.                 (S16) (wgui_inline_date_input.focus_input_box->current_text_p -
  524.                        wgui_inline_date_input.focus_input_box->text);
  525.         }
  526.         h->flags = wgui_inline_date_input.flags;
  527.     }
  528.     return (history_buffer);
  529. }
  530. /*****************************************************************************
  531.  * FUNCTION
  532.  *  inline_date_edit_set_history
  533.  * DESCRIPTION
  534.  *  
  535.  * PARAMETERS
  536.  *  history_ID          [IN]        
  537.  *  history_buffer      [?]         
  538.  * RETURNS
  539.  *  
  540.  *****************************************************************************/
  541. U8 inline_date_edit_set_history(U16 history_ID, U8 *history_buffer)
  542. {
  543.     /*----------------------------------------------------------------*/
  544.     /* Local Variables                                                */
  545.     /*----------------------------------------------------------------*/
  546.     /*----------------------------------------------------------------*/
  547.     /* Code Body                                                      */
  548.     /*----------------------------------------------------------------*/
  549.     if (history_buffer != NULL)
  550.     {
  551.         inline_date_edit_history *h = (inline_date_edit_history*) history_buffer;
  552.         if (history_valid(h->history_ID, history_ID))
  553.         {
  554.             wgui_inline_date_input.current_focus = h->current_focus;
  555.             date_input_reset_focus(&wgui_inline_date_input);
  556.             date_input_set_focus(&wgui_inline_date_input);
  557.             if (wgui_inline_date_input.focus_input_box != NULL)
  558.             {
  559.                 wgui_inline_date_input.focus_input_box->current_text_p =
  560.                     wgui_inline_date_input.focus_input_box->text + h->current_position;
  561.             }
  562.             wgui_inline_date_input.flags = h->flags;
  563.             return (1);
  564.         }
  565.     }
  566.     return (0);
  567. }
  568. /*****************************************************************************
  569.  * FUNCTION
  570.  *  handle_inline_date_edit
  571.  * DESCRIPTION
  572.  *  
  573.  * PARAMETERS
  574.  *  x                   [IN]        
  575.  *  y                   [IN]        
  576.  *  width               [IN]        
  577.  *  height              [IN]        
  578.  *  key_code            [IN]        
  579.  *  key_event           [IN]        
  580.  *  text_p              [IN]        
  581.  *  item                [?]         
  582.  *  flags               [IN]        
  583.  *  history_buffer      [?]         
  584.  * RETURNS
  585.  *  void
  586.  *****************************************************************************/
  587. void handle_inline_date_edit(
  588.         S32 x,
  589.         S32 y,
  590.         S32 width,
  591.         S32 height,
  592.         S32 key_code,
  593.         S32 key_event,
  594.         U8 **text_p,
  595.         void *item,
  596.         U32 flags,
  597.         U8 *history_buffer)
  598. {
  599.     /*----------------------------------------------------------------*/
  600.     /* Local Variables                                                */
  601.     /*----------------------------------------------------------------*/
  602.     wgui_inline_item_date *i = (wgui_inline_item_date*) item;
  603.     S32 xx;
  604.     U32 dtflags = DATE_INPUT_TYPE_YYYY_MM_DD;
  605. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  606.     mmi_pen_handwriting_area_struct stroke_area;
  607.     mmi_pen_handwriting_area_struct ext_stroke;
  608. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  609.     /*----------------------------------------------------------------*/
  610.     /* Code Body                                                      */
  611.     /*----------------------------------------------------------------*/
  612.     UI_UNUSED_PARAMETER(key_code);
  613.     UI_UNUSED_PARAMETER(key_event);
  614.     UI_UNUSED_PARAMETER(flags);
  615.     wgui_current_inline_item_type = INLINE_ITEM_TYPE_DATE;
  616.     /* MTK Elvis for R2L characters */
  617.     if (!r2lMMIFlag)
  618.     {
  619.         if (MMI_fixed_icontext_menuitem.text_x == 2)
  620.         {
  621.             xx = -1;
  622.         }
  623.         else
  624.         {
  625.             xx = MMI_fixed_icontext_menuitem.text_x;
  626.         }
  627.     }
  628.     else
  629.     {
  630.         xx = 1;
  631.     }
  632.     /* MTK end */
  633.     if (flags & INLINE_ITEM_LEFT_ALIGN)
  634.     {
  635.         xx = -1;
  636.     }
  637.     switch (flags & INLINE_ITEM_JUSTIFY_MASK)
  638.     {
  639.         case INLINE_ITEM_RIGHT_JUSTIFY:
  640.             dtflags |= DATE_INPUT_RIGHT_JUSTIFY;
  641.             break;
  642.         case INLINE_ITEM_CENTER_JUSTIFY:
  643.             dtflags |= DATE_INPUT_CENTER_JUSTIFY;
  644.             break;
  645.     }
  646.     complete_inline_item_edit = handle_inline_date_edit_complete;
  647.     current_wgui_inline_date_item = i;
  648.     current_wgui_inline_date_text_p = text_p;
  649.     gui_strcpy((UI_string_type) wgui_inline_date_edit_day_buffer, (UI_string_type) i->day_buffer);
  650.     gui_strcpy((UI_string_type) wgui_inline_date_edit_month_buffer, (UI_string_type) i->month_buffer);
  651.     gui_strcpy((UI_string_type) wgui_inline_date_edit_year_buffer, (UI_string_type) i->year_buffer);
  652.     /* MTK Elvis for R2L characters */
  653.     if (!r2lMMIFlag)
  654.     {
  655.         create_date_input(
  656.             &wgui_inline_date_input,
  657.             x + xx,
  658.             y,
  659.             width - xx,
  660.             height,
  661.             dtflags,
  662.             wgui_inline_date_edit_day_buffer,
  663.             wgui_inline_date_edit_month_buffer,
  664.             wgui_inline_date_edit_year_buffer);
  665.     }
  666.     else
  667.     {
  668.         /* PMT VIKAS START 20050817 */
  669.     #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  670.         /* To reduce the highlighter's width */
  671.         if (flags & INLINE_ITEM_LEFT_ALIGN)
  672.         {
  673.             create_date_input(
  674.                 &wgui_inline_date_input,
  675.                 x + xx,
  676.                 y,
  677.                 width - 1 - xx,
  678.                 height,
  679.                 dtflags,
  680.                 wgui_inline_date_edit_day_buffer,
  681.                 wgui_inline_date_edit_month_buffer,
  682.                 wgui_inline_date_edit_year_buffer);
  683.         }
  684.         else
  685.         {
  686.             create_date_input(
  687.                 &wgui_inline_date_input,
  688.                 x + xx,
  689.                 y,
  690.                 width - 1 - MMI_fixed_icontext_menuitem.text_x - 4,
  691.                 height,
  692.                 dtflags,
  693.                 wgui_inline_date_edit_day_buffer,
  694.                 wgui_inline_date_edit_month_buffer,
  695.                 wgui_inline_date_edit_year_buffer);
  696.         }
  697.     #else /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  698.         if (flags & INLINE_ITEM_LEFT_ALIGN)
  699.         {
  700.             create_date_input(
  701.                 &wgui_inline_date_input,
  702.                 x + xx,
  703.                 y,
  704.                 width - xx,
  705.                 height,
  706.                 dtflags,
  707.                 wgui_inline_date_edit_day_buffer,
  708.                 wgui_inline_date_edit_month_buffer,
  709.                 wgui_inline_date_edit_year_buffer);
  710.         }
  711.         else
  712.         {
  713.             create_date_input(
  714.                 &wgui_inline_date_input,
  715.                 x + xx,
  716.                 y,
  717.                 width - MMI_fixed_icontext_menuitem.text_x,
  718.                 height,
  719.                 dtflags,
  720.                 wgui_inline_date_edit_day_buffer,
  721.                 wgui_inline_date_edit_month_buffer,
  722.                 wgui_inline_date_edit_year_buffer);
  723.         }
  724.     #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  725.         /* PMT VIKAS END 20050817 */
  726.     }
  727.     /* MTK end */
  728.     inline_date_edit_set_history(INLINE_DATE_HISTORY_ID, history_buffer);
  729.     date_input_set_seperator(&wgui_inline_date_input, (UI_character_type) '/');
  730.     date_input_show_background(&wgui_inline_date_input);
  731.     show_date_input(&wgui_inline_date_input);
  732.     set_current_date_input(&wgui_inline_date_input);
  733.     date_input_register_keys();
  734.     register_keyboard_key_handler(inline_date_input_key_handler);
  735.     SetKeyHandler(inline_date_edit_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  736.     SetKeyHandler(inline_date_edit_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
  737.     SetKeyHandler(inline_date_edit_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  738.     SetKeyHandler(inline_date_edit_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
  739.     redraw_current_inline_item = redraw_inline_date_edit;
  740.     register_date_input_callback(handle_inline_date_edit_input);
  741. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  742.     ext_stroke.x1 = 0;
  743.     ext_stroke.y1 = 0;
  744.     ext_stroke.x2 = UI_device_width - 1;
  745.     ext_stroke.y2 = UI_device_height - 1;
  746. #if 0
  747. /* under construction !*/
  748. /* under construction !*/
  749. /* under construction !*/
  750. /* under construction !*/
  751. #else /* 0 */ 
  752.     stroke_area.x1 = MMI_content_x;
  753.     stroke_area.x2 = MMI_content_x + MMI_content_width - MMI_fixed_list_menu.vbar.width;
  754.     stroke_area.y1 = MMI_title_y;
  755.     stroke_area.y2 = MMI_title_y + MMI_content_height + MMI_title_height;
  756. #endif /* 0 */ 
  757.     mmi_pen_editor_setup_input_box(&stroke_area, &ext_stroke, INPUT_TYPE_NUMERIC, MMI_FALSE, PEN_EDITOR_DATE);
  758. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  759. }
  760. /*****************************************************************************
  761.  * FUNCTION
  762.  *  SetInlineItemDate
  763.  * DESCRIPTION
  764.  *  
  765.  * PARAMETERS
  766.  *  item                [?]         
  767.  *  day_buffer          [?]         
  768.  *  month_buffer        [?]         
  769.  *  year_buffer         [?]         
  770.  *  f                   [IN]        
  771.  * RETURNS
  772.  *  void
  773.  *****************************************************************************/
  774. void SetInlineItemDate(
  775.         InlineItem *item,
  776.         U8 *day_buffer,
  777.         U8 *month_buffer,
  778.         U8 *year_buffer,
  779.         void (*f) (U8 *string_buffer, U8 *day_buffer, U8 *month_buffer, U8 *year_buffer))
  780. {
  781.     /*----------------------------------------------------------------*/
  782.     /* Local Variables                                                */
  783.     /*----------------------------------------------------------------*/
  784.     wgui_inline_item_date *i;
  785.     /*----------------------------------------------------------------*/
  786.     /* Code Body                                                      */
  787.     /*----------------------------------------------------------------*/
  788.     if (n_inline_date_items >= MAX_INLINE_DATE_ITEMS)
  789.     {
  790.         return;
  791.     }
  792.     item->item = (void*)&wgui_inline_date_items[n_inline_date_items];
  793.     item->flags = INLINE_ITEM_TYPE_DATE;
  794.     item->text_p = (U8*) wgui_inline_date_display_strings[n_inline_date_items];
  795.     n_inline_date_items++;
  796.     i = (wgui_inline_item_date*) item->item;
  797.     i->day_buffer = day_buffer;
  798.     i->month_buffer = month_buffer;
  799.     i->year_buffer = year_buffer;
  800.     i->flags = INLINE_ITEM_LEFT_JUSTIFY;
  801.     i->string_construct_callback = f;
  802.     i->string_construct_callback(item->text_p, i->day_buffer, i->month_buffer, i->year_buffer);
  803.     item->handler = handle_inline_date_edit;
  804. }
  805. /*****************************************************************************
  806.  * FUNCTION
  807.  *  ReConfigureInlineItemDate
  808.  * DESCRIPTION
  809.  *  
  810.  * PARAMETERS
  811.  *  item                [?]         
  812.  *  day_buffer          [?]         
  813.  *  month_buffer        [?]         
  814.  *  year_buffer         [?]         
  815.  *  f                   [IN]        
  816.  * RETURNS
  817.  *  void
  818.  *****************************************************************************/
  819. void ReConfigureInlineItemDate(
  820.         InlineItem *item,
  821.         U8 *day_buffer,
  822.         U8 *month_buffer,
  823.         U8 *year_buffer,
  824.         void (*f) (U8 *string_buffer, U8 *day_buffer, U8 *month_buffer, U8 *year_buffer))
  825. {
  826.     /*----------------------------------------------------------------*/
  827.     /* Local Variables                                                */
  828.     /*----------------------------------------------------------------*/
  829.     wgui_inline_item_date *i;
  830.     /*----------------------------------------------------------------*/
  831.     /* Code Body                                                      */
  832.     /*----------------------------------------------------------------*/
  833.     if ((item->flags & 0xff) != INLINE_ITEM_TYPE_DATE)
  834.     {
  835.         return;
  836.     }
  837.     i = (wgui_inline_item_date*) item->item;
  838.     i->day_buffer = day_buffer;
  839.     i->month_buffer = month_buffer;
  840.     i->year_buffer = year_buffer;
  841.     i->flags = 0;
  842.     i->string_construct_callback = f;
  843.     i->string_construct_callback(item->text_p, i->day_buffer, i->month_buffer, i->year_buffer);
  844. }
  845. /* Displaying date edit as a menu item in the fixed list menu  */
  846. date_input wgui_inline_date_input_display;
  847. U8 wgui_inline_date_edit_day_display_buffer[3 * ENCODING_LENGTH];
  848. U8 wgui_inline_date_edit_month_display_buffer[3 * ENCODING_LENGTH];
  849. U8 wgui_inline_date_edit_year_display_buffer[5 * ENCODING_LENGTH];
  850. /*****************************************************************************
  851.  * FUNCTION
  852.  *  wgui_set_date_time_input_focussed_theme
  853.  * DESCRIPTION
  854.  *  
  855.  * PARAMETERS
  856.  *  void
  857.  * RETURNS
  858.  *  void
  859.  *****************************************************************************/
  860. void wgui_set_date_time_input_focussed_theme(void)
  861. {
  862.     /*----------------------------------------------------------------*/
  863.     /* Local Variables                                                */
  864.     /*----------------------------------------------------------------*/
  865.     color c1 = {0, 0, 0, 100};
  866.     /*----------------------------------------------------------------*/
  867.     /* Code Body                                                      */
  868.     /*----------------------------------------------------------------*/
  869.     date_time_input_theme.disabled_filler = wgui_inline_singleline_inputbox_focussed_theme.disabled_filler;
  870.     date_time_input_theme.normal_filler = wgui_inline_singleline_inputbox_focussed_theme.normal_filler;
  871.     date_time_input_theme.selected_filler = wgui_inline_singleline_inputbox_focussed_theme.selected_filler;
  872.     date_time_input_theme.disabled_text_color = wgui_inline_singleline_inputbox_focussed_theme.disabled_text_color;
  873.     date_time_input_theme.normal_text_color = wgui_inline_singleline_inputbox_focussed_theme.normal_text_color;
  874.     date_time_input_theme.selected_text_color = wgui_inline_singleline_inputbox_focussed_theme.selected_text_color;
  875.     date_time_input_background_filler = *wgui_inline_singleline_inputbox_focussed_theme.normal_filler;
  876.     date_time_input_background_filler.flags &= 0x00000fff;
  877.     date_time_input_background_filler.flags |= UI_FILLED_AREA_SINGLE_BORDER;
  878. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  879.     date_time_input_background_filler.border_color = current_MMI_theme->list_background_filler->border_color;
  880. #else 
  881.     date_time_input_background_filler.border_color = c1;
  882. #endif 
  883.     /* PMT VIKAS END 20050707 */
  884.     date_time_input_theme.cursor_color = *current_MMI_theme->inline_edit_cursor_color;
  885.     date_time_input_theme.selection_text_color = *current_MMI_theme->inline_edit_selected_text_color;
  886.     date_time_input_theme.selection_color = *current_MMI_theme->inline_edit_selector_color;
  887. }
  888. /*****************************************************************************
  889.  * FUNCTION
  890.  *  wgui_set_date_time_input_unfocussed_theme
  891.  * DESCRIPTION
  892.  *  
  893.  * PARAMETERS
  894.  *  void
  895.  * RETURNS
  896.  *  void
  897.  *****************************************************************************/
  898. void wgui_set_date_time_input_unfocussed_theme(void)
  899. {
  900.     /*----------------------------------------------------------------*/
  901.     /* Local Variables                                                */
  902.     /*----------------------------------------------------------------*/
  903.     color c1 = {0, 0, 0, 100};
  904.     /*----------------------------------------------------------------*/
  905.     /* Code Body                                                      */
  906.     /*----------------------------------------------------------------*/
  907.     date_time_input_theme.disabled_filler = wgui_inline_singleline_inputbox_unfocussed_theme.disabled_filler;
  908.     /* 20051012 HIMANSHU START COMMON */
  909.     /* changed the date time normal filler in case of default text effect is enabled. */
  910. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  911.     if (IsInlineItemDefaultTextEnable())
  912.     {
  913.         date_time_input_theme.normal_filler = &temp_inline_edit_normal_filler;
  914.     }
  915.     else
  916. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  917.         /* 20051012 HIMANSHU END COMMON */
  918.         date_time_input_theme.normal_filler = wgui_inline_singleline_inputbox_unfocussed_theme.normal_filler;
  919.     date_time_input_theme.selected_filler = wgui_inline_singleline_inputbox_unfocussed_theme.selected_filler;
  920.     date_time_input_theme.disabled_text_color = wgui_inline_singleline_inputbox_unfocussed_theme.disabled_text_color;
  921.     date_time_input_theme.normal_text_color = wgui_inline_singleline_inputbox_unfocussed_theme.normal_text_color;
  922.     date_time_input_theme.selected_text_color = wgui_inline_singleline_inputbox_unfocussed_theme.selected_text_color;
  923.     date_time_input_background_filler = *wgui_inline_singleline_inputbox_unfocussed_theme.normal_filler;
  924.     date_time_input_background_filler.flags &= 0x00000fff;
  925.     date_time_input_background_filler.flags |= UI_FILLED_AREA_SINGLE_BORDER;
  926.     /* PMT VIKAS START 20050707 */
  927. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  928.     date_time_input_background_filler.border_color = current_MMI_theme->list_background_filler->border_color;
  929. #else 
  930.     date_time_input_background_filler.border_color = c1;
  931. #endif 
  932.     /* PMT VIKAS END 20050707 */
  933.     time_period_input_background_filler = MMI_inputbox_normal_filler;   /* *MMI_fixed_list_menu.normal_filler; */
  934.     date_time_input_theme.cursor_color = *current_MMI_theme->inline_edit_cursor_color;
  935.     date_time_input_theme.selection_text_color = *current_MMI_theme->inline_edit_selected_text_color;
  936.     date_time_input_theme.selection_color = *current_MMI_theme->inline_edit_selector_color;
  937. }
  938. /*****************************************************************************
  939.  * FUNCTION
  940.  *  wgui_show_inline_date_list_menuitem
  941.  * DESCRIPTION
  942.  *  
  943.  * PARAMETERS
  944.  *  x1          [IN]        
  945.  *  y1          [IN]        
  946.  *  width       [IN]        
  947.  *  height      [IN]        
  948.  *  item        [?]         
  949.  * RETURNS
  950.  *  void
  951.  *****************************************************************************/
  952. void wgui_show_inline_date_list_menuitem(S32 x1, S32 y1, S32 width, S32 height, wgui_inline_item *item)
  953. {
  954.     /*----------------------------------------------------------------*/
  955.     /* Local Variables                                                */
  956.     /*----------------------------------------------------------------*/
  957.     wgui_inline_item_date *i = (wgui_inline_item_date*) item->item;
  958.     S32 xx;
  959.     U32 dtflags = DATE_INPUT_TYPE_YYYY_MM_DD;
  960.     /*----------------------------------------------------------------*/
  961.     /* Code Body                                                      */
  962.     /*----------------------------------------------------------------*/
  963.     gdi_layer_lock_frame_buffer();
  964.     if (MMI_fixed_icontext_menuitem.text_x == 2)
  965.     {
  966.         xx = -1;
  967.     }
  968.     else
  969.     {
  970.         xx = MMI_fixed_icontext_menuitem.text_x;
  971.     }
  972.     if (item->flags & INLINE_ITEM_LEFT_ALIGN)
  973.     {
  974.         xx = -1;
  975.     }
  976.     switch (item->flags & INLINE_ITEM_JUSTIFY_MASK)
  977.     {
  978.         case INLINE_ITEM_RIGHT_JUSTIFY:
  979.             dtflags |= DATE_INPUT_RIGHT_JUSTIFY;
  980.             break;
  981.         case INLINE_ITEM_CENTER_JUSTIFY:
  982.             dtflags |= DATE_INPUT_CENTER_JUSTIFY;
  983.             break;
  984.     }
  985.     gui_strcpy((UI_string_type) wgui_inline_date_edit_day_display_buffer, (UI_string_type) i->day_buffer);
  986.     gui_strcpy((UI_string_type) wgui_inline_date_edit_month_display_buffer, (UI_string_type) i->month_buffer);
  987.     gui_strcpy((UI_string_type) wgui_inline_date_edit_year_display_buffer, (UI_string_type) i->year_buffer);
  988.     wgui_set_date_time_input_unfocussed_theme();
  989.     create_date_input(
  990.         &wgui_inline_date_input_display,
  991.         x1 + xx,
  992.         y1,
  993.         width - xx,
  994.         height,
  995.         dtflags,
  996.         wgui_inline_date_edit_day_display_buffer,
  997.         wgui_inline_date_edit_month_display_buffer,
  998.         wgui_inline_date_edit_year_display_buffer);
  999.     date_input_set_seperator(&wgui_inline_date_input_display, (UI_character_type) '/');
  1000.     /* 20051012 HIMANSHU START INLINE DATE */
  1001.     /* show the different background in case of default text effect is enabled
  1002.        for the inline item type Date. */
  1003. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1004.     if (IsInlineItemDefaultTextEnable())
  1005.     {
  1006.         inline_item_default_text_show_background(
  1007.             wgui_inline_date_input_display.x,
  1008.             wgui_inline_date_input_display.y,
  1009.             wgui_inline_date_input_display.x + wgui_inline_date_input_display.width - 1,
  1010.             wgui_inline_date_input_display.y + wgui_inline_date_input_display.height - 1);
  1011.     }
  1012.     else
  1013. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  1014.         /* 20051012 HIMANSHU END INLINE DATE */
  1015.         date_input_show_background(&wgui_inline_date_input_display);
  1016.     date_input_reset_focus(&wgui_inline_date_input_display);
  1017.     show_date_input(&wgui_inline_date_input_display);
  1018.     wgui_set_date_time_input_focussed_theme();
  1019.     redraw_left_softkey();
  1020.     redraw_right_softkey();
  1021.     gdi_layer_unlock_frame_buffer();
  1022. }
  1023. /*----------------------------------------------------------------------------
  1024.    Inline time edit implementation
  1025. ----------------------------------------------------------------------------*/
  1026. #define MAX_INLINE_TIME_ITEMS                   4
  1027. #define MAX_INLINE_TIME_DISPLAY_STRING_SIZE           24
  1028. S32 n_inline_time_items = 0;
  1029. wgui_inline_item_time wgui_inline_time_items[MAX_INLINE_TIME_ITEMS];
  1030. U8 wgui_inline_time_display_strings[MAX_INLINE_TIME_ITEMS][MAX_INLINE_TIME_DISPLAY_STRING_SIZE];
  1031. wgui_inline_item_time *current_wgui_inline_time_item;
  1032. U8 **current_wgui_inline_time_text_p;
  1033. U8 wgui_inline_time_edit_hours_buffer[3 * ENCODING_LENGTH];
  1034. U8 wgui_inline_time_edit_minutes_buffer[3 * ENCODING_LENGTH];
  1035. U8 wgui_inline_time_edit_seconds_buffer[3 * ENCODING_LENGTH];
  1036. U8 *wgui_inline_time_AM_PM_flag;
  1037. time_input wgui_inline_time_input;
  1038. /*****************************************************************************
  1039.  * FUNCTION
  1040.  *  handle_inline_time_edit_complete
  1041.  * DESCRIPTION
  1042.  *  
  1043.  * PARAMETERS
  1044.  *  void
  1045.  * RETURNS
  1046.  *  void
  1047.  *****************************************************************************/
  1048. void handle_inline_time_edit_complete(void)
  1049. {
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Local Variables                                                */
  1052.     /*----------------------------------------------------------------*/
  1053.     /*----------------------------------------------------------------*/
  1054.     /* Code Body                                                      */
  1055.     /*----------------------------------------------------------------*/
  1056.     register_inline_fixed_list_keys();
  1057.     gui_strcpy(
  1058.         (UI_string_type) current_wgui_inline_time_item->hours_buffer,
  1059.         (UI_string_type) wgui_inline_time_edit_hours_buffer);
  1060.     gui_strcpy(
  1061.         (UI_string_type) current_wgui_inline_time_item->minutes_buffer,
  1062.         (UI_string_type) wgui_inline_time_edit_minutes_buffer);
  1063.     current_wgui_inline_time_item->AM_PM_flag = wgui_inline_time_AM_PM_flag;
  1064.     current_wgui_inline_time_item->string_construct_callback(
  1065.                                     *current_wgui_inline_time_text_p,
  1066.                                     current_wgui_inline_time_item->hours_buffer,
  1067.                                     current_wgui_inline_time_item->minutes_buffer,
  1068.                                     current_wgui_inline_time_item->AM_PM_flag);
  1069.     MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text =
  1070.         (UI_string_type) * current_wgui_inline_time_text_p;
  1071.     clear_left_softkey();
  1072.     clear_right_softkey();
  1073.     register_left_softkey_handler();
  1074.     register_right_softkey_handler();
  1075. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1076.     mmi_pen_editor_close_input_box();
  1077. #endif 
  1078.     wgui_inline_item_handled = 0;
  1079.     wgui_text_menuitem_restart_scrolling();
  1080.     inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
  1081.     redraw_current_inline_item = UI_dummy_function;
  1082.     complete_inline_item_edit = UI_dummy_function;
  1083.     set_current_time_input(NULL);
  1084.     clear_time_input_callback();
  1085. #if defined(__MMI_TOUCH_SCREEN__)
  1086.     wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
  1087.     //W06.09 Draw Center Softkey when entering new screen
  1088.     //But in in-line editor, redrawing is needed when completing in-line item
  1089. #ifdef __MMI_WGUI_CSK_ENABLE__
  1090.     redraw_softkey(MMI_CENTER_SOFTKEY);
  1091. #endif 
  1092. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  1093. }
  1094. /*****************************************************************************
  1095.  * FUNCTION
  1096.  *  handle_inline_time_edit_cancel
  1097.  * DESCRIPTION
  1098.  *  
  1099.  * PARAMETERS
  1100.  *  void
  1101.  * RETURNS
  1102.  *  void
  1103.  *****************************************************************************/
  1104. void handle_inline_time_edit_cancel(void)
  1105. {
  1106.     /*----------------------------------------------------------------*/
  1107.     /* Local Variables                                                */
  1108.     /*----------------------------------------------------------------*/
  1109.     /*----------------------------------------------------------------*/
  1110.     /* Code Body                                                      */
  1111.     /*----------------------------------------------------------------*/
  1112.     register_inline_fixed_list_keys();
  1113.     clear_left_softkey();
  1114.     clear_right_softkey();
  1115.     register_left_softkey_handler();
  1116.     register_right_softkey_handler();
  1117. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1118.     mmi_pen_editor_close_input_box();
  1119. #endif 
  1120.     wgui_inline_item_handled = 0;
  1121.     wgui_text_menuitem_restart_scrolling();
  1122.     inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
  1123.     redraw_current_inline_item = UI_dummy_function;
  1124.     complete_inline_item_edit = UI_dummy_function;
  1125.     set_current_time_input(NULL);
  1126.     clear_time_input_callback();
  1127. #if defined(__MMI_TOUCH_SCREEN__)
  1128.     wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
  1129.     //W06.09 Draw Center Softkey when entering new screen
  1130.     //But in in-line editor, redrawing is needed when completing in-line item
  1131. #ifdef __MMI_WGUI_CSK_ENABLE__
  1132.     redraw_softkey(MMI_CENTER_SOFTKEY);
  1133. #endif 
  1134. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  1135. }
  1136. /*****************************************************************************
  1137.  * FUNCTION
  1138.  *  redraw_inline_time_edit
  1139.  * DESCRIPTION
  1140.  *  
  1141.  * PARAMETERS
  1142.  *  void
  1143.  * RETURNS
  1144.  *  void
  1145.  *****************************************************************************/
  1146. void redraw_inline_time_edit(void)
  1147. {
  1148.     /*----------------------------------------------------------------*/
  1149.     /* Local Variables                                                */
  1150.     /*----------------------------------------------------------------*/
  1151.     /*----------------------------------------------------------------*/
  1152.     /* Code Body                                                      */
  1153.     /*----------------------------------------------------------------*/
  1154.     time_input_show_background(&wgui_inline_time_input);
  1155.     show_time_input(&wgui_inline_time_input);
  1156. }
  1157. /*****************************************************************************
  1158.  * FUNCTION
  1159.  *  inline_time_edit_handle_down_arrow
  1160.  * DESCRIPTION
  1161.  *  
  1162.  * PARAMETERS
  1163.  *  void
  1164.  * RETURNS
  1165.  *  void
  1166.  *****************************************************************************/
  1167. void inline_time_edit_handle_down_arrow(void)
  1168. {
  1169.     /*----------------------------------------------------------------*/
  1170.     /* Local Variables                                                */
  1171.     /*----------------------------------------------------------------*/
  1172.     /*----------------------------------------------------------------*/
  1173.     /* Code Body                                                      */
  1174.     /*----------------------------------------------------------------*/
  1175.     handle_inline_time_edit_complete();
  1176.     inline_fixed_list_goto_next_item();
  1177. }
  1178. /*****************************************************************************
  1179.  * FUNCTION
  1180.  *  inline_time_edit_handle_up_arrow
  1181.  * DESCRIPTION
  1182.  *  
  1183.  * PARAMETERS
  1184.  *  void
  1185.  * RETURNS
  1186.  *  void
  1187.  *****************************************************************************/
  1188. void inline_time_edit_handle_up_arrow(void)
  1189. {
  1190.     /*----------------------------------------------------------------*/
  1191.     /* Local Variables                                                */
  1192.     /*----------------------------------------------------------------*/
  1193.     /*----------------------------------------------------------------*/
  1194.     /* Code Body                                                      */
  1195.     /*----------------------------------------------------------------*/
  1196.     handle_inline_time_edit_complete();
  1197.     inline_fixed_list_goto_previous_item();
  1198. }
  1199. /*****************************************************************************
  1200.  * FUNCTION
  1201.  *  inline_time_input_key_handler
  1202.  * DESCRIPTION
  1203.  *  
  1204.  * PARAMETERS
  1205.  *  vkey_code       [IN]        
  1206.  *  key_state       [IN]        
  1207.  * RETURNS
  1208.  *  void
  1209.  *****************************************************************************/
  1210. void inline_time_input_key_handler(S32 vkey_code, S32 key_state)
  1211. {
  1212. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Local Variables                                                */
  1215.     /*----------------------------------------------------------------*/
  1216.     /*----------------------------------------------------------------*/
  1217.     /* Code Body                                                      */
  1218.     /*----------------------------------------------------------------*/
  1219.     if (key_state)
  1220.     {
  1221.         switch (vkey_code)
  1222.         {
  1223.             case 37:
  1224.                 time_input_previous_character();
  1225.                 break;
  1226.             case 38:
  1227.                 inline_time_edit_handle_up_arrow();
  1228.                 break;
  1229.             case 39:
  1230.                 time_input_next_character();
  1231.                 break;
  1232.             case 40:
  1233.                 inline_time_edit_handle_down_arrow();
  1234.                 break;
  1235.             case 36:    /* home */
  1236.                 break;
  1237.             case 35:    /* end */
  1238.                 break;
  1239.             case 33:    /* page up */
  1240.                 break;
  1241.             case 34:    /* page down */
  1242.                 break;
  1243.             case 45:
  1244.                 time_input_toggle_insert_mode();
  1245.                 break;
  1246.             case 46:
  1247.                 time_input_delete_current_character();
  1248.                 break;
  1249.         }
  1250.     }
  1251. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1252.     UI_UNUSED_PARAMETER(vkey_code);
  1253.     UI_UNUSED_PARAMETER(key_state);
  1254. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1255. }
  1256. /*****************************************************************************
  1257.  * FUNCTION
  1258.  *  handle_inline_time_edit_input
  1259.  * DESCRIPTION
  1260.  *  
  1261.  * PARAMETERS
  1262.  *  void
  1263.  * RETURNS
  1264.  *  void
  1265.  *****************************************************************************/
  1266. void handle_inline_time_edit_input(void)
  1267. {
  1268.     /*----------------------------------------------------------------*/
  1269.     /* Local Variables                                                */
  1270.     /*----------------------------------------------------------------*/
  1271.     /*----------------------------------------------------------------*/
  1272.     /* Code Body                                                      */
  1273.     /*----------------------------------------------------------------*/
  1274.     set_wgui_inline_list_menu_changed();
  1275. }
  1276. /* History implementation for inline time edit  */
  1277. typedef struct _inline_time_edit_history
  1278. {
  1279.     U16 history_ID;
  1280.     S16 current_focus;
  1281.     S16 current_position;
  1282.     S16 dummy;  /* Added for history issue on hardware */
  1283.     U32 flags;
  1284. } inline_time_edit_history;
  1285. /*****************************************************************************
  1286.  * FUNCTION
  1287.  *  inline_time_edit_get_history
  1288.  * DESCRIPTION
  1289.  *  
  1290.  * PARAMETERS
  1291.  *  history_buffer      [?]     
  1292.  * RETURNS
  1293.  *  
  1294.  *****************************************************************************/
  1295. U8 *inline_time_edit_get_history(U8 *history_buffer)
  1296. {
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Local Variables                                                */
  1299.     /*----------------------------------------------------------------*/
  1300.     /*----------------------------------------------------------------*/
  1301.     /* Code Body                                                      */
  1302.     /*----------------------------------------------------------------*/
  1303.     if (history_buffer != NULL)
  1304.     {
  1305.         U16 hID = (U16) (INLINE_TIME_HISTORY_ID | 0x8000);
  1306.         inline_time_edit_history *h = (inline_time_edit_history*) history_buffer;
  1307.         h->history_ID = hID;
  1308.         h->current_focus = (S16) wgui_inline_time_input.current_focus;
  1309.         if (wgui_inline_time_input.focus_input_box != NULL)
  1310.         {
  1311.             h->current_position =
  1312.                 (S16) (wgui_inline_time_input.focus_input_box->current_text_p -
  1313.                        wgui_inline_time_input.focus_input_box->text);
  1314.         }
  1315.         h->flags = wgui_inline_time_input.flags;
  1316.     }
  1317.     return (history_buffer);
  1318. }
  1319. /*****************************************************************************
  1320.  * FUNCTION
  1321.  *  inline_time_edit_set_history
  1322.  * DESCRIPTION
  1323.  *  
  1324.  * PARAMETERS
  1325.  *  history_ID          [IN]        
  1326.  *  history_buffer      [?]         
  1327.  * RETURNS
  1328.  *  
  1329.  *****************************************************************************/
  1330. U8 inline_time_edit_set_history(U16 history_ID, U8 *history_buffer)
  1331. {
  1332.     /*----------------------------------------------------------------*/
  1333.     /* Local Variables                                                */
  1334.     /*----------------------------------------------------------------*/
  1335.     /*----------------------------------------------------------------*/
  1336.     /* Code Body                                                      */
  1337.     /*----------------------------------------------------------------*/
  1338.     if (history_buffer != NULL)
  1339.     {
  1340.         inline_time_edit_history *h = (inline_time_edit_history*) history_buffer;
  1341.         if (history_valid(h->history_ID, history_ID))
  1342.         {
  1343.             wgui_inline_time_input.current_focus = h->current_focus;
  1344.             time_input_reset_focus(&wgui_inline_time_input);
  1345.             time_input_set_focus(&wgui_inline_time_input);
  1346.             if (wgui_inline_time_input.focus_input_box != NULL)
  1347.             {
  1348.                 wgui_inline_time_input.focus_input_box->current_text_p =
  1349.                     wgui_inline_time_input.focus_input_box->text + h->current_position;
  1350.             }
  1351.             wgui_inline_time_input.flags = h->flags;
  1352.             return (1);
  1353.         }
  1354.     }
  1355.     return (0);
  1356. }
  1357. /*****************************************************************************
  1358.  * FUNCTION
  1359.  *  handle_inline_time_edit
  1360.  * DESCRIPTION
  1361.  *  
  1362.  * PARAMETERS
  1363.  *  x                   [IN]        
  1364.  *  y                   [IN]        
  1365.  *  width               [IN]        
  1366.  *  height              [IN]        
  1367.  *  key_code            [IN]        
  1368.  *  key_event           [IN]        
  1369.  *  text_p              [IN]        
  1370.  *  item                [?]         
  1371.  *  flags               [IN]        
  1372.  *  history_buffer      [?]         
  1373.  * RETURNS
  1374.  *  void
  1375.  *****************************************************************************/
  1376. void handle_inline_time_edit(
  1377.         S32 x,
  1378.         S32 y,
  1379.         S32 width,
  1380.         S32 height,
  1381.         S32 key_code,
  1382.         S32 key_event,
  1383.         U8 **text_p,
  1384.         void *item,
  1385.         U32 flags,
  1386.         U8 *history_buffer)
  1387. {
  1388.     /*----------------------------------------------------------------*/
  1389.     /* Local Variables                                                */
  1390.     /*----------------------------------------------------------------*/
  1391.     wgui_inline_item_time *i = (wgui_inline_item_time*) item;
  1392.     S32 xx;
  1393.     U32 dtflags = TIME_INPUT_TYPE_HH_MM;
  1394. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1395.     mmi_pen_handwriting_area_struct stroke_area;
  1396.     mmi_pen_handwriting_area_struct ext_stroke;
  1397. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  1398.     /*----------------------------------------------------------------*/
  1399.     /* Code Body                                                      */
  1400.     /*----------------------------------------------------------------*/
  1401.     UI_UNUSED_PARAMETER(key_event);
  1402.     UI_UNUSED_PARAMETER(key_code);
  1403.     UI_UNUSED_PARAMETER(flags);
  1404.     wgui_current_inline_item_type = INLINE_ITEM_TYPE_TIME;
  1405.     /* MTK Elvis for R2L characters */
  1406.     if (!r2lMMIFlag)
  1407.     {
  1408.         if (MMI_fixed_icontext_menuitem.text_x == 2)
  1409.         {
  1410.             xx = -1;
  1411.         }
  1412.         else
  1413.         {
  1414.             xx = MMI_fixed_icontext_menuitem.text_x;
  1415.         }
  1416.     }
  1417.     else
  1418.     {
  1419.         xx = 1;
  1420.     }
  1421.     /* MTK end */
  1422.     if (flags & INLINE_ITEM_LEFT_ALIGN)
  1423.     {
  1424.         xx = -1;
  1425.     }
  1426.     switch (flags & INLINE_ITEM_JUSTIFY_MASK)
  1427.     {
  1428.         case INLINE_ITEM_RIGHT_JUSTIFY:
  1429.             dtflags |= TIME_INPUT_RIGHT_JUSTIFY;
  1430.             break;
  1431.         case INLINE_ITEM_CENTER_JUSTIFY:
  1432.             dtflags |= TIME_INPUT_CENTER_JUSTIFY;
  1433.             break;
  1434.     }
  1435.     complete_inline_item_edit = handle_inline_time_edit_complete;
  1436.     current_wgui_inline_time_item = i;
  1437.     current_wgui_inline_time_text_p = text_p;
  1438.     gui_strcpy((UI_string_type) wgui_inline_time_edit_hours_buffer, (UI_string_type) i->hours_buffer);
  1439.     gui_strcpy((UI_string_type) wgui_inline_time_edit_minutes_buffer, (UI_string_type) i->minutes_buffer);
  1440.     wgui_inline_time_AM_PM_flag = i->AM_PM_flag;
  1441.     /* MTK Elvis for R2L characters */
  1442.     if (!r2lMMIFlag)
  1443.     {
  1444.         create_time_input(
  1445.             &wgui_inline_time_input,
  1446.             x + xx,
  1447.             y,
  1448.             width - xx,
  1449.             height,
  1450.             dtflags,
  1451.             wgui_inline_time_edit_hours_buffer,
  1452.             wgui_inline_time_edit_minutes_buffer,
  1453.             wgui_inline_time_edit_seconds_buffer);
  1454.     }
  1455.     else
  1456.     {
  1457.         if (flags & INLINE_ITEM_LEFT_ALIGN)
  1458.         {
  1459.             create_time_input(
  1460.                 &wgui_inline_time_input,
  1461.                 x + xx,
  1462.                 y,
  1463.                 width - xx,
  1464.                 height,
  1465.                 dtflags,
  1466.                 wgui_inline_time_edit_hours_buffer,
  1467.                 wgui_inline_time_edit_minutes_buffer,
  1468.                 wgui_inline_time_edit_seconds_buffer);
  1469.         }
  1470.         else
  1471.         {
  1472.             create_time_input(
  1473.                 &wgui_inline_time_input,
  1474.                 x + xx,
  1475.                 y,
  1476.                 width - MMI_fixed_icontext_menuitem.text_x,
  1477.                 height,
  1478.                 dtflags,
  1479.                 wgui_inline_time_edit_hours_buffer,
  1480.                 wgui_inline_time_edit_minutes_buffer,
  1481.                 wgui_inline_time_edit_seconds_buffer);
  1482.         }
  1483.     }
  1484.     /* MTK end */
  1485.     inline_time_edit_set_history(INLINE_TIME_HISTORY_ID, history_buffer);
  1486.     time_input_set_seperator(&wgui_inline_time_input, (UI_character_type) ':');
  1487.     time_input_show_background(&wgui_inline_time_input);
  1488.     show_time_input(&wgui_inline_time_input);
  1489.     set_current_time_input(&wgui_inline_time_input);
  1490.     time_input_register_keys();
  1491.     register_keyboard_key_handler(inline_time_input_key_handler);
  1492.     SetKeyHandler(inline_time_edit_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1493.     SetKeyHandler(inline_time_edit_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1494.     SetKeyHandler(inline_time_edit_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1495.     SetKeyHandler(inline_time_edit_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
  1496.     register_time_input_callback(handle_inline_time_edit_input);
  1497.     redraw_current_inline_item = redraw_inline_time_edit;
  1498. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1499.     ext_stroke.x1 = 0;
  1500.     ext_stroke.y1 = 0;
  1501.     ext_stroke.x2 = UI_device_width - 1;
  1502.     ext_stroke.y2 = UI_device_height - 1;
  1503. #if 0
  1504. /* under construction !*/
  1505. /* under construction !*/
  1506. /* under construction !*/
  1507. /* under construction !*/
  1508. #else /* 0 */ 
  1509.     stroke_area.x1 = MMI_content_x;
  1510.     stroke_area.x2 = MMI_content_x + MMI_content_width - MMI_fixed_list_menu.vbar.width;
  1511.     stroke_area.y1 = MMI_title_y;
  1512.     stroke_area.y2 = MMI_title_y + MMI_content_height + MMI_title_height;
  1513. #endif /* 0 */ 
  1514.     mmi_pen_editor_setup_input_box(&stroke_area, &ext_stroke, INPUT_TYPE_NUMERIC, MMI_FALSE, PEN_EDITOR_TIME);
  1515. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  1516. }
  1517. /*****************************************************************************
  1518.  * FUNCTION
  1519.  *  SetInlineItemTime
  1520.  * DESCRIPTION
  1521.  *  
  1522.  * PARAMETERS
  1523.  *  item                [?]         
  1524.  *  hours_buffer        [?]         
  1525.  *  minutes_buffer      [?]         
  1526.  *  AM_PM_flag          [?]         
  1527.  *  f                   [IN]        
  1528.  * RETURNS
  1529.  *  void
  1530.  *****************************************************************************/
  1531. void SetInlineItemTime(
  1532.         InlineItem *item,
  1533.         U8 *hours_buffer,
  1534.         U8 *minutes_buffer,
  1535.         U8 *AM_PM_flag,
  1536.         void (*f) (U8 *string_buffer, U8 *hours_buffer, U8 *minutes_buffer, U8 *AM_PM_flag))
  1537. {
  1538.     /*----------------------------------------------------------------*/
  1539.     /* Local Variables                                                */
  1540.     /*----------------------------------------------------------------*/
  1541.     wgui_inline_item_time *i;
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Code Body                                                      */
  1544.     /*----------------------------------------------------------------*/
  1545.     if (n_inline_time_items >= MAX_INLINE_TIME_ITEMS)
  1546.     {
  1547.         return;
  1548.     }
  1549.     item->item = (void*)&wgui_inline_time_items[n_inline_time_items];
  1550.     item->flags = INLINE_ITEM_TYPE_TIME;
  1551.     item->text_p = (U8*) wgui_inline_time_display_strings[n_inline_time_items];
  1552.     n_inline_time_items++;
  1553.     i = (wgui_inline_item_time*) item->item;
  1554.     i->hours_buffer = hours_buffer;
  1555.     i->minutes_buffer = minutes_buffer;
  1556.     i->seconds_buffer = NULL;
  1557.     i->AM_PM_flag = AM_PM_flag;
  1558.     i->flags = INLINE_ITEM_LEFT_JUSTIFY;
  1559.     i->string_construct_callback = f;
  1560.     i->string_construct_callback(item->text_p, i->hours_buffer, i->minutes_buffer, i->AM_PM_flag);
  1561.     item->handler = handle_inline_time_edit;
  1562. }
  1563. /*****************************************************************************
  1564.  * FUNCTION
  1565.  *  ReConfigureInlineItemTime
  1566.  * DESCRIPTION
  1567.  *  
  1568.  * PARAMETERS
  1569.  *  item                [?]         
  1570.  *  hours_buffer        [?]         
  1571.  *  minutes_buffer      [?]         
  1572.  *  AM_PM_flag          [?]         
  1573.  *  f                   [IN]        
  1574.  * RETURNS
  1575.  *  void
  1576.  *****************************************************************************/
  1577. void ReConfigureInlineItemTime(
  1578.         InlineItem *item,
  1579.         U8 *hours_buffer,
  1580.         U8 *minutes_buffer,
  1581.         U8 *AM_PM_flag,
  1582.         void (*f) (U8 *string_buffer, U8 *hours_buffer, U8 *minutes_buffer, U8 *AM_PM_flag))
  1583. {
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Local Variables                                                */
  1586.     /*----------------------------------------------------------------*/
  1587.     wgui_inline_item_time *i;
  1588.     /*----------------------------------------------------------------*/
  1589.     /* Code Body                                                      */
  1590.     /*----------------------------------------------------------------*/
  1591.     if ((item->flags & 0xff) != INLINE_ITEM_TYPE_TIME)
  1592.     {
  1593.         return;
  1594.     }
  1595.     i = (wgui_inline_item_time*) item->item;
  1596.     i->hours_buffer = hours_buffer;
  1597.     i->minutes_buffer = minutes_buffer;
  1598.     i->AM_PM_flag = AM_PM_flag;
  1599.     i->flags = 0;
  1600.     i->string_construct_callback = f;
  1601.     i->string_construct_callback(item->text_p, i->hours_buffer, i->minutes_buffer, i->AM_PM_flag);
  1602. }
  1603. /* Displaying time edit as a menu item in the fixed list menu  */
  1604. U8 wgui_inline_time_edit_hours_display_buffer[3 * ENCODING_LENGTH];
  1605. U8 wgui_inline_time_edit_minutes_display_buffer[3 * ENCODING_LENGTH];
  1606. U8 wgui_inline_time_edit_seconds_display_buffer[3 * ENCODING_LENGTH];
  1607. U8 *wgui_inline_time_AM_PM_display_flag;
  1608. time_input wgui_inline_time_input_display;
  1609. /*****************************************************************************
  1610.  * FUNCTION
  1611.  *  wgui_show_inline_time_list_menuitem
  1612.  * DESCRIPTION
  1613.  *  
  1614.  * PARAMETERS
  1615.  *  x1          [IN]        
  1616.  *  y1          [IN]        
  1617.  *  width       [IN]        
  1618.  *  height      [IN]        
  1619.  *  item        [?]         
  1620.  * RETURNS
  1621.  *  void
  1622.  *****************************************************************************/
  1623. void wgui_show_inline_time_list_menuitem(S32 x1, S32 y1, S32 width, S32 height, wgui_inline_item *item)
  1624. {
  1625.     /*----------------------------------------------------------------*/
  1626.     /* Local Variables                                                */
  1627.     /*----------------------------------------------------------------*/
  1628.     wgui_inline_item_time *i = (wgui_inline_item_time*) item->item;
  1629.     S32 xx;
  1630.     U32 dtflags = TIME_INPUT_TYPE_HH_MM;
  1631.     /*----------------------------------------------------------------*/
  1632.     /* Code Body                                                      */
  1633.     /*----------------------------------------------------------------*/
  1634.     gdi_layer_lock_frame_buffer();
  1635.     if (MMI_fixed_icontext_menuitem.text_x == 2)
  1636.     {
  1637.         xx = -1;
  1638.     }
  1639.     else
  1640.     {
  1641.         xx = MMI_fixed_icontext_menuitem.text_x;
  1642.     }
  1643.     if (item->flags & INLINE_ITEM_LEFT_ALIGN)
  1644.     {
  1645.         xx = -1;
  1646.     }
  1647.     switch (item->flags & INLINE_ITEM_JUSTIFY_MASK)
  1648.     {
  1649.         case INLINE_ITEM_RIGHT_JUSTIFY:
  1650.             dtflags |= DATE_INPUT_RIGHT_JUSTIFY;
  1651.             break;
  1652.         case INLINE_ITEM_CENTER_JUSTIFY:
  1653.             dtflags |= DATE_INPUT_CENTER_JUSTIFY;
  1654.             break;
  1655.     }
  1656.     gui_strcpy((UI_string_type) wgui_inline_time_edit_hours_display_buffer, (UI_string_type) i->hours_buffer);
  1657.     gui_strcpy((UI_string_type) wgui_inline_time_edit_minutes_display_buffer, (UI_string_type) i->minutes_buffer);
  1658.     gui_strcpy((UI_string_type) wgui_inline_time_edit_seconds_display_buffer, (UI_string_type) i->seconds_buffer);
  1659.     wgui_inline_time_AM_PM_display_flag = i->AM_PM_flag;
  1660.     wgui_set_date_time_input_unfocussed_theme();
  1661.     create_time_input(
  1662.         &wgui_inline_time_input_display,
  1663.         x1 + xx,
  1664.         y1,
  1665.         width - xx,
  1666.         height,
  1667.         dtflags,
  1668.         wgui_inline_time_edit_hours_display_buffer,
  1669.         wgui_inline_time_edit_minutes_display_buffer,
  1670.         wgui_inline_time_edit_seconds_display_buffer);
  1671.     time_input_set_seperator(&wgui_inline_time_input_display, (UI_character_type) ':');
  1672.     /* 20051012 HIMANSHU START INLINE TIME */
  1673.     /* show the different background in case of default text effect is enabled
  1674.        for the inline item type Time. */
  1675. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1676.     if (IsInlineItemDefaultTextEnable())
  1677.     {
  1678.         inline_item_default_text_show_background(
  1679.             wgui_inline_time_input_display.x,
  1680.             wgui_inline_time_input_display.y,
  1681.             wgui_inline_time_input_display.x + wgui_inline_time_input_display.width - 1,
  1682.             wgui_inline_time_input_display.y + wgui_inline_time_input_display.height - 1);
  1683.     }
  1684.     else
  1685. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  1686.         /* 20051012 HIMANSHU END INLINE TIME */
  1687.         time_input_show_background(&wgui_inline_time_input_display);
  1688.     time_input_reset_focus(&wgui_inline_time_input_display);
  1689.     show_time_input(&wgui_inline_time_input_display);
  1690.     wgui_set_date_time_input_focussed_theme();
  1691.     redraw_left_softkey();
  1692.     redraw_right_softkey();
  1693.     gdi_layer_unlock_frame_buffer();
  1694. }
  1695. /*----------------------------------------------------------------------------
  1696.    Inline user defined select strings implementation
  1697. ----------------------------------------------------------------------------*/
  1698. #define MAX_INLINE_USER_DEFINED_SELECT_ITEMS       4
  1699. S32 n_inline_user_defined_select_items = 0;
  1700. wgui_inline_item_user_defined_select wgui_inline_user_defined_select_items[MAX_INLINE_USER_DEFINED_SELECT_ITEMS];
  1701. wgui_inline_item_user_defined_select *current_wgui_inline_user_defined_select_item;
  1702. U8 **current_wgui_inline_user_defined_select_text_p;
  1703. /*****************************************************************************
  1704.  * FUNCTION
  1705.  *  inline_user_defined_select_menu_previous_item
  1706.  * DESCRIPTION
  1707.  *  
  1708.  * PARAMETERS
  1709.  *  void
  1710.  * RETURNS
  1711.  *  void
  1712.  *****************************************************************************/
  1713. void inline_user_defined_select_menu_previous_item(void)
  1714. {
  1715.     /*----------------------------------------------------------------*/
  1716.     /* Local Variables                                                */
  1717.     /*----------------------------------------------------------------*/
  1718.     /*----------------------------------------------------------------*/
  1719.     /* Code Body                                                      */
  1720.     /*----------------------------------------------------------------*/
  1721.     current_wgui_inline_user_defined_select_item->current_text_p =
  1722.         current_wgui_inline_user_defined_select_item->previous_item_callback();
  1723.     *current_wgui_inline_user_defined_select_text_p = current_wgui_inline_user_defined_select_item->current_text_p;
  1724.     MMI_inline_select_items[0].text = (UI_string_type) * current_wgui_inline_user_defined_select_text_p;
  1725.     show_inline_user_defined_select_menu();
  1726.     set_wgui_inline_list_menu_changed();
  1727. }
  1728. /*****************************************************************************
  1729.  * FUNCTION
  1730.  *  inline_user_defined_select_menu_next_item
  1731.  * DESCRIPTION
  1732.  *  
  1733.  * PARAMETERS
  1734.  *  void
  1735.  * RETURNS
  1736.  *  void
  1737.  *****************************************************************************/
  1738. void inline_user_defined_select_menu_next_item(void)
  1739. {
  1740.     /*----------------------------------------------------------------*/
  1741.     /* Local Variables                                                */
  1742.     /*----------------------------------------------------------------*/
  1743.     /*----------------------------------------------------------------*/
  1744.     /* Code Body                                                      */
  1745.     /*----------------------------------------------------------------*/
  1746.     current_wgui_inline_user_defined_select_item->current_text_p =
  1747.         current_wgui_inline_user_defined_select_item->next_item_callback();
  1748.     *current_wgui_inline_user_defined_select_text_p = current_wgui_inline_user_defined_select_item->current_text_p;
  1749.     MMI_inline_select_items[0].text = (UI_string_type) * current_wgui_inline_user_defined_select_text_p;
  1750.     show_inline_user_defined_select_menu();
  1751.     set_wgui_inline_list_menu_changed();
  1752. }
  1753. /*****************************************************************************
  1754.  * FUNCTION
  1755.  *  inline_user_defined_select_menu_change_complete
  1756.  * DESCRIPTION
  1757.  *  
  1758.  * PARAMETERS
  1759.  *  void
  1760.  * RETURNS
  1761.  *  void
  1762.  *****************************************************************************/
  1763. void inline_user_defined_select_menu_change_complete(void)
  1764. {
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Local Variables                                                */
  1767.     /*----------------------------------------------------------------*/
  1768.     /*----------------------------------------------------------------*/
  1769.     /* Code Body                                                      */
  1770.     /*----------------------------------------------------------------*/
  1771.     wgui_text_menuitem_reset_scrolling();
  1772.     wgui_text_menuitem_reset_scrolling = gui_fixed_icontext_menuitem_stop_scroll;
  1773.     wgui_text_menuitem_restart_scrolling = gui_fixed_icontext_menuitem_start_scroll;
  1774.     clear_inline_select_menu_keys();
  1775.     MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text =
  1776.         (UI_string_type) * current_wgui_inline_user_defined_select_text_p;
  1777.     redraw_current_inline_item = UI_dummy_function;
  1778. #ifdef __MMI_TOUCH_SCREEN__
  1779.     wgui_current_inline_item_pen_function = UI_dummy_inline_item_pen_function;
  1780. #endif 
  1781.     complete_inline_item_edit = UI_dummy_function;
  1782.     wgui_inline_item_handled = 0;
  1783. }
  1784. /*****************************************************************************
  1785.  * FUNCTION
  1786.  *  inline_user_defined_select_menu_handle_up_arrow
  1787.  * DESCRIPTION
  1788.  *  
  1789.  * PARAMETERS
  1790.  *  void
  1791.  * RETURNS
  1792.  *  void
  1793.  *****************************************************************************/
  1794. void inline_user_defined_select_menu_handle_up_arrow(void)
  1795. {
  1796.     /*----------------------------------------------------------------*/
  1797.     /* Local Variables                                                */
  1798.     /*----------------------------------------------------------------*/
  1799.     /*----------------------------------------------------------------*/
  1800.     /* Code Body                                                      */
  1801.     /*----------------------------------------------------------------*/
  1802.     inline_user_defined_select_menu_change_complete();
  1803.     inline_fixed_list_goto_previous_item();
  1804. }
  1805. /*****************************************************************************
  1806.  * FUNCTION
  1807.  *  inline_user_defined_select_menu_handle_down_arrow
  1808.  * DESCRIPTION
  1809.  *  
  1810.  * PARAMETERS
  1811.  *  void
  1812.  * RETURNS
  1813.  *  void
  1814.  *****************************************************************************/
  1815. void inline_user_defined_select_menu_handle_down_arrow(void)
  1816. {
  1817.     /*----------------------------------------------------------------*/
  1818.     /* Local Variables                                                */
  1819.     /*----------------------------------------------------------------*/
  1820.     /*----------------------------------------------------------------*/
  1821.     /* Code Body                                                      */
  1822.     /*----------------------------------------------------------------*/
  1823.     inline_user_defined_select_menu_change_complete();
  1824.     inline_fixed_list_goto_next_item();
  1825. }
  1826. /*****************************************************************************
  1827.  * FUNCTION
  1828.  *  inline_user_defined_select_menu_keyboard_key_handler
  1829.  * DESCRIPTION
  1830.  *  
  1831.  * PARAMETERS
  1832.  *  vkey_code       [IN]        
  1833.  *  key_state       [IN]        
  1834.  * RETURNS
  1835.  *  void
  1836.  *****************************************************************************/
  1837. void inline_user_defined_select_menu_keyboard_key_handler(S32 vkey_code, S32 key_state)
  1838. {
  1839. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Local Variables                                                */
  1842.     /*----------------------------------------------------------------*/
  1843.     /*----------------------------------------------------------------*/
  1844.     /* Code Body                                                      */
  1845.     /*----------------------------------------------------------------*/
  1846.     if (key_state)
  1847.     {
  1848.         switch (vkey_code)
  1849.         {
  1850.             case 37:
  1851.                 inline_user_defined_select_menu_previous_item();
  1852.                 break;
  1853.             case 38:
  1854.                 inline_user_defined_select_menu_handle_up_arrow();
  1855.                 break;
  1856.             case 39:
  1857.                 inline_user_defined_select_menu_next_item();
  1858.                 break;
  1859.             case 40:
  1860.                 inline_user_defined_select_menu_handle_down_arrow();
  1861.                 break;
  1862.         }
  1863.     }
  1864. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1865.     UI_UNUSED_PARAMETER(vkey_code);
  1866.     UI_UNUSED_PARAMETER(key_state);
  1867. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1868. }
  1869. /*****************************************************************************
  1870.  * FUNCTION
  1871.  *  register_inline_user_defined_select_menu_keys
  1872.  * DESCRIPTION
  1873.  *  
  1874.  * PARAMETERS
  1875.  *  void
  1876.  * RETURNS
  1877.  *  void
  1878.  *****************************************************************************/
  1879. void register_inline_user_defined_select_menu_keys(void)
  1880. {
  1881.     /*----------------------------------------------------------------*/
  1882.     /* Local Variables                                                */
  1883.     /*----------------------------------------------------------------*/
  1884.     /*----------------------------------------------------------------*/
  1885.     /* Code Body                                                      */
  1886.     /*----------------------------------------------------------------*/
  1887.     SetKeyHandler(inline_user_defined_select_menu_previous_item, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1888.     SetKeyHandler(inline_user_defined_select_menu_next_item, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1889.     SetKeyHandler(inline_user_defined_select_menu_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1890.     SetKeyHandler(inline_user_defined_select_menu_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1891.     SetKeyHandler(inline_user_defined_select_menu_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
  1892.     SetKeyHandler(inline_user_defined_select_menu_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1893.     register_keyboard_key_handler(inline_user_defined_select_menu_keyboard_key_handler);
  1894. }
  1895. /*****************************************************************************
  1896.  * FUNCTION
  1897.  *  redraw_inline_user_defined_select
  1898.  * DESCRIPTION
  1899.  *  
  1900.  * PARAMETERS
  1901.  *  void
  1902.  * RETURNS
  1903.  *  void
  1904.  *****************************************************************************/
  1905. void redraw_inline_user_defined_select(void)
  1906. {
  1907.     /*----------------------------------------------------------------*/
  1908.     /* Local Variables                                                */
  1909.     /*----------------------------------------------------------------*/
  1910.     /*----------------------------------------------------------------*/
  1911.     /* Code Body                                                      */
  1912.     /*----------------------------------------------------------------*/
  1913.     show_inline_user_defined_select_menu();
  1914. }
  1915. #ifdef __MMI_TOUCH_SCREEN__
  1916. /*****************************************************************************
  1917.  * FUNCTION
  1918.  *  inline_user_defined_select_pen_handler
  1919.  * DESCRIPTION
  1920.  *  
  1921.  * PARAMETERS
  1922.  *  pen_event       [IN]        
  1923.  *  x               [IN]        
  1924.  *  y               [IN]        
  1925.  *  item_event      [?]         
  1926.  * RETURNS
  1927.  *  
  1928.  *****************************************************************************/
  1929. BOOL inline_user_defined_select_pen_handler(
  1930.         mmi_pen_event_type_enum pen_event,
  1931.         S16 x,
  1932.         S16 y,
  1933.         gui_inline_item_pen_enum *item_event)
  1934. {
  1935.     /*----------------------------------------------------------------*/
  1936.     /* Local Variables                                                */
  1937.     /*----------------------------------------------------------------*/
  1938.     BOOL ret;
  1939.     gui_horizontal_select_pen_enum select_event;
  1940.     /*----------------------------------------------------------------*/
  1941.     /* Code Body                                                      */
  1942.     /*----------------------------------------------------------------*/
  1943.     ret = gui_horizontal_select_translate_pen_event(&MMI_inline_select_menu, pen_event, x, y, &select_event);
  1944.     if (ret)
  1945.     {
  1946.         switch (select_event)
  1947.         {
  1948.             case GUI_HORIZONTAL_SELECT_PEN_NONE:
  1949.                 /* Do nothing */
  1950.                 break;
  1951.             case GUI_HORIZONTAL_SELECT_PEN_PREV:
  1952.                 inline_user_defined_select_menu_previous_item();
  1953.                 break;
  1954.             case GUI_HORIZONTAL_SELECT_PEN_NEXT:
  1955.                 inline_user_defined_select_menu_next_item();
  1956.                 break;
  1957.             default:
  1958.                 MMI_ASSERT(0);
  1959.         }
  1960.     }
  1961.     *item_event = GUI_INLINE_ITEM_PEN_NONE;
  1962.     return ret;
  1963. }
  1964. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1965. /*****************************************************************************
  1966.  * FUNCTION
  1967.  *  handle_inline_user_defined_select
  1968.  * DESCRIPTION
  1969.  *  
  1970.  * PARAMETERS
  1971.  *  x                   [IN]        
  1972.  *  y                   [IN]        
  1973.  *  width               [IN]        
  1974.  *  height              [IN]        
  1975.  *  key_code            [IN]        
  1976.  *  key_event           [IN]        
  1977.  *  text_p              [IN]        
  1978.  *  item                [?]         
  1979.  *  flags               [IN]        
  1980.  *  history_buffer      [?]         
  1981.  * RETURNS
  1982.  *  void
  1983.  *****************************************************************************/
  1984. void handle_inline_user_defined_select(
  1985.         S32 x,
  1986.         S32 y,
  1987.         S32 width,
  1988.         S32 height,
  1989.         S32 key_code,
  1990.         S32 key_event,
  1991.         U8 **text_p,
  1992.         void *item,
  1993.         U32 flags,
  1994.         U8 *history_buffer)
  1995. {
  1996.     /*----------------------------------------------------------------*/
  1997.     /* Local Variables                                                */
  1998.     /*----------------------------------------------------------------*/
  1999.     wgui_inline_item_user_defined_select *i = (wgui_inline_item_user_defined_select*) item;
  2000.     S32 xx;
  2001.     /*----------------------------------------------------------------*/
  2002.     /* Code Body                                                      */
  2003.     /*----------------------------------------------------------------*/
  2004.     UI_UNUSED_PARAMETER(key_event);
  2005.     UI_UNUSED_PARAMETER(key_code);
  2006.     UI_UNUSED_PARAMETER(flags);
  2007.     if (MMI_fixed_icontext_menuitem.text_x == 2)
  2008.     {
  2009.         xx = -1;
  2010.     }
  2011.     else
  2012.     {
  2013.         xx = MMI_fixed_icontext_menuitem.text_x;
  2014.     }
  2015.     if (flags & INLINE_ITEM_LEFT_ALIGN)
  2016.     {
  2017.         xx = -1;
  2018.     }
  2019.     clear_inline_item_keys = clear_inline_select_menu_keys;
  2020.     current_wgui_inline_user_defined_select_item = i;
  2021.     current_wgui_inline_user_defined_select_text_p = text_p;
  2022.     initialize_inline_user_defined_select_menu_items(x + xx, y, width - xx, height, i->current_text_p);
  2023.     show_inline_user_defined_select_menu();
  2024.     register_inline_user_defined_select_menu_keys();
  2025.     redraw_current_inline_item = redraw_inline_user_defined_select;
  2026. #ifdef __MMI_TOUCH_SCREEN__
  2027.     wgui_current_inline_item_pen_function = inline_user_defined_select_pen_handler;
  2028. #endif 
  2029. }
  2030. /*****************************************************************************
  2031.  * FUNCTION
  2032.  *  dummy_inline_item_user_defined_select_callback
  2033.  * DESCRIPTION
  2034.  *  
  2035.  * PARAMETERS
  2036.  *  void
  2037.  * RETURNS
  2038.  *  
  2039.  *****************************************************************************/
  2040. U8 *dummy_inline_item_user_defined_select_callback(void)
  2041. {
  2042.     /*----------------------------------------------------------------*/
  2043.     /* Local Variables                                                */
  2044.     /*----------------------------------------------------------------*/
  2045.     /*----------------------------------------------------------------*/
  2046.     /* Code Body                                                      */
  2047.     /*----------------------------------------------------------------*/
  2048.     return (NULL);
  2049. }
  2050. /*****************************************************************************
  2051.  * FUNCTION
  2052.  *  SetInlineItemUserDefinedSelect
  2053.  * DESCRIPTION
  2054.  *  
  2055.  * PARAMETERS
  2056.  *  item                        [?]         
  2057.  *  current_item_callback       [IN]        
  2058.  *  previous_item_callback      [IN]        
  2059.  *  next_item_callback          [IN]        
  2060.  * RETURNS
  2061.  *  void
  2062.  *****************************************************************************/
  2063. void SetInlineItemUserDefinedSelect(
  2064.         InlineItem *item,
  2065.         U8 *(*current_item_callback) (void),
  2066.         U8 *(*previous_item_callback) (void),
  2067.         U8 *(*next_item_callback) (void))
  2068. {
  2069.     /*----------------------------------------------------------------*/
  2070.     /* Local Variables                                                */
  2071.     /*----------------------------------------------------------------*/
  2072.     wgui_inline_item_user_defined_select *i;
  2073.     /*----------------------------------------------------------------*/
  2074.     /* Code Body                                                      */
  2075.     /*----------------------------------------------------------------*/
  2076.     if (n_inline_user_defined_select_items >= MAX_INLINE_USER_DEFINED_SELECT_ITEMS)
  2077.     {
  2078.         return;
  2079.     }
  2080.     item->item = (void*)&wgui_inline_user_defined_select_items[n_inline_user_defined_select_items];
  2081.     item->flags = INLINE_ITEM_TYPE_USER_DEFINED_SELECT;
  2082.     n_inline_user_defined_select_items++;
  2083.     i = (wgui_inline_item_user_defined_select*) item->item;
  2084.     i->flags = 0;
  2085.     if (current_item_callback == NULL)
  2086.     {
  2087.         i->current_item_callback = dummy_inline_item_user_defined_select_callback;
  2088.     }
  2089.     else
  2090.     {
  2091.         i->current_item_callback = current_item_callback;
  2092.     }
  2093.     if (previous_item_callback == NULL)
  2094.     {
  2095.         i->previous_item_callback = dummy_inline_item_user_defined_select_callback;
  2096.     }
  2097.     else
  2098.     {
  2099.         i->previous_item_callback = previous_item_callback;
  2100.     }
  2101.     if (next_item_callback == NULL)
  2102.     {
  2103.         i->next_item_callback = dummy_inline_item_user_defined_select_callback;
  2104.     }
  2105.     else
  2106.     {
  2107.         i->next_item_callback = next_item_callback;
  2108.     }
  2109.     i->current_text_p = current_item_callback();
  2110.     item->text_p = i->current_text_p;
  2111.     item->handler = handle_inline_user_defined_select;
  2112. }
  2113. /*****************************************************************************
  2114.  * FUNCTION
  2115.  *  ReConfigureInlineItemUserDefinedSelect
  2116.  * DESCRIPTION
  2117.  *  
  2118.  * PARAMETERS
  2119.  *  item                        [?]         
  2120.  *  current_item_callback       [IN]        
  2121.  *  previous_item_callback      [IN]        
  2122.  *  next_item_callback          [IN]        
  2123.  * RETURNS
  2124.  *  void
  2125.  *****************************************************************************/
  2126. void ReConfigureInlineItemUserDefinedSelect(
  2127.         InlineItem *item,
  2128.         U8 *(*current_item_callback) (void),
  2129.         U8 *(*previous_item_callback) (void),
  2130.         U8 *(*next_item_callback) (void))
  2131. {
  2132.     /*----------------------------------------------------------------*/
  2133.     /* Local Variables                                                */
  2134.     /*----------------------------------------------------------------*/
  2135.     wgui_inline_item_user_defined_select *i;
  2136.     /*----------------------------------------------------------------*/
  2137.     /* Code Body                                                      */
  2138.     /*----------------------------------------------------------------*/
  2139.     if ((item->flags & 0xff) != INLINE_ITEM_TYPE_USER_DEFINED_SELECT)
  2140.     {
  2141.         return;
  2142.     }
  2143.     i = (wgui_inline_item_user_defined_select*) item->item;
  2144.     i->flags = 0;
  2145.     if (current_item_callback == NULL)
  2146.     {
  2147.         i->current_item_callback = dummy_inline_item_user_defined_select_callback;
  2148.     }
  2149.     else
  2150.     {
  2151.         i->current_item_callback = current_item_callback;
  2152.     }
  2153.     if (previous_item_callback == NULL)
  2154.     {
  2155.         i->previous_item_callback = dummy_inline_item_user_defined_select_callback;
  2156.     }
  2157.     else
  2158.     {
  2159.         i->previous_item_callback = previous_item_callback;
  2160.     }
  2161.     if (next_item_callback == NULL)
  2162.     {
  2163.         i->next_item_callback = dummy_inline_item_user_defined_select_callback;
  2164.     }
  2165.     else
  2166.     {
  2167.         i->next_item_callback = next_item_callback;
  2168.     }
  2169.     i->current_text_p = current_item_callback();
  2170.     item->text_p = i->current_text_p;
  2171. }
  2172. /*----------------------------------------------------------------------------
  2173.    Inline select Day Of Week implementation
  2174. ----------------------------------------------------------------------------*/
  2175. #define MAX_INLINE_DOW_SELECT_ITEMS       2
  2176. S32 n_inline_DOW_items = 0;
  2177. wgui_inline_item_DOW_select wgui_inline_DOW_select_items[MAX_INLINE_DOW_SELECT_ITEMS];
  2178. wgui_inline_item_DOW_select *current_wgui_inline_DOW_item = NULL;
  2179. U8 *current_wgui_inline_DOW_states = NULL;
  2180. U8 **current_wgui_inline_DOW_text_p = NULL;
  2181. DOW_select MMI_inline_DOW_select;
  2182. S32 current_DOW_select_highlighted_index = -1;
  2183. /*****************************************************************************
  2184.  * FUNCTION
  2185.  *  clear_inline_DOW_select_keys
  2186.  * DESCRIPTION
  2187.  *  
  2188.  * PARAMETERS
  2189.  *  void
  2190.  * RETURNS
  2191.  *  void
  2192.  *****************************************************************************/
  2193. void clear_inline_DOW_select_keys(void)
  2194. {
  2195.     /*----------------------------------------------------------------*/
  2196.     /* Local Variables                                                */
  2197.     /*----------------------------------------------------------------*/
  2198.     /*----------------------------------------------------------------*/
  2199.     /* Code Body                                                      */
  2200.     /*----------------------------------------------------------------*/
  2201.     ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2202.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2203.     clear_keyboard_key_handler();
  2204.     clear_inline_item_keys = UI_dummy_function;
  2205. }
  2206. /*****************************************************************************
  2207.  * FUNCTION
  2208.  *  inline_DOW_select_change_complete
  2209.  * DESCRIPTION
  2210.  *  
  2211.  * PARAMETERS
  2212.  *  void
  2213.  * RETURNS
  2214.  *  void
  2215.  *****************************************************************************/
  2216. void inline_DOW_select_change_complete(void)
  2217. {
  2218.     /*----------------------------------------------------------------*/
  2219.     /* Local Variables                                                */
  2220.     /*----------------------------------------------------------------*/
  2221.     S32 i;
  2222.     /*----------------------------------------------------------------*/
  2223.     /* Code Body                                                      */
  2224.     /*----------------------------------------------------------------*/
  2225.     clear_inline_DOW_select_keys();
  2226.     *current_wgui_inline_DOW_text_p = (U8*) "";
  2227.     MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text = (UI_string_type) "";
  2228.     for (i = 0; i < 7; i++)
  2229.     {
  2230.         current_wgui_inline_DOW_states[i] = MMI_inline_DOW_select.states[i];
  2231.     }
  2232.     redraw_current_inline_item = UI_dummy_function;
  2233.     complete_inline_item_edit = UI_dummy_function;
  2234. #ifdef __MMI_TOUCH_SCREEN__
  2235.     wgui_current_inline_item_pen_function = UI_dummy_inline_item_pen_function;
  2236. #endif 
  2237.     clear_left_softkey();
  2238.     clear_right_softkey();
  2239.     wgui_inline_item_handled = 0;
  2240. }
  2241. /*****************************************************************************
  2242.  * FUNCTION
  2243.  *  inline_DOW_select_handle_up_arrow
  2244.  * DESCRIPTION
  2245.  *  
  2246.  * PARAMETERS
  2247.  *  void
  2248.  * RETURNS
  2249.  *  void
  2250.  *****************************************************************************/
  2251. void inline_DOW_select_handle_up_arrow(void)
  2252. {
  2253.     /*----------------------------------------------------------------*/
  2254.     /* Local Variables                                                */
  2255.     /*----------------------------------------------------------------*/
  2256.     /*----------------------------------------------------------------*/
  2257.     /* Code Body                                                      */
  2258.     /*----------------------------------------------------------------*/
  2259.     inline_DOW_select_change_complete();
  2260.     inline_fixed_list_goto_previous_item();
  2261. }
  2262. /*****************************************************************************
  2263.  * FUNCTION
  2264.  *  inline_DOW_select_handle_down_arrow
  2265.  * DESCRIPTION
  2266.  *  
  2267.  * PARAMETERS
  2268.  *  void
  2269.  * RETURNS
  2270.  *  void
  2271.  *****************************************************************************/
  2272. void inline_DOW_select_handle_down_arrow(void)
  2273. {
  2274.     /*----------------------------------------------------------------*/
  2275.     /* Local Variables                                                */
  2276.     /*----------------------------------------------------------------*/
  2277.     /*----------------------------------------------------------------*/
  2278.     /* Code Body                                                      */
  2279.     /*----------------------------------------------------------------*/
  2280.     inline_DOW_select_change_complete();
  2281.     inline_fixed_list_goto_next_item();
  2282. }
  2283. /*****************************************************************************
  2284.  * FUNCTION
  2285.  *  show_inline_DOW_select
  2286.  * DESCRIPTION
  2287.  *  
  2288.  * PARAMETERS
  2289.  *  void
  2290.  * RETURNS
  2291.  *  void
  2292.  *****************************************************************************/
  2293. void show_inline_DOW_select(void)
  2294. {
  2295.     /*----------------------------------------------------------------*/
  2296.     /* Local Variables                                                */
  2297.     /*----------------------------------------------------------------*/
  2298.     /*----------------------------------------------------------------*/
  2299.     /* Code Body                                                      */
  2300.     /*----------------------------------------------------------------*/
  2301.     /* 20051012 HIMANSHU START INLINE DOW */
  2302.     /* don't call the function to show background from here, call it from the
  2303.        function, which is calling this function, in case of default text effect
  2304.        is enabled. */
  2305. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2306.     if (!(IsInlineItemDefaultTextEnable()))
  2307. #endif 
  2308.         /* 20051012 HIMANSHU END INLINE DOW */
  2309.         show_DOW_select_background(&MMI_inline_DOW_select);
  2310.     show_DOW_select(&MMI_inline_DOW_select);
  2311.     /* PMT VIKAS START 20050407 */
  2312. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  2313.     if (line_draw)
  2314.         /* PMT VIKAS START 20051202 */
  2315.     {
  2316.         gui_draw_horizontal_line(
  2317.             MMI_inline_DOW_select.x,
  2318.             MMI_inline_DOW_select.x + MMI_inline_DOW_select.width - 1,
  2319.             MMI_inline_DOW_select.y + MMI_inline_DOW_select.height - 1,
  2320.             current_MMI_theme->list_background_filler->border_color);
  2321.         gui_draw_vertical_line(
  2322.             MMI_inline_DOW_select.y,
  2323.             MMI_inline_DOW_select.y + MMI_inline_DOW_select.height - 1,
  2324.             MMI_inline_DOW_select.x + MMI_inline_DOW_select.width - 1 - 2,
  2325.             current_MMI_theme->list_background_filler->border_color);
  2326.         gui_draw_vertical_line(
  2327.             MMI_inline_DOW_select.y,
  2328.             MMI_inline_DOW_select.y + MMI_inline_DOW_select.height - 1,
  2329.             MMI_fixed_list_menu.vbar.x,
  2330.             current_MMI_theme->list_background_filler->border_color);
  2331.     }
  2332.     /* PMT VIKAS END 20051202 */
  2333. #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  2334.     //PMT VIKAS END 20050707
  2335.     // chnage by Leo, code revise. BLT_DOW_select(&MMI_inline_DOW_select);
  2336.     gdi_layer_blt_previous(
  2337.         MMI_inline_DOW_select.x,
  2338.         MMI_inline_DOW_select.y,
  2339.         MMI_inline_DOW_select.x + MMI_inline_DOW_select.width - 1,
  2340.         MMI_inline_DOW_select.y + MMI_inline_DOW_select.height - 1);
  2341. }
  2342. /*****************************************************************************
  2343.  * FUNCTION
  2344.  *  set_inline_DOW_select_list_menu_theme
  2345.  * DESCRIPTION
  2346.  *  
  2347.  * PARAMETERS
  2348.  *  void
  2349.  * RETURNS
  2350.  *  void
  2351.  *****************************************************************************/
  2352. void set_inline_DOW_select_list_menu_theme(void)
  2353. {
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Local Variables                                                */
  2356.     /*----------------------------------------------------------------*/
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Code Body                                                      */
  2359.     /*----------------------------------------------------------------*/
  2360.     set_DOW_select_list_menu_theme(&MMI_inline_DOW_select);
  2361. }
  2362. /*****************************************************************************
  2363.  * FUNCTION
  2364.  *  handle_inline_DOW_select_LSK_display
  2365.  * DESCRIPTION
  2366.  *  
  2367.  * PARAMETERS
  2368.  *  void
  2369.  * RETURNS
  2370.  *  void
  2371.  *****************************************************************************/
  2372. void handle_inline_DOW_select_LSK_display(void)
  2373. {
  2374.     /*----------------------------------------------------------------*/
  2375.     /* Local Variables                                                */
  2376.     /*----------------------------------------------------------------*/
  2377.     /*----------------------------------------------------------------*/
  2378.     /* Code Body                                                      */
  2379.     /*----------------------------------------------------------------*/
  2380.     if (MMI_inline_DOW_select.states[MMI_inline_DOW_select.highlighted_cell])
  2381.     {
  2382.         set_left_softkey_label(get_string(WGUI_CATEGORY_OFF_STRING_ID));
  2383.     }
  2384.     else
  2385.     {
  2386.         set_left_softkey_label(get_string(WGUI_CATEGORY_ON_STRING_ID));
  2387.     }
  2388.     redraw_left_softkey();
  2389. }
  2390. /*****************************************************************************
  2391.  * FUNCTION
  2392.  *  handle_inline_DOW_select_LSK_up
  2393.  * DESCRIPTION
  2394.  *  
  2395.  * PARAMETERS
  2396.  *  void
  2397.  * RETURNS
  2398.  *  void
  2399.  *****************************************************************************/
  2400. void handle_inline_DOW_select_LSK_up(void)
  2401. {
  2402.     /*----------------------------------------------------------------*/
  2403.     /* Local Variables                                                */
  2404.     /*----------------------------------------------------------------*/
  2405.     /*----------------------------------------------------------------*/
  2406.     /* Code Body                                                      */
  2407.     /*----------------------------------------------------------------*/
  2408.     DOW_select_toggle_item(&MMI_inline_DOW_select);
  2409.     /* 20051012 HIMANSHU START INLINE DOW */
  2410. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2411.     if (IsInlineItemDefaultTextEnable())
  2412.     {
  2413.         show_DOW_select_background(&MMI_inline_DOW_select);
  2414.     }
  2415. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2416.     /* 20051012 HIMANSHU END INLINE DOW */
  2417.     show_inline_DOW_select();
  2418.     handle_inline_DOW_select_LSK_display();
  2419.     set_wgui_inline_list_menu_changed();
  2420. }
  2421. /*****************************************************************************
  2422.  * FUNCTION
  2423.  *  inline_DOW_select_previous_item
  2424.  * DESCRIPTION
  2425.  *  
  2426.  * PARAMETERS
  2427.  *  void
  2428.  * RETURNS
  2429.  *  void
  2430.  *****************************************************************************/
  2431. void inline_DOW_select_previous_item(void)
  2432. {
  2433.     /*----------------------------------------------------------------*/
  2434.     /* Local Variables                                                */
  2435.     /*----------------------------------------------------------------*/
  2436.     /*----------------------------------------------------------------*/
  2437.     /* Code Body                                                      */
  2438.     /*----------------------------------------------------------------*/
  2439.     DOW_select_previous(&MMI_inline_DOW_select);
  2440.     current_DOW_select_highlighted_index = MMI_inline_DOW_select.highlighted_cell;
  2441.     /* 20051012 HIMANSHU START INLINE DOW */
  2442. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2443.     if (IsInlineItemDefaultTextEnable())
  2444.     {
  2445.         show_DOW_select_background(&MMI_inline_DOW_select);
  2446.     }
  2447. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2448.     /* 20051012 HIMANSHU END INLINE DOW */
  2449.     show_inline_DOW_select();
  2450.     handle_inline_DOW_select_LSK_display();
  2451. }
  2452. /*****************************************************************************
  2453.  * FUNCTION
  2454.  *  inline_DOW_select_next_item
  2455.  * DESCRIPTION
  2456.  *  
  2457.  * PARAMETERS
  2458.  *  void
  2459.  * RETURNS
  2460.  *  void
  2461.  *****************************************************************************/
  2462. void inline_DOW_select_next_item(void)
  2463. {
  2464.     /*----------------------------------------------------------------*/
  2465.     /* Local Variables                                                */
  2466.     /*----------------------------------------------------------------*/
  2467.     /*----------------------------------------------------------------*/
  2468.     /* Code Body                                                      */
  2469.     /*----------------------------------------------------------------*/
  2470.     DOW_select_next(&MMI_inline_DOW_select);
  2471.     current_DOW_select_highlighted_index = MMI_inline_DOW_select.highlighted_cell;
  2472.     /* 20051012 HIMANSHU START INLINE DOW */
  2473. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2474.     if (IsInlineItemDefaultTextEnable())
  2475.     {
  2476.         show_DOW_select_background(&MMI_inline_DOW_select);
  2477.     }
  2478. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2479.     /* 20051012 HIMANSHU END INLINE DOW */
  2480.     show_inline_DOW_select();
  2481.     handle_inline_DOW_select_LSK_display();
  2482. }
  2483. /*****************************************************************************
  2484.  * FUNCTION
  2485.  *  inline_DOW_select_keyboard_key_handler
  2486.  * DESCRIPTION
  2487.  *  
  2488.  * PARAMETERS
  2489.  *  vkey_code       [IN]        
  2490.  *  key_state       [IN]        
  2491.  * RETURNS
  2492.  *  void
  2493.  *****************************************************************************/
  2494. void inline_DOW_select_keyboard_key_handler(S32 vkey_code, S32 key_state)
  2495. {
  2496. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  2497.     /*----------------------------------------------------------------*/
  2498.     /* Local Variables                                                */
  2499.     /*----------------------------------------------------------------*/
  2500.     /*----------------------------------------------------------------*/
  2501.     /* Code Body                                                      */
  2502.     /*----------------------------------------------------------------*/
  2503.     if (key_state)
  2504.     {
  2505.         switch (vkey_code)
  2506.         {
  2507.             case 37:
  2508.                 inline_DOW_select_previous_item();
  2509.                 break;
  2510.             case 38:
  2511.                 inline_DOW_select_handle_up_arrow();
  2512.                 break;
  2513.             case 39:
  2514.                 inline_DOW_select_next_item();
  2515.                 break;
  2516.             case 40:
  2517.                 inline_DOW_select_handle_down_arrow();
  2518.                 break;
  2519.         }
  2520.     }
  2521. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  2522.     UI_UNUSED_PARAMETER(vkey_code);
  2523.     UI_UNUSED_PARAMETER(key_state);
  2524. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  2525. }
  2526. /*****************************************************************************
  2527.  * FUNCTION
  2528.  *  register_inline_DOW_select_keys
  2529.  * DESCRIPTION
  2530.  *  
  2531.  * PARAMETERS
  2532.  *  void
  2533.  * RETURNS
  2534.  *  void
  2535.  *****************************************************************************/
  2536. void register_inline_DOW_select_keys(void)
  2537. {
  2538.     /*----------------------------------------------------------------*/
  2539.     /* Local Variables                                                */
  2540.     /*----------------------------------------------------------------*/
  2541.     /*----------------------------------------------------------------*/
  2542.     /* Code Body                                                      */
  2543.     /*----------------------------------------------------------------*/
  2544.     SetKeyHandler(inline_DOW_select_previous_item, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2545.     SetKeyHandler(inline_DOW_select_next_item, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2546.     SetKeyHandler(inline_DOW_select_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
  2547.     SetKeyHandler(inline_DOW_select_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  2548.     SetKeyHandler(inline_DOW_select_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
  2549.     SetKeyHandler(inline_DOW_select_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  2550.     register_keyboard_key_handler(inline_DOW_select_keyboard_key_handler);
  2551. }
  2552. /*****************************************************************************
  2553.  * FUNCTION
  2554.  *  redraw_inline_DOW_select
  2555.  * DESCRIPTION
  2556.  *  
  2557.  * PARAMETERS
  2558.  *  void
  2559.  * RETURNS
  2560.  *  void
  2561.  *****************************************************************************/
  2562. void redraw_inline_DOW_select(void)
  2563. {
  2564.     /*----------------------------------------------------------------*/
  2565.     /* Local Variables                                                */
  2566.     /*----------------------------------------------------------------*/
  2567.     /*----------------------------------------------------------------*/
  2568.     /* Code Body                                                      */
  2569.     /*----------------------------------------------------------------*/
  2570.     /* 20051012 HIMANSHU START INLINE DOW */
  2571. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2572.     if (IsInlineItemDefaultTextEnable())
  2573.     {
  2574.         show_DOW_select_background(&MMI_inline_DOW_select);
  2575.     }
  2576. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2577.     /* 20051012 HIMANSHU END INLINE DOW */
  2578.     show_inline_DOW_select();
  2579. }
  2580. /* History implementation for inline DOW select */
  2581. typedef struct _inline_DOW_select_history
  2582. {
  2583.     U16 history_ID;
  2584.     S16 highlight_index;
  2585.     U32 flags;
  2586. } inline_DOW_select_history;
  2587. /*****************************************************************************
  2588.  * FUNCTION
  2589.  *  inline_DOW_select_get_history
  2590.  * DESCRIPTION
  2591.  *  
  2592.  * PARAMETERS
  2593.  *  history_buffer      [?]     
  2594.  * RETURNS
  2595.  *  
  2596.  *****************************************************************************/
  2597. U8 *inline_DOW_select_get_history(U8 *history_buffer)
  2598. {
  2599.     /*----------------------------------------------------------------*/
  2600.     /* Local Variables                                                */
  2601.     /*----------------------------------------------------------------*/
  2602.     /*----------------------------------------------------------------*/
  2603.     /* Code Body                                                      */
  2604.     /*----------------------------------------------------------------*/
  2605.     if (history_buffer != NULL)
  2606.     {
  2607.         U16 hID = (U16) (INLINE_DOW_SELECT_HISTORY_ID | 0x8000);
  2608.         inline_DOW_select_history *h = (inline_DOW_select_history*) history_buffer;
  2609.         h->history_ID = hID;
  2610.         h->highlight_index = (S16) MMI_inline_DOW_select.highlighted_cell;
  2611.         h->flags = MMI_inline_DOW_select.flags;
  2612.     }
  2613.     return (history_buffer);
  2614. }
  2615. /*****************************************************************************
  2616.  * FUNCTION
  2617.  *  inline_DOW_select_set_history
  2618.  * DESCRIPTION
  2619.  *  
  2620.  * PARAMETERS
  2621.  *  history_ID          [IN]        
  2622.  *  history_buffer      [?]         
  2623.  * RETURNS
  2624.  *  
  2625.  *****************************************************************************/
  2626. U8 inline_DOW_select_set_history(U16 history_ID, U8 *history_buffer)
  2627. {
  2628.     /*----------------------------------------------------------------*/
  2629.     /* Local Variables                                                */
  2630.     /*----------------------------------------------------------------*/
  2631.     /*----------------------------------------------------------------*/
  2632.     /* Code Body                                                      */
  2633.     /*----------------------------------------------------------------*/
  2634.     if (history_buffer != NULL)
  2635.     {
  2636.         inline_DOW_select_history *h = (inline_DOW_select_history*) history_buffer;
  2637.         if (history_valid(h->history_ID, history_ID))
  2638.         {
  2639.             MMI_inline_DOW_select.flags = h->flags;
  2640.             MMI_inline_DOW_select.highlighted_cell = (U8) h->highlight_index;
  2641.             return (1);
  2642.         }
  2643.     }
  2644.     return (0);
  2645. }
  2646. /*****************************************************************************
  2647.  * FUNCTION
  2648.  *  initialize_inline_DOW_select
  2649.  * DESCRIPTION
  2650.  *  
  2651.  * PARAMETERS
  2652.  *  x                   [IN]        
  2653.  *  y                   [IN]        
  2654.  *  width               [IN]        
  2655.  *  height              [IN]        
  2656.  *  list_of_states      [?]         
  2657.  *  history_buffer      [?]         
  2658.  * RETURNS
  2659.  *  void
  2660.  *****************************************************************************/
  2661. void initialize_inline_DOW_select(S32 x, S32 y, S32 width, S32 height, U8 *list_of_states, U8 *history_buffer)
  2662. {
  2663.     /*----------------------------------------------------------------*/
  2664.     /* Local Variables                                                */
  2665.     /*----------------------------------------------------------------*/
  2666.     S32 i;
  2667.     /*----------------------------------------------------------------*/
  2668.     /* Code Body                                                      */
  2669.     /*----------------------------------------------------------------*/
  2670.     create_DOW_select(&MMI_inline_DOW_select, x, y, width, height);
  2671.     for (i = 0; i < 7; i++)
  2672.     {
  2673.         MMI_inline_DOW_select.states[i] = list_of_states[i];
  2674.     }
  2675.     current_wgui_inline_DOW_states = list_of_states;
  2676.     inline_DOW_select_set_history(INLINE_DOW_SELECT_HISTORY_ID, history_buffer);
  2677. }
  2678. #ifdef __MMI_TOUCH_SCREEN__
  2679. /*****************************************************************************
  2680.  * FUNCTION
  2681.  *  inline_DOW_select_pen_handler
  2682.  * DESCRIPTION
  2683.  *  
  2684.  * PARAMETERS
  2685.  *  pen_event       [IN]        
  2686.  *  x               [IN]        
  2687.  *  y               [IN]        
  2688.  *  item_event      [?]         
  2689.  * RETURNS
  2690.  *  
  2691.  *****************************************************************************/
  2692. BOOL inline_DOW_select_pen_handler(
  2693.         mmi_pen_event_type_enum pen_event,
  2694.         S16 x,
  2695.         S16 y,
  2696.         gui_inline_item_pen_enum *item_event)
  2697. {
  2698.     /*----------------------------------------------------------------*/
  2699.     /* Local Variables                                                */
  2700.     /*----------------------------------------------------------------*/
  2701.     BOOL ret;
  2702.     DOW_pen_event_enum DOW_event;
  2703.     gui_pen_event_param_struct DOW_param;
  2704.     /*----------------------------------------------------------------*/
  2705.     /* Code Body                                                      */
  2706.     /*----------------------------------------------------------------*/
  2707.     ret = DOW_translate_pen_event(&MMI_inline_DOW_select, pen_event, x, y, &DOW_event, &DOW_param);
  2708.     if (ret)
  2709.     {
  2710.         switch (DOW_event)
  2711.         {
  2712.             case DOW_PEN_CHANGE_HIGHLIGHT_AND_TOGGLE_I:
  2713.                 DOW_select_highlight_item(&MMI_inline_DOW_select, DOW_param._u.i);
  2714.                 /* FALLTHROUGH no break */
  2715.             case DOW_PEN_TOGGLE_CURRENT_ITEM:
  2716.                 DOW_select_toggle_item(&MMI_inline_DOW_select);
  2717.                 /* 20051012 HIMANSHU START INLINE DOW */
  2718.         #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2719.                 if (IsInlineItemDefaultTextEnable())
  2720.                 {
  2721.                     show_DOW_select_background(&MMI_inline_DOW_select);
  2722.                 }
  2723.         #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2724.                 /* 20051012 HIMANSHU END INLINE DOW */
  2725.                 show_inline_DOW_select();
  2726.                 handle_inline_DOW_select_LSK_display();
  2727.                 set_wgui_inline_list_menu_changed();
  2728.                 break;
  2729.             case DOW_PEN_NONE:
  2730.                 /* Do nothing */
  2731.                 break;
  2732.             default:
  2733.                 MMI_ASSERT(0);
  2734.         }
  2735.     }
  2736.     *item_event = GUI_INLINE_ITEM_PEN_NONE;
  2737.     return ret;
  2738. }
  2739. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2740. /*****************************************************************************
  2741.  * FUNCTION
  2742.  *  handle_inline_DOW_select
  2743.  * DESCRIPTION
  2744.  *  
  2745.  * PARAMETERS
  2746.  *  x                   [IN]        
  2747.  *  y                   [IN]        
  2748.  *  width               [IN]        
  2749.  *  height              [IN]        
  2750.  *  key_code            [IN]        
  2751.  *  key_event           [IN]        
  2752.  *  text_p              [IN]        
  2753.  *  item                [?]         
  2754.  *  flags               [IN]        
  2755.  *  history_buffer      [?]         
  2756.  * RETURNS
  2757.  *  void
  2758.  *****************************************************************************/
  2759. void handle_inline_DOW_select(
  2760.         S32 x,
  2761.         S32 y,
  2762.         S32 width,
  2763.         S32 height,
  2764.         S32 key_code,
  2765.         S32 key_event,
  2766.         U8 **text_p,
  2767.         void *item,
  2768.         U32 flags,
  2769.         U8 *history_buffer)
  2770. {
  2771.     /*----------------------------------------------------------------*/
  2772.     /* Local Variables                                                */
  2773.     /*----------------------------------------------------------------*/
  2774.     wgui_inline_item_DOW_select *i = (wgui_inline_item_DOW_select*) item;
  2775.     S32 xx;
  2776.     /*----------------------------------------------------------------*/
  2777.     /* Code Body                                                      */
  2778.     /*----------------------------------------------------------------*/
  2779.     UI_UNUSED_PARAMETER(key_event);
  2780.     UI_UNUSED_PARAMETER(key_code);
  2781.     UI_UNUSED_PARAMETER(flags);
  2782.     wgui_current_inline_item_type = INLINE_ITEM_TYPE_DOW_SELECT;
  2783.     if (MMI_fixed_icontext_menuitem.text_x == 2)
  2784.     {
  2785.         xx = -1;
  2786.     }
  2787.     else
  2788.     {
  2789.         xx = MMI_fixed_icontext_menuitem.text_x;
  2790.     }
  2791.     if (flags & INLINE_ITEM_LEFT_ALIGN)
  2792.     {
  2793.         xx = -1;
  2794.     }
  2795.     clear_inline_item_keys = clear_inline_DOW_select_keys;
  2796.     current_wgui_inline_DOW_item = i;
  2797.     current_wgui_inline_DOW_text_p = text_p;
  2798.     /* PMT VIKAS START 20050817 */
  2799. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  2800.     if (line_draw)
  2801.     {
  2802.         initialize_inline_DOW_select(x + xx, y + 1, width - xx - 1, height - 2, i->list_of_states, history_buffer);
  2803.     }
  2804.     else
  2805. #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  2806.         //PMT VIKAS END 20050817
  2807.         //20051012 HIMANSHU START INLINE DOW
  2808. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2809.     if (IsInlineItemDefaultTextEnable())
  2810.     {
  2811.         initialize_inline_DOW_select(x, y, width, height, i->list_of_states, history_buffer);
  2812.     }
  2813.     else
  2814. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2815.         /* 20051012 HIMANSHU END INLINE DOW */
  2816.         initialize_inline_DOW_select(x + xx, y, width - xx, height, i->list_of_states, history_buffer);
  2817.     /* 20051012 HIMANSHU START INLINE DOW */
  2818. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2819.     if (IsInlineItemDefaultTextEnable())
  2820.     {
  2821.         show_DOW_select_background(&MMI_inline_DOW_select);
  2822.     }
  2823. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2824.     /* 20051012 HIMANSHU END INLINE DOW */
  2825.     show_inline_DOW_select();
  2826.     register_inline_DOW_select_keys();
  2827.     complete_inline_item_edit = inline_DOW_select_change_complete;
  2828.     redraw_current_inline_item = redraw_inline_DOW_select;
  2829. #ifdef __MMI_TOUCH_SCREEN__
  2830.     wgui_current_inline_item_pen_function = inline_DOW_select_pen_handler;
  2831. #endif 
  2832.     handle_inline_DOW_select_LSK_display();
  2833. }
  2834. /*****************************************************************************
  2835.  * FUNCTION
  2836.  *  SetInlineItemDOWSelect
  2837.  * DESCRIPTION
  2838.  *  
  2839.  * PARAMETERS
  2840.  *  item                [?]         
  2841.  *  item_index          [IN]        
  2842.  *  list_of_states      [?]         
  2843.  * RETURNS
  2844.  *  void
  2845.  *****************************************************************************/
  2846. void SetInlineItemDOWSelect(InlineItem *item, S32 item_index, U8 *list_of_states)
  2847. {
  2848.     /*----------------------------------------------------------------*/
  2849.     /* Local Variables                                                */
  2850.     /*----------------------------------------------------------------*/
  2851.     wgui_inline_item_DOW_select *i;
  2852.     /*----------------------------------------------------------------*/
  2853.     /* Code Body                                                      */
  2854.     /*----------------------------------------------------------------*/
  2855.     if (n_inline_DOW_items >= MAX_INLINE_DOW_SELECT_ITEMS)
  2856.     {
  2857.         return;
  2858.     }
  2859.     item->item = (void*)&wgui_inline_DOW_select_items[n_inline_DOW_items];
  2860.     item->flags = INLINE_ITEM_TYPE_DOW_SELECT;
  2861.     n_inline_DOW_items++;
  2862.     i = (wgui_inline_item_DOW_select*) item->item;
  2863.     i->flags = 0;
  2864.     i->list_of_states = list_of_states;
  2865.     item->handler = handle_inline_DOW_select;
  2866.     MMI_fixed_icontext_menuitems[item_index].flags |= UI_MENUITEM_INLINE_EDIT_OBJECT;
  2867. }
  2868. /*****************************************************************************
  2869.  * FUNCTION
  2870.  *  ReConfigureInlineItemDOWSelect
  2871.  * DESCRIPTION
  2872.  *  
  2873.  * PARAMETERS
  2874.  *  item                [?]         
  2875.  *  item_index          [IN]        
  2876.  *  list_of_states      [?]         
  2877.  * RETURNS
  2878.  *  void
  2879.  *****************************************************************************/
  2880. void ReConfigureInlineItemDOWSelect(InlineItem *item, S32 item_index, U8 *list_of_states)
  2881. {
  2882.     /*----------------------------------------------------------------*/
  2883.     /* Local Variables                                                */
  2884.     /*----------------------------------------------------------------*/
  2885.     wgui_inline_item_DOW_select *i;
  2886.     /*----------------------------------------------------------------*/
  2887.     /* Code Body                                                      */
  2888.     /*----------------------------------------------------------------*/
  2889.     if ((item->flags & 0xff) != INLINE_ITEM_TYPE_DOW_SELECT)
  2890.     {
  2891.         return;
  2892.     }
  2893.     i = (wgui_inline_item_DOW_select*) item->item;
  2894.     i->flags = 0;
  2895.     i->list_of_states = list_of_states;
  2896. }
  2897. /* Displaying DOW select as a menu item in the fixed list menu */
  2898. /*****************************************************************************
  2899.  * FUNCTION
  2900.  *  wgui_show_DOW_list_menuitem
  2901.  * DESCRIPTION
  2902.  *  
  2903.  * PARAMETERS
  2904.  *  x1          [IN]        
  2905.  *  y1          [IN]        
  2906.  *  width       [IN]        
  2907.  *  height      [IN]        
  2908.  *  item        [?]         
  2909.  * RETURNS
  2910.  *  void
  2911.  *****************************************************************************/
  2912. void wgui_show_DOW_list_menuitem(S32 x1, S32 y1, S32 width, S32 height, wgui_inline_item *item)
  2913. {
  2914.     /*----------------------------------------------------------------*/
  2915.     /* Local Variables                                                */
  2916.     /*----------------------------------------------------------------*/
  2917.     S32 xx;
  2918.     wgui_inline_item_DOW_select *i = (wgui_inline_item_DOW_select*) item->item;
  2919.     /*----------------------------------------------------------------*/
  2920.     /* Code Body                                                      */
  2921.     /*----------------------------------------------------------------*/
  2922.     if (MMI_fixed_icontext_menuitem.text_x == 2)
  2923.     {
  2924.         xx = -1;
  2925.     }
  2926.     else
  2927.     {
  2928.         xx = MMI_fixed_icontext_menuitem.text_x;
  2929.     }
  2930.     if (i->flags & INLINE_ITEM_LEFT_ALIGN)
  2931.     {
  2932.         xx = -1;
  2933.     }
  2934.     gdi_layer_lock_frame_buffer();
  2935.     /* 20051012 HIMANSHU START INLINE DOW */
  2936. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2937.     if (IsInlineItemDefaultTextEnable())
  2938.     {
  2939.         initialize_inline_DOW_select(x1, y1, width, height, i->list_of_states, NULL);
  2940.     }
  2941.     else
  2942. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2943.         /* 20051012 HIMANSHU END INLINE DOW */
  2944.         initialize_inline_DOW_select(x1 + xx, y1, width - xx, height, i->list_of_states, NULL);
  2945.     set_inline_DOW_select_list_menu_theme();
  2946.     /* 20051012 HIMANSHU START INLINE DOW */
  2947. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  2948.     if (IsInlineItemDefaultTextEnable())
  2949.     {
  2950.         inline_item_default_text_show_background((x1 - 1), y1, (x1 - 1) + (width - 1), y1 + height - 1);
  2951.     }
  2952. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  2953.     /* 20051012 HIMANSHU END INLINE DOW */
  2954.     show_inline_DOW_select();
  2955.     redraw_left_softkey();
  2956.     redraw_right_softkey();
  2957.     gdi_layer_unlock_frame_buffer();
  2958. }
  2959. /*----------------------------------------------------------------------------
  2960.    Inline time period edit implementation
  2961. ----------------------------------------------------------------------------*/
  2962. #define MAX_INLINE_TIME_PERIOD_ITEMS                     2
  2963. #define MAX_INLINE_TIME_PERIOD_DISPLAY_STRING_SIZE          32
  2964. S32 n_inline_time_period_items = 0;
  2965. wgui_inline_item_time_period wgui_inline_time_period_items[MAX_INLINE_TIME_PERIOD_ITEMS];
  2966. U8 wgui_inline_time_period_display_strings[MAX_INLINE_TIME_PERIOD_ITEMS][MAX_INLINE_TIME_PERIOD_DISPLAY_STRING_SIZE];
  2967. wgui_inline_item_time_period *current_wgui_inline_time_period_item;
  2968. U8 **current_wgui_inline_time_period_text_p;
  2969. U8 wgui_inline_time_period_edit_hours_buffer1[3 * ENCODING_LENGTH];
  2970. U8 wgui_inline_time_period_edit_minutes_buffer1[3 * ENCODING_LENGTH];
  2971. U8 wgui_inline_time_period_edit_hours_buffer2[3 * ENCODING_LENGTH];
  2972. U8 wgui_inline_time_period_edit_minutes_buffer2[3 * ENCODING_LENGTH];
  2973. U8 *wgui_inline_time_period_AM_PM_flag1;
  2974. U8 *wgui_inline_time_period_AM_PM_flag2;
  2975. time_period_input wgui_inline_time_period_input;
  2976. /*****************************************************************************
  2977.  * FUNCTION
  2978.  *  handle_inline_time_period_edit_complete
  2979.  * DESCRIPTION
  2980.  *  
  2981.  * PARAMETERS
  2982.  *  void
  2983.  * RETURNS
  2984.  *  void
  2985.  *****************************************************************************/
  2986. void handle_inline_time_period_edit_complete(void)
  2987. {
  2988.     /*----------------------------------------------------------------*/
  2989.     /* Local Variables                                                */
  2990.     /*----------------------------------------------------------------*/
  2991.     /*----------------------------------------------------------------*/
  2992.     /* Code Body                                                      */
  2993.     /*----------------------------------------------------------------*/
  2994.     register_inline_fixed_list_keys();
  2995.     gui_strcpy(
  2996.         (UI_string_type) current_wgui_inline_time_period_item->hours_buffer1,
  2997.         (UI_string_type) wgui_inline_time_period_edit_hours_buffer1);
  2998.     gui_strcpy(
  2999.         (UI_string_type) current_wgui_inline_time_period_item->minutes_buffer1,
  3000.         (UI_string_type) wgui_inline_time_period_edit_minutes_buffer1);
  3001.     gui_strcpy(
  3002.         (UI_string_type) current_wgui_inline_time_period_item->hours_buffer2,
  3003.         (UI_string_type) wgui_inline_time_period_edit_hours_buffer2);
  3004.     gui_strcpy(
  3005.         (UI_string_type) current_wgui_inline_time_period_item->minutes_buffer2,
  3006.         (UI_string_type) wgui_inline_time_period_edit_minutes_buffer2);
  3007.     current_wgui_inline_time_period_item->AM_PM_flag1 = wgui_inline_time_period_AM_PM_flag1;
  3008.     current_wgui_inline_time_period_item->AM_PM_flag2 = wgui_inline_time_period_AM_PM_flag2;
  3009.     current_wgui_inline_time_period_item->string_construct_callback(
  3010.                                             *current_wgui_inline_time_period_text_p,
  3011.                                             current_wgui_inline_time_period_item->hours_buffer1,
  3012.                                             current_wgui_inline_time_period_item-> minutes_buffer1,
  3013.                                             current_wgui_inline_time_period_item->AM_PM_flag1,
  3014.                                             current_wgui_inline_time_period_item->hours_buffer2,
  3015.                                             current_wgui_inline_time_period_item-> minutes_buffer2,
  3016.                                             current_wgui_inline_time_period_item->AM_PM_flag2);
  3017.     MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text =
  3018.         (UI_string_type) * current_wgui_inline_time_period_text_p;
  3019.     clear_left_softkey();
  3020.     clear_right_softkey();
  3021.     register_left_softkey_handler();
  3022.     register_right_softkey_handler();
  3023. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  3024.     mmi_pen_editor_close_input_box();
  3025. #endif 
  3026.     wgui_inline_item_handled = 0;
  3027.     wgui_text_menuitem_restart_scrolling();
  3028.     inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
  3029.     redraw_current_inline_item = UI_dummy_function;
  3030.     complete_inline_item_edit = UI_dummy_function;
  3031.     set_current_time_period_input(NULL);