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@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 |
#ifndef __LAFMAIN_H__
|
williamr@2
|
17 |
#define __LAFMAIN_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#include <gulbordr.h>
|
williamr@2
|
22 |
#include <gulcolor.h>
|
williamr@2
|
23 |
#include <frmtlay.h>
|
williamr@2
|
24 |
|
williamr@2
|
25 |
class CCoeControl;
|
williamr@2
|
26 |
class CFont;
|
williamr@2
|
27 |
class TLogicalFont;
|
williamr@2
|
28 |
class MLafEnv;
|
williamr@2
|
29 |
|
williamr@2
|
30 |
|
williamr@2
|
31 |
class CLafEdwinCustomDrawBase : public CBase, public MFormCustomDraw
|
williamr@2
|
32 |
/** LAF support for custom drawing of Edwins.
|
williamr@2
|
33 |
|
williamr@2
|
34 |
This class is used by CEikEdwin to draw lines in plain text editors. It does
|
williamr@2
|
35 |
not work in rich text editors, as it assumes the line spacing is constant.
|
williamr@2
|
36 |
|
williamr@2
|
37 |
The custom drawing interface is defined by the MFormCustomDraw class.
|
williamr@2
|
38 |
|
williamr@2
|
39 |
@publishedPartner
|
williamr@2
|
40 |
@released */
|
williamr@2
|
41 |
{
|
williamr@2
|
42 |
public:
|
williamr@2
|
43 |
/** Allocates and constructs the custom drawer.
|
williamr@2
|
44 |
|
williamr@2
|
45 |
@param aEnv LAF environment functions
|
williamr@2
|
46 |
@param aControl The Edwin control
|
williamr@2
|
47 |
@return New custom drawer */
|
williamr@2
|
48 |
IMPORT_C static CLafEdwinCustomDrawBase* NewL(const MLafEnv& aEnv,const CCoeControl& aControl);
|
williamr@2
|
49 |
public: // from MFormCustomDraw
|
williamr@2
|
50 |
/** Implements MFormCustomDraw::DrawBackground() to draw the Edwin background.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
See that function for a full description.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
@param aParam Drawing parameters
|
williamr@2
|
55 |
@param aBackground Default background colour
|
williamr@2
|
56 |
@param aDrawn On return, the rectangle to which the function has drawn */
|
williamr@2
|
57 |
IMPORT_C void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
|
williamr@2
|
58 |
/** Gets the physical colour that maps to a specified logical colour.
|
williamr@2
|
59 |
|
williamr@2
|
60 |
@param aColorIndex Logical colour
|
williamr@2
|
61 |
@param aDefaultColor The default physical colour. This is the colour to be
|
williamr@2
|
62 |
used if no translation is performed. This allows translation to change certain
|
williamr@2
|
63 |
indices but not others ( by passing the default colour back unchanged).
|
williamr@2
|
64 |
@return Physical colour */
|
williamr@2
|
65 |
IMPORT_C TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
|
williamr@2
|
66 |
public:
|
williamr@2
|
67 |
/** Notifies the drawer that a MEikEdwinObserver::EEventFormatChanged event has
|
williamr@2
|
68 |
occurred for the Edwin. */
|
williamr@2
|
69 |
IMPORT_C virtual void LineSpacingChanged();
|
williamr@2
|
70 |
protected:
|
williamr@2
|
71 |
/** Constructor that initialises data members.
|
williamr@2
|
72 |
|
williamr@2
|
73 |
@param aEnv LAF environment functions
|
williamr@2
|
74 |
@param aControl The Edwin control */
|
williamr@2
|
75 |
IMPORT_C CLafEdwinCustomDrawBase(const MLafEnv& aEnv,const CCoeControl& aControl);
|
williamr@2
|
76 |
protected:
|
williamr@2
|
77 |
/** LAF environment functions
|
williamr@2
|
78 |
|
williamr@2
|
79 |
This is initialised by the constructor. */
|
williamr@2
|
80 |
const MLafEnv& iEnv;
|
williamr@2
|
81 |
/** The Edwin control.
|
williamr@2
|
82 |
|
williamr@2
|
83 |
This is initialised by the constructor. */
|
williamr@2
|
84 |
const CCoeControl& iControl;
|
williamr@2
|
85 |
private:
|
williamr@2
|
86 |
/** Unused. */
|
williamr@2
|
87 |
TInt iSpare;
|
williamr@2
|
88 |
};
|
williamr@2
|
89 |
|
williamr@2
|
90 |
|
williamr@2
|
91 |
class CLafEdwinCustomWrapBase : public CBase, public MFormCustomWrap
|
williamr@2
|
92 |
/** LAF support for custom line breaking in Edwins.
|
williamr@2
|
93 |
|
williamr@2
|
94 |
This class is used by CEikEdwin to determine how to place line breaks.
|
williamr@2
|
95 |
|
williamr@2
|
96 |
The custom line breaking interface is defined by the MFormCustomWrap class.
|
williamr@2
|
97 |
|
williamr@2
|
98 |
@publishedPartner
|
williamr@2
|
99 |
@released */
|
williamr@2
|
100 |
{
|
williamr@2
|
101 |
public:
|
williamr@2
|
102 |
/** Allocates and constructs the custom line breaker.
|
williamr@2
|
103 |
|
williamr@2
|
104 |
@param aControl The Edwin control
|
williamr@2
|
105 |
@return The new line breaker */
|
williamr@2
|
106 |
IMPORT_C static CLafEdwinCustomWrapBase* NewL(const CCoeControl& aControl);
|
williamr@2
|
107 |
/** Destructor. */
|
williamr@2
|
108 |
IMPORT_C ~CLafEdwinCustomWrapBase();
|
williamr@2
|
109 |
public: // from MFormCustomWrap
|
williamr@2
|
110 |
/** Gets the line break class for a Unicode character.
|
williamr@2
|
111 |
|
williamr@2
|
112 |
This implements MFormCustomWrap::LineBreakClass().
|
williamr@2
|
113 |
|
williamr@2
|
114 |
@param aCode The Unicode character code
|
williamr@2
|
115 |
@param aRangeStart On return, contains the Unicode character code at the start
|
williamr@2
|
116 |
of the range including aCode that shares the same line break class as aCode.
|
williamr@2
|
117 |
@param aRangeEnd On return, contains the Unicode character code at the end
|
williamr@2
|
118 |
of the range including aCode that shares the same line break class as aCode
|
williamr@2
|
119 |
@return The line break class assigned to the character. Line break classes
|
williamr@2
|
120 |
are enumerated with MTmCustom::EOpLineBreakClass etc. */
|
williamr@2
|
121 |
IMPORT_C TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
|
williamr@2
|
122 |
/** Tests whether a line break is possible between two characters.
|
williamr@2
|
123 |
|
williamr@2
|
124 |
This implements MFormCustomWrap::LineBreakPossible().
|
williamr@2
|
125 |
|
williamr@2
|
126 |
@param aPrevClass The line break class of the previous non-space character.
|
williamr@2
|
127 |
@param aNextClass The line break class of the next non-space character.
|
williamr@2
|
128 |
@param aHaveSpaces True if there are one or more space characters (with a line
|
williamr@2
|
129 |
break class of MTmCustom::ESpLineBreakClass) between aPrevClass and aNextClass;
|
williamr@2
|
130 |
false if not.
|
williamr@2
|
131 |
@return ool True if a line break is possible between characters with the two
|
williamr@2
|
132 |
line break classes, false if not */
|
williamr@2
|
133 |
IMPORT_C TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
|
williamr@2
|
134 |
/** Gets the position of the first or last possible line break position in a text
|
williamr@2
|
135 |
string.
|
williamr@2
|
136 |
|
williamr@2
|
137 |
This implements MFormCustomWrap::GetLineBreakInContext().
|
williamr@2
|
138 |
|
williamr@2
|
139 |
@param aText A string containing characters of class MTmCustom::ESaLineBreakClass.
|
williamr@2
|
140 |
|
williamr@2
|
141 |
@param aMinBreakPos A position within aText at which to begin searching for
|
williamr@2
|
142 |
a possible line break position.
|
williamr@2
|
143 |
@param aMaxBreakPos A position within aText at which to stop searching for
|
williamr@2
|
144 |
a possible line break position.
|
williamr@2
|
145 |
@param aForwards If ETrue, the function gets the first possible line break
|
williamr@2
|
146 |
position (searches forwards from aMinBreakPos); if EFalse, gets the last one
|
williamr@2
|
147 |
(searches backwards from aMaxBreakPos).
|
williamr@2
|
148 |
@param aBreakPos On return, the position of the first or last possible line
|
williamr@2
|
149 |
break within aText. This must be greater than zero and less than aText.Length()
|
williamr@2
|
150 |
- 1, and must also be in the range aMinBreakPos to aMaxBreakPos.
|
williamr@2
|
151 |
@return True if a possible line break position is found, false if not */
|
williamr@2
|
152 |
IMPORT_C TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,TInt& aBreakPos) const;
|
williamr@2
|
153 |
/** Tests whether a character can overhang the right margin.
|
williamr@2
|
154 |
|
williamr@2
|
155 |
@param aChar The Unicode character code of interest
|
williamr@2
|
156 |
@return True if the character specified can overhang the right margin, false
|
williamr@2
|
157 |
if not */
|
williamr@2
|
158 |
IMPORT_C TBool IsHangingCharacter(TUint aChar) const;
|
williamr@2
|
159 |
private:
|
williamr@2
|
160 |
/** Unused. */
|
williamr@2
|
161 |
IMPORT_C void MFormCustomWrap_Reserved_1();
|
williamr@2
|
162 |
/** Unused. */
|
williamr@2
|
163 |
IMPORT_C void MFormCustomWrap_Reserved_2();
|
williamr@2
|
164 |
|
williamr@2
|
165 |
protected:
|
williamr@2
|
166 |
/** Constructor.
|
williamr@2
|
167 |
|
williamr@2
|
168 |
@param aControl The Edwin control */
|
williamr@2
|
169 |
IMPORT_C CLafEdwinCustomWrapBase(const CCoeControl& aControl);
|
williamr@2
|
170 |
protected:
|
williamr@2
|
171 |
/** The Edwin control, initialised by the constructor. */
|
williamr@2
|
172 |
const CCoeControl& iControl;
|
williamr@2
|
173 |
private:
|
williamr@2
|
174 |
/** Unused. */
|
williamr@2
|
175 |
TInt iSpare;
|
williamr@2
|
176 |
};
|
williamr@2
|
177 |
|
williamr@2
|
178 |
class MLafEnv
|
williamr@2
|
179 |
/** LAF interface to access the current system environment settings.
|
williamr@2
|
180 |
|
williamr@2
|
181 |
It is implemented by the Uikon Core, and effectively allows the LAF
|
williamr@2
|
182 |
limited access to the current thread's CEikonEnv.
|
williamr@2
|
183 |
|
williamr@2
|
184 |
@publishedPartner
|
williamr@2
|
185 |
@released
|
williamr@2
|
186 |
*/
|
williamr@2
|
187 |
//@publishedAll @deprecated
|
williamr@2
|
188 |
{
|
williamr@2
|
189 |
public:
|
williamr@2
|
190 |
/** Gets the environment's nearest match to the specified logical font.
|
williamr@2
|
191 |
|
williamr@2
|
192 |
The return value is never NULL.
|
williamr@2
|
193 |
|
williamr@2
|
194 |
@param aLogicalFont Logical font to match.
|
williamr@2
|
195 |
@return The font that most closely matches aLogicalFont. */
|
williamr@2
|
196 |
virtual const CFont* Font(const TLogicalFont& aLogicalFont) const=0;
|
williamr@2
|
197 |
|
williamr@2
|
198 |
/** Gets an environment bitmap specified by UID.
|
williamr@2
|
199 |
|
williamr@2
|
200 |
@param aBmpUid The UID of the bitmap to retrieve.
|
williamr@2
|
201 |
@return The bitmap. */
|
williamr@2
|
202 |
virtual const CFbsBitmap* Bitmap(TUid aBmpUid) const=0;
|
williamr@2
|
203 |
|
williamr@2
|
204 |
/** Gets the physical (TRgb) colour that corresponds to the specified
|
williamr@2
|
205 |
logical colour, for a specified control.
|
williamr@2
|
206 |
|
williamr@2
|
207 |
@param aLogicalColor Logical colour.
|
williamr@2
|
208 |
@param aControl Control for which to get the mapping. Note controls can override
|
williamr@2
|
209 |
the system mappings.
|
williamr@2
|
210 |
@return Physical colour. */
|
williamr@2
|
211 |
virtual TRgb ControlColor(TLogicalColor aLogicalColor, const CCoeControl& aControl) const=0;
|
williamr@2
|
212 |
|
williamr@2
|
213 |
/** Gets the environment's physical (TRgb) colour that corresponds to
|
williamr@2
|
214 |
the specified logical colour.
|
williamr@2
|
215 |
|
williamr@2
|
216 |
@param aLogicalColor Logical colour.
|
williamr@2
|
217 |
@param aColorListUid UID of the colour list from which to get the mapping. The default
|
williamr@2
|
218 |
value is the environment's list.
|
williamr@2
|
219 |
@return Physical colour. */
|
williamr@2
|
220 |
virtual TRgb Color(TLogicalColor aLogicalColor, TUid aColorListUid=KNullUid) const=0;
|
williamr@2
|
221 |
|
williamr@2
|
222 |
/** Gets the environment setting for the default display mode.
|
williamr@2
|
223 |
|
williamr@2
|
224 |
@return Display mode. */
|
williamr@2
|
225 |
virtual TDisplayMode DefaultDisplayMode() const=0;
|
williamr@2
|
226 |
};
|
williamr@2
|
227 |
|
williamr@2
|
228 |
class MLafClientRectResolver
|
williamr@2
|
229 |
/** Interface that works out how screen furniture reduces the available screen area
|
williamr@2
|
230 |
for applications.
|
williamr@2
|
231 |
|
williamr@2
|
232 |
The interface is implemented by the UI and can be called by the LAF to get information
|
williamr@2
|
233 |
on the areas of screen furniture.
|
williamr@2
|
234 |
|
williamr@2
|
235 |
@see LafAppUi::ClientRect()
|
williamr@2
|
236 |
@publishedPartner
|
williamr@2
|
237 |
@released */
|
williamr@2
|
238 |
{
|
williamr@2
|
239 |
public:
|
williamr@2
|
240 |
/** Flags for types of screen furniture. */
|
williamr@2
|
241 |
enum TScreenFurniture
|
williamr@2
|
242 |
{
|
williamr@2
|
243 |
/** Menu bar. */
|
williamr@2
|
244 |
EMenuBar,
|
williamr@2
|
245 |
/** Button group. */
|
williamr@2
|
246 |
EButtonGroup,
|
williamr@2
|
247 |
/** Tool band. */
|
williamr@2
|
248 |
EToolBand,
|
williamr@2
|
249 |
/** Title band. */
|
williamr@2
|
250 |
ETitleBand,
|
williamr@2
|
251 |
/** Status pane. */
|
williamr@2
|
252 |
EStatusPane,
|
williamr@2
|
253 |
/** Command Button Array */
|
williamr@2
|
254 |
ECba
|
williamr@2
|
255 |
};
|
williamr@2
|
256 |
public:
|
williamr@2
|
257 |
/** Calculates how a specified type of screen furniture reduces the application
|
williamr@2
|
258 |
area of a specified screen rectangle.
|
williamr@2
|
259 |
|
williamr@2
|
260 |
@param aScreenFurniture Type of screen furniture.
|
williamr@2
|
261 |
@param aRect Screen rectangle from which to remove area of specified furniture.
|
williamr@2
|
262 |
On return, the modified rectangle. */
|
williamr@2
|
263 |
virtual void ReduceRect(TScreenFurniture aScreenFurniture,TRect& aRect) const=0;
|
williamr@2
|
264 |
};
|
williamr@2
|
265 |
|
williamr@2
|
266 |
#endif //__LAFMAIN_H__
|