⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wgui_categories_mm.c

📁 详细介绍MTK平台图层运用的好东西
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  left_softkey_icon       [IN]        Left softkey icon
 *  right_softkey           [IN]        Right softkey label
 *  right_softkey_icon      [IN]        Right softkey icon
 *  number_of_items         [IN]        Number of items in the menu
 *  list_of_items           [IN]        Array of items
 *  list_of_icons           [IN]        Array of icons
 *  flags                   [IN]        (see explanation below)
 *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
 *  history_buffer          [IN]        History buffer
 * RETURNS
 *  void
 *****************************************************************************/
void ShowCategory14Screen(
        U16 title,
        U16 title_icon,
        U16 left_softkey,
        U16 left_softkey_icon,
        U16 right_softkey,
        U16 right_softkey_icon,
        S32 number_of_items,
        U16 *list_of_items,
        U16 *list_of_icons,
        S32 flags,
        S32 highlighted_item,
        U8 *history_buffer)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    dm_data_struct dm_data;
    S32 i, shortcut_width;
    U8 h_flag;
    S32 ixsize, iysize;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
    gui_block_list_effect();
#endif 
    gdi_layer_lock_frame_buffer();
    UI_disable_alignment_timers();
    MMI_menu_shortcut_number = -1;
    change_left_softkey(left_softkey, left_softkey_icon);
    change_right_softkey(right_softkey, right_softkey_icon);
    SetupCategoryKeyHandlers();

    create_fixed_icontext_menuitems();
    MMI_main_menu_type = flags & 0xf;
    MMI_current_menu_type = flags & 0x0f;
    MMI_title_string = (UI_string_type) get_string(title);
    MMI_title_icon = (PU8) get_image(title_icon);

#ifdef __MMI_UI_TECHNO_STATUS_ICON__
    MMI_title_x = MMI_TITLE_X + MMI_SIGNAL_WIDTH;
    MMI_title_width = UI_device_width - (2 * MMI_SIGNAL_WIDTH);
    MMI_title_height = 26;
    MMI_content_y = MMI_content_y - MMI_TITLE_HEIGHT + MMI_title_height;
    MMI_content_height = MMI_content_height + MMI_TITLE_HEIGHT - MMI_title_height;
#endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
    switch (MMI_main_menu_type)
    {
        case ANI_BG_LIST_MENU:
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_LOOP;
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR;
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND;
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_CENTER_HIGHLIGHTED;
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_HIGHLIGHT_DISPLAY;
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_DISPLAY;
            resize_fixed_list(40, MMI_content_height + 2);
            associate_fixed_icontext_list();
            MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_MARQUEE_SCROLL;
            MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_TWO_DIRECTION_SCROLL;
            for (i = 0; i < number_of_items; i++)
            {
                add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));

            #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
            #ifndef WAP_SUPPORT
                if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
                {
                    MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
                        (UI_string_type) GetSATMainMenuAlphaID();
                }
            #endif /* WAP_SUPPORT */ 
            #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 

            }
            register_fixed_list_shortcut_handler();
            register_fixed_list_keys();

            shortcut_width = set_menu_item_count(number_of_items) + 7;
            resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
            move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);

            resize_fixed_icontext_menuitems(0, MMI_content_height / 3);
            set_fixed_icontext_positions(MMI_ICONTEXT_MENUITEM_HEIGHT + 2, 0, 1, 0);
            move_fixed_list(0, (MMI_title_y + MMI_title_height));

            resize_fixed_list(40, MMI_content_height + 2);

            register_fixed_list_highlight_handler(standard_bg_ani_list_highlight_handler);
            MMI_current_menu_type = ANI_BG_LIST_MENU;
            h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
            MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
            if (h_flag)
            {
                fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
            }
            else
            {
                if (history_buffer != NULL && main_menu_index != -1)
                {
                    highlighted_item = main_menu_index;
                }
                fixed_list_goto_item_no_redraw(highlighted_item);
            }
            break;

        case LIST_MENU:
        #ifdef __MMI_UI_MM_LIST_NO_GRID__
            gui_disable_fixed_list_line_draw();
        #endif 

            resize_fixed_list(MMI_content_width, MMI_content_height + 2);
            associate_fixed_icontext_list();
            set_MMI_list_main_menu_theme();
            gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
            gui_set_fixed_icontext_menuitem_theme(
                &MMI_fixed_icontext_menuitem,
                current_UI_theme->fixed_icontext_menuitem_theme);
            for (i = 0; i < number_of_items; i++)
            {
                add_fixed_icontext_item(get_string(list_of_items[i]), wgui_get_list_menu_icon(i, list_of_icons[i]));
            #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
            #ifndef WAP_SUPPORT
                if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
                {
                    MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
                        (UI_string_type) GetSATMainMenuAlphaID();
                }
            #endif /* WAP_SUPPORT */ 
            #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
            #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_LIST_ICON_IMGBASE;
            #else 
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
            #endif 
            }
            register_fixed_list_shortcut_handler();
            register_fixed_list_keys();
            shortcut_width = set_menu_item_count(number_of_items) + 7;
            resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
            move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
            register_hide_menu_shortcut(draw_title);
            gui_measure_image(MMI_fixed_icontext_menuitems[0].item_icon, &ixsize, &iysize);
            set_fixed_icontext_positions(ixsize + 2, 0, 1, 0);
        #ifdef __MMI_MAINLCD_240X320__
            resize_fixed_icontext_menuitems(0, MMI_content_height / 6);
            title_bg_id = MAIN_MENU_LIST_TITLE_BG;
        #else /* __MMI_MAINLCD_240X320__ */ 
            resize_fixed_icontext_menuitems(0, MMI_content_height / 3);
        #endif /* __MMI_MAINLCD_240X320__ */ 

            register_fixed_list_highlight_handler(standard_list_highlight_handler);
            MMI_current_menu_type = LIST_MENU;
            resize_fixed_list_to_content_height();
            h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
            MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_SCROLLBAR;
            if (h_flag)
            {
                fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
            }
            else
            {
                if (history_buffer != NULL && main_menu_index != -1)
                {
                    highlighted_item = main_menu_index;
                }
                fixed_list_goto_item_no_redraw(highlighted_item);
            }
        #if (!defined(__MMI_UI_TECHNO_MAINMENU__) && !defined(__MMI_UI_DALMATIAN_MAINMENU__))
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE;
        #endif             
            resize_fixed_icontext_menuitems_to_list_width();
            dm_data.s32CatId = MMI_CATEGORY14_LIST_ID;
            break;

        case PAGE_MENU:
            /* Temporary:  Needs to be enhanced */
            gui_set_fixed_list_menu_theme(&MMI_fixed_list_menu, current_UI_theme->fixed_list_menu_theme);
            gui_set_fixed_icontext_menuitem_theme(
                &MMI_fixed_icontext_menuitem,
                current_UI_theme->fixed_icontext_menuitem_theme);

        #ifdef __MMI_UI_TECHNO_MAINMENU__
            create_techno_main_menu(number_of_items, list_of_icons);
        #endif 
