www.pudn.com > symbianex.rar > HelloWorldAppUi.cpp


/* 
* ============================================================================ 
*  Name     : CHelloWorldAppUi from HelloWorldAppUi.cpp 
*  Part of  : HelloWorld 
*  Created  : 2006-3-9 by Hewei 
*  Implementation notes: 
*     Initial content was generated by Series 60 AppWizard. 
*  Version  : 
*  Copyright:  
* ============================================================================ 
*/ 
 
// INCLUDE FILES 
#include "HelloWorldAppUi.h" 
#include "HelloWorldContainer.h"  
#include  
#include "helloworld.hrh" 
#include   
 
#include  
 
// ================= MEMBER FUNCTIONS ======================= 
// 
// ---------------------------------------------------------- 
// CHelloWorldAppUi::ConstructL() 
//  
// ---------------------------------------------------------- 
// 
void CHelloWorldAppUi::ConstructL() 
    { 
    BaseConstructL(); 
 
    iAppContainer = new (ELeave) CHelloWorldContainer; 
    iAppContainer->SetMopParent( this ); 
    iAppContainer->ConstructL( ClientRect() ); 
    AddToStackL( iAppContainer ); 
    } 
 
// ---------------------------------------------------- 
// CHelloWorldAppUi::~CHelloWorldAppUi() 
// Destructor 
// Frees reserved resources 
// ---------------------------------------------------- 
// 
CHelloWorldAppUi::~CHelloWorldAppUi() 
    { 
    if (iAppContainer) 
        { 
        RemoveFromStack( iAppContainer ); 
        delete iAppContainer; 
        } 
   } 
 
// ------------------------------------------------------------------------------ 
// CHelloWorldAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) 
//  This function is called by the EIKON framework just before it displays 
//  a menu pane. Its default implementation is empty, and by overriding it, 
//  the application can set the state of menu items dynamically according 
//  to the state of application data. 
// ------------------------------------------------------------------------------ 
// 
void CHelloWorldAppUi::DynInitMenuPaneL( 
    TInt aResourceId,CEikMenuPane* aMenuPane) 
    { 
	  if(aResourceId==R_HELLOWORLD_MENU) 
	  { 
		  aMenuPane->SetItemDimmed(EHelloWorldCmdAppTest,ETrue); 
	  } 
    } 
 
// ---------------------------------------------------- 
// CHelloWorldAppUi::HandleKeyEventL( 
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/) 
// takes care of key event handling 
// ---------------------------------------------------- 
// 
TKeyResponse CHelloWorldAppUi::HandleKeyEventL( 
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) 
    { 
    return EKeyWasNotConsumed; 
    } 
 
// ---------------------------------------------------- 
// CHelloWorldAppUi::HandleCommandL(TInt aCommand) 
// takes care of command handling 
// ---------------------------------------------------- 
// 
void CHelloWorldAppUi::HandleCommandL(TInt aCommand) 
    { 
    switch ( aCommand ) 
        { 
        case EAknSoftkeyBack: 
        case EEikCmdExit: 
            { 
            Exit(); 
            break; 
            } 
        case EHelloWorldCmdAppTest: 
            { 
            iEikonEnv->InfoMsg(_L("test")); 
            break; 
            } 
		case EHelloWorldCmdAppSubMenu1: 
			{ 
            iEikonEnv->InfoMsg(_L("test1")); 
            break; 
			} 
		case EHelloWorldCmdAppSubMenu2: 
			{ 
            iEikonEnv->InfoMsg(_L("test2")); 
            break; 
			} 
 
        // TODO: Add Your command handling code here 
 
        default: 
            break;       
        } 
    } 
 
// End of File