现在的位置: 首页 > 综合 > 正文

让程序用自定义的菜单-自定义菜单AVKON_VIEW,CBA,MENU_BAR,MENU_PANE

2013年12月04日 ⁄ 综合 ⁄ 共 1949字 ⁄ 字号 评论关闭

注意:一般情况下不要修改CBA栏的左键ID,默认就是EAknSoftkeyOptions,不要修改为别的。

// -----------------------------------------------------------------------------
// help menu avkon
//在CHelpView::ConstructL()函数中调用
// -----------------------------------------------------------------------------

RESOURCE AVKON_VIEW r_help_menu
{
    menubar = r_help_menu_bar;
    //cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;   
    //自定义CBA
    cba = r_help_menu_cba;
}
//定义CBA栏
RESOURCE CBA r_help_menu_cba
{
buttons=
    {
        AVKON_CBA_BUTTON
        {
            id = EAknSoftkeyOptions;
            txt = qtn_hewb_option;
        },
        AVKON_CBA_BUTTON
        {
            id = EExit;
            txt = qtn_hewb_exit;
        }
    };

}
//定义菜单块
RESOURCE MENU_BAR r_help_menu_bar
{
titles =
    {
    MENU_TITLE { menu_pane = r_help_menu_pane; }
    };
}
//定义菜单面板
RESOURCE MENU_PANE  r_help_menu_pane
{
    items =
        {
        // added the new Options menu command here
        MENU_ITEM
            {
            command = EInput;
            txt = qtn_hewb_input;
            //cascade =  r_potato_menupane;
            },
        MENU_ITEM
            {
            command = EHelpTwo;
            txt = qtn_hewb_helptwo;
            }
        };
}

//定义子菜单的菜单面板
RESOURCE MENU_PANE  r_potato_menupane
{
    items =
        {
        // added the new Options menu command here
        MENU_ITEM
            {
            command = EMenuPotato1;
            txt = qtn_menu_potato1;
            },
            MENU_ITEM
            {
            command = EMenuPotato2;
            txt = qtn_menu_potato2;
            }
        };
}

 

 

//控制菜单的显示与隐藏,由系统调用
void CListView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
    {
    if (aResourceId != R_LIST_MENU_PANE)
        return;

    //如果没有记录的情况下,就隐藏EListComeCard,EListCallPerson,EListSendCard
    if (0 == iSelectCountNum)
        {
        aMenuPane->SetItemDimmed(EListComeCard, ETrue);
        aMenuPane->SetItemDimmed(EListCallPerson, ETrue);
        aMenuPane->SetItemDimmed(EListSendCard, ETrue);
        }
    else
        {
        aMenuPane->SetItemDimmed(EListComeCard, EFalse);
        aMenuPane->SetItemDimmed(EListCallPerson, EFalse);
        aMenuPane->SetItemDimmed(EListSendCard, EFalse);
        }

    }

抱歉!评论已关闭.