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

MTK

开发平台:

C/C++

  1. {
  2.     /*----------------------------------------------------------------*/
  3.     /* Local Variables                                                */
  4.     /*----------------------------------------------------------------*/
  5.     /*----------------------------------------------------------------*/
  6.     /* Code Body                                                      */
  7.     /*----------------------------------------------------------------*/
  8.     switch (MMI_main_menu_type)
  9.     {
  10.         case LIST_MENU:
  11.             break;
  12.         case MATRIX_MENU:
  13.             gui_hide_fixed_matrix_menu_highlighted_item(&MMI_fixed_matrix_menu);
  14.             break;
  15.     }
  16. }
  17. /*****************************************************************************
  18.  * FUNCTION
  19.  *  draw_main_menu_list_type_title
  20.  * DESCRIPTION
  21.  *  Redraws the category14 screen
  22.  * PARAMETERS
  23.  *  void
  24.  * RETURNS
  25.  *  void
  26.  *****************************************************************************/
  27. void draw_main_menu_list_type_title(void)
  28. {
  29.     /*----------------------------------------------------------------*/
  30.     /* Local Variables                                                */
  31.     /*----------------------------------------------------------------*/
  32.     /*----------------------------------------------------------------*/
  33.     /* Code Body                                                      */
  34.     /*----------------------------------------------------------------*/
  35.     show_title_status_icon();
  36.     draw_title();
  37. }
  38. /*****************************************************************************
  39.  * FUNCTION
  40.  *  category14_main_menu_list_highlight_handler
  41.  * DESCRIPTION
  42.  *  highlight handler for main menu lsit of category 14
  43.  * PARAMETERS
  44.  *  item_index      [IN]        Index of current highlighted item
  45.  * RETURNS
  46.  *  void
  47.  *****************************************************************************/
  48. void category14_main_menu_list_highlight_handler(S32 item_index)
  49. {
  50.     /*----------------------------------------------------------------*/
  51.     /* Local Variables                                                */
  52.     /*----------------------------------------------------------------*/
  53.     /*----------------------------------------------------------------*/
  54.     /* Code Body                                                      */
  55.     /*----------------------------------------------------------------*/
  56.     /* PMT VIKAS START 20051209 */
  57. #if(TITLE_TRANSITION_STYLE_NON_BLOCKING)
  58.     if (MMI_main_menu_type == PAGE_MENU)
  59.     {
  60.         wgui_stop_transition_title_non_blocking();
  61.         reset_title_transition();
  62.     }
  63. #ifndef TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT
  64.     set_previous_title_shortcut(MMI_menu_shortcut_number);
  65. #endif 
  66. #endif /* (TITLE_TRANSITION_STYLE_NON_BLOCKING) */ 
  67.     /* PMT VIKAS END 20051209 */
  68.     MMI_menu_shortcut_number = item_index + 1;
  69.     MMI_highlighted_item_text = get_item_text(item_index);
  70.     MMI_title_string = MMI_highlighted_item_text;
  71.     gdi_layer_lock_frame_buffer();
  72.     MMI_list_highlight_handler(item_index);
  73.     if (!menu_shortcut_handler_display)
  74.     {
  75.         draw_main_menu_list_type_title();
  76.     }
  77.     gui_hide_animations();
  78. #if (!defined(__MMI_UI_TECHNO_MAINMENU__))
  79.     MMI_fixed_list_menu.item_display_function(
  80.                             MMI_fixed_list_menu.items[MMI_fixed_list_menu.highlighted_item],
  81.                             MMI_fixed_list_menu.common_item_data,
  82.                             MMI_fixed_list_menu.x,
  83.                             MMI_fixed_list_menu.y);
  84. #endif /* (!defined(__MMI_UI_TECHNO_MAINMENU__)) */ 
  85.     gdi_layer_unlock_frame_buffer();
  86. #ifndef __MMI_UI_DALMATIAN_MAINMENU__
  87. #ifdef __MMI_UI_TITLE_TRANSITION__
  88.     /* PMT VIKAS START 20051209 */
  89.     if (MMI_main_menu_type == PAGE_MENU && is_mmi_title_transition_on_keys() == 0)
  90.         /* PMT VIKAS END 20051209 */
  91.     {
  92.         U16 keyCode, keyType;
  93.         GetkeyInfo(&keyCode, &keyType);
  94.     #ifdef __MMI_UI_MM_HORIZONTAL_PAGE_STYLE__
  95.         if (keyCode == KEY_RIGHT_ARROW)
  96.     #else 
  97.         if (keyCode == KEY_DOWN_ARROW || keyCode == KEY_VOL_DOWN)
  98.     #endif 
  99.         {
  100.             set_title_transition(WGUI_TRANSITION_L2R);
  101.             draw_title();
  102.             /* PMT VIKAS START 20051209 */
  103.         #if(!TITLE_TRANSITION_STYLE_NON_BLOCKING)
  104.             reset_title_transition();
  105.         #endif 
  106.             /* PMT VIKAS END 20051209 */
  107.         }
  108.         else
  109.     #ifdef __MMI_UI_MM_HORIZONTAL_PAGE_STYLE__
  110.         if (keyCode == KEY_LEFT_ARROW)
  111.     #else 
  112.         if (keyCode == KEY_UP_ARROW || keyCode == KEY_VOL_UP)
  113.     #endif 
  114.         {
  115.             set_title_transition(WGUI_TRANSITION_R2L);
  116.             draw_title();
  117.             /* PMT VIKAS START 20051209 */
  118.         #if(!TITLE_TRANSITION_STYLE_NON_BLOCKING)
  119.             reset_title_transition();
  120.         #endif 
  121.             /* PMT VIKAS END 20051209 */
  122.         }
  123.     }
  124.     /* PMT VIKAS START 20051209 */
  125.     else if (MMI_main_menu_type == PAGE_MENU && is_mmi_title_transition_on_keys() == 1)
  126.     {
  127.         draw_title();
  128.     #if(!TITLE_TRANSITION_STYLE_NON_BLOCKING)
  129.         reset_title_transition();
  130.     #endif 
  131.     }
  132.     /* PMT VIKAS END 20051209 */
  133. #endif /* __MMI_UI_TITLE_TRANSITION__ */ 
  134. #endif /* __MMI_UI_DALMATIAN_MAINMENU__ */ 
  135.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  136. }
  137. /*****************************************************************************
  138.  * FUNCTION
  139.  *  initialize_mainmenu_title_icons
  140.  * DESCRIPTION
  141.  *  Called once during bootup to initialize category screens
  142.  * PARAMETERS
  143.  *  void
  144.  * RETURNS
  145.  *  void
  146.  *****************************************************************************/
  147. void initialize_mainmenu_title_icons(void)
  148. {
  149.     /*----------------------------------------------------------------*/
  150.     /* Local Variables                                                */
  151.     /*----------------------------------------------------------------*/
  152.     S32 i = 0;
  153.     MMI_ID_TYPE mm_iconID[MAX_MAIN_MENU_ITEMS];
  154. #ifdef __MMI_BI_DEGREE_MAIN_MENU_STYLE__
  155.     U8 j = 0;
  156.     U8 num_of_group = 0;
  157.     U8 num_of_child = 0;
  158.     U16 total_number = 0;
  159.     U16 menu_id = 0;
  160.     /*----------------------------------------------------------------*/
  161.     /* Code Body                                                      */
  162.     /*----------------------------------------------------------------*/
  163.     num_of_group = (U8) GetNumOfChild(IDLE_SCREEN_MENU_ID); /* 101705 */
  164.     for (i = 0; i < num_of_group; i++)
  165.     {
  166.         menu_id = GetSeqItemId(IDLE_SCREEN_MENU_ID, (U16) i);
  167.         num_of_child = (U8) GetNumOfChild(menu_id); /* 101705 */
  168.         GetSequenceImageIds(menu_id, mm_iconID);
  169.         for (j = 0; j < num_of_child; j++)
  170.         {
  171.             MMI_ASSERT(total_number < MAX_MAIN_MENU_ITEMS);
  172.             gMainMenuTitleIcon[total_number++] = MAIN_MENU_TITLE_ICON_BASE + mm_iconID[j] - MAIN_MENU_ICON_IMGBASE;
  173.         }
  174.     }
  175. #else /* __MMI_BI_DEGREE_MAIN_MENU_STYLE__ */ 
  176.     GetSequenceImageIds(IDLE_SCREEN_MENU_ID, mm_iconID);
  177.     for (i = 0; i < MAX_MAIN_MENU_ITEMS; i++)
  178.     {
  179.         gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + mm_iconID[i] - MAIN_MENU_ICON_IMGBASE;
  180.     }
  181. #endif /* __MMI_BI_DEGREE_MAIN_MENU_STYLE__ */ 
  182. }
  183. #ifdef __MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__
  184. /*****************************************************************************
  185.  * FUNCTION
  186.  *  matrix_menu_full_background_show_softkey_background
  187.  * DESCRIPTION
  188.  *  Draws a background behind the softkeys for matrix_main_menu_no_titlebar
  189.  * PARAMETERS
  190.  *  void
  191.  * RETURNS
  192.  *  void
  193.  *****************************************************************************/
  194. void matrix_menu_full_background_show_softkey_background(void)
  195. {
  196.     /*----------------------------------------------------------------*/
  197.     /* Local Variables                                                */
  198.     /*----------------------------------------------------------------*/
  199.     /*----------------------------------------------------------------*/
  200.     /* Code Body                                                      */
  201.     /*----------------------------------------------------------------*/
  202.     gdi_layer_push_clip();
  203.     gui_set_clip(0, UI_device_height - MMI_button_bar_height, UI_device_width - 1, UI_device_height - 1);
  204.     gdi_image_draw_id(0, UI_device_height - MMI_button_bar_height, MAIN_MENU_MATRIX_SOFTKEY_BG);
  205.     gdi_layer_pop_clip();
  206. }
  207. /*****************************************************************************
  208.  * FUNCTION
  209.  *  matrix_menu_full_background_hide_left_softkey
  210.  * DESCRIPTION
  211.  *  Hides the left softkey for matrix_main_menu_no_titlebar
  212.  *  
  213.  *  Default hide left softkey function
  214.  * PARAMETERS
  215.  *  void
  216.  * RETURNS
  217.  *  void
  218.  *****************************************************************************/
  219. void matrix_menu_full_background_hide_left_softkey(void)
  220. {
  221.     /*----------------------------------------------------------------*/
  222.     /* Local Variables                                                */
  223.     /*----------------------------------------------------------------*/
  224.     /*----------------------------------------------------------------*/
  225.     /* Code Body                                                      */
  226.     /*----------------------------------------------------------------*/
  227.     gdi_layer_push_clip();
  228.     gui_set_clip(
  229.         MMI_softkeys[MMI_LEFT_SOFTKEY].x,
  230.         MMI_softkeys[MMI_LEFT_SOFTKEY].y,
  231.         MMI_softkeys[MMI_LEFT_SOFTKEY].x + MMI_softkeys[MMI_LEFT_SOFTKEY].width - 1,
  232.         MMI_softkeys[MMI_LEFT_SOFTKEY].y + MMI_softkeys[MMI_LEFT_SOFTKEY].height - 1);
  233.     gdi_image_draw_id(0, UI_device_height - MMI_button_bar_height, MAIN_MENU_MATRIX_SOFTKEY_BG);
  234.     gdi_layer_pop_clip();
  235. }
  236. /*****************************************************************************
  237.  * FUNCTION
  238.  *  matrix_menu_full_background_hide_right_softkey
  239.  * DESCRIPTION
  240.  *  Hides the right softkey for matrix_main_menu_no_titlebar
  241.  *  
  242.  *  Default hide left softkey function
  243.  * PARAMETERS
  244.  *  void
  245.  * RETURNS
  246.  *  void
  247.  *****************************************************************************/
  248. void matrix_menu_full_background_hide_right_softkey(void)
  249. {
  250.     /*----------------------------------------------------------------*/
  251.     /* Local Variables                                                */
  252.     /*----------------------------------------------------------------*/
  253.     /*----------------------------------------------------------------*/
  254.     /* Code Body                                                      */
  255.     /*----------------------------------------------------------------*/
  256.     gdi_layer_push_clip();
  257.     gui_set_clip(
  258.         MMI_softkeys[MMI_RIGHT_SOFTKEY].x,
  259.         MMI_softkeys[MMI_RIGHT_SOFTKEY].y,
  260.         MMI_softkeys[MMI_RIGHT_SOFTKEY].x + MMI_softkeys[MMI_RIGHT_SOFTKEY].width - 1,
  261.         MMI_softkeys[MMI_RIGHT_SOFTKEY].y + MMI_softkeys[MMI_RIGHT_SOFTKEY].height - 1);
  262.     gdi_image_draw_id(0, UI_device_height - MMI_button_bar_height, MAIN_MENU_MATRIX_SOFTKEY_BG);
  263.     gdi_layer_pop_clip();
  264. }
  265. #endif /* __MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__ */ 
  266. /*----------------------------------------------------------------------------
  267. Function: category14callback
  268. Description: callback from draw manager used to draw category 14 controlled area
  269. Input Parameters: co-ordinates
  270. Output Parameters: Void
  271. Returns: void
  272. Remarks:
  273. ----------------------------------------------------------------------------*/
  274. #if defined __MMI_UI_TECHNO_MAINMENU__ || defined __MMI_UI_DALMATIAN_MAINMENU__
  275. void category14_callback(dm_coordinates *coordinate)
  276. {
  277. #if defined(__MMI_UI_DALMATIAN_MAINMENU__)
  278. s32 i;
  279. s32 x1, y1, x2, y2;
  280. #endif
  281. #if defined(__MMI_UI_TECHNO_MAINMENU__)
  282. show_techno_menu();
  283. #else
  284. show_fixed_list();
  285. #endif
  286. #if defined(__MMI_UI_DALMATIAN_MAINMENU__)
  287. gui_push_clip();
  288. initialize_balls();
  289. for(i = 0; i < NUMBER_OF_BALLS; i++)
  290. {
  291. x1 = *(ball[i].position + 0);
  292. y1 = *(ball[i].position + 1);
  293. x2 = x1 + BALL_WIDTH - 1;
  294. y2 = y1 + BALL_HEIGHT -1;
  295. if(x1 < MMI_content_x)
  296. x1 = MMI_content_x;
  297. if(y1 < MMI_content_y)
  298. y1 = MMI_content_y;
  299. if(x2> UI_device_width - 1)
  300. x2 = UI_device_width - 1;
  301. if(y2> UI_device_height - MMI_button_bar_height)
  302. y2 = UI_device_height - MMI_button_bar_height;
  303. _get_bitmap(x1, y1, x2, y2, &ball[i].image);
  304. }
  305. gui_set_clip(MMI_content_x, MMI_content_y,
  306. UI_device_width - 1,
  307. UI_device_height - MMI_button_bar_height - 1);
  308. for(i = 0; i < NUMBER_OF_BALLS; i++)
  309. {
  310. gui_show_image(*(ball[i].position + 0),
  311. *(ball[i].position + 1),
  312. get_image(MAIN_MENU_DALMATIAN_BALL));
  313. }
  314. gui_pop_clip();
  315. #endif
  316. }
  317. #endif
  318. /*****************************************************************************
  319.  * FUNCTION
  320.  *  ShowCategory14Screen
  321.  * DESCRIPTION
  322.  *  Displays the category14 screen . this is a scrren to show main menu
  323.  * PARAMETERS
  324.  *  title                   [IN]        Title for the screen
  325.  *  title_icon              [IN]        Icon displayed with the title
  326.  *  left_softkey            [IN]        Left softkey label
  327.  *  left_softkey_icon       [IN]        Left softkey icon
  328.  *  right_softkey           [IN]        Right softkey label
  329.  *  right_softkey_icon      [IN]        Right softkey icon
  330.  *  number_of_items         [IN]        Number of items in the menu
  331.  *  list_of_items           [IN]        Array of items
  332.  *  list_of_icons           [IN]        Array of icons
  333.  *  flags                   [IN]        (see explanation below)
  334.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  335.  *  history_buffer          [IN]        History buffer
  336.  *  LIST_MENU(?)            [IN]        
  337.  *  Values(?)               [IN]        Allowed for these 8 bits are:
  338.  *  MATRIX_MENU(?)          [IN]        
  339.  *  The(?)                  [IN]        Last 8 bits of flags represent the type of the menu.
  340.  * RETURNS
  341.  *  void
  342.  *****************************************************************************/
  343. void ShowCategory14Screen(
  344.         U16 title,
  345.         U16 title_icon,
  346.         U16 left_softkey,
  347.         U16 left_softkey_icon,
  348.         U16 right_softkey,
  349.         U16 right_softkey_icon,
  350.         S32 number_of_items,
  351.         U16 *list_of_items,
  352.         U16 *list_of_icons,
  353.         S32 flags,
  354.         S32 highlighted_item,
  355.         U8 *history_buffer)
  356. {
  357.     /*----------------------------------------------------------------*/
  358.     /* Local Variables                                                */
  359.     /*----------------------------------------------------------------*/
  360.     dm_data_struct dm_data;
  361.     S32 i, shortcut_width;
  362.     U8 h_flag;
  363. #if(ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
  364.     S32 h_item;
  365. #endif 
  366.     S32 ixsize, iysize;
  367.     /*----------------------------------------------------------------*/
  368.     /* Code Body                                                      */
  369.     /*----------------------------------------------------------------*/
  370. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  371.     gui_block_list_effect();
  372. #endif 
  373. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
  374. #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
  375.     close_status_icons();
  376. #endif
  377. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
  378.     gdi_layer_lock_frame_buffer();
  379.     UI_disable_alignment_timers();
  380.     MMI_menu_shortcut_number = -1;
  381.     change_left_softkey(left_softkey, left_softkey_icon);
  382.     change_right_softkey(right_softkey, right_softkey_icon);
  383.     SetupCategoryKeyHandlers();
  384.     create_fixed_icontext_menuitems();
  385.     MMI_main_menu_type = flags & 0xf;
  386.     MMI_current_menu_type = flags & 0x0f;
  387.     MMI_title_string = (UI_string_type) get_string(title);
  388.     MMI_title_icon = (PU8) get_image(title_icon);
  389. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  390.     MMI_title_x = MMI_TITLE_X + MMI_SIGNAL_WIDTH;
  391.     MMI_title_width = UI_device_width - (2 * MMI_SIGNAL_WIDTH);
  392.     MMI_title_height = 26;
  393.     MMI_content_y = MMI_content_y - MMI_TITLE_HEIGHT + MMI_title_height;
  394.     MMI_content_height = MMI_content_height + MMI_TITLE_HEIGHT - MMI_title_height;
  395. #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  396.     switch (MMI_main_menu_type)
  397.     {
  398.         case ANI_BG_LIST_MENU:
  399.             MMI_fixed_list_menu.flags |= UI_LIST_MENU_LOOP;
  400.             MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR;
  401.             MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND;
  402.             MMI_fixed_list_menu.flags |= UI_LIST_MENU_CENTER_HIGHLIGHTED;
  403.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_HIGHLIGHT_DISPLAY;
  404.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  405.             resize_fixed_list(40, MMI_content_height + 2);
  406.             associate_fixed_icontext_list();
  407.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_MARQUEE_SCROLL;
  408.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_TWO_DIRECTION_SCROLL;
  409.             for (i = 0; i < number_of_items; i++)
  410.             {
  411.                 add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));
  412.             #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
  413.             #ifndef WAP_SUPPORT
  414.                 if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
  415.                 {
  416.                     MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
  417.                         (UI_string_type) GetSATMainMenuAlphaID();
  418.                 }
  419.             #endif /* WAP_SUPPORT */ 
  420.             #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
  421.             }
  422.             register_fixed_list_shortcut_handler();
  423.             register_fixed_list_keys();
  424.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  425.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  426.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  427.             resize_fixed_icontext_menuitems(0, MMI_content_height / 3);
  428.             set_fixed_icontext_positions(MMI_ICONTEXT_MENUITEM_HEIGHT + 2, 0, 1, 0);
  429.             move_fixed_list(0, (MMI_title_y + MMI_title_height));
  430.             resize_fixed_list(40, MMI_content_height + 2);
  431.             register_fixed_list_highlight_handler(standard_bg_ani_list_highlight_handler);
  432.             MMI_current_menu_type = ANI_BG_LIST_MENU;
  433.             h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
  434.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
  435.             if (h_flag)
  436.             {
  437.                 fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  438.             }
  439.             else
  440.             {
  441.                 if (history_buffer != NULL && main_menu_index != -1)
  442.                 {
  443.                     highlighted_item = main_menu_index;
  444.                 }
  445.                 fixed_list_goto_item_no_redraw(highlighted_item);
  446.             }
  447.             break;
  448.         case LIST_MENU:
  449.         #ifdef __MMI_UI_MM_LIST_NO_GRID__
  450.             gui_disable_fixed_list_line_draw();
  451.         #endif 
  452.             resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  453.             associate_fixed_icontext_list();
  454.             set_MMI_list_main_menu_theme();
  455.             gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  456.             gui_set_fixed_icontext_menuitem_theme(
  457.                 &MMI_fixed_icontext_menuitem,
  458.                 current_UI_theme->fixed_icontext_menuitem_theme);
  459.             for (i = 0; i < number_of_items; i++)
  460.             {
  461.                 add_fixed_icontext_item(get_string(list_of_items[i]), wgui_get_list_menu_icon(i, list_of_icons[i]));
  462.             #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
  463.             #ifndef WAP_SUPPORT
  464.                 if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
  465.                 {
  466.                     MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
  467.                         (UI_string_type) GetSATMainMenuAlphaID();
  468.                 }
  469.             #endif /* WAP_SUPPORT */ 
  470.             #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
  471.             #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  472.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_LIST_ICON_IMGBASE;
  473.             #else 
  474.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
  475.             #endif 
  476.             }
  477.             register_fixed_list_shortcut_handler();
  478.             register_fixed_list_keys();
  479.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  480.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  481.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  482.             register_hide_menu_shortcut(draw_title);
  483.             gui_measure_image(MMI_fixed_icontext_menuitems[0].item_icon, &ixsize, &iysize);
  484.             set_fixed_icontext_positions(ixsize + 2, 0, 1, 0);
  485.         #ifdef __MMI_MAINLCD_240X320__
  486.             resize_fixed_icontext_menuitems(0, MMI_content_height / 6);
  487.             title_bg_id = MAIN_MENU_LIST_TITLE_BG;
  488.         #else /* __MMI_MAINLCD_240X320__ */ 
  489.             resize_fixed_icontext_menuitems(0, MMI_content_height / 3);
  490.         #endif /* __MMI_MAINLCD_240X320__ */ 
  491.             register_fixed_list_highlight_handler(standard_list_highlight_handler);
  492.             MMI_current_menu_type = LIST_MENU;
  493.             resize_fixed_list_to_content_height();
  494.             h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
  495.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
  496.             if (h_flag)
  497.             {
  498.                 fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  499.             }
  500.             else
  501.             {
  502.                 if (history_buffer != NULL && main_menu_index != -1)
  503.                 {
  504.                     highlighted_item = main_menu_index;
  505.                 }
  506.                 fixed_list_goto_item_no_redraw(highlighted_item);
  507.             }
  508.         #if (!defined(__MMI_UI_TECHNO_MAINMENU__) && !defined(__MMI_UI_DALMATIAN_MAINMENU__))
  509.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE;
  510.         #endif             
  511.             resize_fixed_icontext_menuitems_to_list_width();
  512.             dm_data.s32CatId = MMI_CATEGORY14_LIST_ID;
  513.             break;
  514.         case PAGE_MENU:
  515.             /* Temporary:  Needs to be enhanced */
  516.             gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  517.             gui_set_fixed_icontext_menuitem_theme(
  518.                 &MMI_fixed_icontext_menuitem,
  519.                 current_UI_theme->fixed_icontext_menuitem_theme);
  520.         #ifdef __MMI_UI_TECHNO_MAINMENU__
  521.             create_techno_main_menu(number_of_items, list_of_icons);
  522.         #endif 
  523. #if defined __MMI_UI_TECHNO_MAINMENU__ || defined __MMI_UI_DALMATIAN_MAINMENU__
  524.             dm_register_category_controlled_callback(category14_callback);
  525. #endif
  526.             /* PMT VIKAS START 20051209 */
  527.         #if(TITLE_TRANSITION_STYLE_NON_BLOCKING)
  528.             enable_title_transition();
  529.         #endif 
  530.             /* PMT VIKAS END 20051209 */
  531.             resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  532.             associate_fixed_icontext_list();
  533.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_MARQUEE_SCROLL;
  534.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_TWO_DIRECTION_SCROLL;
  535.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_CLIP;
  536.             for (i = 0; i < number_of_items; i++)
  537.             {
  538.                 add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));
  539.             #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
  540.             #ifndef WAP_SUPPORT
  541.                 if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
  542.                 {
  543.                     MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
  544.                         (UI_string_type) GetSATMainMenuAlphaID();
  545.                 }
  546.             #endif /* WAP_SUPPORT */ 
  547.             #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
  548.             #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  549.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_EMPTY_ICON;
  550.             #else /* __MMI_WALLPAPER_ON_BOTTOM__ */
  551.             #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  552.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_PAGE_ICON_IMGBASE;
  553.             #else 
  554.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
  555.             #endif 
  556.             #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */
  557.             }
  558.             register_fixed_list_shortcut_handler();
  559.         #ifdef __MMI_UI_MM_HORIZONTAL_PAGE_STYLE__
  560.             register_horizontal_fixed_list_keys();
  561.         #else 
  562.             register_fixed_list_keys();
  563.         #endif 
  564.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  565.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  566.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  567.             register_hide_menu_shortcut(draw_main_menu_list_type_title);
  568.             move_fixed_list(0, (MMI_title_y + MMI_title_height));
  569.             gui_measure_image(get_image(list_of_icons[0]), &ixsize, &iysize);
  570.             resize_fixed_list(MMI_content_width, MMI_content_height);
  571.             register_fixed_list_highlight_handler(category14_main_menu_list_highlight_handler);
  572.             if (MMI_content_height < iysize)
  573.             {
  574.                 resize_fixed_icontext_menuitems(MMI_content_width, MMI_content_height);
  575.             }
  576.             else
  577.             {
  578.                 resize_fixed_icontext_menuitems(MMI_content_width, MMI_content_height);
  579.             }
  580.         #ifdef __MMI_MAINLCD_240X320__
  581.             title_bg_id = MAIN_MENU_PAGE_TITLE_BG;
  582.         #endif 
  583.             set_fixed_icontext_positions(0, 0, 0, (MMI_content_height - iysize) >> 1);
  584.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_HIGHLIGHT | UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  585.             MMI_current_menu_type = PAGE_MENU;
  586.             h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
  587.             MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR;
  588.             if (h_flag)
  589.             {
  590.                 fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  591.             }
  592.             else
  593.             {
  594.                 if (history_buffer != NULL && main_menu_index != -1)
  595.                 {
  596.                     MMI_fixed_list_menu.highlighted_item = main_menu_index;
  597.                     MMI_fixed_list_menu.first_displayed_item = main_menu_index;
  598.                     MMI_fixed_list_menu.last_displayed_item = main_menu_index;
  599.                     highlighted_item = main_menu_index;
  600.                 }
  601.                 fixed_list_goto_item_no_redraw(highlighted_item);
  602.             }
  603.         #if (!defined(__MMI_UI_TECHNO_MAINMENU__) && !defined(__MMI_UI_DALMATIAN_MAINMENU__))
  604.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE;
  605.         #endif 
  606.             resize_fixed_icontext_menuitems_to_list_width();
  607.             dm_data.s32CatId = MMI_CATEGORY14_LIST_ID;
  608.             break;
  609.         case FIXED_GRID_MENU:
  610.         #if(ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
  611.             h_flag = set_matrix_main_menu_category_history(MMI_CATEGORY14_MATRIX_ID, history_buffer);
  612.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
  613.             if (h_flag)
  614.             {
  615.                 h_item = _wgui_main_menu.highlighted_item;
  616.             }
  617.             else
  618.             {
  619.                 h_item = highlighted_item;
  620.             }
  621.             MMI_disable_title_shortcut_display = 0;
  622.             wgui_setup_main_menu(9, list_of_items, list_of_icons, h_item);
  623.             wgui_register_main_menu_keys();
  624.             wgui_register_main_menu_shortcut_handler();
  625.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  626.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  627.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  628.             register_hide_menu_shortcut(draw_title);
  629.             dm_data.s32CatId = MMI_CATEGORY14_MATRIX_ID;
  630.             break;
  631.         #endif /* (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION) */ 
  632.         case MATRIX_MENU:
  633.             associate_fixed_icontext_matrix();
  634.             for (i = 0; i < number_of_items; i++)
  635.             {
  636.                 add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));
  637.             #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
  638.             #ifndef WAP_SUPPORT
  639.                 if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
  640.                 {
  641.                     MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
  642.                         (UI_string_type) GetSATMainMenuAlphaID();
  643.                 }
  644.             #endif /* WAP_SUPPORT */ 
  645.             #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
  646.                 gMainMenuAnimation[i] = MAIN_MENU_ICON_ANI_IMGBASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
  647.             #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  648.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_MATRIX_ICON_IMGBASE;
  649.             #else 
  650.                 gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
  651.             #endif 
  652.             }
  653.             register_fixed_matrix_shortcut_handler();
  654.             MMI_fixed_matrix_menu.flags |= UI_MATRIX_MENU_LOOP | UI_MATRIX_MENU_FOR_MAINMENU;
  655.         #if defined(__MMI_MAINMENU_MATRIX_LOOP__)
  656.             {
  657.                 MMI_fixed_matrix_menu.flags |= UI_MATRIX_MENU_VERTICAL_LOOP;
  658.             }
  659.         #endif /* defined(__MMI_MAINMENU_MATRIX_LOOP__) */ 
  660.             register_fixed_matrix_loop_keys();
  661.             MMI_current_menu_type = MATRIX_MENU;
  662.         #if(UI_MAIN_MENU_CATEGORY_TYPE == UI_MAIN_MENU_CATEGORY_TYPE1)
  663.             register_fixed_matrix_highlight_handler(standard_animated_matrix_highlight_handler);
  664.             move_fixed_matrix(0, (MMI_title_y + MMI_title_height) + 1);
  665.             resize_fixed_matrix(MMI_content_width, MMI_content_height - MMI_matrix_bar_height);
  666.             if (number_of_items > 9)
  667.             {
  668.                 ixsize = (MMI_content_width - MMI_fixed_matrix_menu.vbar.width - 6) / 3;
  669.             }
  670.             else
  671.             {
  672.                 ixsize = (MMI_content_width - 6) / 3;
  673.             }
  674.             iysize = (MMI_content_height - MMI_matrix_bar_height - 6) / 3;
  675.             configure_fixed_matrix(ixsize, iysize, 3, 0);
  676.             move_menu_shortcut_handler(MMI_matrix_bar_x, MMI_matrix_bar_y);
  677.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  678.             resize_menu_shortcut_handler(shortcut_width, MMI_matrix_bar_height);
  679.             register_hide_menu_shortcut(show_fixed_matrix_bar);
  680.             set_fixed_icontext_positions(0, 0, 0, 0);
  681.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  682.         #elif(UI_MAIN_MENU_CATEGORY_TYPE==UI_MAIN_MENU_CATEGORY_TYPE2)
  683.             set_MMI_matrix_main_menu_theme();
  684.             gui_set_fixed_matrix_menu_theme(&MMI_fixed_matrix_menu, current_UI_theme->fixed_matrix_menu_theme);
  685.             gui_set_fixed_icontext_menuitem_theme(
  686.                 &MMI_fixed_icontext_menuitem,
  687.                 current_UI_theme->fixed_icontext_menuitem_theme);
  688.             register_fixed_matrix_highlight_handler(standard_animated_matrix_highlight_handler_type2);
  689.             move_fixed_matrix(0, (MMI_title_y + MMI_title_height));
  690.             resize_fixed_matrix(MMI_content_width, MMI_content_height);
  691.             if (number_of_items > 9)
  692.             {
  693.                 ixsize = (MMI_content_width - MMI_fixed_matrix_menu.vbar.width - 6) / 3;
  694.             }
  695.             else
  696.             {
  697.                 ixsize = (MMI_content_width - 6) / 3;
  698.             }
  699.             iysize = (MMI_content_height - 6) / 3;
  700.             /* use image height as item height */
  701.             gui_measure_image(get_image(list_of_icons[0]), &ixsize, &iysize);
  702. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
  703. #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
  704. //jerson modify begin 20070625
  705. #if defined(__MMI_MAINLCD_176X220__)
  706. ixsize = 58;
  707. iysize =45; 
  708. #elif defined(__MMI_MAINLCD_240X320__)
  709.             ixsize = 80;
  710.             iysize = 66;
  711. #endif
  712. //jerson modify end 20070625
  713. #endif
  714. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
  715.             configure_fixed_matrix(ixsize, iysize, 3, 0);
  716.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  717.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  718.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  719.             register_hide_menu_shortcut(draw_title);
  720.             set_fixed_icontext_positions(0, 0, 0, 0);
  721.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  722.             MMI_disable_title_shortcut_display = 0;
  723.         #if defined (__MMI_WALLPAPER_ON_BOTTOM__) ||defined (__MMI_KP_STYLE_MAIN_MENU_MATRIX__)  //KP Jerry add "__MMI_KP_STYLE_MAIN_MENU_MATRIX__" for KP-Style 12-Matrix mainmenu on 2007-3-19
  724.             title_bg_id = MAIN_MENU_MATRIX_TITLE_BG;
  725.             wgui_set_wallpaper_on_bottom(MMI_TRUE);
  726. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 start
  727. #ifndef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
  728.             dm_get_scr_bg_image(&mm_bg_ID, &mm_bg_filename, &mm_bg_x, &mm_bg_y, &mm_bg_opacity);
  729. dm_set_scr_bg_image(IMG_MAIN_MENU_MATRIX_BG, NULL, -1, -1, current_MMI_theme->bg_opacity_full);
  730. #else
  731.             dm_set_scr_bg_image(IMG_MAIN_MENU_BG, NULL, -1, -1, current_MMI_theme->bg_opacity_full);
  732. #endif
  733. //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19 end
  734.             dm_get_scr_bg_flag(&mm_bg_flags);
  735.             dm_set_scr_bg_flag(mm_bg_flags | DM_SCR_BG_FORCE_SHOW);
  736.         #endif 
  737.         #elif defined(__MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__) && (UI_MAIN_MENU_CATEGORY_TYPE==UI_MAIN_MENU_CATEGORY_TYPE3)
  738.             register_hide_left_softkey(matrix_menu_full_background_hide_left_softkey);
  739.             register_hide_right_softkey(matrix_menu_full_background_hide_right_softkey);
  740.             set_MMI_matrix_main_menu_theme();
  741.             gui_set_fixed_matrix_menu_theme(&MMI_fixed_matrix_menu, current_UI_theme->fixed_matrix_menu_theme);
  742.             gui_set_fixed_icontext_menuitem_theme(
  743.                 &MMI_fixed_icontext_menuitem,
  744.                 current_UI_theme->fixed_icontext_menuitem_theme);
  745.             register_fixed_matrix_highlight_handler(standard_animated_matrix_highlight_handler_full_background);
  746.         #ifdef __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__
  747.             move_fixed_matrix(0, 0);
  748.             resize_fixed_matrix(MMI_content_width, MMI_content_height + MMI_title_height);
  749.         #else /* __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__ */ 
  750.             move_fixed_matrix(0, (MMI_title_y + MMI_title_height));
  751.             resize_fixed_matrix(MMI_content_width, MMI_content_height);
  752.         #endif /* __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__ */ 
  753.             if (number_of_items > 9)
  754.             {
  755.                 ixsize = (MMI_content_width - MMI_fixed_matrix_menu.vbar.width - 6) / 3;
  756.             }
  757.             else
  758.             {
  759.                 ixsize = (MMI_content_width - 6) / 3;
  760.             }
  761.             iysize = (MMI_content_height - 6) / 3;
  762.             /* use image height as item height */
  763.             gui_measure_image(get_image(list_of_icons[0]), &ixsize, &iysize);
  764.             configure_fixed_matrix(ixsize, iysize, 3, 0);
  765.             shortcut_width = set_menu_item_count(number_of_items) + 7;  /* keep for calculate the buffer size */
  766.         #ifdef __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__
  767.             disable_menu_shortcut_box_display = 1;  /* don't show shortcut box */
  768.             MMI_softkeys[MMI_LEFT_SOFTKEY].clicked_down_text_color = MMI_softkeys[MMI_LEFT_SOFTKEY].normal_up_text_color = gui_color(255, 255, 50);     /* customizable */
  769.             MMI_softkeys[MMI_RIGHT_SOFTKEY].clicked_down_text_color = MMI_softkeys[MMI_RIGHT_SOFTKEY].normal_up_text_color = gui_color(255, 255, 255);  /* customizable */
  770.             inMatrixNoTitleFlag = TRUE;
  771.         #else /* __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__ */ 
  772.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  773.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  774.             register_hide_menu_shortcut(draw_title);
  775.             disable_menu_shortcut_box_display = 0;  /* don't show shortcut box */
  776.             inMatrixNoTitleFlag = FALSE;
  777.         #endif /* __MMI_MATRIX_MAIN_MENU_NO_TITLEBAR__ */ 
  778.             set_fixed_icontext_positions(0, 0, 0, 0);
  779.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
  780.             MMI_softkeys[MMI_LEFT_SOFTKEY].flags |= UI_BUTTON_DISABLE_BACKGND_DISPLAY;  /* don't clean each softkey becuase of cleaning all softkey background */
  781.             MMI_softkeys[MMI_RIGHT_SOFTKEY].flags |= UI_BUTTON_DISABLE_BACKGND_DISPLAY; /* don't clean each softkey becuase of cleaning all softkey background */
  782.         #endif 
  783.             h_flag = set_matrix_menu_category_history(MMI_CATEGORY14_MATRIX_ID, history_buffer);
  784.             if (h_flag)
  785.         #ifdef __MMI_WGUI_MINI_TAB_BAR__
  786.                 if (wgui_if_mini_tab_bar_in_parent() == MMI_TRUE)
  787.                 {
  788.                     S32 idx = (S32) wgui_mini_tab_bar_get_index();
  789.                     fixed_matrix_goto_item_no_redraw(idx);
  790.                 }
  791.                 else
  792.         #endif /* __MMI_WGUI_MINI_TAB_BAR__ */ 
  793.                     fixed_matrix_goto_item_no_redraw(MMI_fixed_matrix_menu.highlighted_item);
  794.             else
  795.             {
  796.                 if (history_buffer != NULL && main_menu_index != -1)
  797.                 {
  798.                     highlighted_item = main_menu_index;
  799.                 }
  800.                 fixed_matrix_goto_item_no_redraw(highlighted_item);
  801.             }
  802.             MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE;
  803.             SetKeyHandler(fixed_matrix_goto_previous_item, KEY_VOL_UP, KEY_EVENT_DOWN);
  804.             SetKeyHandler(fixed_matrix_goto_next_item, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  805.             dm_data.s32CatId = MMI_CATEGORY14_MATRIX_ID;
  806.             break;
  807.         #if(ENABLE_CIRCULAR_3D_MENU)
  808.         case CIRCULAR_3D_MENU:
  809.             entry_full_screen();
  810.             MMI_current_menu_type = CIRCULAR_3D_MENU;
  811.             create_circular_3d_menu(number_of_items, list_of_items, list_of_icons);
  812.             register_circular_3d_menu_keys();
  813.             register_circular_3d_highlight_handler(standard_circular_3d_highlight_handler);
  814.             register_3d_menu_shortcut_handler();
  815.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  816.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  817.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  818.             register_hide_menu_shortcut(show_circular_3d_menu);
  819.             h_flag = set_circular_menu_category_history(MMI_CATEGORY14_CIRCULAR_ID, history_buffer);
  820.             if (h_flag)
  821.             {
  822.                 circular_3d_menu_goto_item_no_redraw(wgui_CM3D_menu.highlighted_item);
  823.             }
  824.             else
  825.             {
  826.                 if (history_buffer != NULL && main_menu_index != -1)
  827.                 {
  828.                     highlighted_item = main_menu_index;
  829.                 }
  830.                 circular_3d_menu_goto_item_no_redraw(highlighted_item);
  831.             }
  832.             dm_data.s32CatId = MMI_CATEGORY14_CIRCULAR_ID;
  833.             break;
  834.         #endif /* (ENABLE_CIRCULAR_3D_MENU) */ 
  835.         #if(ENABLE_ROTATE_MENU)
  836.         case ROTATE_MENU:
  837.             entry_full_screen();
  838.             MMI_current_menu_type = ROTATE_MENU;
  839.             highlighted_item = number_of_items - 1;
  840.             create_circular_3d_menu(number_of_items, list_of_items, list_of_icons);
  841.             register_rotate_menu_keys();
  842.             register_circular_3d_highlight_handler(standard_circular_3d_highlight_handler);
  843.             register_3d_menu_shortcut_handler();
  844.             shortcut_width = set_menu_item_count(number_of_items) + 7;
  845.             resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  846.         #ifdef ROTATE_VERT_LINE_RIGHT
  847.             move_menu_shortcut_handler(0, MMI_title_y);
  848.         #else 
  849.             move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  850.         #endif 
  851.             register_hide_menu_shortcut(show_circular_3d_menu);
  852.             h_flag = set_circular_menu_category_history(MMI_CATEGORY14_ROTATE_ID, history_buffer);
  853.             if (h_flag)
  854.             {
  855.                 circular_3d_menu_goto_item_no_redraw(wgui_CM3D_menu.highlighted_item);
  856.             }
  857.             else
  858.             {
  859.                 if (history_buffer != NULL && main_menu_index != -1)
  860.                 {
  861.                     highlighted_item = main_menu_index - 1;
  862.                 }
  863.                 circular_3d_menu_goto_item_no_redraw(highlighted_item);
  864.             }
  865.             dm_data.s32CatId = MMI_CATEGORY14_ROTATE_ID;
  866.             break;
  867.         #endif /* (ENABLE_ROTATE_MENU) */ 
  868.     }
  869. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  870.     leave_full_screen();
  871. #endif 
  872.     gdi_layer_unlock_frame_buffer();
  873.     ExitCategoryFunction = ExitCategory14Screen;
  874.     UI_hide_animation_frame_function = hide_main_menu_animation_frame;
  875.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory14History, GetCategory14HistorySize);
  876.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  877.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  878.     dm_setup_data(&dm_data);
  879.     dm_redraw_category_screen();
  880. }
  881. /*****************************************************************************
  882.  * FUNCTION
  883.  *  ExitCategory14Screen
  884.  * DESCRIPTION
  885.  *  Exits the category14 screen
  886.  * PARAMETERS
  887.  *  void
  888.  * RETURNS
  889.  *  void
  890.  *****************************************************************************/
  891. void ExitCategory14Screen(void)
  892. {
  893. #if((ENABLE_CIRCULAR_3D_MENU) || (ENABLE_ROTATE_MENU))
  894.     /*----------------------------------------------------------------*/
  895.     /* Local Variables                                                */
  896.     /*----------------------------------------------------------------*/
  897.     /*----------------------------------------------------------------*/
  898.     /* Code Body                                                      */
  899.     /*----------------------------------------------------------------*/
  900.     if (MMI_main_menu_type == CIRCULAR_3D_MENU || MMI_main_menu_type == ROTATE_MENU)
  901.     {
  902.         stop_rotate_circular_menu();
  903.     }
  904. #endif /* ((ENABLE_CIRCULAR_3D_MENU) || (ENABLE_ROTATE_MENU)) */ 
  905.     UI_enable_alignment_timers();
  906.     ClearHighlightHandler();
  907. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  908.     gui_unblock_list_effect();
  909. #endif 
  910.     UI_hide_animation_frame_function = UI_dummy_function;
  911.     gui_hide_animations();
  912. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  913.     MMI_title_x = MMI_TITLE_X;
  914.     MMI_title_width = UI_device_width;
  915.     MMI_title_height = MMI_TITLE_HEIGHT;
  916.     MMI_content_y = MMI_CONTENT_Y;
  917.     MMI_content_height = MMI_CONTENT_HEIGHT;
  918. #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  919.     switch (MMI_current_menu_type)
  920.     {
  921.         case ANI_BG_LIST_MENU:
  922.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_CENTER_HIGHLIGHTED;
  923.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
  924.             MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_BACKGROUND;
  925.             set_MMI_list_sub_menu_theme();
  926.             gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  927.             gui_set_fixed_icontext_menuitem_theme(
  928.                 &MMI_fixed_icontext_menuitem,
  929.                 current_UI_theme->fixed_icontext_menuitem_theme);
  930.             break;
  931.         case LIST_MENU:
  932.         case PAGE_MENU:
  933.             /* disable lines grids on this category screen */
  934.     #ifdef __MMI_UI_MM_LIST_NO_GRID__
  935.             gui_enable_fixed_list_line_draw();
  936.     #endif 
  937.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_FOCUSSED_ANIMATE;
  938.             set_MMI_list_sub_menu_theme();
  939.             gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  940.             gui_set_fixed_icontext_menuitem_theme(
  941.                 &MMI_fixed_icontext_menuitem,
  942.                 current_UI_theme->fixed_icontext_menuitem_theme);
  943.     #ifdef __MMI_MAINLCD_240X320__
  944.             title_bg_id = 0;
  945.     #endif 
  946.             /* PMT VIKAS START 20051209 */
  947.     #if(TITLE_TRANSITION_STYLE_NON_BLOCKING)
  948.             disable_title_transition();
  949.     #endif 
  950.             /* PMT VIKAS END 20051209 */
  951.             break;
  952.         case FIXED_GRID_MENU:
  953.     #if(ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
  954.             wgui_close_main_menu();
  955.             break;
  956.     #endif /* (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION) */ 
  957.         case MATRIX_MENU:
  958.             MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_FOCUSSED_ANIMATE;
  959.             MMI_fixed_matrix_menu.flags &= ~UI_MATRIX_MENU_FOR_MAINMENU;
  960.     #if(UI_MAIN_MENU_CATEGORY_TYPE == UI_MAIN_MENU_CATEGORY_TYPE2)
  961.             set_MMI_matrix_sub_menu_theme();
  962.             gui_set_fixed_matrix_menu_theme(&MMI_fixed_matrix_menu, current_UI_theme->fixed_matrix_menu_theme);
  963.             gui_set_fixed_icontext_menuitem_theme(
  964.                 &MMI_fixed_icontext_menuitem,
  965.                 current_UI_theme->fixed_icontext_menuitem_theme);
  966.         #if defined(__MMI_WALLPAPER_ON_BOTTOM__) || defined (__MMI_KP_STYLE_MAIN_MENU_MATRIX__)  //KP Jerry add "__MMI_KP_STYLE_MAIN_MENU_MATRIX__" for KP-Style 12-Matrix mainmenu on 2007-3-19
  967.             title_bg_id = 0;
  968.             dm_set_scr_bg_flag(mm_bg_flags);
  969.             //dm_set_scr_bg_image(mm_bg_ID, mm_bg_filename, mm_bg_x, mm_bg_y, mm_bg_opacity);
  970.          #ifndef __MMI_KP_STYLE_MAIN_MENU_MATRIX__     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19  
  971.             dm_set_scr_bg_image_no_draw(mm_bg_ID, mm_bg_filename, mm_bg_x, mm_bg_y, mm_bg_opacity);
  972.   #endif     //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
  973.             wgui_reset_wallpaper_on_bottom();
  974.         #endif 
  975.     #elif defined(__MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__) && (UI_MAIN_MENU_CATEGORY_TYPE==UI_MAIN_MENU_CATEGORY_TYPE3)
  976.             set_MMI_matrix_sub_menu_theme();
  977.             gui_set_fixed_matrix_menu_theme(&MMI_fixed_matrix_menu, current_UI_theme->fixed_matrix_menu_theme);
  978.             gui_set_fixed_icontext_menuitem_theme(
  979.                 &MMI_fixed_icontext_menuitem,
  980.                 current_UI_theme->fixed_icontext_menuitem_theme);
  981.             disable_menu_shortcut_box_display = 0;
  982.             MMI_softkeys[MMI_LEFT_SOFTKEY].flags &= ~UI_BUTTON_DISABLE_BACKGND_DISPLAY;
  983.             MMI_softkeys[MMI_RIGHT_SOFTKEY].flags &= ~UI_BUTTON_DISABLE_BACKGND_DISPLAY;
  984.             restore_softkeys();
  985.             inMatrixNoTitleFlag = FALSE;
  986.     #endif 
  987.             break;
  988.     }
  989.     reset_softkeys();
  990.     reset_menu_shortcut_handler();
  991.     reset_fixed_list();
  992.     reset_fixed_matrix();
  993. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  994.     arrange_status_icons();
  995.     leave_full_screen();
  996. #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  997.     ExitCategoryFunction = MMI_dummy_function;
  998.     RedrawCategoryFunction = MMI_dummy_function;
  999.     GetCategoryHistory = dummy_get_history;
  1000.     GetCategoryHistorySize = dummy_get_history_size;
  1001. }
  1002. /*****************************************************************************
  1003.  * FUNCTION
  1004.  *  GetCategory14HistorySize
  1005.  * DESCRIPTION
  1006.  *  Gets the history buffer size for the category14 screen
  1007.  * PARAMETERS
  1008.  *  void
  1009.  * RETURNS
  1010.  *  size in U8s of the history buffer
  1011.  *****************************************************************************/
  1012. S32 GetCategory14HistorySize(void)
  1013. {
  1014.     /*----------------------------------------------------------------*/
  1015.     /* Local Variables                                                */
  1016.     /*----------------------------------------------------------------*/
  1017.     /*----------------------------------------------------------------*/
  1018.     /* Code Body                                                      */
  1019.     /*----------------------------------------------------------------*/
  1020.     switch (MMI_current_menu_type)
  1021.     {
  1022.         case ANI_BG_LIST_MENU:
  1023.         case LIST_MENU:
  1024.         case PAGE_MENU:
  1025.             return (sizeof(list_menu_category_history));
  1026.             break;
  1027.         case FIXED_GRID_MENU:
  1028.     #if(ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
  1029.             return (sizeof(matrix_main_menu_category_history));
  1030.             break;
  1031.     #endif /* (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION) */ 
  1032.         case MATRIX_MENU:
  1033.             return (sizeof(matrix_menu_category_history));
  1034.             break;
  1035.     #if(ENABLE_CIRCULAR_3D_MENU)
  1036.         case CIRCULAR_3D_MENU:
  1037.             return (sizeof(circular_menu_category_history));
  1038.             break;
  1039.     #endif /* (ENABLE_CIRCULAR_3D_MENU) */ 
  1040.     #if(ENABLE_ROTATE_MENU)
  1041.         case ROTATE_MENU:
  1042.             return (sizeof(circular_menu_category_history));
  1043.             break;
  1044.     #endif /* (ENABLE_ROTATE_MENU) */ 
  1045.     }
  1046.     return (0);
  1047. }
  1048. /*****************************************************************************
  1049.  * FUNCTION
  1050.  *  GetCategory14History
  1051.  * DESCRIPTION
  1052.  *  Gets the history buffer for the category14 screen
  1053.  * PARAMETERS
  1054.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1055.  * RETURNS
  1056.  *  pointer to the history buffer
  1057.  *****************************************************************************/
  1058. U8 *GetCategory14History(U8 *history_buffer)
  1059. {
  1060.     /*----------------------------------------------------------------*/
  1061.     /* Local Variables                                                */
  1062.     /*----------------------------------------------------------------*/
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Code Body                                                      */
  1065.     /*----------------------------------------------------------------*/
  1066.     switch (MMI_current_menu_type)
  1067.     {
  1068.         case ANI_BG_LIST_MENU:
  1069.         case LIST_MENU:
  1070.         case PAGE_MENU:
  1071.             get_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
  1072.             break;
  1073.         case FIXED_GRID_MENU:
  1074.     #if(ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
  1075.             get_matrix_main_menu_category_history(MMI_CATEGORY14_MATRIX_ID, history_buffer);
  1076.             break;
  1077.     #endif /* (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION) */ 
  1078.         case MATRIX_MENU:
  1079.             get_matrix_menu_category_history(MMI_CATEGORY14_MATRIX_ID, history_buffer);
  1080.             break;
  1081.     #if(ENABLE_CIRCULAR_3D_MENU)
  1082.         case CIRCULAR_3D_MENU:
  1083.             get_circular_menu_category_history(MMI_CATEGORY14_CIRCULAR_ID, history_buffer);
  1084.             break;
  1085.     #endif /* (ENABLE_CIRCULAR_3D_MENU) */ 
  1086.     #if(ENABLE_ROTATE_MENU)
  1087.         case ROTATE_MENU:
  1088.             get_circular_menu_category_history(MMI_CATEGORY14_ROTATE_ID, history_buffer);
  1089.             break;
  1090.     #endif /* (ENABLE_ROTATE_MENU) */ 
  1091.     }
  1092.     return (history_buffer);
  1093. }
  1094. /* for new list_matrix menu style */
  1095. #ifdef __MMI_BI_DEGREE_MAIN_MENU_STYLE__
  1096. #if defined(__MMI_MAINLCD_240X320__)
  1097. #define MMI_BI_DEGREE_MAIN_MENU_LIST_WIDTH   65
  1098. #define MMI_BI_DEGREE_MAIN_MENU_COLUMN_COUNT 2
  1099. #define MMI_BI_DEGREE_MAIN_MENU_ROW_COUNT 2
  1100. #define MMI_BI_DEGREE_MAIN_MENU_ROW_RATIO 3
  1101. #else /* defined(__MMI_MAINLCD_240X320__) */ 
  1102. #define MMI_BI_DEGREE_MAIN_MENU_LIST_WIDTH   40
  1103. #define MMI_BI_DEGREE_MAIN_MENU_COLUMN_COUNT 2
  1104. #define MMI_BI_DEGREE_MAIN_MENU_ROW_COUNT 2
  1105. #define MMI_BI_DEGREE_MAIN_MENU_ROW_RATIO 2
  1106. #endif /* defined(__MMI_MAINLCD_240X320__) */ 
  1107. #define MMI_BI_DEGREE_MAIN_MENU_NAVI_BAR_HEIGHT 20
  1108. #define MMI_BI_DEGREE_MAIN_MENU_GAP    3
  1109. #define MMI_BI_DEGREE_MAIN_MENU_ICON_TEXT_GAP 3
  1110. extern void stop_fixed_icontext_menuitem_animation(S32 index);
  1111. extern void wgui_set_title_bknd_display(MMI_BOOL state);    /* 101705 */
  1112. #ifdef __MMI_BI_DEGREE_MAIN_MENU_STYLE__
  1113. extern void set_fixed_icontext_list_type2(void);
  1114. extern void create_fixed_icontext_list_menuitems2(S32 n_text_columns, S32 n_icon_columns);
  1115. extern void associate_fixed_icontext_list_list2(void);
  1116. extern void restore_fixed_icontext_list_type(void);
  1117. #endif /* __MMI_BI_DEGREE_MAIN_MENU_STYLE__ */ 
  1118. extern gdi_handle wgui_layer_1;
  1119. extern MMI_ID_TYPE idle_screen_wallpaper_ID;
  1120. MMI_BOOL back_from_history = MMI_FALSE;
  1121. /*****************************************************************************
  1122.  * FUNCTION
  1123.  *  Cat414MatrixHighlightHandler
  1124.  * DESCRIPTION
  1125.  *  highlight handler for main menu lsit of category 414 on bi degree main menu
  1126.  * PARAMETERS
  1127.  *  index       [IN]        Of current highlighted item
  1128.  * RETURNS
  1129.  *  void
  1130.  *****************************************************************************/
  1131. void Cat414MatrixHighlightHandler(S32 index)
  1132. {
  1133.     /*----------------------------------------------------------------*/
  1134.     /* Local Variables                                                */
  1135.     /*----------------------------------------------------------------*/
  1136.     /*----------------------------------------------------------------*/
  1137.     /* Code Body                                                      */
  1138.     /*----------------------------------------------------------------*/
  1139.     MMI_matrix_highlight_handler(index);
  1140.     register_fixed_matrix_loop_keys();  /* for right arrow keys */
  1141. }
  1142. /*****************************************************************************
  1143.  * FUNCTION
  1144.  *  ShowCat414Matrix
  1145.  * DESCRIPTION
  1146.  *  Displays the category414 matrix menu
  1147.  * PARAMETERS
  1148.  *  number_of_items         [IN]        Number of items in the menu
  1149.  *  list_of_items           [IN]        Array of items
  1150.  *  list_of_icons           [IN]        Array of icons
  1151.  *  flags                   [IN]        
  1152.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  1153.  *  history_buffer          [IN]        History buffer
  1154.  * RETURNS
  1155.  *  void
  1156.  *****************************************************************************/
  1157. void ShowCat414Matrix(
  1158.         S32 number_of_items,
  1159.         U16 *list_of_items,
  1160.         U16 *list_of_icons,
  1161.         S32 flags,
  1162.         S32 highlighted_item,
  1163.         matrix_menu_category_history *history_buffer)
  1164. {
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Local Variables                                                */
  1167.     /*----------------------------------------------------------------*/
  1168.     S32 i;
  1169.     S32 symbol_width = 0, symbol_height = 0, width = 0, height = 0, str_width = 0, str_height = 0;
  1170.     S32 item_width = 0, item_height = 0;
  1171.     /*----------------------------------------------------------------*/
  1172.     /* Code Body                                                      */
  1173.     /*----------------------------------------------------------------*/
  1174.     Cat414MatrixExitHandler = stop_fixed_icontext_menuitem_animation;
  1175.     gdi_layer_lock_frame_buffer();
  1176.     PowerAndEndKeyHandler();
  1177.     MMI_current_menu_type = LIST_MATRIX_MENU;
  1178.     create_fixed_icontext_menuitems();
  1179.     associate_fixed_icontext_matrix();
  1180.     set_MMI_current_fixed_icontext_menuitem_theme_matrix_bidegree_menu();
  1181.     gui_set_fixed_icontext_menuitem_current_theme(&MMI_fixed_icontext_menuitem);    
  1182. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1183.     enable_fixed_icontext_menuitem_transparent_effect();
  1184.     disable_fixed_icontext_menuitem_transparent_effect();
  1185. #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 
  1186.     resize_fixed_matrix(
  1187.         UI_device_width - MMI_BI_DEGREE_MAIN_MENU_LIST_WIDTH,
  1188.         UI_device_height - MMI_title_height - MMI_button_bar_height - MMI_BI_DEGREE_MAIN_MENU_NAVI_BAR_HEIGHT);
  1189.     for (i = 0; i < number_of_items; i++)
  1190.     {
  1191.         PU8 img = (PU8) get_image(list_of_icons[i]);
  1192.         add_fixed_icontext_item((UI_string_type) get_string(list_of_items[i]), img);
  1193.         gui_measure_image(img, &symbol_width, &symbol_height);
  1194.         if (symbol_width > width)
  1195.         {
  1196.             width = symbol_width;
  1197.         }
  1198.         if (symbol_height > height)
  1199.         {
  1200.             height = symbol_height;
  1201.         }
  1202.     }
  1203.     gui_set_font(&MMI_default_font);
  1204.     gui_measure_string(get_string(list_of_items[0]), &str_width, &str_height);
  1205.     MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE | UI_MENUITEM_MARQUEE_SCROLL;
  1206.     MMI_fixed_matrix_menu.flags |=
  1207.         UI_MATRIX_MENU_VERTICAL_TRIGGER | UI_MATRIX_MENU_DISABLE_SCROLLBAR | UI_MATRIX_MENU_DISABLE_BACKGROUND | 
  1208.         UI_MATRIX_MENU_ALIGN_LEFT_TOP;
  1209.     register_fixed_matrix_loop_keys();
  1210.     register_fixed_matrix_highlight_handler(Cat414MatrixHighlightHandler);
  1211.     item_width =
  1212.         ((UI_device_width - MMI_BI_DEGREE_MAIN_MENU_LIST_WIDTH) / MMI_BI_DEGREE_MAIN_MENU_COLUMN_COUNT) -
  1213.         MMI_BI_DEGREE_MAIN_MENU_GAP;
  1214.     item_height = MMI_fixed_matrix_menu.height / MMI_BI_DEGREE_MAIN_MENU_ROW_RATIO;
  1215.     if ((item_height - height - str_height - MMI_BI_DEGREE_MAIN_MENU_ICON_TEXT_GAP) <= 1)       /* can't set iy=0; */
  1216.     {
  1217.         set_fixed_icontext_positions(1, item_height - str_height, 0, 1);
  1218.     }
  1219.     else
  1220.     {
  1221.         set_fixed_icontext_positions(
  1222.             1,
  1223.             item_height - str_height,
  1224.             0,
  1225.             (item_height - height - str_height - MMI_BI_DEGREE_MAIN_MENU_ICON_TEXT_GAP) >> 1);
  1226.     }
  1227.     configure_fixed_matrix(
  1228.         item_width,
  1229.         item_height,
  1230.         MMI_BI_DEGREE_MAIN_MENU_COLUMN_COUNT,
  1231.         MMI_BI_DEGREE_MAIN_MENU_ROW_COUNT);
  1232.     move_fixed_matrix(MMI_BI_DEGREE_MAIN_MENU_LIST_WIDTH, MMI_title_height);
  1233.     if (back_from_history == MMI_TRUE)
  1234.     {
  1235.         set_matrix_menu_category_history(MMI_CATEGORY414_ID, (U8*) history_buffer);
  1236.         fixed_matrix_goto_item_no_redraw(MMI_fixed_matrix_menu.highlighted_item);
  1237.         back_from_history = MMI_FALSE;
  1238.     }
  1239.     else
  1240.     {
  1241.         fixed_matrix_goto_item_no_redraw(highlighted_item);
  1242.     }
  1243.     MMI_disable_title_shortcut_display = 1;
  1244.     show_fixed_matrix();
  1245.     gdi_layer_unlock_frame_buffer();
  1246.     gdi_layer_blt_previous(
  1247.         MMI_fixed_matrix_menu.x,
  1248.         MMI_fixed_matrix_menu.y,
  1249.         MMI_fixed_matrix_menu.x + MMI_fixed_matrix_menu.width - 1,
  1250.         MMI_fixed_matrix_menu.y + MMI_fixed_matrix_menu.height);
  1251. }
  1252. /*****************************************************************************
  1253.  * FUNCTION
  1254.  *  ExitCategory414Screen
  1255.  * DESCRIPTION
  1256.  *  Exits the category414 screen
  1257.  * PARAMETERS
  1258.  *  void
  1259.  * RETURNS
  1260.  *  void
  1261.  *****************************************************************************/
  1262. void ExitCategory414Screen(void)
  1263. {
  1264.     /*----------------------------------------------------------------*/
  1265.     /* Local Variables                                                */
  1266.     /*----------------------------------------------------------------*/
  1267.     /*----------------------------------------------------------------*/
  1268.     /* Code Body                                                      */
  1269.     /*----------------------------------------------------------------*/
  1270.     UI_enable_alignment_timers();
  1271.     ClearHighlightHandler();
  1272. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1273.     gui_unblock_list_effect();  /* 072505 Calvin added */
  1274. #endif 
  1275.     UI_hide_animation_frame_function = UI_dummy_function;
  1276.     gui_hide_animations();
  1277. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1278.     enable_fixed_icontext_menuitem_transparent_effect();
  1279. #endif 
  1280.     MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_FOCUSSED_ANIMATE | UI_MENUITEM_MARQUEE_SCROLL;
  1281.     MMI_fixed_icontext_list_menuitem.flags &= ~UI_MENUITEM_DISABLE_TEXT_DISPLAY | UI_MENUITEM_HIGHLIGHT_SWITCH_ICON;
  1282.     MMI_fixed_matrix_menu.flags &= ~(UI_MATRIX_MENU_LOOP | UI_MATRIX_MENU_VERTICAL_TRIGGER | UI_MATRIX_MENU_ALIGN_LEFT_TOP);
  1283.     MMI_fixed_matrix_menu.flags &= ~UI_MATRIX_MENU_DISABLE_SCROLLBAR;
  1284.     MMI_fixed_matrix_menu.flags &= ~UI_MATRIX_MENU_DISABLE_BACKGROUND;
  1285.     MMI_fixed_matrix_menu.trigger_top_function = UI_dummy_function;
  1286.     MMI_fixed_matrix_menu.trigger_bottom_function = UI_dummy_function;
  1287.     gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  1288.     gui_set_fixed_icontext_list_menuitem_theme(
  1289.         &MMI_fixed_icontext_list_menuitem,
  1290.         current_UI_theme->fixed_icontext_list_menuitem_theme);
  1291.     set_MMI_matrix_sub_menu_theme();
  1292.     gui_set_fixed_matrix_menu_current_theme(&MMI_fixed_matrix_menu);
  1293.     gui_set_fixed_icontext_menuitem_current_theme(&MMI_fixed_icontext_menuitem);    
  1294.         
  1295.     reset_softkeys();
  1296.     reset_menu_shortcut_handler();
  1297.     reset_fixed_list();
  1298.     enable_softkey_background();
  1299.     gdi_layer_multi_layer_disable();
  1300.     wgui_set_title_bknd_display(MMI_TRUE);
  1301. }
  1302. /*****************************************************************************
  1303.  * FUNCTION
  1304.  *  GetCategory414HistorySize
  1305.  * DESCRIPTION
  1306.  *  Gets the history buffer size for the category414 screen
  1307.  * PARAMETERS
  1308.  *  void
  1309.  * RETURNS
  1310.  *  size in U8s of the history buffer
  1311.  *****************************************************************************/
  1312. S32 GetCategory414HistorySize(void)
  1313. {
  1314.     /*----------------------------------------------------------------*/
  1315.     /* Local Variables                                                */
  1316.     /*----------------------------------------------------------------*/
  1317.     /*----------------------------------------------------------------*/
  1318.     /* Code Body                                                      */
  1319.     /*----------------------------------------------------------------*/
  1320.     return sizeof(list_matrix_menu_category_history);
  1321. }
  1322. /*****************************************************************************
  1323.  * FUNCTION
  1324.  *  GetCategory414History
  1325.  * DESCRIPTION
  1326.  *  Gets the history buffer for the category14 screen
  1327.  * PARAMETERS
  1328.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1329.  * RETURNS
  1330.  *  pointer to the history buffer
  1331.  *****************************************************************************/
  1332. U8 *GetCategory414History(U8 *history_buffer)
  1333. {
  1334.     /*----------------------------------------------------------------*/
  1335.     /* Local Variables                                                */
  1336.     /*----------------------------------------------------------------*/
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Code Body                                                      */
  1339.     /*----------------------------------------------------------------*/
  1340.     get_list_matrix_menu_category_history(MMI_CATEGORY414_ID, history_buffer);
  1341.     return history_buffer;
  1342. }
  1343. /*****************************************************************************
  1344.  * FUNCTION
  1345.  *  cat14_list_highlight_handler
  1346.  * DESCRIPTION
  1347.  *  highlight handler for main menu lsit of category 14 on bi degree
  1348.  * PARAMETERS
  1349.  *  index       [IN]        Of current highlighted item
  1350.  * RETURNS
  1351.  *  void
  1352.  *****************************************************************************/
  1353. void cat14_list_highlight_handler(S32 index)
  1354. {
  1355.     /*----------------------------------------------------------------*/
  1356.     /* Local Variables                                                */
  1357.     /*----------------------------------------------------------------*/
  1358.     /*----------------------------------------------------------------*/
  1359.     /* Code Body                                                      */
  1360.     /*----------------------------------------------------------------*/
  1361.     if (Cat414MatrixExitHandler != NULL)
  1362.     {
  1363.         Cat414MatrixExitHandler(MMI_fixed_matrix_menu.highlighted_item);
  1364.     }
  1365.     MMI_list_highlight_handler(index);
  1366. }
  1367. /*****************************************************************************
  1368.  * FUNCTION
  1369.  *  wgui_list_matrix_menu_hide_lsk
  1370.  * DESCRIPTION
  1371.  *  left softkey hide function on bi degree
  1372.  * PARAMETERS
  1373.  *  void
  1374.  * RETURNS
  1375.  *  void
  1376.  *****************************************************************************/
  1377. void wgui_list_matrix_menu_hide_lsk(void)
  1378. {
  1379.     /*----------------------------------------------------------------*/
  1380.     /* Local Variables                                                */
  1381.     /*----------------------------------------------------------------*/
  1382.     /*----------------------------------------------------------------*/
  1383.     /* Code Body                                                      */
  1384.     /*----------------------------------------------------------------*/
  1385.     gdi_layer_push_clip();
  1386.     gdi_layer_set_clip(0, UI_device_height - MMI_button_bar_height, UI_device_width - 1, UI_device_height - 1);
  1387.     gdi_draw_solid_rect(
  1388.         MMI_softkeys[MMI_LEFT_SOFTKEY].x,
  1389.         UI_device_height - MMI_button_bar_height,
  1390.         MMI_softkeys[MMI_LEFT_SOFTKEY].x + MMI_softkeys[MMI_LEFT_SOFTKEY].width,
  1391.         UI_device_height - 1,
  1392.         GDI_COLOR_TRANSPARENT);
  1393.     gdi_layer_pop_clip();
  1394. }
  1395. /*****************************************************************************
  1396.  * FUNCTION
  1397.  *  wgui_list_matrix_menu_hide_rsk
  1398.  * DESCRIPTION
  1399.  *  right softkey hide function on bi degree
  1400.  * PARAMETERS
  1401.  *  void
  1402.  * RETURNS
  1403.  *  void
  1404.  *****************************************************************************/
  1405. void wgui_list_matrix_menu_hide_rsk(void)
  1406. {
  1407.     /*----------------------------------------------------------------*/
  1408.     /* Local Variables                                                */
  1409.     /*----------------------------------------------------------------*/
  1410.     /*----------------------------------------------------------------*/
  1411.     /* Code Body                                                      */
  1412.     /*----------------------------------------------------------------*/
  1413.     gdi_layer_push_clip();
  1414.     gdi_layer_set_clip(0, UI_device_height - MMI_button_bar_height, UI_device_width - 1, UI_device_height - 1);
  1415.     gdi_draw_solid_rect(
  1416.         MMI_softkeys[MMI_RIGHT_SOFTKEY].x,
  1417.         UI_device_height - MMI_button_bar_height,
  1418.         MMI_softkeys[MMI_RIGHT_SOFTKEY].x + MMI_softkeys[MMI_RIGHT_SOFTKEY].width,
  1419.         UI_device_height - 1,
  1420.         GDI_COLOR_TRANSPARENT);
  1421.     gdi_layer_pop_clip();
  1422. }
  1423. #ifdef __MMI_TOUCH_SCREEN__
  1424. /*****************************************************************************
  1425.  * FUNCTION
  1426.  *  Cate414CategoryControlAreaPenDownHandler
  1427.  * DESCRIPTION
  1428.  *  
  1429.  * PARAMETERS
  1430.  *  point       [IN]        
  1431.  * RETURNS
  1432.  *  
  1433.  *****************************************************************************/
  1434. MMI_BOOL Cate414CategoryControlAreaPenDownHandler(mmi_pen_point_struct point)
  1435. {
  1436.     /*----------------------------------------------------------------*/
  1437.     /* Local Variables                                                */
  1438.     /*----------------------------------------------------------------*/
  1439.     /*----------------------------------------------------------------*/
  1440.     /* Code Body                                                      */
  1441.     /*----------------------------------------------------------------*/
  1442.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_DOWN);
  1443. }
  1444. /*****************************************************************************
  1445.  * FUNCTION
  1446.  *  Cate414CategoryControlAreaPenUpHandler
  1447.  * DESCRIPTION
  1448.  *  
  1449.  * PARAMETERS
  1450.  *  point       [IN]        
  1451.  * RETURNS
  1452.  *  
  1453.  *****************************************************************************/
  1454. MMI_BOOL Cate414CategoryControlAreaPenUpHandler(mmi_pen_point_struct point)
  1455. {
  1456.     /*----------------------------------------------------------------*/
  1457.     /* Local Variables                                                */
  1458.     /*----------------------------------------------------------------*/
  1459.     /*----------------------------------------------------------------*/
  1460.     /* Code Body                                                      */
  1461.     /*----------------------------------------------------------------*/
  1462.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1463. }
  1464. /*****************************************************************************
  1465.  * FUNCTION
  1466.  *  Cate414CategoryControlAreaPenAbortHandler
  1467.  * DESCRIPTION
  1468.  *  
  1469.  * PARAMETERS
  1470.  *  point       [IN]        
  1471.  * RETURNS
  1472.  *  
  1473.  *****************************************************************************/
  1474. MMI_BOOL Cate414CategoryControlAreaPenAbortHandler(mmi_pen_point_struct point)
  1475. {
  1476.     /*----------------------------------------------------------------*/
  1477.     /* Local Variables                                                */
  1478.     /*----------------------------------------------------------------*/
  1479.     /*----------------------------------------------------------------*/
  1480.     /* Code Body                                                      */
  1481.     /*----------------------------------------------------------------*/
  1482.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1483. }
  1484. /*****************************************************************************
  1485.  * FUNCTION
  1486.  *  Cate414CategoryControlAreaPenLongTapHandler
  1487.  * DESCRIPTION
  1488.  *  
  1489.  * PARAMETERS
  1490.  *  point       [IN]        
  1491.  * RETURNS
  1492.  *  
  1493.  *****************************************************************************/
  1494. MMI_BOOL Cate414CategoryControlAreaPenLongTapHandler(mmi_pen_point_struct point)
  1495. {
  1496.     /*----------------------------------------------------------------*/
  1497.     /* Local Variables                                                */
  1498.     /*----------------------------------------------------------------*/
  1499.     /*----------------------------------------------------------------*/
  1500.     /* Code Body                                                      */
  1501.     /*----------------------------------------------------------------*/
  1502.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1503. }
  1504. /*****************************************************************************
  1505.  * FUNCTION
  1506.  *  Cate414CategoryControlAreaPenRepeatHandler
  1507.  * DESCRIPTION
  1508.  *  
  1509.  * PARAMETERS
  1510.  *  point       [IN]        
  1511.  * RETURNS
  1512.  *  
  1513.  *****************************************************************************/
  1514. MMI_BOOL Cate414CategoryControlAreaPenRepeatHandler(mmi_pen_point_struct point)
  1515. {
  1516.     /*----------------------------------------------------------------*/
  1517.     /* Local Variables                                                */
  1518.     /*----------------------------------------------------------------*/
  1519.     /*----------------------------------------------------------------*/
  1520.     /* Code Body                                                      */
  1521.     /*----------------------------------------------------------------*/
  1522.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1523. }
  1524. /*****************************************************************************
  1525.  * FUNCTION
  1526.  *  Cate414CategoryControlAreaPenMoveHandler
  1527.  * DESCRIPTION
  1528.  *  
  1529.  * PARAMETERS
  1530.  *  point       [IN]        
  1531.  * RETURNS
  1532.  *  
  1533.  *****************************************************************************/
  1534. MMI_BOOL Cate414CategoryControlAreaPenMoveHandler(mmi_pen_point_struct point)
  1535. {
  1536.     /*----------------------------------------------------------------*/
  1537.     /* Local Variables                                                */
  1538.     /*----------------------------------------------------------------*/
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Code Body                                                      */
  1541.     /*----------------------------------------------------------------*/
  1542.     return wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  1543. }
  1544. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1545. /*****************************************************************************
  1546.  * FUNCTION
  1547.  *  ShowCategory414Screen
  1548.  * DESCRIPTION
  1549.  *  Displays the category414 screen . this is a scrren to show main menu
  1550.  * PARAMETERS
  1551.  *  title                   [IN]        Title for the screen
  1552.  *  title_icon              [IN]        Icon displayed with the title
  1553.  *  left_softkey            [IN]        Left softkey label
  1554.  *  left_softkey_icon       [IN]        Left softkey icon
  1555.  *  right_softkey           [IN]        Right softkey label
  1556.  *  right_softkey_icon      [IN]        Right softkey icon
  1557.  *  number_of_items         [IN]        Number of items in the menu
  1558.  *  list_of_items           [IN]        Array of items
  1559.  *  list_of_icons           [IN]        Array of icons
  1560.  *  list_of_icons2          [IN]        Array of icons
  1561.  *  list_of_menuitem_id     [IN]        
  1562.  *  flags                   [IN]        
  1563.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  1564.  *  history_buffer          [IN]        History buffer
  1565.  * RETURNS
  1566.  *  void
  1567.  *****************************************************************************/
  1568. void ShowCategory414Screen(
  1569.         U16 title,
  1570.         U16 title_icon,
  1571.         U16 left_softkey,
  1572.         U16 left_softkey_icon,
  1573.         U16 right_softkey,
  1574.         U16 right_softkey_icon,
  1575.         S32 number_of_items,
  1576.         U16 *list_of_items,
  1577.         U16 *list_of_icons,
  1578.         U16 *list_of_icons2,
  1579.         U16 *list_of_menuitem_id,
  1580.         S32 flags,
  1581.         S32 highlighted_item,
  1582.         U8 *history_buffer)
  1583. {
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Local Variables                                                */
  1586.     /*----------------------------------------------------------------*/
  1587.     dm_data_struct dm_data;
  1588.     S32 i;
  1589.     U8 h_flag;
  1590.     S32 ixsize, iysize;
  1591.     gdi_handle base_layer_handle;
  1592.     /*----------------------------------------------------------------*/
  1593.     /* Code Body                                                      */
  1594.     /*----------------------------------------------------------------*/
  1595.     gdi_layer_lock_frame_buffer();
  1596. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1597.     gui_block_list_effect();
  1598. #endif 
  1599.     Cat414MatrixExitHandler = NULL;
  1600.     UI_disable_alignment_timers();
  1601.     MMI_menu_shortcut_number = -1;
  1602.     entry_full_screen();
  1603.     disable_softkey_background();
  1604.     wgui_set_title_bknd_display(MMI_FALSE);
  1605.     gdi_layer_get_base_handle(&base_layer_handle);
  1606.     gdi_layer_set_active(base_layer_handle);
  1607.     gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  1608.     gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  1609.     MMI_title_string = get_string(title);
  1610.     MMI_title_icon = get_image(title_icon);
  1611.     change_left_softkey(left_softkey, left_softkey_icon);
  1612.     change_right_softkey(right_softkey, right_softkey_icon);
  1613.     SetupCategoryKeyHandlers();
  1614.     register_hide_left_softkey(wgui_list_matrix_menu_hide_lsk);
  1615.     register_hide_right_softkey(wgui_list_matrix_menu_hide_rsk);
  1616.     create_fixed_icontext_menuitems();
  1617.     set_fixed_icontext_list_type2();
  1618.     create_fixed_icontext_list_menuitems2(1, 2);
  1619.     gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
  1620.     gui_set_fixed_icontext_list_menuitem_theme(
  1621.         &MMI_fixed_icontext_list_menuitem,
  1622.         current_UI_theme->fixed_icontext_list_menuitem_theme);
  1623.     associate_fixed_icontext_list_list2();
  1624.     wgui_register_list_item_selected_callback_all(UI_dummy_function);
  1625. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  1626.     disable_fixed_icontext_menuitem_transparent_effect();
  1627. #endif 
  1628.     gui_measure_image(get_image(list_of_icons2[0]), &ixsize, &iysize);
  1629.     set_fixed_icontext_list_text_coordinates(0, 0, 0, 0, 0);
  1630.     set_fixed_icontext_list_icon_coordinates(0, 0, 0, ixsize, iysize);
  1631.     set_fixed_icontext_list_icon_coordinates(1, 0, 0, ixsize, iysize);
  1632.     for (i = 0; i < number_of_items; i++)
  1633.     {
  1634.         fixed_icontext_list_item_insert(i);
  1635.         add_fixed_icontext_list_item_icon(i, 0, get_image(list_of_icons[i]));
  1636.         add_fixed_icontext_list_item_icon(i, 1, get_image(list_of_icons2[i]));
  1637.         add_fixed_icontext_list_item_text(i, 0, NULL);
  1638.     }
  1639.     register_fixed_list_highlight_handler(cat14_list_highlight_handler);
  1640.     resize_fixed_icontext_list_menuitems(ixsize, iysize);
  1641.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY | UI_MENUITEM_HIGHLIGHT_SWITCH_ICON;
  1642.     MMI_current_menu_type = LIST_MENU;
  1643.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR | UI_LIST_MENU_DISABLE_BACKGROUND;
  1644.     MMI_fixed_matrix_menu.trigger_top_function = fixed_list_goto_previous_item;
  1645.     MMI_fixed_matrix_menu.trigger_bottom_function = fixed_list_goto_next_item;
  1646.     h_flag = set_list_matrix_menu_category_history(MMI_CATEGORY414_ID, history_buffer);
  1647.     if (h_flag)
  1648.     {
  1649.         back_from_history = MMI_TRUE;
  1650.     }
  1651.     else
  1652.     {
  1653.         back_from_history = MMI_FALSE;
  1654.     }
  1655.     gdi_layer_unlock_frame_buffer();
  1656.     restore_fixed_icontext_list_type();
  1657.     ExitCategoryFunction = ExitCategory414Screen;
  1658.     dm_add_image(get_image(IMG_MAIN_MENU_BG), NULL, NULL);
  1659. #ifdef __MMI_TOUCH_SCREEN__
  1660.     wgui_register_category_screen_control_area_pen_handlers(
  1661.         Cate414CategoryControlAreaPenDownHandler,
  1662.         MMI_PEN_EVENT_DOWN);
  1663.     wgui_register_category_screen_control_area_pen_handlers(Cate414CategoryControlAreaPenUpHandler, MMI_PEN_EVENT_UP);
  1664.     wgui_register_category_screen_control_area_pen_handlers(
  1665.         Cate414CategoryControlAreaPenMoveHandler,
  1666.         MMI_PEN_EVENT_MOVE);
  1667.     wgui_register_category_screen_control_area_pen_handlers(
  1668.         Cate414CategoryControlAreaPenLongTapHandler,
  1669.         MMI_PEN_EVENT_LONG_TAP);
  1670.     wgui_register_category_screen_control_area_pen_handlers(
  1671.         Cate414CategoryControlAreaPenRepeatHandler,
  1672.         MMI_PEN_EVENT_REPEAT);
  1673.     wgui_register_category_screen_control_area_pen_handlers(
  1674.         Cate414CategoryControlAreaPenAbortHandler,
  1675.         MMI_PEN_EVENT_ABORT);
  1676. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1677.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory414History, GetCategory414HistorySize);
  1678.     dm_register_category_controlled_callback(NULL);
  1679.     dm_data.s32CatId = MMI_CATEGORY414_ID;
  1680.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1681.     dm_data.s32flags = 0;
  1682.     dm_setup_data(&dm_data);
  1683.     dm_redraw_category_screen();
  1684. }
  1685. #endif /* __MMI_BI_DEGREE_MAIN_MENU_STYLE__ */