drawing.h

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

H
185
字号
// 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 <QikApplication.h>
#include <QikViewBase.h>
#include <QikDocument.h>
#include <QikAppui.h>

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


/** Application UID should correspond to UID3 (SECUREID) in the MMP file. */
const TUid KUidExampleApp={0x101F8B3D};
const TUid KUidExampleView={0x00000001};


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

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

////////////////////////////////////////////////////////////////////////
//
// CExampleHelloView
//
////////////////////////////////////////////////////////////////////////
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;
	};

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

// QIKON application classes

////////////////////////////////////////////////////////////////////////
//
// CExampleAppView
//
////////////////////////////////////////////////////////////////////////
class CExampleAppView : public CQikViewBase
	{
public:
	static CExampleAppView* NewL(CQikAppUi& aAppUi);
	void ConstructL();
	void ViewConstructL();
	// from CQikViewBase
	TVwsViewId ViewId()const;
	void HandleCommandL(CQikCommand& aCommand);
	// zooming
	void ZoomInL();
	void ZoomOutL();
private:
    void SizeChanged();

private: // from CCoeControl
	CExampleAppView(CQikAppUi& aAppUi);
	~CExampleAppView();
private:
	CQikCommandManager& iCommandManager; // View does not own Command Manager
	CExampleHelloControl* iControl0;     // or any of the controls
	CExampleHelloControl* iControl1;     // through these pointers
	CExampleHelloControl* iControl2;     //
	CExampleHelloControl* iControl3;     //
	};


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

private:
	CExampleAppView* iAppView;
	};


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


#endif

⌨️ 快捷键说明

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