Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // 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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__GULUTIL_H__)
23 #include <gulftflg.hrh>
29 const TUint KTextUtilClipEndChar=0x2026;
35 const TUint KColumnListSeparator='\t';
39 class CWsScreenDevice;
40 class TResourceReader;
42 class CGraphicsDevice;
45 template <class T> class CArrayFix;
49 /** A set of margins stored as 8 bit integer values which can represent
50 either pixels or twips between -128 and +127.
56 /** Left margin in twips or pixels. */
58 /** Right margin in twips or pixels. */
60 /** Top margin in twips or pixels. */
62 /** Bottom margin in twips or pixels. */
66 IMPORT_C TMargins8(TInt8 aLeft, TInt8 aTop, TInt8 aRight, TInt8 aBottom);
67 IMPORT_C void SetAllValuesTo(TInt aCommonValue);
68 IMPORT_C TRect InnerRect(const TRect& aOuterRect) const;
69 IMPORT_C TRect OuterRect(const TRect& aInnerRect) const;
70 IMPORT_C TSize SizeDelta() const;
75 /** Provides static functions for drawing text in a rectangle.
81 IMPORT_C static void DrawText(CGraphicsContext& aGc,const TDesC& aString,const TRect& aBox,TInt aBaseLineOffset,
82 CGraphicsContext::TTextAlign aHoriz,TInt aMargin,const CFont* aFont);
83 IMPORT_C static void DrawBetweenRects(CGraphicsContext& aGc,const TRect& aOuterRect,const TRect& aInnerRect);
84 IMPORT_C static void ClearBetweenRects(CGraphicsContext& aGc,const TRect& aOuterRect,const TRect& aInnerRect);
89 /** Provides static functions for truncating and aligning text strings.
95 IMPORT_C static void ClipToFit(TDes& aBuffer,const CFont& aFont,TInt aMaxWidthInPixels,TChar aAlternativeEnd=KTextUtilClipEndChar);
96 IMPORT_C static TInt ColumnText(TPtrC& aColumnText,TInt aColumn,const TDesC* aSourceText,TChar aColumnSeparator=KColumnListSeparator);
97 IMPORT_C static void TruncateToNumChars(TDes& aBuffer, TInt numChars);
101 /** Provides static functions for getting information about the fonts supported by a graphics
108 IMPORT_C static void GetAvailableFontsL(const CGraphicsDevice& aDevice,CDesCArray& aFontNameList,
109 TInt aFonts=EGulNoSymbolFonts);
110 IMPORT_C static TInt TypefaceAttributes(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName);
111 IMPORT_C static TInt GetAvailableHeightsInTwipsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,
112 CArrayFix<TInt>& aHeightList);
113 IMPORT_C static TInt GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,
114 CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList);
115 IMPORT_C static TInt PointsFromTwips(TInt aTwips);
116 IMPORT_C static TInt TwipsFromPoints(TInt aPoints);
117 IMPORT_C static TInt TwipsFromPoints(const TDesC& aPoints);
118 IMPORT_C static TInt IndexOfNearestHeight(CArrayFix<TInt>& aTwipsList,TInt aHeight);
123 /** Provides static functions for resource reading.
125 All functions use pre-initialised resource reader objects to read information
130 @see CCoeEnv::CreateResourceReaderLC() */
133 IMPORT_C static CFbsFont* CreateNamedScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
134 IMPORT_C static CFbsFont* CreateNamedScreenFontInPixelsL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
135 IMPORT_C static CFbsFont* CreateScreenFontL(TResourceReader& aResourceReader,CWsScreenDevice& aScreenDevice);
136 inline static TInt8 ReadTInt8L(TResourceReader& aReader);
137 inline static TInt16 ReadTInt16L(TResourceReader& aReader);
138 inline static TInt32 ReadTInt32L(TResourceReader& aReader);
139 IMPORT_C static void PopulateColorArrayL(CColorArray& aColors,TResourceReader& aReader);
141 enum TResourceTypeInt { EResourceInt8,EResourceInt16,EResourceInt32 };
143 IMPORT_C static TInt32 ReadResourceIntL(TResourceReader& aReader,TResourceTypeInt aSize);
147 /** Provides static functions for manipulating colours.
154 /** The orientation of a bitmap. */
155 enum TBitmapOrientation
157 /** The bitmap is vertical. */
158 EBitmapOrientationVertical,
159 /** The bitmap is horizontal. */
160 EBitmapOrientationHorizontal
163 IMPORT_C static TRgb ColorAdjust(TRgb aColor,TInt aPercentage);
164 IMPORT_C static void CreateGradientBitmapL(CFbsBitmap& aBitmap, const RWsSession& aWs, TInt aBreadth,
165 TBitmapOrientation aOrientation, TRgb aStartColor, TRgb aEndColor);
166 IMPORT_C static CColorList* CreateSystemColorListL(RFs& aFs);
167 IMPORT_C static CColorList* CreateSystemColorListL(RFs& aFs,const CColorList& aColorList);
168 IMPORT_C static void UpdateSystemColorListL(RFs& aFs,CColorList& aColorList);
169 IMPORT_C static void GetRgbDerivedBorderColors(TGulBorder::TColors& aBorderColors,TRgb aBackgroundColor,TDisplayMode aMode);
170 IMPORT_C static TRgb RgbDarkerColor(TRgb aRgb,TDisplayMode aMode);
171 IMPORT_C static TRgb RgbMidDarkerColor(TRgb aRgb,TDisplayMode aMode);
172 IMPORT_C static TRgb RgbLighterColor(TRgb aRgb,TDisplayMode aMode);
176 class TFindWidthOfWidestTextItem
177 /** Finds the width in pixels of the widest item in a range of indexed text items.
179 This is the base class for several classes used to get the maximum width for
180 date and time components.
182 Derived classes should override the pure virtual methods to supply an appropriate
189 /** Default constructor. */
190 inline TFindWidthOfWidestTextItem() {}
192 IMPORT_C TInt MaximumWidthInPixels(const CFont& aFont) const;
194 /** Gets the first and last index in the range of items.
196 @param aFirstIndex On return, the first index.
197 @param aLastIndex On return, the last index.
200 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const=0;
201 /** Gets the text item at the specfied index.
203 @param aText On return, the indexed text item.
204 @param aIndex The index.
207 virtual void GetTextItem(TDes& aText, TInt aIndex) const=0;
211 class TFindWidthOfWidestDigit : public TFindWidthOfWidestTextItem
212 /** Finds the width in pixels of the widest digit, when displayed in a specified
215 After construction, call MaximumWidthInPixels(), defined in the base class,
222 IMPORT_C TFindWidthOfWidestDigit();
224 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
225 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
228 class TFindWidthOfWidestDigitType : public TFindWidthOfWidestTextItem
235 IMPORT_C TFindWidthOfWidestDigitType(TDigitType aDigitType);
237 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
238 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
241 TDigitType iDigitType;
244 class TFindWidthOfWidestAmPmName : public TFindWidthOfWidestTextItem
245 /** Finds the width in pixels of the widest Am or Pm text, when displayed in a specified
248 After construction, call MaximumWidthInPixels(), defined in the base class,
256 IMPORT_C TFindWidthOfWidestAmPmName();
258 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
259 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
262 class TFindWidthOfWidestAbbreviatedDayName : public TFindWidthOfWidestTextItem
263 /** Finds the width in pixels of the widest abbreviated day name (for instance Mon, Tue)
264 when displayed in a specified font.
266 After construction, call MaximumWidthInPixels(), defined in the base class,
274 IMPORT_C TFindWidthOfWidestAbbreviatedDayName();
276 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
277 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
281 class TFindWidthOfWidestDayName : public TFindWidthOfWidestTextItem
282 /** Finds the width in pixels of the widest day name, when displayed in a specified
285 After construction, call MaximumWidthInPixels(), defined in the base class,
292 IMPORT_C TFindWidthOfWidestDayName();
294 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
295 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
299 class TFindWidthOfWidestAbbreviatedMonthName : public TFindWidthOfWidestTextItem
300 /** Finds the width in pixels of the widest abbreviated month name (for instance Jan, Feb),
301 when displayed in a specified font.
303 After construction, call MaximumWidthInPixels(), defined in the base class,
310 IMPORT_C TFindWidthOfWidestAbbreviatedMonthName();
312 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
313 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
316 class TFindWidthOfWidestMonthName : public TFindWidthOfWidestTextItem
317 /** Finds the width in pixels of the widest month name, when displayed in a specified
320 After construction, call MaximumWidthInPixels(), defined in the base class,
327 IMPORT_C TFindWidthOfWidestMonthName();
329 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
330 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
333 class TFindWidthOfWidestDateSuffix : public TFindWidthOfWidestTextItem
334 /** Finds the width in pixels of the widest date suffix (for instance st, nd),
335 when displayed in a specified font.
337 After construction, call MaximumWidthInPixels(), defined in the base class,
344 IMPORT_C TFindWidthOfWidestDateSuffix();
346 virtual void GetFirstAndLastIndex(TInt& aFirstIndex, TInt& aLastIndex) const;
347 virtual void GetTextItem(TDes& aText, TInt aIndex) const;
350 // class ResourceUtils
351 inline TInt8 ResourceUtils::ReadTInt8L(TResourceReader& aReader)
352 /** Reads an 8 bit signed integer from a resource.
354 @param aReader Resource reader to use to read the integer.
355 @return The 8 bit signed integer. */
356 { return((TInt8)ReadResourceIntL(aReader,EResourceInt8)); }
357 inline TInt16 ResourceUtils::ReadTInt16L(TResourceReader& aReader)
358 /** Reads a 16 bit signed integer from a resource.
360 @param aReader Resource reader to use to read the integer.
361 @return The 16 bit signed integer. */
362 { return((TInt16)ReadResourceIntL(aReader,EResourceInt16)); }
363 inline TInt32 ResourceUtils::ReadTInt32L(TResourceReader& aReader)
364 /** Reads a 32 bit signed integer from a resource.
366 @param aReader Resource reader to use to read the integer.
367 @return The 32 bit signed integer. */
368 { return((TInt32)ReadResourceIntL(aReader,EResourceInt32)); }