cfont.h

来自「symbian C++ 手机二维软件开发例子程序」· C头文件 代码 · 共 83 行

H
83
字号
///////////////////////////////////////////////////////////////////////////////
//
// CFont.h
//
// Copyright (c) 2003 Forum Nokia.  All rights reserved.
//
// 	 Technology developed by Rocket Science Oy Ltd
//
///////////////////////////////////////////////////////////////////////////////

#ifndef __CFONT_H__
#define __CFONT_H__

// INCLUDE FILES
#include <e32base.h>
#include "CBitmap.h"

// FORWARD DECLARATIONS
class CBitmap;
class MSystem;

// CLASS DECLARATION

/**
* CFont class handles creation and drawing of bitmap fonts
*/
class CBmFont
	{
	public:

		/**
		* Two-phased constructor.
		*/
		static CBmFont* NewL(CBitmap* aBitmap, MSystem* aSystem );
	
		/**
		* Destructor.
		*/	
		~CBmFont();

	private:

		/**
		* Default constructor
		*/
		CBmFont( CBitmap* aBitmap, MSystem* aSystem );

		/**
		* Second phase constructor
		*/
		void ConstructL( CBitmap* aBitmap );

	public: // New functions
		
		/**
		* Draws string to the given destination and coordinates.
		* @param aTarget Target bitmap.
		* @param aString Text to draw.
		* @param aPosition Text is drawn to this position.
		*/
		void DrawText(  CBitmap& aTarget,  const TDesC8& aString,
				   const TPoint& aPosition );

		/**
		* Draws number to the given destination and coordinates.
		* @param aTarget Target bitmap.
		* @param aNumber Number to be converted to string and drawn.
		* @param aPosition Number is drawn to this position.
		*/
		void DrawNumber(  CBitmap& aTarget,  const TInt aNumber,
				   const TPoint& aPosition );
		
	private: // Data members
				
		TRect		iRects[256];	/// font areas in bitmap
		CBitmap*	iBitmap;		/// font bitmap
		MSystem*    iSystem;		/// pointer to system
	};

#endif

// End of file

⌨️ 快捷键说明

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