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

📄 cactivehelloappview.cpp

📁 symbian活动对象的例子
💻 CPP
字号:
// CActiveHelloAppView.cpp
//
// Copyright (c) 2002 Symbian Ltd.  All rights reserved.

#include "cactivehelloappview.h"

#include <eikenv.h>
#include <activehello.rsg>

// app view

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

CActiveHelloAppView::CActiveHelloAppView()
	{
	}

void CActiveHelloAppView::ConstructL(const TRect& aRect)
	{
	CreateWindowL();
	SetRect(aRect);
	ActivateL();
	iText=iEikonEnv->AllocReadResourceL(R_ACTIVEHELLO_TEXT_HELLO);
	iShowText=ETrue;
	}

CActiveHelloAppView::~CActiveHelloAppView()
	{
	delete iText;
	}

void CActiveHelloAppView::Draw(const TRect& /*aRect*/) const
	{
	CWindowGc& gc = SystemGc();
	gc.Clear();
	TRect rect=Rect();
	rect.Shrink(10,10);
	gc.DrawRect(rect);
	if (iShowText)
		{
		rect.Shrink(1,1);
		const CFont* font=iEikonEnv->TitleFont();
		gc.UseFont(font);
		TInt baseline=rect.Height()/2 + font->AscentInPixels()/2;
		gc.DrawText(*iText, rect, baseline, CGraphicsContext::ECenter);
		gc.DiscardFont();
		}
	else
		{
		rect.Shrink(1,1);
		gc.SetPenStyle(CGraphicsContext::ENullPen);
		gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		gc.DrawRect(rect);
		}
	}

⌨️ 快捷键说明

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