retroappui.cpp

来自「symbian系统上的2D图形游戏」· C++ 代码 · 共 92 行

CPP
92
字号
////////////////////////////////////////////////////////////////////////
//
// RetroAppUi.cpp
//
// Copyright (c) 2003 Nokia Mobile Phones.  All rights reserved.
//
////////////////////////////////////////////////////////////////////////

#include <avkon.hrh>
#include <eikmenup.h>

#include "RetroAppUi.h"
#include "RetroAppView.h"
#include "Retroblaster.h"
//#include "Retroblaster_AppView.h"
#include "RetroBlaster.hrh"
#include <RetroBlaster.rsg>

// 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<CRetroAppView*>(iAppView)->StartGameL();
			break;
		case ERetroGameStop:
			static_cast<CRetroAppView*>(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<CRetroAppView*>(iAppView)->IsPlaying())
			{
			aMenuPane->SetItemDimmed(ERetroGameStart, ETrue);
			aMenuPane->SetItemDimmed(ERetroGameStop, EFalse);
			}
		else
			{
			aMenuPane->SetItemDimmed(ERetroGameStart, EFalse);
			aMenuPane->SetItemDimmed(ERetroGameStop, ETrue);
			}
		}
	}

⌨️ 快捷键说明

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