williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#if !defined(__GULFONT_H__)
|
williamr@2
|
17 |
#define __GULFONT_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <gdi.h>
|
williamr@2
|
20 |
#include <w32std.h>
|
williamr@2
|
21 |
|
williamr@2
|
22 |
class TResourceReader;
|
williamr@2
|
23 |
|
williamr@2
|
24 |
class TLogicalFont
|
williamr@2
|
25 |
/** Packages the attributes of a logical font.
|
williamr@2
|
26 |
|
williamr@2
|
27 |
These attributes include a UID (iFontId) and a category (iCategory), either
|
williamr@2
|
28 |
of which can be used to identify a required system font. The possible values
|
williamr@2
|
29 |
for the UID are defined in the UI variant's look and feel layer, so are not
|
williamr@2
|
30 |
the same as the UID values that may be used to create a physical font.
|
williamr@2
|
31 |
|
williamr@2
|
32 |
An object of this class can be passed by any application to CEikonEnv::Font(),
|
williamr@2
|
33 |
to return the closest matching system font (a CFont-derived object).
|
williamr@2
|
34 |
|
williamr@2
|
35 |
@publishedAll
|
williamr@2
|
36 |
@released */
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
public:
|
williamr@2
|
39 |
/** Logical font categories.
|
williamr@2
|
40 |
|
williamr@2
|
41 |
The font category specifies the type of font that is required. It can be specified
|
williamr@2
|
42 |
as an alternative to the logical font UID. The physical fonts associated with
|
williamr@2
|
43 |
these categories are specified in the LAF layer, so are UI variant-specific. */
|
williamr@2
|
44 |
enum TFontCategory
|
williamr@2
|
45 |
{
|
williamr@2
|
46 |
/** The normal system font. */
|
williamr@2
|
47 |
EView,
|
williamr@2
|
48 |
/** The font used in buttons. */
|
williamr@2
|
49 |
EButton,
|
williamr@2
|
50 |
/** The font used for annotations. This is smaller than the normal font.
|
williamr@2
|
51 |
For instance, it is used to draw the page number in some applications. */
|
williamr@2
|
52 |
EAnnotation,
|
williamr@2
|
53 |
/** The font used for titles. */
|
williamr@2
|
54 |
ETitle
|
williamr@2
|
55 |
};
|
williamr@2
|
56 |
/** Font styles. */
|
williamr@2
|
57 |
enum TFontStyle
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
/** Normal style. */
|
williamr@2
|
60 |
ENormal,
|
williamr@2
|
61 |
/** Bold. */
|
williamr@2
|
62 |
EBold,
|
williamr@2
|
63 |
/** Italics. */
|
williamr@2
|
64 |
EItalic,
|
williamr@2
|
65 |
/** Bold and italics. */
|
williamr@2
|
66 |
EBoldItalic,
|
williamr@2
|
67 |
/** Superscript. */
|
williamr@2
|
68 |
ESuperscript,
|
williamr@2
|
69 |
/** Subscript. */
|
williamr@2
|
70 |
ESubscript,
|
williamr@2
|
71 |
/** Light. This is the opposite of bold, i.e. a smaller than normal pen size is
|
williamr@2
|
72 |
used to draw it. */
|
williamr@2
|
73 |
ELight,
|
williamr@2
|
74 |
/** Custom font. */
|
williamr@2
|
75 |
ECustom
|
williamr@2
|
76 |
};
|
williamr@2
|
77 |
public:
|
williamr@2
|
78 |
IMPORT_C TLogicalFont();
|
williamr@2
|
79 |
IMPORT_C TLogicalFont(TUid aId);
|
williamr@2
|
80 |
IMPORT_C TLogicalFont(TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
|
williamr@2
|
81 |
IMPORT_C TLogicalFont(TUid aId,TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
|
williamr@2
|
82 |
public:
|
williamr@2
|
83 |
/** The logical font ID. */
|
williamr@2
|
84 |
TUid iFontId;
|
williamr@2
|
85 |
/** The logical font category. */
|
williamr@2
|
86 |
TFontCategory iCategory;
|
williamr@2
|
87 |
/** The font style. */
|
williamr@2
|
88 |
TFontStyle iStyle;
|
williamr@2
|
89 |
/** The zoom factor. */
|
williamr@2
|
90 |
TZoomFactor iZoomFactor;
|
williamr@2
|
91 |
};
|
williamr@2
|
92 |
|
williamr@2
|
93 |
|
williamr@2
|
94 |
class CCleanupStackableFont : public CBase
|
williamr@2
|
95 |
/** Wraps a font (CFbsFont) object that can be pushed onto the cleanup stack.
|
williamr@2
|
96 |
|
williamr@2
|
97 |
By default, the cleanup stack only handles CBase-derived classes, and untyped
|
williamr@2
|
98 |
(TAny*) objects that can be cleaned up by a simple memory free call. Fonts
|
williamr@2
|
99 |
must also be released, which this class handles automatically in its destructor.
|
williamr@2
|
100 |
|
williamr@2
|
101 |
The font is initialised from a resource file, and can be identified by name
|
williamr@2
|
102 |
or UID.
|
williamr@2
|
103 |
|
williamr@2
|
104 |
@publishedAll
|
williamr@2
|
105 |
@released
|
williamr@2
|
106 |
@see CFbsFont */
|
williamr@2
|
107 |
{
|
williamr@2
|
108 |
public:
|
williamr@2
|
109 |
IMPORT_C static CCleanupStackableFont* NewL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
|
williamr@2
|
110 |
IMPORT_C static CCleanupStackableFont* NewLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
|
williamr@2
|
111 |
IMPORT_C static CCleanupStackableFont* NewByNameL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
|
williamr@2
|
112 |
IMPORT_C static CCleanupStackableFont* NewByNameLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
|
williamr@2
|
113 |
IMPORT_C virtual ~CCleanupStackableFont();
|
williamr@2
|
114 |
public:
|
williamr@2
|
115 |
IMPORT_C CFbsFont& Font() const;
|
williamr@2
|
116 |
IMPORT_C CFbsFont* TakeOwnershipOfFont();
|
williamr@2
|
117 |
private:
|
williamr@2
|
118 |
CCleanupStackableFont(CWsScreenDevice& aScreenDevice);
|
williamr@2
|
119 |
static CCleanupStackableFont* NewLC(TBool aByUid,TResourceReader& aReader, CWsScreenDevice& aScreenDevice);
|
williamr@2
|
120 |
private:
|
williamr@2
|
121 |
CWsScreenDevice& iScreenDevice;
|
williamr@2
|
122 |
CFbsFont* iFont;
|
williamr@2
|
123 |
};
|
williamr@2
|
124 |
|
williamr@2
|
125 |
#endif
|