www.pudn.com > Example2D.rar > CFont.h


/////////////////////////////////////////////////////////////////////////////// 
// 
// 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  
#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