drawing.h

来自「Symbian OS C++ for Mobile Phones v3 Exam」· C头文件 代码 · 共 165 行

H
165
字号
// drawing.h
// ------------
//
// Copyright (c) 2002 - 2007 Symbian Software Ltd.  All rights reserved.
//

////////////////////////////////////////////////////////////////////
// drawing 
// ----------
//
//
// The class definitions for the example application
// containing a single view with the text "Hello World !" drawn in 2
// separate boxes.
//
// The class definitions are:
//
// CExampleApplication 
// CExampleAppUi
// CExampleAppView
// CExampleDocument
//
//
////////////////////////////////////////////////////////////////////
#ifndef __DRAWING_H
#define __DRAWING_H

#include <coeccntx.h>

#include <eikenv.h>
#include <eikappui.h>
#include <eikapp.h>
#include <eikdoc.h>
#include <eikmenup.h>

#include <eikon.hrh>

#include <aknappui.h>

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



////////////////////////////////////////////////////////////////////////
//
// CExampleApplication
//
////////////////////////////////////////////////////////////////////////

class CExampleApplication : public CEikApplication
	{
private: 
	           // Inherited from class CApaApplication
	CApaDocument* CreateDocumentL();
	TUid AppDllUid() const;
	};

////////////////////////////////////////////////////////////////////////
//
// CExampleAppView
//
////////////////////////////////////////////////////////////////////////
class CExampleHelloView : public CBase
	{
public:
	// construct/destruct
	static CExampleHelloView* NewL();
	~CExampleHelloView();
	// settings
	void SetTextL(const TDesC& aText);
	void SetFullRedraw(TBool aFullRedraw);
	// draw
	void DrawInRect(const MGraphicsDeviceMap& aMap, CGraphicsContext& aGc, const TRect& aDeviceRect, CFont* aFont) const;
private:
	void ConstructL();
private:
	HBufC* iText;
	TBool iFullRedraw;
	};

class CExampleHelloControl : public CCoeControl
	{
public:
	// construct/destruct
	static CExampleHelloControl* NewL(const CCoeControl& aContainer, const TRect& aRect);
	~CExampleHelloControl();
	// settings
	void SetZoomAndDeviceDependentFontL(TInt aZoomFactor);
	TInt GetZoom() const;
	void SetZoomInL();
	void SetZoomOutL();
	void SetFullRedraw(TBool aFullRedraw);
private:
	void ConstructL(const CCoeControl& aContainer, const TRect& aRect);
private: // from CCoeControl
	void Draw(const TRect&) const;
private:
	HBufC* iText;
	TZoomFactor iZoomFactor;
	CExampleHelloView* iView;
	CFont* iFont;
	};

// EIKON application classes

class CExampleAppView : public CCoeControl
	{
public:
	~CExampleAppView();
	void ConstructL(const TRect& aRect);
	// zooming
	void ZoomInL();
	void ZoomOutL();
private: // from CCoeControl
	TInt CountComponentControls() const;
	CCoeControl* ComponentControl(TInt aIndex) const;
private:
	CExampleHelloControl* iControl0;
	CExampleHelloControl* iControl1;
	CExampleHelloControl* iControl2;
	CExampleHelloControl* iControl3;
	};


////////////////////////////////////////////////////////////////////////
//
// CExampleAppUi
//
////////////////////////////////////////////////////////////////////////
//class CExampleAppUi : public CEikAppUi
class CExampleAppUi : public CAknAppUi
    {
public:
    void ConstructL();
	~CExampleAppUi();

private:
              // Inherited from class CEikAppUi
	void HandleCommandL(TInt aCommand);

private:
	CExampleAppView* iAppView;
	};


////////////////////////////////////////////////////////////////////////
//
// CExampleDocument
//
////////////////////////////////////////////////////////////////////////
class CExampleDocument : public CEikDocument
	{
public:
	static CExampleDocument* NewL(CEikApplication& aApp);
	CExampleDocument(CEikApplication& aApp);
	void ConstructL();
private: 
	           // Inherited from CEikDocument
	CEikAppUi* CreateAppUiL();
	};


#endif

⌨️ 快捷键说明

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