williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1998-1999 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#if !defined(__EIKLBD_H__)
|
williamr@2
|
21 |
#define __EIKLBD_H__
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#include <e32base.h>
|
williamr@2
|
24 |
#include <gdi.h>
|
williamr@2
|
25 |
#include <w32std.h>
|
williamr@2
|
26 |
#include <eiklbx.h>
|
williamr@2
|
27 |
|
williamr@2
|
28 |
class TListItemProperties;
|
williamr@2
|
29 |
class CListBoxDataExtension;
|
williamr@2
|
30 |
class MAknsControlContext;
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/**
|
williamr@2
|
33 |
* The data container class @c TListFontBoundValues class holds size
|
williamr@2
|
34 |
* properties of the fonts used in list boxes.
|
williamr@2
|
35 |
*
|
williamr@2
|
36 |
* @since ER5U
|
williamr@2
|
37 |
*/
|
williamr@2
|
38 |
class TListFontBoundValues
|
williamr@2
|
39 |
{
|
williamr@2
|
40 |
public: // Constructors and destructor
|
williamr@2
|
41 |
|
williamr@2
|
42 |
/**
|
williamr@2
|
43 |
* Default C++ constructor
|
williamr@2
|
44 |
*/
|
williamr@2
|
45 |
IMPORT_C TListFontBoundValues();
|
williamr@2
|
46 |
|
williamr@2
|
47 |
public: // Data
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* The maximum permitted width of list box characters in pixels.
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
TInt iMaxNormalCharWidthInPixels;
|
williamr@2
|
53 |
|
williamr@2
|
54 |
/**
|
williamr@2
|
55 |
* The list box height in pixels.
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
TInt iHeightInPixels;
|
williamr@2
|
58 |
};
|
williamr@2
|
59 |
|
williamr@2
|
60 |
/**
|
williamr@2
|
61 |
* The @c CListBoxData class is the base class for list box data classes.
|
williamr@2
|
62 |
* It stores one or more instances of fonts in normal, bold and italic styles.
|
williamr@2
|
63 |
*
|
williamr@2
|
64 |
* @since ER5U
|
williamr@2
|
65 |
*/
|
williamr@2
|
66 |
class CListBoxData : public CBase
|
williamr@2
|
67 |
{
|
williamr@2
|
68 |
|
williamr@2
|
69 |
// friend classes
|
williamr@2
|
70 |
friend class CListItemDrawer;
|
williamr@2
|
71 |
|
williamr@2
|
72 |
public: // Constructors and destructor
|
williamr@2
|
73 |
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
* C++ default constructor.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
IMPORT_C CListBoxData();
|
williamr@2
|
78 |
|
williamr@2
|
79 |
/**
|
williamr@2
|
80 |
* Destructor
|
williamr@2
|
81 |
*/
|
williamr@2
|
82 |
IMPORT_C ~CListBoxData();
|
williamr@2
|
83 |
|
williamr@2
|
84 |
public: // New functions
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
* By default Symbian 2nd phase constructor is private.
|
williamr@2
|
88 |
* This one is public.
|
williamr@2
|
89 |
*
|
williamr@2
|
90 |
* @param aBaseFont Parameter not used in the code.
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
IMPORT_C void ConstructL(const CFont* aBaseFont);
|
williamr@2
|
93 |
|
williamr@2
|
94 |
/**
|
williamr@2
|
95 |
* Returns a pointer to the type of font wanted.
|
williamr@2
|
96 |
*
|
williamr@2
|
97 |
* @param aItemProperties Definition of font type wanted.
|
williamr@2
|
98 |
* @return CFont* Handle to the font or NULL.
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
IMPORT_C virtual CFont*
|
williamr@2
|
101 |
Font(const TListItemProperties& aItemProperties) const;
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
* Sets properties (underlining on / off, pen colorm and font) of
|
williamr@2
|
105 |
* graphical context.
|
williamr@2
|
106 |
*
|
williamr@2
|
107 |
* @param aItemProperties Contains properties to set.
|
williamr@2
|
108 |
* @param aGc Target of settings.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
IMPORT_C void SetupGc(const TListItemProperties& aItemProperties,
|
williamr@2
|
111 |
CWindowGc& aGc) const;
|
williamr@2
|
112 |
|
williamr@2
|
113 |
/**
|
williamr@2
|
114 |
* Queries boundary values of font size.
|
williamr@2
|
115 |
*
|
williamr@2
|
116 |
* @retun TListFontBoundValues& Reference to boundary value object.
|
williamr@2
|
117 |
*/
|
williamr@2
|
118 |
IMPORT_C const TListFontBoundValues& FontBoundValues() const;
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/**
|
williamr@2
|
121 |
* Sets a new height of fonts
|
williamr@2
|
122 |
*
|
williamr@2
|
123 |
* @param aFontHeightInTwips New height for fonts.
|
williamr@2
|
124 |
* @return TInt Symbian error code, @c KErrNone if success.
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C TInt SetFontHeight(TInt aFontHeightInTwips);
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
* Setter for a search string used for viewing search results
|
williamr@2
|
130 |
*
|
williamr@2
|
131 |
* @param aSearchString The search string.
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
IMPORT_C void SetSearchStringL(const TDesC* aSearchString);
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/**
|
williamr@2
|
136 |
* Query is search string set
|
williamr@2
|
137 |
*
|
williamr@2
|
138 |
* @return TBool @c ETrue if search string set and has non zero length.
|
williamr@2
|
139 |
* @c EFalse if no search string set or length is 0.
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C TBool IsSearchString() const;
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Draws list item text. Supports different drawing for the search string.
|
williamr@2
|
145 |
*
|
williamr@2
|
146 |
* @param aGc Graphics context used.
|
williamr@2
|
147 |
* @param aItemTextRect The item's text rectangle.
|
williamr@2
|
148 |
* @param aItemText Text of the item.
|
williamr@2
|
149 |
* @param aItemFont Used font.
|
williamr@2
|
150 |
* @param aBaseLineOffset Item's base line offset.
|
williamr@2
|
151 |
* @param aAlign Text alignment.
|
williamr@2
|
152 |
* Default alignment is @c CGraphicsContext::ELeft
|
williamr@2
|
153 |
*/
|
williamr@2
|
154 |
IMPORT_C void DrawItem(CWindowGc& aGc,
|
williamr@2
|
155 |
const TRect& aItemTextRect,
|
williamr@2
|
156 |
const TDesC& aItemText,
|
williamr@2
|
157 |
const CFont& aItemFont,
|
williamr@2
|
158 |
const TInt aBaseLineOffset,
|
williamr@2
|
159 |
const CGraphicsContext::TTextAlign aAlign =
|
williamr@2
|
160 |
CGraphicsContext::ELeft) const;
|
williamr@2
|
161 |
|
williamr@2
|
162 |
/**
|
williamr@2
|
163 |
* Sets list item's text alignment.
|
williamr@2
|
164 |
*
|
williamr@2
|
165 |
* @param aAlign Text alignment to use.
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
inline void SetAlignmentL(CGraphicsContext::TTextAlign aAlign);
|
williamr@2
|
168 |
|
williamr@2
|
169 |
/**
|
williamr@2
|
170 |
* Queries used text alignment.
|
williamr@2
|
171 |
*
|
williamr@2
|
172 |
* @return CGraphicsContext::TTextAlign The text alignment.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
inline CGraphicsContext::TTextAlign Alignment() const;
|
williamr@2
|
175 |
|
williamr@2
|
176 |
/**
|
williamr@2
|
177 |
* Access to skin contexts from plain listboxes.
|
williamr@2
|
178 |
*
|
williamr@2
|
179 |
* @since Series 60 2.0
|
williamr@2
|
180 |
* @return MAknsControlContext* Used skin context
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
IMPORT_C MAknsControlContext* SkinBackgroundControlContext() const;
|
williamr@2
|
183 |
|
williamr@2
|
184 |
protected:
|
williamr@2
|
185 |
|
williamr@2
|
186 |
/**
|
williamr@2
|
187 |
* Sets a background skinning context. Set @c NULL to disable background
|
williamr@2
|
188 |
* skinning.
|
williamr@2
|
189 |
*
|
williamr@2
|
190 |
* @since Series 60 2.0
|
williamr@2
|
191 |
* @param aContext Background skinning context.
|
williamr@2
|
192 |
*/
|
williamr@2
|
193 |
IMPORT_C void
|
williamr@2
|
194 |
SetSkinBackgroundControlContextL(MAknsControlContext* aContext);
|
williamr@2
|
195 |
|
williamr@2
|
196 |
/**
|
williamr@2
|
197 |
* Sets whether skins are enabled.
|
williamr@2
|
198 |
*
|
williamr@2
|
199 |
* @param aEnabled @c EFalse disable skinning, @c ETrue enable
|
williamr@2
|
200 |
*/
|
williamr@2
|
201 |
IMPORT_C void SetSkinEnabledL(TBool aEnabled);
|
williamr@2
|
202 |
|
williamr@2
|
203 |
protected:
|
williamr@2
|
204 |
|
williamr@2
|
205 |
NONSHARABLE_CLASS(CFontsWithStyle) : public CBase
|
williamr@2
|
206 |
{
|
williamr@2
|
207 |
|
williamr@2
|
208 |
public: // Constructors and destructor
|
williamr@2
|
209 |
|
williamr@2
|
210 |
/**
|
williamr@2
|
211 |
* C++ default constructor.
|
williamr@2
|
212 |
*/
|
williamr@2
|
213 |
CFontsWithStyle();
|
williamr@2
|
214 |
|
williamr@2
|
215 |
/**
|
williamr@2
|
216 |
* Destructor.
|
williamr@2
|
217 |
*/
|
williamr@2
|
218 |
~CFontsWithStyle();
|
williamr@2
|
219 |
|
williamr@2
|
220 |
public: // new functions
|
williamr@2
|
221 |
|
williamr@2
|
222 |
/**
|
williamr@2
|
223 |
* Releases fonts when they are no longer required.
|
williamr@2
|
224 |
*/
|
williamr@2
|
225 |
IMPORT_C void ReleaseFonts();
|
williamr@2
|
226 |
|
williamr@2
|
227 |
/**
|
williamr@2
|
228 |
* Getter for used font style
|
williamr@2
|
229 |
*
|
williamr@2
|
230 |
* @return TFontStyle Used font style
|
williamr@2
|
231 |
*/
|
williamr@2
|
232 |
IMPORT_C TFontStyle FontStyle();
|
williamr@2
|
233 |
|
williamr@2
|
234 |
/**
|
williamr@2
|
235 |
* Setter for used font style
|
williamr@2
|
236 |
*
|
williamr@2
|
237 |
* @return aFontStyle Font style to use.
|
williamr@2
|
238 |
*/
|
williamr@2
|
239 |
IMPORT_C void SetFontStyle(TFontStyle aFontStyle);
|
williamr@2
|
240 |
|
williamr@2
|
241 |
public: // data
|
williamr@2
|
242 |
|
williamr@2
|
243 |
/**
|
williamr@2
|
244 |
* @c CArrayPtrFlat<CFont> is used instead of @c CFont*,
|
williamr@2
|
245 |
* because in some subclasses this structure
|
williamr@2
|
246 |
* can contain more than 1 font.
|
williamr@2
|
247 |
*/
|
williamr@2
|
248 |
CArrayPtrFlat<CFont>* iFonts;
|
williamr@2
|
249 |
|
williamr@2
|
250 |
private: // data
|
williamr@2
|
251 |
|
williamr@2
|
252 |
/**
|
williamr@2
|
253 |
* Font style in use
|
williamr@2
|
254 |
*/
|
williamr@2
|
255 |
TFontStyle iFontStyle;
|
williamr@2
|
256 |
};
|
williamr@2
|
257 |
|
williamr@2
|
258 |
/**
|
williamr@2
|
259 |
* Constructs a new font based on the base font and font style given.
|
williamr@2
|
260 |
* Constructed font is added to @c CFontsWithStyle.
|
williamr@2
|
261 |
*
|
williamr@2
|
262 |
* @param aBaseFont Base fontused in construction
|
williamr@2
|
263 |
* @param aFontStyle A new font's style
|
williamr@2
|
264 |
* @param aFonts New font is added to this font container.
|
williamr@2
|
265 |
*/
|
williamr@2
|
266 |
IMPORT_C void ConstructFontL(const CFont* aBaseFont,
|
williamr@2
|
267 |
TFontStyle aFontStyle,
|
williamr@2
|
268 |
CFontsWithStyle& aFonts);
|
williamr@2
|
269 |
|
williamr@2
|
270 |
/**
|
williamr@2
|
271 |
* Updates width and heigh information. Used when font is changed.
|
williamr@2
|
272 |
*
|
williamr@2
|
273 |
* @param aFont A font from which bound values are taken.
|
williamr@2
|
274 |
*/
|
williamr@2
|
275 |
IMPORT_C void UpdateFontBoundValues(const CFont& aFont);
|
williamr@2
|
276 |
|
williamr@2
|
277 |
/**
|
williamr@2
|
278 |
* Changes fonts' height. Takes new height as argument and regenerates
|
williamr@2
|
279 |
* font set so that height is modified.
|
williamr@2
|
280 |
*
|
williamr@2
|
281 |
* @param aFonts Font set to modify
|
williamr@2
|
282 |
* @param aFontHeightInTwips New font height
|
williamr@2
|
283 |
*/
|
williamr@2
|
284 |
IMPORT_C TInt RegenerateFonts(CFontsWithStyle& aFonts,
|
williamr@2
|
285 |
TInt aFontHeightInTwips);
|
williamr@2
|
286 |
|
williamr@2
|
287 |
protected:
|
williamr@2
|
288 |
|
williamr@2
|
289 |
/**
|
williamr@2
|
290 |
* Normal style font
|
williamr@2
|
291 |
*/
|
williamr@2
|
292 |
CFontsWithStyle iNormalFont;
|
williamr@2
|
293 |
|
williamr@2
|
294 |
/**
|
williamr@2
|
295 |
* Bold style font
|
williamr@2
|
296 |
*/
|
williamr@2
|
297 |
CFontsWithStyle iBoldFont;
|
williamr@2
|
298 |
|
williamr@2
|
299 |
/**
|
williamr@2
|
300 |
* Italic style font
|
williamr@2
|
301 |
*/
|
williamr@2
|
302 |
CFontsWithStyle iItalicFont;
|
williamr@2
|
303 |
|
williamr@2
|
304 |
/**
|
williamr@2
|
305 |
* Font with normal and italic styles
|
williamr@2
|
306 |
*/
|
williamr@2
|
307 |
CFontsWithStyle iBoldItalicFont;
|
williamr@2
|
308 |
|
williamr@2
|
309 |
/**
|
williamr@2
|
310 |
* String used in list box search field.
|
williamr@2
|
311 |
*/
|
williamr@2
|
312 |
HBufC* iSearchString;
|
williamr@2
|
313 |
|
williamr@2
|
314 |
private:
|
williamr@2
|
315 |
|
williamr@2
|
316 |
IMPORT_C virtual void Reserved_1();
|
williamr@2
|
317 |
IMPORT_C virtual void Reserved_2();
|
williamr@2
|
318 |
|
williamr@2
|
319 |
private:
|
williamr@2
|
320 |
|
williamr@2
|
321 |
TListFontBoundValues iFontBoundValues;
|
williamr@2
|
322 |
CGraphicsContext::TTextAlign iAlign;
|
williamr@2
|
323 |
|
williamr@2
|
324 |
private:
|
williamr@2
|
325 |
|
williamr@2
|
326 |
CListBoxDataExtension* iLBDExtension;
|
williamr@2
|
327 |
};
|
williamr@2
|
328 |
|
williamr@2
|
329 |
// Inline functions
|
williamr@2
|
330 |
inline void CListBoxData::SetAlignmentL(CGraphicsContext::TTextAlign aAlign)
|
williamr@2
|
331 |
{iAlign=aAlign;}
|
williamr@2
|
332 |
|
williamr@2
|
333 |
inline CGraphicsContext::TTextAlign CListBoxData::Alignment() const
|
williamr@2
|
334 |
{return iAlign;}
|
williamr@2
|
335 |
|
williamr@2
|
336 |
#endif
|
williamr@2
|
337 |
|
williamr@2
|
338 |
// End of File |