⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ballappview.cpp

📁 symbian中活动对象的一个例子
💻 CPP
字号:
/* Copyright (c) 2008, Nokia. All rights reserved */

#include "BallAppView.h"
#include "ActiveBall.h"
#include <EIKMSG.H>
#include "Ball.mbg"
#include <aknutils.h>
#include <EIKAPP.h>
#include <f32file.h>
#include <EIKAPPUI.H>

CBallAppView* CBallAppView::NewL(const TRect& aRect)
    {
    CBallAppView* self = NewLC(aRect);
    CleanupStack::Pop(self);
    return self;
    }

CBallAppView* CBallAppView::NewLC(const TRect& aRect)
    {
    CBallAppView* self = new (ELeave) CBallAppView;
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    return self;
    }

void CBallAppView::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    SetRect(aRect);

	TBuf<KMaxPath> pathAppMbm;
#ifdef __WINS__
	pathAppMbm.Copy(_L("z:\\system\\apps\\Ball\\Ball.mbm"));
#else
// 	CEikonEnv& ee = *CEikonEnv::Static();
// 	CEikAppUi& ea = *( ee.EikAppUi() );
// 	appFullName = (ea.Application())->AppFullName();

	TFileName appFullName;
	appFullName = iEikonEnv->Static()->EikAppUi()->Application()->AppFullName();
// // 	TFileName appFullName;
//  	appFullName = Application()->AppFullName();
	TParsePtr parse(appFullName);
	pathAppMbm.Copy(parse.DriveAndPath());
	pathAppMbm.Append(_L("Ball.mbm"));
#endif
	iActive = new( ELeave) CActiveBall(this, 50,50);
	iBall = iEikonEnv->CreateIconL(pathAppMbm,EMbmBallBall,EMbmBallBall_mask);

	//启动
	iActive->Start();
    ActivateL();
    }

CBallAppView::CBallAppView()
    {
    // Add any construction code that can not leave here
    }


CBallAppView::~CBallAppView()
    {
	iActive->Cancel();
	if(iBall != NULL)
	{
		delete iBall;
		iBall = NULL;
	}
	if(iActive != NULL)
	{
		delete iActive;
		iActive = NULL;
	}
    // Add any destruction code here
    }

void CBallAppView::Draw(const TRect& /*aRect*/) const
    {
    // Clear the screen
    CWindowGc& gc = SystemGc();
    gc.Clear(Rect());
	gc.BitBlt(iActive->GetPoint(), iBall->Bitmap());
    }


⌨️ 快捷键说明

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