cactivehelloappui.cpp

来自「symbian活动对象的例子」· C++ 代码 · 共 77 行

CPP
77
字号
// CActiveHelloAppUi.cpp
//
// Copyright (c) 2002 Symbian Ltd.  All rights reserved.

#include "cactivehelloappui.h"

#include <eikenv.h>

#include "cactivehelloappview.h"
#include "cdelayedhello.h"
#include "cflashinghello.h"
#include "cmultiparthello.h"

#include <activehello.rsg>
#include "activehello.hrh"

// app UI

void CActiveHelloAppUi::ConstructL()
    {
	CQikAppUi::ConstructL();

    iAppView = CActiveHelloAppView::NewL(ClientRect());

	iDelayedHello=CDelayedHello::NewL();
	iFlashingHello=CFlashingHello::NewL(iAppView);
	iMultiHello=CMultiPartHello::NewL(iAppView);
    }

CActiveHelloAppUi::~CActiveHelloAppUi()
	{
	delete iDelayedHello;
	delete iMultiHello;	// must delete before iAppView!
	delete iFlashingHello; // must delete before iAppView!
    delete iAppView;
	}

void CActiveHelloAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
	case EActiveHelloCmdSetHello:
		iDelayedHello->Cancel(); // just in case
		iDelayedHello->SetHello(3000000); // 3-second delay
		break;
	case EActiveHelloCmdCancelHello:
		iDelayedHello->Cancel();
		iEikonEnv->InfoMsg(R_ACTIVEHELLO_TEXT_CANCELLED);
		break;
	case EActiveHelloCmdStartFlashing:
		iMultiHello->Cancel();
		iFlashingHello->Cancel(); // just in case
		iFlashingHello->Start(1000000); // 1-second half-period
		iEikonEnv->InfoMsg(R_ACTIVEHELLO_TEXT_STARTED);
		break;
	case EActiveHelloCmdStopFlashing:
		iFlashingHello->Cancel();
		iEikonEnv->InfoMsg(R_ACTIVEHELLO_TEXT_STOPPED);
		break;
	case EActiveHelloCmdStartMultiHello:
		iFlashingHello->Cancel();
		iMultiHello->Cancel();
		iMultiHello->Start(3000000); // 1-second half-period
		iEikonEnv->InfoMsg(R_ACTIVEHELLO_TEXT_MULTI_STARTED);
		break;
	case EActiveHelloCmdCancelMultiHello:
		iMultiHello->Cancel();
		iEikonEnv->InfoMsg(R_ACTIVEHELLO_TEXT_MULTI_CANCEL);
		break;
	case EEikCmdExit: 
		iFlashingHello->Cancel();
		iMultiHello->Cancel();
		Exit();
		break;
		}
	}

⌨️ 快捷键说明

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