#if defined __MMI_UI_TECHNO_MAINMENU__ || defined __MMI_UI_DALMATIAN_MAINMENU__
            dm_register_category_controlled_callback(category14_callback);
#endif
        #if(TITLE_TRANSITION_STYLE_NON_BLOCKING)
            enable_title_transition();
        #endif 
            resize_fixed_list(MMI_content_width, MMI_content_height + 2);
            associate_fixed_icontext_list();
            MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_MARQUEE_SCROLL;
            MMI_fixed_icontext_menuitem.flags &= ~UI_MENUITEM_TWO_DIRECTION_SCROLL;
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_TEXT_CLIP;
            for (i = 0; i < number_of_items; i++)
            {
                /* Landscape page MM uses SCR BG images, not menu item icons. */
            #ifdef __MMI_MAINLCD_320X240__
                add_fixed_icontext_item(get_string(list_of_items[i]), NULL);
                /* save SCR BG image ID */
                gMainMenuAnimation[i] = list_of_icons[i];
            #else /* __MMI_MAINLCD_320X240__ */
                add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));
            #endif /* __MMI_MAINLCD_320X240__ */            

            #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
            #ifndef WAP_SUPPORT
                if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
                {
                    MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
                        (UI_string_type) GetSATMainMenuAlphaID();
                }
            #endif /* WAP_SUPPORT */ 
            #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 

            #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_PAGE_ICON_IMGBASE;
            #else 
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
            #endif
            }
            register_fixed_list_shortcut_handler();
        #ifdef __MMI_UI_MM_HORIZONTAL_PAGE_STYLE__
            register_horizontal_fixed_list_keys();
        #else 
            register_fixed_list_keys();
        #endif 
            shortcut_width = set_menu_item_count(number_of_items) + 7;
            resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
            move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
            register_hide_menu_shortcut(draw_main_menu_list_type_title);
            move_fixed_list(0, (MMI_title_y + MMI_title_height));
            gui_measure_image(get_image(list_of_icons[0]), &ixsize, &iysize);
            resize_fixed_list(MMI_content_width, MMI_content_height);
            register_fixed_list_highlight_handler(category14_main_menu_list_highlight_handler);
            if (MMI_content_height < iysize)
            {
                resize_fixed_icontext_menuitems(MMI_content_width, MMI_content_height);
            }
            else
            {
                resize_fixed_icontext_menuitems(MMI_content_width, MMI_content_height);
            }

        #ifdef __MMI_MAINLCD_240X320__
            title_bg_id = MAIN_MENU_PAGE_TITLE_BG;
        #endif 

        #ifdef __MMI_WALLPAPER_ON_BOTTOM__
            title_bg_id = MAIN_MENU_PAGE_TITLE_BG;
            wgui_set_wallpaper_on_bottom(MMI_TRUE);
            dm_get_scr_bg_image(&mm_bg_ID, &mm_bg_filename, &mm_bg_x, &mm_bg_y, &mm_bg_opacity);
            dm_set_scr_bg_image(IMG_MAIN_MENU_PAGE_BG, NULL, -1, -1, 255);
            dm_get_scr_bg_flag(&mm_bg_flags);
            dm_set_scr_bg_flag(mm_bg_flags | DM_SCR_BG_FORCE_SHOW);
        #endif

            set_fixed_icontext_positions(0, 0, 0, (MMI_content_height - iysize) >> 1);
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_DISABLE_HIGHLIGHT | UI_MENUITEM_DISABLE_TEXT_DISPLAY;
            MMI_current_menu_type = PAGE_MENU;
            h_flag = set_list_menu_category_history(MMI_CATEGORY14_LIST_ID, history_buffer);
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR;
            if (h_flag)
            {
                fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
            }
            else
            {
                if (history_buffer != NULL && main_menu_index != -1)
                {
                    MMI_fixed_list_menu.highlighted_item = main_menu_index;
                    MMI_fixed_list_menu.first_displayed_item = main_menu_index;
                    MMI_fixed_list_menu.last_displayed_item = main_menu_index;
                    highlighted_item = main_menu_index;
                }
                fixed_list_goto_item_no_redraw(highlighted_item);
            }
        #if (!defined(__MMI_UI_TECHNO_MAINMENU__) && !defined(__MMI_UI_DALMATIAN_MAINMENU__))
            MMI_fixed_icontext_menuitem.flags |= UI_MENUITEM_FOCUSSED_ANIMATE;
        #endif 
            resize_fixed_icontext_menuitems_to_list_width();
            dm_data.s32CatId = MMI_CATEGORY14_LIST_ID;
            break;

        case MATRIX_MENU:
            associate_fixed_icontext_matrix();
            for (i = 0; i < number_of_items; i++)
            {
                add_fixed_icontext_item(get_string(list_of_items[i]), get_image(list_of_icons[i]));
            #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
            #ifndef WAP_SUPPORT
                if (IsSATPresent() && list_of_items[i] == MAIN_MENU_SERVICES_TEXT)
                {
                    MMI_fixed_icontext_menuitems[(*fixed_icontext_menu_n_items) - 1].item_text =
                        (UI_string_type) GetSATMainMenuAlphaID();
                }
            #endif /* WAP_SUPPORT */ 
            #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */ 
                gMainMenuAnimation[i] = MAIN_MENU_ICON_ANI_IMGBASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
            #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_MATRIX_ICON_IMGBASE;
            #else 
                gMainMenuTitleIcon[i] = MAIN_MENU_TITLE_ICON_BASE + list_of_icons[i] - MAIN_MENU_ICON_IMGBASE;
            #endif 
            }
            register_fixed_matrix_shortcut_handler();
            MMI_fixed_matrix_menu.flags |= UI_MATRIX_MENU_LOOP | UI_MATRIX_MENU_FOR_MAINMENU;
        #if defined(__MMI_MAINMENU_MATRIX_LOOP__)
            {
                MMI_fixed_matrix_menu.flags |= UI_MATRIX_MENU_VERTICAL_LOOP;
            }
        #endif /* defined(__MMI_MAINMENU_MATRIX_LOOP__) */ 
            register_fixed_matrix_loop_keys();
            MMI_current_menu_type = MATRIX_MENU;

            set_MMI_matrix_main_menu_theme();
            gui_set_fixed_matrix_menu_theme(&MMI_fixed_matrix_menu, current_UI_theme->fixed_matrix_menu_theme);
            gui_set_fixed_icontext_menuitem_theme(
                &MMI_fixed_icontext_menuitem,
                current_UI_theme->fixed_icontext_menuitem_theme);
            register_fixed_matrix_highlight_handler(standard_animated_matrix_highlight_handler_type2);
            move_fixed_matrix(0, (MMI_title_y + MMI_title_height));
            resize_fixed_matrix(MMI_content_width, MMI_content_height);
            if (number_of_items > 9)
            {
                ixsize = (MMI_content_width - MMI_fixed_matrix_menu.vbar.width - 6) / 3;
            }
            else
            {
                ixsize = (MMI_content_width - 6) / 3;
            }
            iysize = (MMI_content_height - 6) / 3;
            /* use image height as item height */
            gui_measure_image(get_image(list_of_icons[0]), &ixsize, &iysize);
            
        #ifdef __MMI_MAINLCD_320X240__
            configure_fixed_matrix(ixsize, iysize, 4, 0);
        #else /* __MMI_MAINLCD_320X240__ */
            configure_fixed_matrix(ixsize, iysize, 3, 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -