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

MTK

开发平台:

C/C++

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