epoc32/include/gulutil.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/gulutil.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,370 +0,0 @@
     1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 -// All rights reserved.
     1.6 -// This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 -// which accompanies this distribution, and is available
     1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 -//
    1.11 -// Initial Contributors:
    1.12 -// Nokia Corporation - initial contribution.
    1.13 -//
    1.14 -// Contributors:
    1.15 -//
    1.16 -// Description:
    1.17 -//
    1.18 -
    1.19 -#if !defined(__GULUTIL_H__)
    1.20 -#define __GULUTIL_H__
    1.21 -
    1.22 -#include <e32std.h>
    1.23 -#include <badesca.h>
    1.24 -#include <gdi.h>
    1.25 -#include <gulbordr.h>
    1.26 -#include <gulftflg.hrh>
    1.27 -
    1.28 -/** 
    1.29 -@publishedAll 
    1.30 -@released 
    1.31 -*/
    1.32 -const TUint KTextUtilClipEndChar=0x2026;
    1.33 -
    1.34 -/**
    1.35 -@publishedAll 
    1.36 -@released 
    1.37 -*/
    1.38 -const TUint KColumnListSeparator='\t';
    1.39 -
    1.40 -class CFont;
    1.41 -class CFbsFont;
    1.42 -class CWsScreenDevice;
    1.43 -class TResourceReader;
    1.44 -class CColorArray;
    1.45 -class CGraphicsDevice;
    1.46 -class RWsSession;
    1.47 -class CColorList;
    1.48 -template <class T> class CArrayFix;
    1.49 -
    1.50 -
    1.51 -class TMargins8
    1.52 -/** A set of margins stored as 8 bit integer values which can represent 
    1.53 -either pixels or twips between -128 and +127.
    1.54 -
    1.55 -@publishedAll 
    1.56 -@released */
    1.57 -	{
    1.58 -public :
    1.59 -	/** Left margin in twips or pixels. */
    1.60 -	TInt8 iLeft;
    1.61 -	/** Right margin in twips or pixels. */
    1.62 -	TInt8 iRight;
    1.63 -	/** Top margin in twips or pixels. */
    1.64 -	TInt8 iTop;
    1.65 -	/** Bottom margin in twips or pixels. */
    1.66 -	TInt8 iBottom;
    1.67 -public :
    1.68 -	IMPORT_C TMargins8();
    1.69 -	IMPORT_C TMargins8(TInt8 aLeft, TInt8 aTop, TInt8 aRight, TInt8 aBottom);
    1.70 -	IMPORT_C void SetAllValuesTo(TInt aCommonValue);
    1.71 -    IMPORT_C TRect InnerRect(const TRect& aOuterRect) const;
    1.72 -    IMPORT_C TRect OuterRect(const TRect& aInnerRect) const;
    1.73 -	IMPORT_C TSize SizeDelta() const;
    1.74 -	};
    1.75 -
    1.76 -
    1.77 -class DrawUtils
    1.78 -/** Provides static functions for drawing text in a rectangle. 
    1.79 -
    1.80 -@publishedAll 
    1.81 -@released */
    1.82 -	{
    1.83 -public:
    1.84 -	IMPORT_C static void DrawText(CGraphicsContext& aGc,const TDesC& aString,const TRect& aBox,TInt aBaseLineOffset,
    1.85 -									CGraphicsContext::TTextAlign aHoriz,TInt aMargin,const CFont* aFont);
    1.86 -    IMPORT_C static void DrawBetweenRects(CGraphicsContext& aGc,const TRect& aOuterRect,const TRect& aInnerRect);
    1.87 -    IMPORT_C static void ClearBetweenRects(CGraphicsContext& aGc,const TRect& aOuterRect,const TRect& aInnerRect);
    1.88 -	};
    1.89 -
    1.90 -
    1.91 -class TextUtils
    1.92 -/** Provides static functions for truncating and aligning text strings. 
    1.93 -
    1.94 -@publishedAll 
    1.95 -@released */
    1.96 -	{
    1.97 -public:
    1.98 -	IMPORT_C static void ClipToFit(TDes& aBuffer,const CFont& aFont,TInt aMaxWidthInPixels,TChar aAlternativeEnd=KTextUtilClipEndChar);
    1.99 -	IMPORT_C static TInt ColumnText(TPtrC& aColumnText,TInt aColumn,const TDesC* aSourceText,TChar aColumnSeparator=KColumnListSeparator);
   1.100 -	IMPORT_C static void TruncateToNumChars(TDes& aBuffer, TInt numChars);
   1.101 -	};
   1.102 -
   1.103 -class FontUtils
   1.104 -/** Provides static functions for getting information about the fonts supported by a graphics 
   1.105 -device. 
   1.106 -
   1.107 -@publishedAll 
   1.108 -@released */
   1.109 -	{
   1.110 -public:
   1.111 -	IMPORT_C static void GetAvailableFontsL(const CGraphicsDevice& aDevice,CDesCArray& aFontNameList,
   1.112 -											TInt aFonts=EGulNoSymbolFonts);
   1.113 -	IMPORT_C static TInt TypefaceAttributes(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName);
   1.114 -	IMPORT_C static TInt GetAvailableHeightsInTwipsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,
   1.115 -													CArrayFix<TInt>& aHeightList);
   1.116 -	IMPORT_C static TInt GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,
   1.117 -															CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList);
   1.118 -	IMPORT_C static TInt PointsFromTwips(TInt aTwips);
   1.119 -	IMPORT_C static TInt TwipsFromPoints(TInt aPoints);
   1.120 -	IMPORT_C static TInt TwipsFromPoints(const TDesC& aPoints);
   1.121 -	IMPORT_C static TInt IndexOfNearestHeight(CArrayFix<TInt>& aTwipsList,TInt aHeight);
   1.122 -	};
   1.123 -
   1.124 -
   1.125 -class ResourceUtils
   1.126 -/** Provides static functions for resource reading.
   1.127 -
   1.128 -All functions use pre-initialised resource reader objects to read information 
   1.129 -from resource files.
   1.130 -
   1.131 -@publishedAll 
   1.132 -@released 
   1.133 -@see CCoeEnv::CreateResourceReaderLC() */
   1.134 -	{
   1.135 -public:
   1.136 -	IMPORT_C static CFbsFont* CreateNamedScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
   1.137 -	IMPORT_C static CFbsFont* CreateNamedScreenFontInPixelsL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
   1.138 -	IMPORT_C static CFbsFont* CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
   1.139 -	inline static TInt8 ReadTInt8L(TResourceReader& aReader);
   1.140 -	inline static TInt16 ReadTInt16L(TResourceReader& aReader);
   1.141 -	inline static TInt32 ReadTInt32L(TResourceReader& aReader);
   1.142 -	IMPORT_C static void PopulateColorArrayL(CColorArray& aColors,TResourceReader& aReader);
   1.143 -private:
   1.144 -	enum TResourceTypeInt { EResourceInt8,EResourceInt16,EResourceInt32 };
   1.145 -private:
   1.146 -	IMPORT_C static TInt32 ReadResourceIntL(TResourceReader& aReader,TResourceTypeInt aSize);
   1.147 -	};
   1.148 -
   1.149 -class ColorUtils
   1.150 -/** Provides static functions for manipulating colours.
   1.151 -
   1.152 -@publishedAll 
   1.153 -@released 
   1.154 -@see TDisplayMode */
   1.155 -	{
   1.156 -public:
   1.157 -	/** The orientation of a bitmap. */
   1.158 -    enum TBitmapOrientation
   1.159 -	    {
   1.160 -		/** The bitmap is vertical. */
   1.161 -	    EBitmapOrientationVertical,
   1.162 -		/** The bitmap is horizontal. */
   1.163 -	    EBitmapOrientationHorizontal
   1.164 -	    };
   1.165 -public:
   1.166 -	IMPORT_C static TRgb ColorAdjust(TRgb aColor,TInt aPercentage);
   1.167 -    IMPORT_C static void CreateGradientBitmapL(CFbsBitmap& aBitmap, const RWsSession& aWs, TInt aBreadth,
   1.168 -                                       TBitmapOrientation aOrientation, TRgb aStartColor, TRgb aEndColor);
   1.169 -	IMPORT_C static CColorList* CreateSystemColorListL(RFs& aFs);
   1.170 -	IMPORT_C static CColorList* CreateSystemColorListL(RFs& aFs,const CColorList& aColorList);
   1.171 -	IMPORT_C static void UpdateSystemColorListL(RFs& aFs,CColorList& aColorList);
   1.172 -	IMPORT_C static void GetRgbDerivedBorderColors(TGulBorder::TColors& aBorderColors,TRgb aBackgroundColor,TDisplayMode aMode);
   1.173 -	IMPORT_C static TRgb RgbDarkerColor(TRgb aRgb,TDisplayMode aMode);
   1.174 -	IMPORT_C static TRgb RgbMidDarkerColor(TRgb aRgb,TDisplayMode aMode);
   1.175 -	IMPORT_C static TRgb RgbLighterColor(TRgb aRgb,TDisplayMode aMode);
   1.176 -	};
   1.177 -
   1.178 -
   1.179 -class TFindWidthOfWidestTextItem
   1.180 -/** Finds the width in pixels of the widest item in a range of indexed text items.
   1.181 -
   1.182 -This is the base class for several classes used to get the maximum width for 
   1.183 -date and time components.
   1.184 -
   1.185 -Derived classes should override the pure virtual methods to supply an appropriate 
   1.186 -range of items. 
   1.187 -
   1.188 -@publishedAll 
   1.189 -@released */
   1.190 -	{
   1.191 -protected:
   1.192 -	/** Default constructor. */
   1.193 -	inline TFindWidthOfWidestTextItem() {}
   1.194 -public:
   1.195 -	IMPORT_C TInt MaximumWidthInPixels(const CFont& aFont) const;
   1.196 -private:
   1.197 -	/** Gets the first and last index in the range of items.
   1.198 -	
   1.199 -	@param aFirstIndex On return, the first index.
   1.200 -	@param aLastIndex On return, the last index. 
   1.201 -	@publishedAll
   1.202 -	@released */
   1.203 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const=0;
   1.204 -	/** Gets the text item at the specfied index.
   1.205 -	
   1.206 -	@param aText On return, the indexed text item.
   1.207 -	@param aIndex The index. 
   1.208 -	@publishedAll 
   1.209 -	@released */
   1.210 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const=0;
   1.211 -	};
   1.212 -
   1.213 -
   1.214 -class TFindWidthOfWidestDigit : public TFindWidthOfWidestTextItem
   1.215 -/** Finds the width in pixels of the widest digit, when displayed in a specified 
   1.216 -font.
   1.217 -
   1.218 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.219 -specifying the font. 
   1.220 -
   1.221 -@publishedAll
   1.222 -@released */
   1.223 -	{
   1.224 -public:
   1.225 -	IMPORT_C TFindWidthOfWidestDigit();
   1.226 -private:
   1.227 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.228 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.229 -	};
   1.230 -
   1.231 -class TFindWidthOfWidestDigitType : public TFindWidthOfWidestTextItem
   1.232 -/**
   1.233 -@publishedAll
   1.234 -@released
   1.235 -*/
   1.236 -	{
   1.237 -public:
   1.238 -	IMPORT_C TFindWidthOfWidestDigitType(TDigitType aDigitType);
   1.239 -private:
   1.240 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.241 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.242 -
   1.243 -private:
   1.244 -	TDigitType iDigitType;
   1.245 -	};
   1.246 -
   1.247 -class TFindWidthOfWidestAmPmName : public TFindWidthOfWidestTextItem
   1.248 -/** Finds the width in pixels of the widest Am or Pm text, when displayed in a specified 
   1.249 -font.
   1.250 -
   1.251 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.252 -specifying the font.
   1.253 -
   1.254 -@publishedAll
   1.255 -@released 
   1.256 -@see TAmPmName */
   1.257 -	{
   1.258 -public:
   1.259 -	IMPORT_C TFindWidthOfWidestAmPmName();
   1.260 -private:
   1.261 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.262 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.263 -	};
   1.264 -
   1.265 -class TFindWidthOfWidestAbbreviatedDayName : public TFindWidthOfWidestTextItem
   1.266 -/** Finds the width in pixels of the widest abbreviated day name (for instance Mon, Tue) 
   1.267 -when displayed in a specified font.
   1.268 -
   1.269 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.270 -specifying the font.
   1.271 -
   1.272 -@publishedAll
   1.273 -@released 
   1.274 -@see TDayNameAbb */
   1.275 -	{
   1.276 -public:
   1.277 -	IMPORT_C TFindWidthOfWidestAbbreviatedDayName();
   1.278 -private:
   1.279 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.280 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.281 -	};
   1.282 -
   1.283 -
   1.284 -class TFindWidthOfWidestDayName : public TFindWidthOfWidestTextItem
   1.285 -/** Finds the width in pixels of the widest day name, when displayed in a specified 
   1.286 -font.
   1.287 -
   1.288 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.289 -specifying the font. 
   1.290 -
   1.291 -@publishedAll 
   1.292 -@released */
   1.293 -	{
   1.294 -public:
   1.295 -	IMPORT_C TFindWidthOfWidestDayName();
   1.296 -private:
   1.297 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.298 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.299 -	};
   1.300 -
   1.301 -
   1.302 -class TFindWidthOfWidestAbbreviatedMonthName : public TFindWidthOfWidestTextItem
   1.303 -/** Finds the width in pixels of the widest abbreviated month name (for instance Jan, Feb), 
   1.304 -when displayed in a specified font.
   1.305 -
   1.306 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.307 -specifying the font. 
   1.308 -
   1.309 -@publishedAll 
   1.310 -@released */
   1.311 -	{
   1.312 -public:
   1.313 -	IMPORT_C TFindWidthOfWidestAbbreviatedMonthName();
   1.314 -private:
   1.315 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.316 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.317 -	};
   1.318 -
   1.319 -class TFindWidthOfWidestMonthName : public TFindWidthOfWidestTextItem
   1.320 -/** Finds the width in pixels of the widest month name, when displayed in a specified 
   1.321 -font.
   1.322 -
   1.323 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.324 -specifying the font. 
   1.325 -
   1.326 -@publishedAll 
   1.327 -@released */
   1.328 -	{
   1.329 -public:
   1.330 -	IMPORT_C TFindWidthOfWidestMonthName();
   1.331 -private:
   1.332 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.333 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.334 -	};
   1.335 -
   1.336 -class TFindWidthOfWidestDateSuffix : public TFindWidthOfWidestTextItem
   1.337 -/** Finds the width in pixels of the widest date suffix (for instance st, nd), 
   1.338 -when displayed in a specified font.
   1.339 -
   1.340 -After construction, call MaximumWidthInPixels(), defined in the base class, 
   1.341 -specifying the font. 
   1.342 -
   1.343 -@publishedAll 
   1.344 -@released */
   1.345 -	{
   1.346 -public:
   1.347 -	IMPORT_C TFindWidthOfWidestDateSuffix();
   1.348 -private:
   1.349 -	virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
   1.350 -	virtual void GetTextItem(TDes& aText, TInt aIndex) const;
   1.351 -	};
   1.352 -
   1.353 -//	class ResourceUtils
   1.354 -inline TInt8 ResourceUtils::ReadTInt8L(TResourceReader& aReader)
   1.355 -/** Reads an 8 bit signed integer from a resource.
   1.356 -
   1.357 -@param aReader Resource reader to use to read the integer.
   1.358 -@return The 8 bit signed integer. */
   1.359 -	{ return((TInt8)ReadResourceIntL(aReader,EResourceInt8)); }
   1.360 -inline TInt16 ResourceUtils::ReadTInt16L(TResourceReader& aReader)
   1.361 -/** Reads a 16 bit signed integer from a resource.
   1.362 -
   1.363 -@param aReader Resource reader to use to read the integer.
   1.364 -@return The 16 bit signed integer. */
   1.365 -	{ return((TInt16)ReadResourceIntL(aReader,EResourceInt16)); }
   1.366 -inline TInt32 ResourceUtils::ReadTInt32L(TResourceReader& aReader)
   1.367 -/** Reads a 32 bit signed integer from a resource.
   1.368 -
   1.369 -@param aReader Resource reader to use to read the integer.
   1.370 -@return The 32 bit signed integer. */
   1.371 -	{ return((TInt32)ReadResourceIntL(aReader,EResourceInt32)); }
   1.372 -
   1.373 -#endif