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

📄 drawing_appview.cpp

📁 《SymbianOSC手机应用开发》源码
💻 CPP
字号:
// Drawing_AppView.cpp
// ------------------------------
//
// Copyright (c) 2002 Symbian Ltd.  All rights reserved.
//

////////////////////////////////////////////////////////////////////////
//
// Source file for the implementation of the 
// application view class - CExampleAppView
//
////////////////////////////////////////////////////////////////////////

#include "Drawing.h"


void CExampleAppView::ConstructL(const TRect& aRect)
	{
	// give myself a window: the control is a window-owning control
	CreateWindowL();
	SetRect(aRect); // Extent of the control, passed to us from the application UI.
					// The rectangle available for drawing, with co-ordinates which
					// are relative to the whole screen. The control has to have
					// this area set.
	TRect drawingRect=Rect(); // The rectangle available for drawing, with the top left
	                // and bottom right co-ordinates relating only to this area (i.e.
	                // the top left point of the drawing area has the co-ordinate (0,0)).
	                // This makes the division of the drawing area into two areas,
	                // each with its own control, simpler.
	// vertical mid-point coordinate
	TInt midY=(drawingRect.iTl.iY+drawingRect.iBr.iY)/2;
	// construct upper control
	TRect upper=drawingRect;
	upper.iBr.iY=midY;
	iControl0=CExampleHelloControl::NewL(*this, upper);
	iControl0->SetFullRedraw(EFalse);
	// construct lower control
	TRect lower=drawingRect;
	lower.iTl.iY=midY;
	iControl1=CExampleHelloControl::NewL(*this, lower);
	// At this stage, the control is ready to draw so
    // we tell the UI framework by activating it.
	ActivateL();
	}

CExampleAppView::~CExampleAppView()
	{
	delete iControl0;
	delete iControl1;
	}

void CExampleAppView::ZoomInL()
	{
	iControl0->SetZoomInL();
	iControl0->DrawNow();
	iControl1->SetZoomInL();
	iControl1->DrawNow();
	}

void CExampleAppView::ZoomOutL()
	{
	iControl0->SetZoomOutL();
	iControl0->DrawNow();
	iControl1->SetZoomOutL();
	iControl1->DrawNow();
	}

TInt CExampleAppView::CountComponentControls() const
	{
	return 2;
	}

CCoeControl* CExampleAppView::ComponentControl(TInt aIndex) const
	{
	switch (aIndex)
		{
	case 0: return iControl0;
	case 1: return iControl1;
	default: return 0;
		}
	}

⌨️ 快捷键说明

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