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

// -----------------------------------------------------------------------------
// 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);
        }

    }

大部分转载 小部分自写
原文地址:https://www.cnblogs.com/8586/p/2091466.html