www.pudn.com > 2DGameAnimS60C_v1_0.zip > RetroAppUi.cpp


//////////////////////////////////////////////////////////////////////// 
// 
// RetroAppUi.cpp 
// 
// Copyright (c) 2003 Nokia Mobile Phones.  All rights reserved. 
// 
//////////////////////////////////////////////////////////////////////// 
 
#include  
#include  
 
#include "RetroAppUi.h" 
#include "RetroAppView.h" 
#include "Retroblaster.h" 
//#include "Retroblaster_AppView.h" 
#include "RetroBlaster.hrh" 
#include  
 
// Construction: 
// ------------- 
 
CRetroAppUi::CRetroAppUi() 
    { 
    } 
 
// ConstructL is called by the application framework 
void CRetroAppUi::ConstructL() 
    { 
    BaseConstructL(); 
 
    //  Create the application view 
//	iAppView = CRetroAppViewOld::NewL(ApplicationRect());     
	iAppView = CRetroAppView::NewL(ApplicationRect());     
 
    AddToStackL(iAppView); 
    } 
 
// Destruction: 
// ------------ 
 
CRetroAppUi::~CRetroAppUi() 
    { 
    if (iAppView) 
		{ 
		RemoveFromStack(iAppView); 
 
		delete iAppView; 
		iAppView = NULL; 
		} 
    } 
 
// Handle any menu commands: 
// ------------------------- 
void CRetroAppUi::HandleCommandL(TInt aCommand) 
    { 
    switch(aCommand) 
        { 
        case EAknSoftkeyExit: 
            Exit(); 
            break; 
		case ERetroGameStart: 
			static_cast(iAppView)->StartGameL(); 
			break; 
		case ERetroGameStop: 
			static_cast(iAppView)->StopGame(); 
			break; 
        default: 
            break; 
        } 
    } 
 
// Set up the menu: 
// ---------------- 
 
// The Uikon framework calls this function immediately before the menu pane is activated  
void CRetroAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) 
	{ 
	if (aResourceId == R_RETRO_MENUPANE) 
		{ 
		if (static_cast(iAppView)->IsPlaying()) 
			{ 
			aMenuPane->SetItemDimmed(ERetroGameStart, ETrue); 
			aMenuPane->SetItemDimmed(ERetroGameStop, EFalse); 
			} 
		else 
			{ 
			aMenuPane->SetItemDimmed(ERetroGameStart, EFalse); 
			aMenuPane->SetItemDimmed(ERetroGameStop, ETrue); 
			} 
		} 
	}