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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2.  * FUNCTION
  3.  *  gui_remove_highlight_fixed_icontext_list_menuitem
  4.  * DESCRIPTION
  5.  *  Removes the highlight of a fixed icontext list menuitem (not visually)
  6.  * PARAMETERS
  7.  *  item                    [IN]        Is a specific fixed icontext list menuitem object
  8.  *  common_item_data        [IN]        
  9.  * RETURNS
  10.  *  void
  11.  *****************************************************************************/
  12. void gui_remove_highlight_fixed_icontext_list_menuitem(void *item, void *common_item_data)
  13. {
  14.     /*----------------------------------------------------------------*/
  15.     /* Local Variables                                                */
  16.     /*----------------------------------------------------------------*/
  17.     S32 i = 0;
  18.     fixed_icontext_list_menuitem_type *t = (fixed_icontext_list_menuitem_type*) item;
  19.     fixed_icontext_list_menuitem *m = (fixed_icontext_list_menuitem*) common_item_data;
  20.     /*----------------------------------------------------------------*/
  21.     /* Code Body                                                      */
  22.     /*----------------------------------------------------------------*/
  23.     t->flags &= ~UI_MENUITEM_STATE_FOCUSSED;
  24.     for (i = 0; i < m->n_icon_columns; i++)
  25.     {
  26.         if (t->item_icon_handles[i] != GDI_ERROR_HANDLE)
  27.         {
  28.             gdi_image_stop_animation(t->item_icon_handles[i]);
  29.             t->item_icon_handles[i] = GDI_ERROR_HANDLE;
  30.         }
  31.     }
  32. }
  33. /* GUI: fixed two state menuitem functions               */
  34. UI_fixed_twostate_menuitem_theme *current_fixed_twostate_menuitem_theme = NULL;
  35. /*****************************************************************************
  36.  * FUNCTION
  37.  *  gui_set_fixed_twostate_menuitem_current_theme
  38.  * DESCRIPTION
  39.  *  Applies the current theme to a fixed twostate menuitem
  40.  * PARAMETERS
  41.  *  m       [IN]        Is the fixed twostate menuitem object  (common data)
  42.  * RETURNS
  43.  *  void
  44.  *****************************************************************************/
  45. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  46. UI_filled_area fixed_twostate_menuitem_transparent_filled_area;
  47. #endif 
  48. void gui_set_fixed_twostate_menuitem_current_theme(fixed_twostate_menuitem *m)
  49. {
  50.     /*----------------------------------------------------------------*/
  51.     /* Local Variables                                                */
  52.     /*----------------------------------------------------------------*/
  53.     /*----------------------------------------------------------------*/
  54.     /* Code Body                                                      */
  55.     /*----------------------------------------------------------------*/
  56.     m->disabled_filler = current_fixed_twostate_menuitem_theme->disabled_filler;
  57.     m->disabled_text_color = current_fixed_twostate_menuitem_theme->disabled_text_color;
  58.     m->flags |= current_fixed_twostate_menuitem_theme->flags;
  59.     m->focussed_filler = current_fixed_twostate_menuitem_theme->focussed_filler;
  60. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  61.     if (!m->focussed_filler->flags & UI_FILLED_AREA_TYPE_BITMAP)
  62.     {
  63.         fixed_twostate_menuitem_transparent_filled_area = *(m->focussed_filler);
  64.         m->focussed_filler = &fixed_twostate_menuitem_transparent_filled_area;
  65.         fixed_twostate_menuitem_transparent_filled_area.flags |= UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  66.         fixed_twostate_menuitem_transparent_filled_area.c.alpha = HIGHLIGHTER_COLOR_OPACITY_VALUE;
  67.     }
  68. #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  69.     m->focussed_text_color = current_fixed_twostate_menuitem_theme->focussed_text_color;
  70.     m->normal_filler = current_fixed_twostate_menuitem_theme->normal_filler;
  71.     m->normal_text_color = current_fixed_twostate_menuitem_theme->normal_text_color;
  72.     m->selected_filler = current_fixed_twostate_menuitem_theme->selected_filler;
  73.     m->selected_text_color = current_fixed_twostate_menuitem_theme->selected_text_color;
  74.     m->text_font = current_fixed_twostate_menuitem_theme->text_font;
  75. }
  76. /*****************************************************************************
  77.  * FUNCTION
  78.  *  gui_set_fixed_twostate_menuitem_theme
  79.  * DESCRIPTION
  80.  *  Applies the given theme to a fixed twostate menuitem
  81.  * PARAMETERS
  82.  *  m       [IN]        Is the fixed twostate menuitem object  (common data)
  83.  *  t       [IN]        Is the theme
  84.  * RETURNS
  85.  *  void
  86.  *****************************************************************************/
  87. void gui_set_fixed_twostate_menuitem_theme(fixed_twostate_menuitem *m, UI_fixed_twostate_menuitem_theme *t)
  88. {
  89.     /*----------------------------------------------------------------*/
  90.     /* Local Variables                                                */
  91.     /*----------------------------------------------------------------*/
  92.     /*----------------------------------------------------------------*/
  93.     /* Code Body                                                      */
  94.     /*----------------------------------------------------------------*/
  95.     m->disabled_filler = t->disabled_filler;
  96.     m->disabled_text_color = t->disabled_text_color;
  97.     m->flags |= t->flags;
  98.     m->focussed_filler = t->focussed_filler;
  99. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  100.     if (!m->focussed_filler->flags & UI_FILLED_AREA_TYPE_BITMAP)
  101.     {
  102.         fixed_twostate_menuitem_transparent_filled_area = *(m->focussed_filler);
  103.         m->focussed_filler = &fixed_twostate_menuitem_transparent_filled_area;
  104.         fixed_twostate_menuitem_transparent_filled_area.flags |= UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  105.         fixed_twostate_menuitem_transparent_filled_area.c.alpha = HIGHLIGHTER_COLOR_OPACITY_VALUE;
  106.     }
  107. #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  108.     m->focussed_text_color = t->focussed_text_color;
  109.     m->normal_filler = t->normal_filler;
  110.     m->normal_text_color = t->normal_text_color;
  111.     m->selected_filler = t->selected_filler;
  112.     m->selected_text_color = t->selected_text_color;
  113.     m->text_font = t->text_font;
  114. }
  115. /*****************************************************************************
  116.  * FUNCTION
  117.  *  gui_create_fixed_twostate_menuitem
  118.  * DESCRIPTION
  119.  *  Creates a fixed twostate menuitem
  120.  * PARAMETERS
  121.  *  m               [IN]        Is the fixed twostate menuitem object (common data)
  122.  *  width           [IN]        Width is the width of the fixed twostate menuitem
  123.  *  height          [IN]        Height is the height of the fixed twostate menuitem
  124.  *  ON_icon         [IN]        
  125.  *  OFF_icon        [IN]        
  126.  * RETURNS
  127.  *  void
  128.  *****************************************************************************/
  129. void gui_create_fixed_twostate_menuitem(fixed_twostate_menuitem *m, S32 width, S32 height, PU8 ON_icon, PU8 OFF_icon)
  130. {
  131.     /*----------------------------------------------------------------*/
  132.     /* Local Variables                                                */
  133.     /*----------------------------------------------------------------*/
  134.     /*----------------------------------------------------------------*/
  135.     /* Code Body                                                      */
  136.     /*----------------------------------------------------------------*/
  137.     m->width = width;
  138.     m->height = height;
  139.     m->flags = 0;
  140.     m->ext_flags = 0;
  141.     m->icon_transparent_color = gui_transparent_color(0, 0, 0);
  142.     gui_set_fixed_twostate_menuitem_current_theme(m);
  143.     m->OFF_icon = OFF_icon;
  144.     m->ON_icon = ON_icon;
  145.     m->icon_x = 0;
  146.     m->icon_y = 0;
  147.     /* Autocalculate the icon position              */
  148.     if (m->OFF_icon != UI_NULL_IMAGE)
  149.     {
  150.         S32 icon_width, icon_height;
  151.         gui_measure_image(m->OFF_icon, &icon_width, &icon_height);
  152.         if (m->flags & UI_MENUITEM_CENTER_ICON_X)
  153.         {
  154.             m->icon_x = (m->width >> 1) - (icon_width >> 1);
  155.         }
  156.         if (m->flags & UI_MENUITEM_CENTER_ICON_Y)
  157.         {
  158.             m->icon_y = (m->height >> 1) - (icon_height >> 1);
  159.         }
  160.     }
  161.     m->scroll_x = 0;
  162.     m->scroll_width = width;
  163.     m->parent_list = NULL;
  164.     m->parent_matrix = NULL;        
  165. }
  166. /*****************************************************************************
  167.  * FUNCTION
  168.  *  gui_fixed_twostate_menuitem_set_text_position
  169.  * DESCRIPTION
  170.  *  Sets the text position within a fixed twostate menuitem
  171.  * PARAMETERS
  172.  *  m       [IN]        Is the fixed twostate menuitem object  (common data)
  173.  *  x       [IN]        Is the position of the text (offset from the left-top corner of the menuitem)
  174.  *  y       [IN]        Is the position of the text (offset from the left-top corner of the menuitem)
  175.  * RETURNS
  176.  *  void
  177.  *****************************************************************************/
  178. void gui_fixed_twostate_menuitem_set_text_position(fixed_twostate_menuitem *m, S32 x, S32 y)
  179. {
  180.     /*----------------------------------------------------------------*/
  181.     /* Local Variables                                                */
  182.     /*----------------------------------------------------------------*/
  183.     /*----------------------------------------------------------------*/
  184.     /* Code Body                                                      */
  185.     /*----------------------------------------------------------------*/
  186.     m->text_x = x;
  187.     m->text_y = y;
  188.     if (m->icon_x > m->text_x)
  189.     {
  190.         m->scroll_width = m->icon_x - m->text_x;
  191.     }
  192.     else
  193.     {
  194.         m->scroll_width = m->width - m->text_x;
  195.     }
  196. }
  197. /*****************************************************************************
  198.  * FUNCTION
  199.  *  gui_fixed_twostate_menuitem_set_icon_position
  200.  * DESCRIPTION
  201.  *  Sets the icon position within a fixed twostate menuitem
  202.  * PARAMETERS
  203.  *  m       [IN]        Is the fixed twostate menuitem object  (common data)
  204.  *  x       [IN]        Is the position of the icon (offset from the left-top corner of the menuitem)
  205.  *  y       [IN]        Is the position of the icon (offset from the left-top corner of the menuitem)
  206.  * RETURNS
  207.  *  void
  208.  *****************************************************************************/
  209. void gui_fixed_twostate_menuitem_set_icon_position(fixed_twostate_menuitem *m, S32 x, S32 y)
  210. {
  211.     /*----------------------------------------------------------------*/
  212.     /* Local Variables                                                */
  213.     /*----------------------------------------------------------------*/
  214.     /*----------------------------------------------------------------*/
  215.     /* Code Body                                                      */
  216.     /*----------------------------------------------------------------*/
  217.     m->icon_x = x;
  218.     m->icon_x = y;
  219.     if (m->icon_x > m->text_x)
  220.     {
  221.         m->scroll_width = m->icon_x - m->text_x;
  222.     }
  223.     else
  224.     {
  225.         m->scroll_width = m->width - m->text_x;
  226.     }
  227. }
  228. /*****************************************************************************
  229.  * FUNCTION
  230.  *  gui_fixed_twostate_menuitem_set_icons
  231.  * DESCRIPTION
  232.  *  sets the two state icons
  233.  * PARAMETERS
  234.  *  m               [IN]        Is the fixed twostate menuitem object (common_data)
  235.  *  ON_icon         [IN]        Is the icon that is displayed when the item is selected
  236.  *  OFF_icon        [IN]        Is the icon that is displayed when the item is not selected
  237.  * RETURNS
  238.  *  void
  239.  *****************************************************************************/
  240. void gui_fixed_twostate_menuitem_set_icons(fixed_twostate_menuitem *m, PU8 ON_icon, PU8 OFF_icon)
  241. {
  242.     /*----------------------------------------------------------------*/
  243.     /* Local Variables                                                */
  244.     /*----------------------------------------------------------------*/
  245.     /*----------------------------------------------------------------*/
  246.     /* Code Body                                                      */
  247.     /*----------------------------------------------------------------*/
  248.     m->OFF_icon = OFF_icon;
  249.     m->ON_icon = ON_icon;
  250.     /* Autocalculate the icon position              */
  251.     if (m->OFF_icon != UI_NULL_IMAGE)
  252.     {
  253.         S32 icon_width, icon_height;
  254.         gui_measure_image(m->OFF_icon, &icon_width, &icon_height);
  255.         if (m->flags & UI_MENUITEM_CENTER_ICON_X)
  256.         {
  257.             m->icon_x = (m->width >> 1) - (icon_width >> 1);
  258.         }
  259.         if (m->flags & UI_MENUITEM_CENTER_ICON_Y)
  260.         {
  261.             m->icon_y = (m->height >> 1) - (icon_height >> 1);
  262.         }
  263.     }
  264.     if (m->icon_x > m->text_x)
  265.     {
  266.         m->scroll_width = m->icon_x - m->text_x;
  267.     }
  268.     else
  269.     {
  270.         m->scroll_width = m->width - m->text_x;
  271.     }
  272. }
  273. /*****************************************************************************
  274.  * FUNCTION
  275.  *  gui_resize_fixed_twostate_menuitem
  276.  * DESCRIPTION
  277.  *  Changes the size of a fixed twostate menuitem
  278.  * PARAMETERS
  279.  *  m           [IN]        Is the fixed twostate menuitem object  (common data)
  280.  *  width       [IN]        Is the new width
  281.  *  height      [IN]        Is the new height
  282.  * RETURNS
  283.  *  void
  284.  *****************************************************************************/
  285. void gui_resize_fixed_twostate_menuitem(fixed_twostate_menuitem *m, S32 width, S32 height)
  286. {
  287.     /*----------------------------------------------------------------*/
  288.     /* Local Variables                                                */
  289.     /*----------------------------------------------------------------*/
  290.     /*----------------------------------------------------------------*/
  291.     /* Code Body                                                      */
  292.     /*----------------------------------------------------------------*/
  293.     m->width = width;
  294.     m->height = height;
  295.     if (m->icon_x > m->text_x)
  296.     {
  297.         m->scroll_width = m->icon_x - m->text_x;
  298.     }
  299.     /* PMT VIKAS START 20051202 */
  300. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  301.     else
  302.     {
  303.         m->scroll_width = m->width - (m->text_x + TEXT_ICON_GAP);       /* As TEXT_ICON_GAP is add in text x to start show text */
  304.     }
  305. #else /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  306.     else
  307.     {
  308.         m->scroll_width = m->width - m->text_x;
  309.     }
  310. #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  311.     /* PMT VIKAS END 20051202 */
  312. }
  313. /* Text scrolling related functions within the menu item */
  314. fixed_twostate_menuitem *GUI_current_fixed_twostate_menuitem_common_data = NULL;
  315. fixed_twostate_menuitem_type *GUI_current_fixed_twostate_menuitem_data = NULL;
  316. U8 GUI_current_fixed_twostate_menuitem_scroll = 0;
  317. U8 GUI_current_fixed_twostate_menuitem_scroll_direction;
  318. S32 GUI_current_fixed_twostate_menuitem_x;
  319. S32 GUI_current_fixed_twostate_menuitem_y;
  320. S32 GUI_current_fixed_twostate_menuitem_scroll_counter = 0;
  321. UI_string_type GUI_current_fixed_twostate_menuitem_scroll_text = NULL;
  322. UI_string_type GUI_current_fixed_twostate_menuitem_scroll_text_end = NULL;
  323. /*****************************************************************************
  324.  * FUNCTION
  325.  *  gui_fixed_twostate_menuitem_scroll_handler
  326.  * DESCRIPTION
  327.  *  Scoll the menu item text
  328.  * PARAMETERS
  329.  *  void
  330.  * RETURNS
  331.  *  void
  332.  *****************************************************************************/
  333. void gui_fixed_twostate_menuitem_scroll_handler(void)
  334. {
  335.     /*----------------------------------------------------------------*/
  336.     /* Local Variables                                                */
  337.     /*----------------------------------------------------------------*/
  338.     U32 flags = GUI_current_fixed_twostate_menuitem_common_data->flags;
  339.     /*----------------------------------------------------------------*/
  340.     /* Code Body                                                      */
  341.     /*----------------------------------------------------------------*/
  342.     flags |= GUI_current_fixed_twostate_menuitem_data->flags;
  343. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  344.     gui_reset_current_list_effect();
  345. #endif 
  346.     if (GUI_current_fixed_twostate_menuitem_scroll_counter)
  347.     {
  348.         GUI_current_fixed_twostate_menuitem_scroll_counter--;
  349.     }
  350.     else
  351.     {
  352.     #if(UI_USE_WORD_SCROLLING_TEXT)
  353.         GUI_current_fixed_twostate_menuitem_scroll_text = GUI_current_fixed_twostate_menuitem_scroll_text_end;
  354.     #else /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  355.         if (flags & UI_MENUITEM_MARQUEE_SCROLL)
  356.         {
  357.             if (r2lMMIFlag)
  358.             {
  359.                 GUI_current_fixed_twostate_menuitem_common_data->scroll_x += UI_text_menuitem_scroll_size;
  360.                 if (GUI_current_fixed_twostate_menuitem_common_data->scroll_x >=
  361.                     (GUI_current_fixed_twostate_menuitem_common_data->text_width + UI_text_menuitem_scroll_gap))
  362.                 {
  363.                     GUI_current_fixed_twostate_menuitem_common_data->scroll_x = 0;
  364.                 }
  365.             }
  366.             else
  367.             {
  368.                 GUI_current_fixed_twostate_menuitem_common_data->scroll_x -= UI_text_menuitem_scroll_size;
  369.                 if (GUI_current_fixed_twostate_menuitem_common_data->scroll_x <=
  370.                     (-(GUI_current_fixed_twostate_menuitem_common_data->text_width + UI_text_menuitem_scroll_gap)))
  371.                 {
  372.                     GUI_current_fixed_twostate_menuitem_common_data->scroll_x = 0;
  373.                 }
  374.             }
  375.         }
  376.         else
  377.         {
  378.             if (GUI_current_fixed_twostate_menuitem_scroll_direction == 0)
  379.             {
  380.                 GUI_current_fixed_twostate_menuitem_common_data->scroll_x -= UI_text_menuitem_scroll_size;
  381.                 if ((GUI_current_fixed_twostate_menuitem_common_data->scroll_x +
  382.                      GUI_current_fixed_twostate_menuitem_common_data->text_width) <=
  383.                     (GUI_current_fixed_twostate_menuitem_common_data->scroll_width))
  384.                 {
  385.                     GUI_current_fixed_twostate_menuitem_scroll_direction = 1;
  386.                     GUI_current_fixed_twostate_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
  387.                 }
  388.             }
  389.             else if (GUI_current_fixed_twostate_menuitem_scroll_direction == 1)
  390.             {
  391.                 GUI_current_fixed_twostate_menuitem_common_data->scroll_x += UI_text_menuitem_scroll_size;
  392.                 if (GUI_current_fixed_twostate_menuitem_common_data->scroll_x >= 0)
  393.                 {
  394.                     GUI_current_fixed_twostate_menuitem_scroll_direction = 0;
  395.                     GUI_current_fixed_twostate_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
  396.                 }
  397.             }
  398.         }
  399.     #endif /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  400.         /* 
  401.          * WAP might display two-state fixed list as list box outside of content region.
  402.          * We should disable scrolling text when it locates outside the content region, 
  403.          * otherwise it will overlap with the title bar or softkey.
  404.          */
  405.         if (GUI_current_fixed_twostate_menuitem_y >= MMI_content_y &&
  406.             (GUI_current_fixed_twostate_menuitem_y + GUI_current_fixed_twostate_menuitem_common_data->height - 1)
  407.             < (MMI_content_y + MMI_content_height))
  408.         {
  409.             GUI_current_fixed_twostate_menuitem_common_data->ext_flags |= UI_MENUITEM_EXT_SHOW_IN_MARQUEE;
  410.         #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  411.             if (!gui_is_current_transparency_with_multi_layer())
  412.             {
  413.                 gui_fixed_twostate_menuitem_disable_transparent_effect(GUI_current_fixed_twostate_menuitem_common_data);        /* To hide text below scrolling text */
  414.             }
  415.         #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  416.             gui_show_fixed_twostate_menuitem(
  417.                 (void*)GUI_current_fixed_twostate_menuitem_data,
  418.                 (void*)GUI_current_fixed_twostate_menuitem_common_data,
  419.                 GUI_current_fixed_twostate_menuitem_x,
  420.                 GUI_current_fixed_twostate_menuitem_y);
  421.         #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  422.             gui_fixed_twostate_menuitem_enable_transparent_effect(GUI_current_fixed_twostate_menuitem_common_data);     /* To enable transparency */
  423.         #endif 
  424.             GUI_current_fixed_twostate_menuitem_common_data->ext_flags &= ~UI_MENUITEM_EXT_SHOW_IN_MARQUEE;
  425.             gui_BLT_double_buffer(
  426.                 GUI_current_fixed_twostate_menuitem_x,
  427.                 GUI_current_fixed_twostate_menuitem_y,
  428.                 GUI_current_fixed_twostate_menuitem_x + GUI_current_fixed_twostate_menuitem_common_data->width - 1,
  429.                 GUI_current_fixed_twostate_menuitem_y + GUI_current_fixed_twostate_menuitem_common_data->height - 1);
  430.         }
  431.     }
  432.     /* start timer of scrolling text */
  433.     gui_start_timer(UI_text_menuitem_scroll_time, gui_fixed_twostate_menuitem_scroll_handler);
  434. }
  435. /*****************************************************************************
  436.  * FUNCTION
  437.  *  gui_fixed_twostate_menuitem_start_scroll
  438.  * DESCRIPTION
  439.  *  start the scrolling of menu item text
  440.  * PARAMETERS
  441.  *  void
  442.  * RETURNS
  443.  *  void
  444.  *****************************************************************************/
  445. void gui_fixed_twostate_menuitem_start_scroll(void)
  446. {
  447.     /*----------------------------------------------------------------*/
  448.     /* Local Variables                                                */
  449.     /*----------------------------------------------------------------*/
  450.     fixed_twostate_menuitem_type *t = (fixed_twostate_menuitem_type*) GUI_current_fixed_twostate_menuitem_data;
  451.     fixed_twostate_menuitem *m = (fixed_twostate_menuitem*) GUI_current_fixed_twostate_menuitem_common_data;
  452.     S32 w;
  453.     U32 flags;
  454.     /*----------------------------------------------------------------*/
  455.     /* Code Body                                                      */
  456.     /*----------------------------------------------------------------*/
  457.     flags = m->flags;
  458.     flags |= t->flags;
  459.     gui_set_font(m->text_font);
  460.     w = gui_get_string_width(t->item_text);
  461.     m->text_width = w;
  462.     m->scroll_x = 0;
  463.     if (w >= (m->scroll_width - 1))
  464.     {
  465.     #if(UI_USE_WORD_SCROLLING_TEXT)
  466.         GUI_current_fixed_twostate_menuitem_scroll_text = t->item_text;
  467.         GUI_current_fixed_twostate_menuitem_scroll = 1;
  468.         GUI_current_fixed_twostate_menuitem_scroll_direction = 0;
  469.         GUI_current_fixed_twostate_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
  470.     #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  471.         if (gui_get_current_list_effect() && gblock_list_effect != 1)
  472.         {
  473.             gui_register_callback_menuitem_scroll(gui_fixed_twostate_menuitem_scroll_handler);
  474.         }
  475.         else
  476.     #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  477.         {
  478.             gui_start_timer(UI_text_menuitem_scroll_time, gui_fixed_twostate_menuitem_scroll_handler);
  479.         }
  480.     #else /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  481.         if ((flags & UI_MENUITEM_MARQUEE_SCROLL) || (flags & UI_MENUITEM_TWO_DIRECTION_SCROLL))
  482.         {
  483.             GUI_current_fixed_twostate_menuitem_scroll = 1;
  484.             GUI_current_fixed_twostate_menuitem_scroll_direction = 0;
  485.             GUI_current_fixed_twostate_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
  486.         #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  487.             if (gui_get_current_list_effect() && gblock_list_effect != 1)
  488.             {
  489.                 gui_register_callback_menuitem_scroll(gui_fixed_twostate_menuitem_scroll_handler);
  490.             }
  491.             else
  492.         #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  493.             {
  494.                 gui_start_timer(UI_text_menuitem_scroll_time, gui_fixed_twostate_menuitem_scroll_handler);
  495.             }
  496.         }
  497.     #endif /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  498.     }
  499.     else
  500. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  501.     {
  502.         gui_register_callback_menuitem_scroll(gui_dummy_scroll_handler_for_list_effects);
  503.         GUI_current_fixed_twostate_menuitem_scroll = 0;
  504.     }
  505. #else /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  506.     {
  507.         GUI_current_fixed_twostate_menuitem_scroll = 0;
  508.     }
  509. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  510. }
  511. /*****************************************************************************
  512.  * FUNCTION
  513.  *  gui_fixed_twostate_menuitem_stop_scroll
  514.  * DESCRIPTION
  515.  *  stop the scrolling of menu item text
  516.  * PARAMETERS
  517.  *  void
  518.  * RETURNS
  519.  *  void
  520.  *****************************************************************************/
  521. void gui_fixed_twostate_menuitem_stop_scroll(void)
  522. {
  523.     /*----------------------------------------------------------------*/
  524.     /* Local Variables                                                */
  525.     /*----------------------------------------------------------------*/
  526.     /*----------------------------------------------------------------*/
  527.     /* Code Body                                                      */
  528.     /*----------------------------------------------------------------*/
  529.     if (GUI_current_fixed_twostate_menuitem_scroll)
  530.     {
  531.         gui_cancel_timer(gui_fixed_twostate_menuitem_scroll_handler);
  532.         GUI_current_fixed_twostate_menuitem_scroll = 0;
  533.     }
  534. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  535.     gui_register_callback_menuitem_scroll(gui_dummy_scroll_handler_for_list_effects);
  536.     gui_restore_current_list_effect();
  537. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  538. }
  539. /*****************************************************************************
  540.  * FUNCTION
  541.  *  gui_show_fixed_twostate_menuitem
  542.  * DESCRIPTION
  543.  *  Displays the fixed twostate menuitem
  544.  * PARAMETERS
  545.  *  item                    [IN]        Is a specific fixed twostate menuitem object
  546.  *  common_item_data        [IN]        Is the fixed twostate menuitem object (common_data)
  547.  *  x                       [IN]        Is the position at which the menuitem is displayed
  548.  *  y                       [IN]        Is the position at which the menuitem is displayed
  549.  * RETURNS
  550.  *  void
  551.  *****************************************************************************/
  552. void gui_show_fixed_twostate_menuitem(void *item, void *common_item_data, S32 x, S32 y)
  553. {
  554.     /*----------------------------------------------------------------*/
  555.     /* Local Variables                                                */
  556.     /*----------------------------------------------------------------*/
  557.     S32 x1, y1, x2, y2;
  558.     S32 text_x, text_y;
  559.     color text_color;
  560.     UI_filled_area *f = NULL;
  561.     fixed_twostate_menuitem *m = (fixed_twostate_menuitem*) common_item_data;
  562.     fixed_twostate_menuitem_type *mi = (fixed_twostate_menuitem_type*) item;
  563.     U32 flags;
  564.     UI_string_type _text;
  565.     /* byte animation_flag=0; */
  566.     S32 sw, sh;
  567. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  568.     PU8 temp_on_icon = m->ON_icon;
  569.     PU8 temp_off_icon = m->OFF_icon;
  570. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  571. #if(UI_USE_WORD_SCROLLING_TEXT)
  572.     S32 text_width;
  573. #endif 
  574.     /*----------------------------------------------------------------*/
  575.     /* Code Body                                                      */
  576.     /*----------------------------------------------------------------*/
  577.     flags = mi->flags;
  578.     flags |= m->flags;
  579.     _text = mi->item_text;
  580.     if (flags & UI_MENUITEM_STATE_FOCUSSED)
  581.     {
  582.         GUI_current_fixed_twostate_menuitem_x = x;
  583.         GUI_current_fixed_twostate_menuitem_y = y;
  584.     }
  585.     /* Autocalculate the text position based on font   */
  586.     gui_set_font(m->text_font); /* set font */
  587.     gui_measure_string(_text, &sw, &sh);
  588.     if (flags & UI_MENUITEM_CENTER_TEXT_X)
  589.     {
  590.         m->text_x = (m->width >> 1) - (sw >> 1);
  591.     }
  592.     if (flags & UI_MENUITEM_CENTER_TEXT_Y)
  593.     {
  594.         m->text_y = (m->height >> 1) - (sh >> 1);
  595.     }
  596.     x1 = x;
  597.     y1 = y;
  598.     x2 = x1 + m->width - 1;
  599.     y2 = y1 + m->height - 1;
  600.     if (r2lMMIFlag)
  601.     {
  602.         text_x = x2 - m->text_x;    /* xt_x=m->width-2-m->text_x; */
  603.     }
  604.     else
  605.     {
  606.     #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  607.         text_x = m->text_x + TEXT_ICON_GAP; /* To display text grid gap */
  608.     #else 
  609.         text_x = m->text_x;
  610.     #endif 
  611.     }
  612.     text_y = m->text_y;
  613. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  614.     /* To hide the text and icon of the menuitem up to the last frame for flash feel effect */
  615.     if (gblock_list_effect == 0)
  616.     {
  617.         if (gui_get_current_list_effect() == MMI_UI_LIST_HIGHLIGHT_EFFECT_FLASH_FEELING &&
  618.             MMI_current_menu_type == LIST_MENU)
  619.         {
  620.             if (flash_feel_last_frame == 0)
  621.             {
  622.                 if (flags & UI_MENUITEM_STATE_FOCUSSED)
  623.                 {
  624.                     temp_on_icon = UI_NULL_IMAGE;
  625.                     temp_off_icon = UI_NULL_IMAGE;
  626.                     flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  627.                 }
  628.             }
  629.         }
  630.     }
  631. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  632.     if (flags & UI_MENUITEM_STATE_FOCUSSED)
  633.     {
  634.         text_x += m->scroll_x;
  635.     }
  636.     if ((flags & UI_MENUITEM_STATE_FOCUSSED) && !(flags & UI_MENUITEM_DISABLE_HIGHLIGHT))
  637.     {
  638.         f = m->focussed_filler;
  639.         text_color = m->focussed_text_color;
  640.         /* if(flags & UI_MENUITEM_FOCUSSED_ANIMATE) animation_flag=1; */
  641.     }
  642.     else if (flags & UI_MENUITEM_STATE_DISABLED)
  643.     {
  644.         if (!(flags & UI_MENUITEM_DISABLE_BACKGROUND))
  645.         {
  646.             f = m->disabled_filler;
  647.         }
  648.         text_color = m->focussed_text_color;
  649.     }
  650.     else if (flags & UI_MENUITEM_STATE_SELECTED)
  651.     {
  652.         if (!(flags & UI_MENUITEM_DISABLE_BACKGROUND))
  653.         {
  654.             f = m->selected_filler;
  655.         }
  656.         text_color = m->selected_text_color;
  657.         /* if(flags & UI_MENUITEM_SELECTED_ANIMATE) animation_flag=1; */
  658.     }
  659.     else
  660.     {
  661.         if (!(flags & UI_MENUITEM_DISABLE_BACKGROUND))
  662.         {
  663.             f = m->normal_filler;
  664.         }
  665.         text_color = m->normal_text_color;
  666.     }
  667.     gui_push_clip();
  668. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  669.     if (line_draw)
  670.     {
  671.         if (GUI_current_fixed_twostate_menuitem_scroll)
  672.         {
  673.             gui_set_clip(x1, y1 + 1, x2 - 1, y2);
  674.         }
  675.         else
  676.         {
  677.             gui_set_clip(x1, y1, x2, y2);
  678.         }
  679.     }
  680. #else /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  681.     gui_set_clip(x1, y1, x2 + 2, y2 + 2);
  682. #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  683.     if (f != NULL)
  684.     {
  685.   #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  686.   #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  687.         if (is_draw_next_frame_list_highlight_effect_value())
  688.     #endif
  689.         {
  690.             g_mmi_frm_cntx.dump_screen_info.hightlight_type = MMI_SCREEN_HIGHLIGHT_TWOSTATE_ITEM;
  691.         }
  692.     #endif
  693.     #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  694.         set_start_position_and_item_parameters_for_list_highlighter_effect(item, common_item_data, x1, y1);
  695.     #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  696.         if (line_draw && MMI_current_menu_type == LIST_MENU)
  697.         {
  698.             if (GUI_current_fixed_twostate_menuitem_scroll)
  699.             {
  700.                 gui_draw_list_filled_area(x1, y1 + 1, x2 - 1, y2, f);
  701.             }
  702.             else
  703.             {
  704.                 gui_draw_list_filled_area(x1, y1 + 1, x2 - 1, y2, f);
  705.             }
  706.         }
  707.     #else /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  708.         gui_draw_list_filled_area(x1, y1, x2, y2, f);
  709.     #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  710.     #else /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  711.     #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  712.         if (line_draw && MMI_current_menu_type == LIST_MENU)
  713.         {
  714.             if (GUI_current_fixed_twostate_menuitem_scroll)
  715.             {
  716.                 gui_draw_filled_area(x1, y1, x2 - 1, y2, f);
  717.             }
  718.             else
  719.             {
  720.                 gui_draw_filled_area(x1, y1, x2, y2, f);
  721.             }
  722.         }
  723.     #else /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  724.         gui_draw_filled_area(x1, y1, x2, y2, f);
  725.     #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  726.     #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  727.     }
  728.     if (flags & UI_MENUITEM_STATE_SELECTED)
  729.     {
  730.     #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  731.         /* To hide the ON icon of the menuitem up to the last frame for flash feel effect */
  732.         if (temp_on_icon != UI_NULL_IMAGE)
  733.     #else /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  734.         if (m->ON_icon != UI_NULL_IMAGE)
  735.     #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  736.         {
  737.             if (!r2lMMIFlag)
  738.             {
  739.                 gui_show_transparent_image(x1 + m->icon_x, y1 + m->icon_y, m->ON_icon, m->icon_transparent_color);
  740.             }
  741.             else
  742.             {
  743.                 gui_show_transparent_image(
  744.                     x2 - m->icon_x - m->text_x + 5,
  745.                     y1 + m->icon_y,
  746.                     m->ON_icon,
  747.                     m->icon_transparent_color);
  748.             }
  749.         }
  750.     }
  751.     else
  752.     {
  753.     #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  754.         /* To hide the ON icon of the menuitem up to the last frame for flash feel effect */
  755.         if (temp_off_icon != UI_NULL_IMAGE)
  756.     #else /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  757.         if (m->OFF_icon != UI_NULL_IMAGE)
  758.     #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  759.         {
  760.             /* show transparent image */
  761.             if (!r2lMMIFlag)
  762.             {
  763.                 gui_show_transparent_image(x1 + m->icon_x, y1 + m->icon_y, m->OFF_icon, m->icon_transparent_color);
  764.             }
  765.             else
  766.             {
  767.                 gui_show_transparent_image(
  768.                     x2 - m->icon_x - m->text_x + 5,
  769.                     y1 + m->icon_y,
  770.                     m->OFF_icon,
  771.                     m->icon_transparent_color);
  772.             }
  773.         }
  774.     }
  775.     if (!(flags & UI_MENUITEM_DISABLE_TEXT_DISPLAY))
  776.     {
  777.         gui_push_text_clip();
  778.         if (m->icon_x > m->text_x)
  779.         {
  780.             gui_set_text_clip(x1, y1, x2 - (m->width - m->icon_x), y2);
  781.         #if(UI_USE_WORD_SCROLLING_TEXT)
  782.             text_width = x2 - (m->width - m->icon_x) - x1 + 1;
  783.         #endif 
  784.         }
  785.         else
  786.         {
  787.         #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  788.             gui_set_text_clip(x1 + m->text_x, y1, x2 - 2, y2);
  789.         #else 
  790.             gui_set_text_clip(x1 + m->text_x, y1, x2, y2);
  791.         #endif 
  792.         #if(UI_USE_WORD_SCROLLING_TEXT)
  793.             text_width = x2 - (x1 + m->text_x) + 1;
  794.         #endif 
  795.         }
  796.         if (r2lMMIFlag)
  797.         {
  798.             gui_set_text_clip(x1, y1, x2 - m->text_x, y2);
  799.         }
  800.         if (r2lMMIFlag)
  801.         {
  802.             gui_move_text_cursor(text_x, y1 + text_y);
  803.         }
  804.         else
  805.         {
  806.             gui_move_text_cursor(x1 + text_x, y1 + text_y);
  807.         }
  808.         gui_set_text_color(text_color); /* set text clor */
  809.         gui_set_line_height(sh);
  810.     #if(UI_USE_WORD_SCROLLING_TEXT)
  811.         if ((flags & UI_MENUITEM_STATE_FOCUSSED) && GUI_current_fixed_twostate_menuitem_scroll)
  812.         {
  813.             GUI_current_fixed_twostate_menuitem_scroll_text_end = GUI_current_fixed_twostate_menuitem_scroll_text;
  814.             if (gui_print_truncated_text2
  815.                 (x1 + text_x, y1 + text_y, text_width, &GUI_current_fixed_twostate_menuitem_scroll_text_end))
  816.             {
  817.                 GUI_current_fixed_twostate_menuitem_scroll_text_end = _text;
  818.             }
  819.         }
  820.         else
  821.         {
  822.             gui_print_truncated_text2(x1 + text_x, y1 + text_y, text_width, &_text);
  823.         }
  824.     #else /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  825.         gui_print_text(_text);  /* print text */
  826.         if ((flags & UI_MENUITEM_STATE_FOCUSSED) && (flags & UI_MENUITEM_MARQUEE_SCROLL) &&
  827.             GUI_current_fixed_twostate_menuitem_scroll)
  828.         {
  829.             if (r2lMMIFlag)
  830.             {
  831.                 gui_move_text_cursor(x1 + text_x - (m->text_width + UI_text_menuitem_scroll_gap), y1 + text_y);
  832.             }
  833.             else
  834.             {
  835.                 gui_move_text_cursor(x1 + text_x + m->text_width + UI_text_menuitem_scroll_gap, y1 + text_y);
  836.             }
  837.             gui_set_line_height(sh);
  838.             gui_print_text(_text);  /* print text */
  839.         }
  840.     #endif /* (UI_USE_WORD_SCROLLING_TEXT) */ 
  841.         gui_pop_text_clip();
  842.     #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  843.         if (line_draw)
  844.         {
  845.             gui_reset_clip();
  846.             if (r2lMMIFlag)
  847.             {
  848.                 gui_draw_vertical_line(y1, y2, (x2 - (m->text_x) + ((TEXT_ICON_GAP) >> 1)), current_MMI_theme->list_background_filler->border_color);   /* Assume icon is square in shape add 2 for inline edit items having gap from grid */
  849.             }
  850.             else
  851.             {
  852.                 gui_draw_vertical_line(y1, y2, m->text_x - ((TEXT_ICON_GAP) >> 1), current_MMI_theme->list_background_filler->border_color);    /* vertical partion between icon and text add 2 for inline edit items having gap from grid */
  853.             }
  854.         }
  855.     #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  856.     }
  857.     gui_pop_clip();
  858. #if(UI_ENABLE_POP_UP_DESCRIPTIONS)
  859.     if ((flags & UI_MENUITEM_STATE_FOCUSSED) && !(m->ext_flags & UI_MENUITEM_EXT_SHOW_IN_MARQUEE))
  860.     {
  861.         gui_display_pop_up_description(x, y, m->width, m->height);      /* display popp description */
  862.     }
  863. #endif /* (UI_ENABLE_POP_UP_DESCRIPTIONS) */ 
  864. }
  865. #ifdef __MMI_TOUCH_SCREEN__
  866. /*****************************************************************************
  867.  * FUNCTION
  868.  *  gui_fixed_twostate_menuitem_translate_pen_event
  869.  * DESCRIPTION
  870.  *  
  871.  * PARAMETERS
  872.  *  item                    [?]         
  873.  *  common_item_data        [?]         
  874.  *  item_x                  [IN]        
  875.  *  item_y                  [IN]        
  876.  *  pen_event               [IN]        
  877.  *  x                       [IN]        
  878.  *  y                       [IN]        
  879.  *  menuitem_event          [?]         
  880.  *  menuitem_param          [?]         
  881.  * RETURNS
  882.  *  
  883.  *****************************************************************************/
  884. BOOL gui_fixed_twostate_menuitem_translate_pen_event(
  885.         void *item,
  886.         void *common_item_data,
  887.         S32 item_x,
  888.         S32 item_y,
  889.         mmi_pen_event_type_enum pen_event,
  890.         S16 x,
  891.         S16 y,
  892.         gui_list_pen_enum *menuitem_event,
  893.         gui_pen_event_param_struct *menuitem_param)
  894. {
  895.     /*----------------------------------------------------------------*/
  896.     /* Local Variables                                                */
  897.     /*----------------------------------------------------------------*/
  898.     BOOL ret = MMI_TRUE, pen_inside = MMI_FALSE;
  899.     S32 iwidth, iheight;
  900.     fixed_twostate_menuitem *m = (fixed_twostate_menuitem*) common_item_data;
  901.     /*----------------------------------------------------------------*/
  902.     /* Code Body                                                      */
  903.     /*----------------------------------------------------------------*/
  904.     UI_UNUSED_PARAMETER(item);
  905.     *menuitem_event = GUI_LIST_PEN_NONE;
  906.     GUI_PEN_EVENT_PARAM_SET_VOID(menuitem_param);
  907.     if (m->OFF_icon != UI_NULL_IMAGE)
  908.     {
  909.         gui_measure_image(m->OFF_icon, &iwidth, &iheight);
  910.     }
  911.     else
  912.     {
  913.         iwidth = iheight = 0;
  914.     }
  915.     item_x += m->icon_x;
  916.     item_y += m->icon_y;
  917.     if (PEN_CHECK_BOUND(x, y, item_x, item_y, iwidth, iheight))
  918.     {
  919.         pen_inside = MMI_TRUE;
  920.     }
  921.     if (pen_event == MMI_PEN_EVENT_DOWN)
  922.     {
  923.         if (!pen_inside)
  924.         {
  925.             /* The following pen events will not be directed to twostate menuitem */
  926.             ret = MMI_FALSE;
  927.         }
  928.     }
  929.     else if (pen_event == MMI_PEN_EVENT_UP)
  930.     {
  931.         if (pen_inside)
  932.         {
  933.             /* Outside of the image, it is not controlled by menuitem */
  934.             *menuitem_event = GUI_TWOSTATE_PEN_TOGGLE;
  935.         }
  936.     }
  937.     return ret;
  938. }
  939. #endif /* __MMI_TOUCH_SCREEN__ */ 
  940. /*****************************************************************************
  941.  * FUNCTION
  942.  *  gui_measure_fixed_twostate_menuitem
  943.  * DESCRIPTION
  944.  *  Measures a fixed twostate menuitem
  945.  * PARAMETERS
  946.  *  item                    [?]         
  947.  *  common_item_data        [IN]        Is the fixed twostate menuitem object (common_data)
  948.  *  width                   [OUT]       
  949.  *  height                  [OUT]       
  950.  * RETURNS
  951.  *  void
  952.  *****************************************************************************/
  953. void gui_measure_fixed_twostate_menuitem(void *item, void *common_item_data, S32 *width, S32 *height)
  954. {
  955.     /*----------------------------------------------------------------*/
  956.     /* Local Variables                                                */
  957.     /*----------------------------------------------------------------*/
  958.     fixed_twostate_menuitem *t = (fixed_twostate_menuitem*) common_item_data;
  959.     /*----------------------------------------------------------------*/
  960.     /* Code Body                                                      */
  961.     /*----------------------------------------------------------------*/
  962.     UI_UNUSED_PARAMETER(item);
  963.     *width = t->width;
  964.     *height = t->height;
  965. }
  966. /*****************************************************************************
  967.  * FUNCTION
  968.  *  gui_highlight_fixed_twostate_menuitem
  969.  * DESCRIPTION
  970.  *  Highlights a fixed twostate menuitem (not visually)
  971.  * PARAMETERS
  972.  *  item                    [IN]        Is a specific fixed twostate menuitem object
  973.  *  common_item_data        [IN]        
  974.  * RETURNS
  975.  *  void
  976.  *****************************************************************************/
  977. void gui_highlight_fixed_twostate_menuitem(void *item, void *common_item_data)
  978. {
  979.     /*----------------------------------------------------------------*/
  980.     /* Local Variables                                                */
  981.     /*----------------------------------------------------------------*/
  982.     fixed_twostate_menuitem_type *t = (fixed_twostate_menuitem_type*) item;
  983.     fixed_twostate_menuitem *m = (fixed_twostate_menuitem*) common_item_data;
  984.     U32 flags;
  985.     /*----------------------------------------------------------------*/
  986.     /* Code Body                                                      */
  987.     /*----------------------------------------------------------------*/
  988.     flags = m->flags;
  989.     flags |= t->flags;
  990.     GUI_current_fixed_twostate_menuitem_common_data = m;
  991.     GUI_current_fixed_twostate_menuitem_data = t;
  992.     gui_fixed_twostate_menuitem_stop_scroll();
  993.     gui_fixed_twostate_menuitem_start_scroll();
  994.     if (t->flags & UI_MENUITEM_DISABLE_HIGHLIGHT)
  995.     {
  996.         return;
  997.     }
  998.     t->flags |= UI_MENUITEM_STATE_FOCUSSED;
  999. }
  1000. /*****************************************************************************
  1001.  * FUNCTION
  1002.  *  gui_remove_highlight_fixed_twostate_menuitem
  1003.  * DESCRIPTION
  1004.  *  Removes the highlight of a fixed twostate menuitem (not visually)
  1005.  * PARAMETERS
  1006.  *  item                    [IN]        Is a specific fixed twostate menuitem object
  1007.  *  common_item_data        [IN]        
  1008.  * RETURNS
  1009.  *  void
  1010.  *****************************************************************************/
  1011. void gui_remove_highlight_fixed_twostate_menuitem(void *item, void *common_item_data)
  1012. {
  1013.     /*----------------------------------------------------------------*/
  1014.     /* Local Variables                                                */
  1015.     /*----------------------------------------------------------------*/
  1016.     fixed_twostate_menuitem_type *t = (fixed_twostate_menuitem_type*) item;
  1017.     /*----------------------------------------------------------------*/
  1018.     /* Code Body                                                      */
  1019.     /*----------------------------------------------------------------*/
  1020.     UI_UNUSED_PARAMETER(common_item_data);
  1021.     t->flags &= ~UI_MENUITEM_STATE_FOCUSSED;
  1022. }
  1023. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1024. #define LIST_EFFECT_TYPE__(A) MMI_UI_LIST_HIGHLIGHT_EFFECT_##A
  1025. #define LIST_EFFECT_TYPE_(A)  LIST_EFFECT_TYPE__(A)
  1026. #define LIST_EFFECT_TYPE(A)      LIST_EFFECT_TYPE_(A)
  1027. /* 122205 MMI_features.h revise Start */
  1028. static gui_list_effect_styles goriginal_list_effect = LIST_EFFECT_TYPE_(UI_LIST_EFFECT_TYPE);
  1029. static gui_list_effect_styles current_list_effect = LIST_EFFECT_TYPE_(UI_LIST_EFFECT_TYPE);
  1030. static gui_list_effect_styles backup_current_list_effect = LIST_EFFECT_TYPE_(UI_LIST_EFFECT_TYPE);
  1031. /* 122205 MMI_features.h revise End */
  1032. static void *ghighlight_item;
  1033. static void *ghighlight_common_item_data;
  1034. static S32 xstart_effect, ystart_effect, xend_effect, yend_effect;
  1035. static S32 gstartX1, gstartY1;
  1036. static UI_filled_area backup_filler;
  1037. static S32 list_highlight_effect_current_frame = 0;
  1038. static is_draw_next_frame_list_highlight_effect = 0;
  1039. extern fixed_list_menu MMI_fixed_list_menu;
  1040. void (*gui_call_menuitem_scroll) (void);
  1041. /*****************************************************************************
  1042.  * FUNCTION
  1043.  *  gui_draw_list_highlight_effect_last_frame
  1044.  * DESCRIPTION
  1045.  *  Display the last frame of list highlight effect.
  1046.  * PARAMETERS
  1047.  *  void
  1048.  *  S32(?)      [IN]        X1,S32 y1,S32 x2,S32 y2,UI_filled_area *f
  1049.  * RETURNS
  1050.  *  void
  1051.  *****************************************************************************/
  1052. void gui_draw_list_highlight_effect_last_frame(void)
  1053. {
  1054.     /*----------------------------------------------------------------*/
  1055.     /* Local Variables                                                */
  1056.     /*----------------------------------------------------------------*/
  1057.     /*----------------------------------------------------------------*/
  1058.     /* Code Body                                                      */
  1059.     /*----------------------------------------------------------------*/
  1060.     if (!ghighlight_item || !ghighlight_common_item_data)
  1061.     {
  1062.         MMI_DBG_ASSERT(0);
  1063.         return;
  1064.     }
  1065.     gui_lock_double_buffer();
  1066.     MMI_fixed_list_menu.item_display_function(ghighlight_item, ghighlight_common_item_data, gstartX1, gstartY1);
  1067.     gui_unlock_double_buffer();
  1068.     gui_BLT_double_buffer(xstart_effect, ystart_effect, xend_effect, yend_effect);
  1069. }
  1070. /*****************************************************************************
  1071.  * FUNCTION
  1072.  *  gui_draw_animated_highlight_filler
  1073.  * DESCRIPTION
  1074.  *  Draw the animated highlighter filler
  1075.  * PARAMETERS
  1076.  *  x1      [IN]        
  1077.  *  y1      [IN]        
  1078.  *  x2      [IN]        
  1079.  *  y2      [IN]        
  1080.  *  f       [IN]        
  1081.  * RETURNS
  1082.  *  void
  1083.  *****************************************************************************/
  1084. void gui_draw_animated_highlight_filler(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f)
  1085. {
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Local Variables                                                */
  1088.     /*----------------------------------------------------------------*/
  1089.     S32 Max_frames;
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Code Body                                                      */
  1092.     /*----------------------------------------------------------------*/
  1093.     xstart_effect = x1;
  1094.     ystart_effect = y1;
  1095.     xend_effect = x2;
  1096.     yend_effect = y2;
  1097.     Max_frames = gui_image_n_frames(get_image(IMG_LIST_HIGHLIGHTER));   /* Read the no of frames in the gif image. */
  1098.     if (list_highlight_effect_current_frame == Max_frames)
  1099.     {
  1100.         gui_push_clip();
  1101.         gui_set_clip(x1, y1, x2, y2);
  1102.         gdi_image_draw_animation_single_frame(x1, y1, get_image(IMG_LIST_HIGHLIGHTER), 0);
  1103.         list_highlight_effect_current_frame++;
  1104.         gui_pop_clip();
  1105.         /* To call filler for last time. */
  1106.         gui_draw_list_highlight_effect_last_frame();
  1107.         list_highlight_effect_current_frame = 0;
  1108.         gui_scroll_start_handler_for_list_effects();
  1109.         return;
  1110.     }
  1111.     else if (list_highlight_effect_current_frame < Max_frames)
  1112.     {
  1113.         gui_push_clip();
  1114.         gui_set_clip(x1, y1, x2, y2);
  1115.         gui_show_animated_image_frame(x1, y1, get_image(IMG_LIST_HIGHLIGHTER), (S16) list_highlight_effect_current_frame);      /* Show frame by frame no. */
  1116.         list_highlight_effect_current_frame++;  /* Treat list_highlight_effect_current_frame as frame no. */
  1117.         gui_pop_clip();
  1118.         /* To call filler repeatedly */
  1119.         gui_start_timer(LIST_ANIMATION_HIGHLIGHTER_TIMER, gui_callback_highlighter_text_filler);
  1120.     }
  1121. }
  1122. /*****************************************************************************
  1123.  * FUNCTION
  1124.  *  gui_draw_transparent_color_filler
  1125.  * DESCRIPTION
  1126.  *  Draw the transparent highlighter filler with increasing opacity
  1127.  * PARAMETERS
  1128.  *  x1      [IN]        
  1129.  *  y1      [IN]        
  1130.  *  x2      [IN]        
  1131.  *  y2      [IN]        
  1132.  *  f       [IN]        
  1133.  * RETURNS
  1134.  *  void
  1135.  *****************************************************************************/
  1136. void gui_draw_transparent_color_filler(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f)
  1137. {
  1138.     /*----------------------------------------------------------------*/
  1139.     /* Local Variables                                                */
  1140.     /*----------------------------------------------------------------*/
  1141.     /*----------------------------------------------------------------*/
  1142.     /* Code Body                                                      */
  1143.     /*----------------------------------------------------------------*/
  1144.     xstart_effect = x1;
  1145.     ystart_effect = y1;
  1146.     xend_effect = x2;
  1147.     yend_effect = y2;
  1148.     if (list_highlight_effect_current_frame + TRANSPARENCY_START_OPACITY_VALUE == 0)
  1149.     {
  1150.         /* Last alpha value is reached. nothing more to do. */
  1151.         list_highlight_effect_current_frame = 0;
  1152.         gui_scroll_start_handler_for_list_effects();
  1153.         return;
  1154.     }
  1155.     else
  1156.     {
  1157.         if ((list_highlight_effect_current_frame + TRANSPARENCY_START_OPACITY_VALUE) > MAX_OPACITY_VALUE_FACTOR)        /* For start Transparency from some values greater then 0. */
  1158.         {
  1159.             gui_push_clip();
  1160.             gui_set_clip(x1, y1, x2, y2);
  1161.             backup_filler = *f;
  1162.             /* To disable Transparent effect flag for flash feeling */
  1163.             if (backup_filler.flags & UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR && (wgui_is_wallpaper_on_bottom() == MMI_FALSE))    /* 072505 Calvin modified */
  1164.             {
  1165.                 backup_filler.flags &= ~UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  1166.             }
  1167.             gui_draw_filled_area(x1, y1, x2, y2, &backup_filler);
  1168.             list_highlight_effect_current_frame = -TRANSPARENCY_START_OPACITY_VALUE;
  1169.             gui_pop_clip();
  1170.             /* To call filler repeatedly */
  1171.             gui_start_timer(LIST_TRANSPARENT_HIGHLIGHTER_TIMER, gui_callback_highlighter_text_filler);
  1172.         }
  1173.         else
  1174.         {
  1175.             gui_push_clip();
  1176.             gui_set_clip(x1, y1, x2, y2);
  1177.             backup_filler = *f;
  1178.         #if 0
  1179. /* under construction !*/
  1180. /* under construction !*/
  1181.         #else /* 0 */ 
  1182.             backup_filler.flags |= UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  1183.             backup_filler.c.alpha =
  1184.                 (list_highlight_effect_current_frame + TRANSPARENCY_START_OPACITY_VALUE) * MAX_OPACITY_VALUE_FACTOR;
  1185.         #endif /* 0 */ 
  1186.             gui_draw_filled_area(x1, y1, x2, y2, &backup_filler);
  1187.             list_highlight_effect_current_frame += JUMP_IN_HIGHLIGHTERS_EFFECTS_FRAME;
  1188.             gui_pop_clip();
  1189.             /* To call filler repeatedly */
  1190.             gui_start_timer(LIST_TRANSPARENT_HIGHLIGHTER_TIMER, gui_callback_highlighter_text_filler);
  1191.         }
  1192.     }
  1193. }
  1194. /*****************************************************************************
  1195.  * FUNCTION
  1196.  *  gui_draw_flash_feeling_filler
  1197.  * DESCRIPTION
  1198.  *  Draw the flash feeling highlighter filler with increasing width
  1199.  * PARAMETERS
  1200.  *  x1      [IN]        
  1201.  *  y1      [IN]        
  1202.  *  x2      [IN]        
  1203.  *  y2      [IN]        
  1204.  *  f       [IN]        
  1205.  * RETURNS
  1206.  *  void
  1207.  *****************************************************************************/
  1208. void gui_draw_flash_feeling_filler(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f)
  1209. {
  1210.     /*----------------------------------------------------------------*/
  1211.     /* Local Variables                                                */
  1212.     /*----------------------------------------------------------------*/
  1213.     S32 f_count;    /* f_count is the gap of texts upper and below positions from the top and bottom of the highlighter and uses as the no of frames */
  1214.     /*----------------------------------------------------------------*/
  1215.     /* Code Body                                                      */
  1216.     /*----------------------------------------------------------------*/
  1217.     f_count = get_menu_item_height() >> 1;
  1218.     if (list_highlight_effect_current_frame > f_count)
  1219.     {
  1220.         list_highlight_effect_current_frame = 0;
  1221.         flash_feel_last_frame = 0;
  1222.         gui_scroll_start_handler_for_list_effects();
  1223.     }
  1224.     else if (list_highlight_effect_current_frame == f_count)
  1225.     {
  1226.         /* To achieve the original hilighter height */
  1227.         xstart_effect = x1;
  1228.         ystart_effect = y1;
  1229.         xend_effect = x2;
  1230.         yend_effect = y2;
  1231.         backup_filler = *f;
  1232.         /* To disable Transparent effect flag for flash feeling */
  1233.         if (backup_filler.flags & UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR && (wgui_is_wallpaper_on_bottom() == MMI_FALSE))        /* 072505 Calvin modified */
  1234.         {
  1235.             backup_filler.flags &= ~UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  1236.         }
  1237.         gui_draw_filled_area(x1, y1, x2, y2, &backup_filler);
  1238.         list_highlight_effect_current_frame++;
  1239.         flash_feel_last_frame = 1;
  1240.         gui_start_timer(LIST_FLASH_HIGHLIGHTER_TIMER, gui_callback_highlighter_text_filler);
  1241.     }
  1242.     else
  1243.     {
  1244.         xstart_effect = x1;
  1245.         ystart_effect = y1 + f_count - list_highlight_effect_current_frame;
  1246.         xend_effect = x2;
  1247.         yend_effect = y2 - f_count + list_highlight_effect_current_frame;
  1248.         gui_push_clip();
  1249.         gui_set_clip(x1, ystart_effect, x2, yend_effect);
  1250.         backup_filler = *f;
  1251.         /* To disable Transparent effect flag for flash feeling */
  1252.         if (backup_filler.flags & UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR)
  1253.         {
  1254.             backup_filler.flags &= ~UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  1255.         }
  1256.         gui_draw_filled_area(x1, y1, x2, y2, &backup_filler);
  1257.         gui_pop_clip();
  1258.         list_highlight_effect_current_frame += JUMP_IN_HIGHLIGHTERS_EFFECTS_FRAME;
  1259.         if ((list_highlight_effect_current_frame) >= f_count)
  1260.         {
  1261.             list_highlight_effect_current_frame = f_count;  /* To handle counter if jump more then 1 in list_highlight_effect_current_frame */
  1262.         }
  1263.         /* To call filler repeatedly */
  1264.         gui_start_timer(LIST_FLASH_HIGHLIGHTER_TIMER, gui_callback_highlighter_text_filler);
  1265.     }
  1266. }
  1267. /*****************************************************************************
  1268.  * FUNCTION
  1269.  *  gui_get_current_list_effect
  1270.  * DESCRIPTION
  1271.  *  Return the current list effect
  1272.  * PARAMETERS
  1273.  *  void
  1274.  * RETURNS
  1275.  *  S32
  1276.  *****************************************************************************/
  1277. S32 gui_get_current_list_effect(void)
  1278. {
  1279.     /*----------------------------------------------------------------*/
  1280.     /* Local Variables                                                */
  1281.     /*----------------------------------------------------------------*/
  1282.     /*----------------------------------------------------------------*/
  1283.     /* Code Body                                                      */
  1284.     /*----------------------------------------------------------------*/
  1285.     return current_list_effect;
  1286. }
  1287. /*****************************************************************************
  1288.  * FUNCTION
  1289.  *  gui_set_current_list_effect
  1290.  * DESCRIPTION
  1291.  *  Set the current list effect to filler recieved by function as argument
  1292.  * PARAMETERS
  1293.  *  list_style                      [IN]        
  1294.  *  wgui_list_effect_styles(?)      [IN]        Effect type
  1295.  * RETURNS
  1296.  *  void
  1297.  *****************************************************************************/
  1298. void gui_set_current_list_effect(gui_list_effect_styles list_style)
  1299. {
  1300.     /*----------------------------------------------------------------*/
  1301.     /* Local Variables                                                */
  1302.     /*----------------------------------------------------------------*/
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Code Body                                                      */
  1305.     /*----------------------------------------------------------------*/
  1306.     current_list_effect = list_style;
  1307.     backup_current_list_effect = current_list_effect;
  1308. }
  1309. /*****************************************************************************
  1310.  * FUNCTION
  1311.  *  gui_reset_current_list_effect
  1312.  * DESCRIPTION
  1313.  *  Reset the current list effect to normal filler for some cases
  1314.  * PARAMETERS
  1315.  *  void
  1316.  * RETURNS
  1317.  *  void
  1318.  *****************************************************************************/
  1319. void gui_reset_current_list_effect(void)
  1320. {
  1321.     /*----------------------------------------------------------------*/
  1322.     /* Local Variables                                                */
  1323.     /*----------------------------------------------------------------*/
  1324.     /*----------------------------------------------------------------*/
  1325.     /* Code Body                                                      */
  1326.     /*----------------------------------------------------------------*/
  1327.     if (current_list_effect != MMI_UI_LIST_HIGHLIGHT_EFFECT_NONE)
  1328.     {
  1329.         backup_current_list_effect = current_list_effect;
  1330.     }
  1331.     current_list_effect = MMI_UI_LIST_HIGHLIGHT_EFFECT_NONE;
  1332. }
  1333. /*****************************************************************************
  1334.  * FUNCTION
  1335.  *  gui_set_current_list_effect_to_default
  1336.  * DESCRIPTION
  1337.  *  Set the current list effect to defult or the selected filler
  1338.  * PARAMETERS
  1339.  *  void
  1340.  * RETURNS
  1341.  *  void
  1342.  *****************************************************************************/
  1343. void gui_set_current_list_effect_to_default(void)
  1344. {
  1345.     /*----------------------------------------------------------------*/
  1346.     /* Local Variables                                                */
  1347.     /*----------------------------------------------------------------*/
  1348.     /*----------------------------------------------------------------*/
  1349.     /* Code Body                                                      */
  1350.     /*----------------------------------------------------------------*/
  1351.     current_list_effect = goriginal_list_effect;
  1352.     backup_current_list_effect = goriginal_list_effect; /* restore as current list effect is also set to default */
  1353. }
  1354. /*****************************************************************************
  1355.  * FUNCTION
  1356.  *  gui_restore_current_list_effect
  1357.  * DESCRIPTION
  1358.  *  Restore the current list effect from the backup_current_list_effect
  1359.  * PARAMETERS
  1360.  *  void
  1361.  * RETURNS
  1362.  *  void
  1363.  *****************************************************************************/
  1364. void gui_restore_current_list_effect(void)
  1365. {
  1366.     /*----------------------------------------------------------------*/
  1367.     /* Local Variables                                                */
  1368.     /*----------------------------------------------------------------*/
  1369.     /*----------------------------------------------------------------*/
  1370.     /* Code Body                                                      */
  1371.     /*----------------------------------------------------------------*/
  1372.     current_list_effect = backup_current_list_effect;
  1373. }
  1374. /*****************************************************************************
  1375.  * FUNCTION
  1376.  *  gui_block_list_effect
  1377.  * DESCRIPTION
  1378.  *  set the list effect Block flag off
  1379.  * PARAMETERS
  1380.  *  void
  1381.  * RETURNS
  1382.  *  void
  1383.  *****************************************************************************/
  1384. void gui_block_list_effect(void)
  1385. {
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Local Variables                                                */
  1388.     /*----------------------------------------------------------------*/
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Code Body                                                      */
  1391.     /*----------------------------------------------------------------*/
  1392.     gblock_list_effect = 1;
  1393.     gui_reset_current_list_effect();
  1394. }
  1395. /*****************************************************************************
  1396.  * FUNCTION
  1397.  *  gui_unblock_list_effect
  1398.  * DESCRIPTION
  1399.  *  set the list effect Block flag on
  1400.  * PARAMETERS
  1401.  *  void
  1402.  * RETURNS
  1403.  *  void
  1404.  *****************************************************************************/
  1405. void gui_unblock_list_effect(void)
  1406. {
  1407.     /*----------------------------------------------------------------*/
  1408.     /* Local Variables                                                */
  1409.     /*----------------------------------------------------------------*/
  1410.     /*----------------------------------------------------------------*/
  1411.     /* Code Body                                                      */
  1412.     /*----------------------------------------------------------------*/
  1413.     gblock_list_effect = 0;
  1414.     gui_restore_current_list_effect();
  1415. }
  1416. /*****************************************************************************
  1417.  * FUNCTION
  1418.  *  gui_draw_list_filled_area
  1419.  * DESCRIPTION
  1420.  *  This function decide the effect to be called according to current list effect flag
  1421.  * PARAMETERS
  1422.  *  x1      [IN]        
  1423.  *  y1      [IN]        
  1424.  *  x2      [IN]        
  1425.  *  y2      [IN]        
  1426.  *  f       [IN]        
  1427.  * RETURNS
  1428.  *  void
  1429.  *****************************************************************************/
  1430. void gui_draw_list_filled_area(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f)
  1431. {
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Local Variables                                                */
  1434.     /*----------------------------------------------------------------*/
  1435.     /*----------------------------------------------------------------*/
  1436.     /* Code Body                                                      */
  1437.     /*----------------------------------------------------------------*/
  1438.     if (gblock_list_effect == 1)
  1439.     {
  1440.         gui_reset_current_list_effect();    /* This is to block the effects in case of inline edit screens. */
  1441.     }
  1442.     switch (current_list_effect)
  1443.     {
  1444.         case MMI_UI_LIST_HIGHLIGHT_EFFECT_NONE:
  1445. {
  1446.             /* Disable transparent effect if we do not have screen background layer. */
  1447.             UI_filled_area tf = *f;
  1448.         if (!gui_is_current_transparency_with_multi_layer())
  1449.         {
  1450.                 tf.flags &= ~UI_FILLED_AREA_TYPE_TRANSPARENT_COLOR;
  1451.             }
  1452.             gui_draw_filled_area(x1, y1, x2, y2, &tf);
  1453.             break;
  1454. }
  1455.         case MMI_UI_LIST_HIGHLIGHT_EFFECT_TRANSPARENCY:
  1456.             /* For increasing opacity highlighter */
  1457.             gui_draw_transparent_color_filler(x1, y1, x2, y2, f);
  1458.             break;
  1459.         case MMI_UI_LIST_HIGHLIGHT_EFFECT_FLASH_FEELING:
  1460.             /* For flash type of highlighter */
  1461.             gui_draw_flash_feeling_filler(x1, y1, x2, y2, f);
  1462.             break;
  1463.         case MMI_UI_LIST_HIGHLIGHT_EFFECT_ANIMATION:
  1464.             /* For showing any animation as a gif file in place of highlighter */
  1465.             gui_draw_animated_highlight_filler(x1, y1, x2, y2, f);
  1466.             break;
  1467.     }
  1468. }
  1469. /*****************************************************************************
  1470.  * FUNCTION
  1471.  *  gui_callback_highlighter_text_filler
  1472.  * DESCRIPTION
  1473.  *  Display the all other things on highlighter then filler.
  1474.  * PARAMETERS
  1475.  *  void
  1476.  *  S32(?)      [IN]        X1,S32 y1,S32 x2,S32 y2,UI_filled_area *f
  1477.  * RETURNS
  1478.  *  void
  1479.  *****************************************************************************/
  1480. void gui_callback_highlighter_text_filler(void)
  1481. {
  1482.     /*----------------------------------------------------------------*/
  1483.     /* Local Variables                                                */
  1484.     /*----------------------------------------------------------------*/
  1485.     GDI_HANDLE lcd;
  1486.     /*----------------------------------------------------------------*/
  1487.     /* Code Body                                                      */
  1488.     /*----------------------------------------------------------------*/
  1489.     if (!ghighlight_item || !ghighlight_common_item_data)
  1490.     {
  1491.         MMI_DBG_ASSERT(0);
  1492.         return;
  1493.     }
  1494.     gdi_lcd_get_active(&lcd);
  1495.     gdi_lcd_set_active(MMI_fixed_list_menu.act_lcd_handle);
  1496.     gui_lock_double_buffer();
  1497.     is_draw_next_frame_list_highlight_effect = 1;
  1498.     gdi_layer_push_and_set_active(MMI_fixed_list_menu.act_layer_handle);
  1499.     MMI_fixed_list_menu.item_display_function(ghighlight_item, ghighlight_common_item_data, gstartX1, gstartY1);
  1500.     gdi_layer_pop_and_restore_active();
  1501.     is_draw_next_frame_list_highlight_effect = 0;
  1502.     gui_unlock_double_buffer();
  1503.     gui_BLT_double_buffer(xstart_effect, ystart_effect, xend_effect, yend_effect);
  1504.     gdi_lcd_set_active(lcd);
  1505. }
  1506. /*****************************************************************************
  1507.  * FUNCTION
  1508.  *  gui_stop_list_highlight_effect
  1509.  * DESCRIPTION
  1510.  *  Close the timer associated with highlighter filler.
  1511.  * PARAMETERS
  1512.  *  void
  1513.  * RETURNS
  1514.  *  void
  1515.  *****************************************************************************/
  1516. void gui_stop_list_highlight_effect(void)
  1517. {
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Local Variables                                                */
  1520.     /*----------------------------------------------------------------*/
  1521.     /*----------------------------------------------------------------*/
  1522.     /* Code Body                                                      */
  1523.     /*----------------------------------------------------------------*/
  1524.     flash_feel_last_frame = 0;
  1525.     list_highlight_effect_current_frame = 0;
  1526.     gui_cancel_timer(gui_callback_highlighter_text_filler);
  1527. }
  1528. /*****************************************************************************
  1529.  * FUNCTION
  1530.  *  gui_register_callback_menuitem_scroll
  1531.  * DESCRIPTION
  1532.  *  Set the associated scroll handler
  1533.  * PARAMETERS
  1534.  *  f       [IN]        )(void)
  1535.  * RETURNS
  1536.  *  void
  1537.  *****************************************************************************/
  1538. void gui_register_callback_menuitem_scroll(void (*f) (void))
  1539. {
  1540.     /*----------------------------------------------------------------*/
  1541.     /* Local Variables                                                */
  1542.     /*----------------------------------------------------------------*/
  1543.     /*----------------------------------------------------------------*/
  1544.     /* Code Body                                                      */
  1545.     /*----------------------------------------------------------------*/
  1546.     gui_call_menuitem_scroll = f;   /* set the  call function */
  1547. }
  1548. /*****************************************************************************
  1549.  * FUNCTION
  1550.  *  gui_scroll_start_handler_for_list_effects
  1551.  * DESCRIPTION
  1552.  *  Set the associated scroll handler
  1553.  * PARAMETERS
  1554.  *  void
  1555.  * RETURNS
  1556.  *  void
  1557.  *****************************************************************************/
  1558. void gui_scroll_start_handler_for_list_effects(void)
  1559. {
  1560.     /*----------------------------------------------------------------*/
  1561.     /* Local Variables                                                */
  1562.     /*----------------------------------------------------------------*/
  1563.     /*----------------------------------------------------------------*/
  1564.     /* Code Body                                                      */
  1565.     /*----------------------------------------------------------------*/
  1566.     if (gui_call_menuitem_scroll)
  1567.     {
  1568.         gui_call_menuitem_scroll(); /* call the corresponding scroll handler */
  1569.     }
  1570. }
  1571. /*****************************************************************************
  1572.  * FUNCTION
  1573.  *  gui_dummy_scroll_handler_for_list_effects
  1574.  * DESCRIPTION
  1575.  *  
  1576.  * PARAMETERS
  1577.  *  void
  1578.  * RETURNS
  1579.  *  void
  1580.  *****************************************************************************/
  1581. void gui_dummy_scroll_handler_for_list_effects(void)
  1582. {
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Local Variables                                                */
  1585.     /*----------------------------------------------------------------*/
  1586.     /*----------------------------------------------------------------*/
  1587.     /* Code Body                                                      */
  1588.     /*----------------------------------------------------------------*/
  1589.     /* For the cases where text size is not suitable for scroll */
  1590. }
  1591. /*****************************************************************************
  1592.  * FUNCTION
  1593.  *  is_draw_next_frame_list_highlight_effect_value
  1594.  * DESCRIPTION
  1595.  *  Return the is_draw_next_frame_list_highlight_effect value
  1596.  * PARAMETERS
  1597.  *  void
  1598.  * RETURNS
  1599.  *  S32 is_draw_next_frame_list_highlight_effect
  1600.  *****************************************************************************/
  1601. S32 is_draw_next_frame_list_highlight_effect_value(void)
  1602. {
  1603.     /*----------------------------------------------------------------*/
  1604.     /* Local Variables                                                */
  1605.     /*----------------------------------------------------------------*/
  1606.     /*----------------------------------------------------------------*/
  1607.     /* Code Body                                                      */
  1608.     /*----------------------------------------------------------------*/
  1609.     return is_draw_next_frame_list_highlight_effect;
  1610. }
  1611. /*****************************************************************************
  1612.  * FUNCTION
  1613.  *  set_start_position_and_item_parameters_for_list_highlighter_effect
  1614.  * DESCRIPTION
  1615.  *  Set the gstartX1 and gstartY1
  1616.  * PARAMETERS
  1617.  *  item                    [?]         
  1618.  *  common_item_data        [?]         
  1619.  *  x                       [IN]        S32 y
  1620.  *  y                       [IN]        
  1621.  * RETURNS
  1622.  *  S32 is_draw_next_frame_list_highlight_effect(?)
  1623.  *****************************************************************************/
  1624. void set_start_position_and_item_parameters_for_list_highlighter_effect(
  1625.         void *item,
  1626.         void *common_item_data,
  1627.         S32 x,
  1628.         S32 y)
  1629. {
  1630.     /*----------------------------------------------------------------*/
  1631.     /* Local Variables                                                */
  1632.     /*----------------------------------------------------------------*/
  1633.     /*----------------------------------------------------------------*/
  1634.     /* Code Body                                                      */
  1635.     /*----------------------------------------------------------------*/
  1636.     ghighlight_item = item;
  1637.     ghighlight_common_item_data = common_item_data;
  1638.     gstartX1 = x;
  1639.     gstartY1 = y;
  1640. }
  1641. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
  1642. #if (defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ || defined __MMI_UI_HINTS_IN_MENUITEM__)
  1643. /*****************************************************************************
  1644.  * FUNCTION
  1645.  *  UI_dummy_set_current_two_line_menuitem_data
  1646.  * DESCRIPTION
  1647.  *  dummy function to set two line menuitem data
  1648.  * PARAMETERS
  1649.  *  void
  1650.  * RETURNS
  1651.  *  string to be displayed(?)
  1652.  *****************************************************************************/
  1653. void UI_dummy_set_current_two_line_menuitem_data(void)
  1654. {
  1655.     /*----------------------------------------------------------------*/
  1656.     /* Local Variables                                                */
  1657.     /*----------------------------------------------------------------*/
  1658.     /*----------------------------------------------------------------*/
  1659.     /* Code Body                                                      */
  1660.     /*----------------------------------------------------------------*/
  1661.     return;
  1662. }
  1663. /*****************************************************************************
  1664.  * FUNCTION
  1665.  *  UI_dummy_reset_current_two_line_menuitem_data
  1666.  * DESCRIPTION
  1667.  *  dummy function to reset two line menuitem data
  1668.  * PARAMETERS
  1669.  *  void
  1670.  * RETURNS
  1671.  *  string to be displayed(?)
  1672.  *****************************************************************************/
  1673. void UI_dummy_reset_current_two_line_menuitem_data(void)
  1674. {
  1675.     /*----------------------------------------------------------------*/
  1676.     /* Local Variables                                                */
  1677.     /*----------------------------------------------------------------*/
  1678.     /*----------------------------------------------------------------*/
  1679.     /* Code Body                                                      */
  1680.     /*----------------------------------------------------------------*/
  1681.     return;
  1682. }
  1683. #endif /* (defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ || defined __MMI_UI_HINTS_IN_MENUITEM__) */ 
  1684. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1685. /*****************************************************************************
  1686.  * FUNCTION
  1687.  *  UI_dummy_show_two_line_menuitem_part
  1688.  * DESCRIPTION
  1689.  *  dummy function to show two line menuitem part
  1690.  * PARAMETERS
  1691.  *  void
  1692.  * RETURNS
  1693.  *  string to be displayed(?)
  1694.  *****************************************************************************/
  1695. void UI_dummy_show_two_line_menuitem_part(void)
  1696. {
  1697.     /*----------------------------------------------------------------*/
  1698.     /* Local Variables                                                */
  1699.     /*----------------------------------------------------------------*/
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Code Body                                                      */
  1702.     /*----------------------------------------------------------------*/
  1703.     return;
  1704. }
  1705. /*****************************************************************************
  1706.  * FUNCTION
  1707.  *  UI_dummy_move_two_line_menuitem_part
  1708.  * DESCRIPTION
  1709.  *  dummy function to move two line menuitem part
  1710.  * PARAMETERS
  1711.  *  x       [IN]        
  1712.  *  y       [IN]        
  1713.  * RETURNS
  1714.  *  string to be displayed(?)
  1715.  *****************************************************************************/
  1716. void UI_dummy_move_two_line_menuitem_part(S32 x, S32 y)
  1717. {
  1718.     /*----------------------------------------------------------------*/
  1719.     /* Local Variables                                                */
  1720.     /*----------------------------------------------------------------*/
  1721.     /*----------------------------------------------------------------*/
  1722.     /* Code Body                                                      */
  1723.     /*----------------------------------------------------------------*/
  1724.     return;
  1725. }
  1726. /*****************************************************************************
  1727.  * FUNCTION
  1728.  *  UI_dummy_resize_two_line_menuitem_part
  1729.  * DESCRIPTION
  1730.  *  dummy function to resize two line menuitem part
  1731.  * PARAMETERS
  1732.  *  x       [IN]        
  1733.  *  y       [IN]        
  1734.  * RETURNS
  1735.  *  string to be displayed(?)
  1736.  *****************************************************************************/
  1737. void UI_dummy_resize_two_line_menuitem_part(S32 x, S32 y)
  1738. {
  1739.     /*----------------------------------------------------------------*/
  1740.     /* Local Variables                                                */
  1741.     /*----------------------------------------------------------------*/
  1742.     /*----------------------------------------------------------------*/
  1743.     /* Code Body                                                      */
  1744.     /*----------------------------------------------------------------*/
  1745.     return;
  1746. }
  1747. /*****************************************************************************
  1748.  * FUNCTION
  1749.  *  UI_dummy_get_two_line_menuitem_height
  1750.  * DESCRIPTION
  1751.  *  dummy function to whether the current menuitem is two line
  1752.  * PARAMETERS
  1753.  *  void
  1754.  * RETURNS
  1755.  *  string to be displayed
  1756.  *****************************************************************************/
  1757. pBOOL UI_dummy_get_two_line_menuitem_height(void)
  1758. {
  1759.     /*----------------------------------------------------------------*/
  1760.     /* Local Variables                                                */
  1761.     /*----------------------------------------------------------------*/
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Code Body                                                      */
  1764.     /*----------------------------------------------------------------*/
  1765.     return FALSE;
  1766. }
  1767. /*****************************************************************************
  1768.  * FUNCTION
  1769.  *  UI_dummy_two_line_get_thumbnail_flags
  1770.  * DESCRIPTION
  1771.  *  dummy function that returns thumbnail flags
  1772.  * PARAMETERS
  1773.  *  void
  1774.  * RETURNS
  1775.  *  no thumbnail flag
  1776.  *****************************************************************************/
  1777. U8 UI_dummy_two_line_get_thumbnail_flags(void)
  1778. {
  1779.     /*----------------------------------------------------------------*/
  1780.     /* Local Variables                                                */
  1781.     /*----------------------------------------------------------------*/
  1782.     /*----------------------------------------------------------------*/
  1783.     /* Code Body                                                      */
  1784.     /*----------------------------------------------------------------*/
  1785.     return 0;
  1786. }
  1787. /*----------------------------------------------------------------------------
  1788. The various callbakcs for two line menu item are defined below this line.
  1789. ----------------------------------------------------------------------------*/
  1790. U8(*gui_two_line_get_thumbnail_flags) (void) = UI_dummy_two_line_get_thumbnail_flags;
  1791. void (*gui_reset_two_line) (void) = UI_dummy_function;
  1792. void (*gui_two_line_toggle_thumbnail_direction) (void) = UI_dummy_function;
  1793. void (*gui_set_current_two_line_menuitem_data) (void) = UI_dummy_set_current_two_line_menuitem_data;
  1794. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  1795. #if (defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ || defined __MMI_UI_HINTS_IN_MENUITEM__)
  1796. void (*gui_reset_current_two_line_menuitem_data) (void) = UI_dummy_set_current_two_line_menuitem_data;
  1797. #endif 
  1798. #if defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1799. void (*gui_show_two_line_menuitem_part) (void) = UI_dummy_show_two_line_menuitem_part;
  1800. void (*gui_move_two_line_menuitem_part) (S32 x, S32 y) = UI_dummy_move_two_line_menuitem_part;
  1801. void (*gui_resize_two_line_menuitem_part) (S32 x, S32 y) = UI_dummy_resize_two_line_menuitem_part;
  1802. pBOOL(*gui_get_two_line_menuitem_height) (void) = UI_dummy_get_two_line_menuitem_height;
  1803. #endif /* defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  1804. // TODO: modify function name
  1805. #if (defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ || defined __MMI_UI_HINTS_IN_MENUITEM__)
  1806. /*****************************************************************************
  1807.  * FUNCTION
  1808.  *  scrolling_text_draw_two_line_background
  1809.  * DESCRIPTION
  1810.  *  Function to display backgrounds for two line hint/select menuitem
  1811.  *  with scrolling
  1812.  * PARAMETERS
  1813.  *  x1          [IN]        
  1814.  *  y1          [IN]        
  1815.  *  x2          [IN]        
  1816.  *  y2          [IN]        
  1817.  *  co(?)       [IN]        Ordinates for background draw area
  1818.  * RETURNS
  1819.  *  void
  1820.  *****************************************************************************/
  1821. void scrolling_text_draw_two_line_background(S32 x1, S32 y1, S32 x2, S32 y2)
  1822. {
  1823. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1824.     /*----------------------------------------------------------------*/
  1825.     /* Local Variables                                                */
  1826.     /*----------------------------------------------------------------*/
  1827.     /*----------------------------------------------------------------*/
  1828.     /* Code Body                                                      */
  1829.     /*----------------------------------------------------------------*/
  1830.     if (!gui_is_current_transparency_with_multi_layer())
  1831.     {
  1832.         gui_fixed_icontext_disable_transparent_effect(&MMI_fixed_icontext_menuitem);    /* To hide text below scrolling text */
  1833.     }
  1834. #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  1835.     gui_draw_filled_area(x1, y1, x2, y2, MMI_fixed_icontext_menuitem.focussed_filler);
  1836. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1837.     gui_fixed_icontext_enable_transparent_effect(&MMI_fixed_icontext_menuitem); /* To hide text below scrolling text */
  1838. #endif 
  1839. }
  1840. /*****************************************************************************
  1841.  * FUNCTION
  1842.  *  line_scrolling_text_timer_handler
  1843.  * DESCRIPTION
  1844.  *  called on timer expiry to draw two line hint/select menuitem text
  1845.  * PARAMETERS
  1846.  *  void
  1847.  * RETURNS
  1848.  *  void
  1849.  *****************************************************************************/
  1850. void line_scrolling_text_timer_handler(void)
  1851. {
  1852.     /*----------------------------------------------------------------*/
  1853.     /* Local Variables                                                */
  1854.     /*----------------------------------------------------------------*/
  1855.     /*----------------------------------------------------------------*/
  1856.     /* Code Body                                                      */
  1857.     /*----------------------------------------------------------------*/
  1858.     gui_handle_scrolling_text(&gui_two_line_scroll_text);
  1859. }
  1860. /*****************************************************************************
  1861.  * FUNCTION
  1862.  *  two_line_menuitem_cleanup_function
  1863.  * DESCRIPTION
  1864.  *  clean up function mainly to stop scrolling text on category exit.
  1865.  * PARAMETERS
  1866.  *  void
  1867.  * RETURNS
  1868.  *  void
  1869.  *****************************************************************************/
  1870. void two_line_menuitem_cleanup_function(void)
  1871. {
  1872.     /*----------------------------------------------------------------*/
  1873.     /* Local Variables                                                */
  1874.     /*----------------------------------------------------------------*/
  1875.     /*----------------------------------------------------------------*/
  1876.     /* Code Body                                                      */
  1877.     /*----------------------------------------------------------------*/
  1878.     gui_scrolling_text_stop(&gui_two_line_scroll_text);
  1879.     gui_reset_current_two_line_menuitem_data();
  1880. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1881.     gui_reset_two_line();
  1882. #endif 
  1883. }
  1884. /*****************************************************************************
  1885.  * FUNCTION
  1886.  *  gui_show_two_line_icontext_menuitem
  1887.  * DESCRIPTION
  1888.  *  Function to display an two line hint/select menuitem
  1889.  * PARAMETERS
  1890.  *  item                    [?]         
  1891.  *  common_item_data        [?]         
  1892.  *  x                       [IN]        
  1893.  *  y                       [IN]        
  1894.  *  pointer(?)              [IN]        To menuitem, common data and letft corner co-ordinates
  1895.  * RETURNS
  1896.  *  void
  1897.  *****************************************************************************/
  1898. void gui_show_two_line_icontext_menuitem(void *item, void *common_item_data, S32 x, S32 y)
  1899. {
  1900.     /*----------------------------------------------------------------*/
  1901.     /* Local Variables                                                */
  1902.     /*----------------------------------------------------------------*/
  1903.     /* Locals Start */
  1904.     S32 x1, y1, x2, y2;
  1905.     S32 text_x1 = 0;
  1906.     S32 text_x2 = 0;
  1907.     S32 text_y1 = 0;
  1908.     S32 text_y2 = 0;
  1909.     S32 icon_x = 0;
  1910.     S32 icon_y = 0;
  1911.     S32 icon_width = 0;
  1912.     S32 icon_height = 0;
  1913.     S32 image_width = 0;
  1914.     S32 image_height = 0;
  1915.     S32 sw = 0, sh = 0;
  1916.     U8 show_two_line_hints = 1;
  1917.     U8 thumbnail_flags = 0;
  1918.     U32 flags;
  1919.     UI_filled_area *f = NULL;
  1920.     fixed_icontext_menuitem *m = (fixed_icontext_menuitem*) common_item_data;
  1921.     fixed_icontext_menuitem_type *mi = (fixed_icontext_menuitem_type*) item;
  1922.     UI_string_type _text = NULL;
  1923. #ifdef __MMI_UI_HINTS_IN_MENUITEM__
  1924.     UI_string_type _hint_text = NULL;
  1925. #endif 
  1926.     PU8 _icon = NULL;
  1927.     /*----------------------------------------------------------------*/
  1928.     /* Code Body                                                      */
  1929.     /*----------------------------------------------------------------*/
  1930.     /* Locals End */
  1931.     gui_add_cleanup_hook(two_line_menuitem_cleanup_function);//053006 2 line Calvin
  1932.     flags = mi->flags;
  1933.     flags |= m->flags;
  1934.     _text = mi->item_text;
  1935.     _icon = mi->item_icon;
  1936.     x1 = x;
  1937.     y1 = y;
  1938.     x2 = x1 + m->width - 1;
  1939.     y2 = y1 + (m->height << 1) - 1;
  1940.     gui_lock_double_buffer();
  1941. #if defined(__MMI_UI_HINTS_IN_MENUITEM__) && defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__)
  1942.     if ((_hint_text = gui_get_current_pop_up_description_string()) == NULL ||
  1943.         (m->ext_flags & UI_MENUITEM_EXT_SHOW_TWO_LINE_SELECT))
  1944. #elif defined (__MMI_UI_HINTS_IN_MENUITEM__)
  1945.     if ((_hint_text = gui_get_current_pop_up_description_string()) == NULL)
  1946. #endif 
  1947.     {
  1948.         show_two_line_hints = 0;
  1949.     #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1950.         thumbnail_flags = gui_two_line_get_thumbnail_flags();
  1951.     #endif 
  1952.     }
  1953. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1954.     if (r2lMMIFlag && thumbnail_flags)
  1955.     {
  1956.         gui_two_line_toggle_thumbnail_direction();
  1957.         thumbnail_flags = gui_two_line_get_thumbnail_flags();
  1958.     }
  1959. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  1960. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1961.     gui_reset_current_list_effect();
  1962. #endif 
  1963.     /* Draw Filler Start */
  1964.     if (!(flags & UI_MENUITEM_DISABLE_BACKGROUND_ALWAYS) && (flags & UI_MENUITEM_STATE_FOCUSSED))
  1965.     {
  1966.         gui_push_clip();
  1967.         gui_set_clip(x1, y1, x2, y2);
  1968.         f = m->focussed_filler;
  1969.     #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1970. /* Currently special list effect is not supported in two-line menu item */
  1971.         gui_draw_list_filled_area(x1, y1, x2, y2, f);
  1972.     #else
  1973.         gui_draw_filled_area(x1, y1, x2, y2, f);
  1974.     #endif
  1975.         gui_pop_clip();
  1976.     }
  1977.     /* Draw Filler End */
  1978.     if (!show_two_line_hints)
  1979.     {
  1980.     #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1981.         if (!gui_is_current_transparency_with_multi_layer())
  1982.         {
  1983.             gui_fixed_icontext_disable_transparent_effect(m);   /* To hide text below scrolling text */
  1984.         }
  1985.     #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  1986.     }
  1987.     if (_icon != UI_NULL_IMAGE)
  1988.     {
  1989.         gui_measure_image(_icon, &icon_width, &icon_height);
  1990.     }
  1991.     else
  1992.     {
  1993.         icon_width = icon_height = 0;
  1994.     }
  1995.     /* scenario 0 - No Image, 1 - LEFT Image,  2 - RIGHT Image */
  1996.     if (show_two_line_hints
  1997. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1998.         || (thumbnail_flags == UI_TWO_LINE_MENUITEM_NO_THUMBNAIL)
  1999. #endif 
  2000.         )
  2001.     {
  2002.         image_width = image_height = 0;
  2003.         if (r2lMMIFlag)
  2004.         {
  2005.             /* Icon calculation */
  2006.             icon_x = x2 - m->text_x + 2;    /* Use text position to compute icon position */
  2007.             icon_y = y1;
  2008.             /* Text calculation */
  2009.             text_x1 = x1;
  2010.             text_x2 = x2 - m->text_x;
  2011.             text_y1 = y1;
  2012.             text_y2 = text_y1 + ((y2 - y1) >> 1);
  2013.         }
  2014.         else
  2015.         {
  2016.             /* Icon calculation */
  2017.             icon_x = x1 + m->icon_x;
  2018.             icon_y = y1;
  2019.             /* Text calculation */
  2020.             text_x1 = x1 + m->text_x;
  2021.             text_x2 = x2;
  2022.             text_y1 = y1;
  2023.             text_y2 = text_y1 + ((y2 - y1) >> 1);
  2024.         }
  2025.         if ((flags & UI_MENUITEM_DISABLE_ICON) && (_icon == UI_NULL_IMAGE))
  2026.         {
  2027.             if (r2lMMIFlag)
  2028.             {
  2029.                 text_x2 = x2 - 2;
  2030.             }
  2031.             else
  2032.             {
  2033.                 text_x1 = x1 + 2;
  2034.             }
  2035.         }
  2036.     }
  2037. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  2038.     else if (thumbnail_flags & UI_TWO_LINE_MENUITEM_LEFT_ALIGN_THUMBNAIL)
  2039.     {
  2040.         image_width = image_height = (m->height << 1);
  2041.         /* Icon calculation */
  2042.         icon_x = x2 - m->text_x + 2;
  2043.         icon_y = y1;
  2044.         /* Text calculation */
  2045.         text_x1 = x1 + image_width + 2;
  2046.         text_x2 = x2 - (m->text_x + GUI_TWO_LINE_TEXT_ICON_GAP);
  2047.         text_y1 = y1;
  2048.         text_y2 = text_y1 + ((y2 - y1) >> 1);
  2049.         if ((flags & UI_MENUITEM_DISABLE_ICON) && (_icon == UI_NULL_IMAGE))
  2050.         {
  2051.             text_x2 = x2 - GUI_TWO_LINE_TEXT_ICON_GAP;
  2052.         }
  2053.     }
  2054.     else if (thumbnail_flags & UI_TWO_LINE_MENUITEM_RIGHT_ALIGN_THUMBNAIL)
  2055.     {
  2056.         image_width = image_height = (m->height << 1);
  2057.         /* Icon calculation */
  2058.         icon_x = x1 + m->icon_x;
  2059.         if ((flags & UI_MENUITEM_DISABLE_ICON) && (_icon == UI_NULL_IMAGE))
  2060.         {
  2061.             text_x1 = x1 + 2;
  2062.         }
  2063.         else
  2064.         {
  2065.             text_x1 = x1 + m->text_x;
  2066.         }
  2067.         icon_y = y1;
  2068.         /* Text calulation */
  2069.         text_x2 = x2 - image_width - 2;
  2070.         text_y1 = y1;
  2071.         text_y2 = text_y1 + ((y2 - y1) >> 1);
  2072.     }
  2073. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  2074.     /* Text Start */
  2075.     if (_text != NULL && (!(flags & UI_MENUITEM_DISABLE_TEXT_DISPLAY)))
  2076.     {
  2077.         gui_push_text_clip();
  2078.         gui_set_text_clip(text_x1, text_y1, text_x2, text_y2);
  2079.         gui_set_font(MMI_fixed_icontext_menuitem.text_font);
  2080.         gui_measure_string((UI_string_type) _text, &sw, &sh);
  2081.         text_y1 += (m->height >> 1) - (sh >> 1);    /* Center Vertically */
  2082.         if (flags & UI_MENUITEM_STATE_FOCUSSED)
  2083.         {
  2084.         #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  2085.             g_mmi_frm_cntx.dump_screen_info.hightlight_type = MMI_SCREEN_FOCUSED_TWO_LINE_ICONTEXT;
  2086.         #endif
  2087.             /* Use another scroll handler */
  2088.             gui_fixed_icontext_menuitem_stop_scroll();
  2089.             gui_set_text_color(MMI_fixed_icontext_menuitem.focussed_text_color);
  2090.         }
  2091.         else
  2092.         {
  2093.             gui_set_text_color(MMI_fixed_icontext_menuitem.normal_text_color);
  2094.         }
  2095.         if (sw < (text_x2 - text_x1 - 1) || (!(flags & UI_MENUITEM_STATE_FOCUSSED)))
  2096.         {
  2097.             if (r2lMMIFlag)
  2098.             {
  2099.                 gui_move_text_cursor(text_x2, text_y1);
  2100.             }
  2101.             else
  2102.             {
  2103.                 gui_move_text_cursor(text_x1, text_y1);
  2104.             }
  2105.             gui_print_text((UI_string_type) _text);
  2106.         }
  2107.         else
  2108.         {
  2109.             gui_create_scrolling_text(
  2110.                 &gui_two_line_scroll_text,
  2111.                 text_x1,
  2112.                 text_y1,
  2113.                 text_x2 - text_x1,
  2114.                 sh + 1,
  2115.                 (UI_string_type) _text,
  2116.                 line_scrolling_text_timer_handler,
  2117.                 scrolling_text_draw_two_line_background,
  2118.                 MMI_fixed_icontext_menuitem.focussed_text_color,
  2119.                 MMI_fixed_icontext_menuitem.focussed_text_color);
  2120.             gui_show_scrolling_text(&gui_two_line_scroll_text);
  2121.         }
  2122.         gui_pop_text_clip();
  2123.     }
  2124.     //Text End
  2125.     //Icon Start
  2126.     if (_icon != UI_NULL_IMAGE)
  2127.     {
  2128.         gui_push_clip();
  2129.         gui_measure_image(_icon, &sw, &sh);
  2130.         icon_y += (m->height >> 1) - (sh >> 1); /* Center Vertically */
  2131.         gui_set_clip(icon_x, icon_y, icon_x + sw, icon_y + sh);
  2132.         /* gui_show_transparent_animated_image_frame(icon_x,icon_y,_icon,m->icon_transparent_color,0); */
  2133.         gdi_image_draw_animation_single_frame(icon_x, icon_y, (U8*) _icon, 0);
  2134.         gui_pop_clip();
  2135.     }
  2136.     /* Icon End */
  2137. #ifdef __MMI_UI_HINTS_IN_MENUITEM__
  2138.     if (show_two_line_hints)
  2139.     {
  2140.         S32 hint_x1 = text_x1;  /* Use the same X position as item text */
  2141.         S32 hint_y1 = y + m->height;
  2142.         S32 hint_x2 = text_x2;
  2143.         S32 hint_y2 = hint_y1 + m->height - 1;
  2144.     #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  2145.         g_mmi_frm_cntx.dump_screen_info.hightlight_type = MMI_SCREEN_HIGHLIGHT_TWO_LINE_HINTS;
  2146.     #endif
  2147.         gui_show_two_line_hint_part(hint_x1, hint_x2, hint_y1, hint_y2, _hint_text, flags);
  2148.         gui_unlock_double_buffer();
  2149.         return;
  2150.     }
  2151. #endif /* __MMI_UI_HINTS_IN_MENUITEM__ */ 
  2152. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  2153.     /* Two Line Start */
  2154.     {
  2155.         gui_move_two_line_menuitem_part(x1 + 2, y1 + m->height);
  2156.         gui_resize_two_line_menuitem_part(x2 - x1 - 4, m->height);
  2157.         gui_show_two_line_menuitem_part();
  2158.         gui_unlock_double_buffer();
  2159.         return;
  2160.     }
  2161.     /* Two Line End */
  2162. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 
  2163. }
  2164. /*****************************************************************************
  2165.  * FUNCTION
  2166.  *  gui_two_line_scroller_stop
  2167.  * DESCRIPTION
  2168.  *  Function to stop two line scroll timer
  2169.  * PARAMETERS
  2170.  *  void
  2171.  * RETURNS
  2172.  *  void
  2173.  *****************************************************************************/
  2174. void gui_two_line_scroller_stop(void)
  2175. {
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Local Variables                                                */
  2178.     /*----------------------------------------------------------------*/
  2179.     /*----------------------------------------------------------------*/
  2180.     /* Code Body                                                      */
  2181.     /*----------------------------------------------------------------*/
  2182.     gui_scrolling_text_stop(&gui_two_line_scroll_text);
  2183. }
  2184. #endif /* (defined __MMI_UI_TWO_LINE_MENUITEM_STYLES__ || defined __MMI_UI_HINTS_IN_MENUITEM__) */