|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: template header for CoverFlow |
|
15 * |
|
16 */ |
|
17 |
|
18 // This file defines the API for MulCoverFlowWidget.dll |
|
19 |
|
20 #ifndef __MULCOVERFLOWTEMPLATE_H__ |
|
21 #define __MULCOVERFLOWTEMPLATE_H__ |
|
22 |
|
23 // Avkon Includes |
|
24 #include <aknlayoutscalable_uiaccel.cdl.h> |
|
25 |
|
26 #include "mulbaseelement.h" // for TMulCoverflowItem |
|
27 |
|
28 namespace osncore |
|
29 { |
|
30 // Forward declarations |
|
31 class UString; |
|
32 } |
|
33 |
|
34 namespace Alf |
|
35 { |
|
36 // Forward declarations |
|
37 class MulCoverFlowControl; |
|
38 |
|
39 struct TMulCoverFlowTemplateImpl |
|
40 { |
|
41 |
|
42 TMulCoverFlowTemplateImpl() |
|
43 { |
|
44 mEnhancedSupportFlag = false; |
|
45 mSliderEnabled = false; |
|
46 mUiOnOffFlag = false; |
|
47 mOrientationChange = false; |
|
48 mControl = NULL; |
|
49 mBaseElement = NULL; |
|
50 mMaxVisibleCount = 0; |
|
51 mTitleFontMaxCharLength = 0; |
|
52 mDetailFontMaxCharLength = 0; |
|
53 mCounterFontMaxCharLength = 0; |
|
54 } |
|
55 |
|
56 //Structure used to store the position and sizes of the counter. |
|
57 TMulCoverFlowItem mCounterDimensions; |
|
58 TMulCoverFlowItem mSliderDimensions; |
|
59 TMulCoverFlowItem mIndicatorDimensions; |
|
60 bool mEnhancedSupportFlag; |
|
61 bool mSliderEnabled; |
|
62 bool mUiOnOffFlag ; |
|
63 int mMaxVisibleCount; |
|
64 MulBaseElement* mBaseElement; |
|
65 bool mOrientationChange; |
|
66 MulCoverFlowControl* mControl; // doesn't own it . |
|
67 mulwidget::TLogicalTemplate mTemplateID; // to store the template name |
|
68 TSize mTitleParentSize; |
|
69 TSize mDetailParentSize; |
|
70 int mTitleFontMaxCharLength; |
|
71 int mDetailFontMaxCharLength; |
|
72 int mCounterFontMaxCharLength; |
|
73 |
|
74 ~TMulCoverFlowTemplateImpl() |
|
75 { |
|
76 } |
|
77 }; |
|
78 |
|
79 |
|
80 |
|
81 class MulCoverFlowTemplate |
|
82 { |
|
83 |
|
84 public: // Constructor and Destructor |
|
85 |
|
86 /** |
|
87 * Constructor |
|
88 */ |
|
89 MulCoverFlowTemplate(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); |
|
90 |
|
91 /** |
|
92 * Destructor |
|
93 */ |
|
94 virtual ~MulCoverFlowTemplate(); |
|
95 |
|
96 public: // New Methods |
|
97 |
|
98 /** |
|
99 * Returns the counter element structure. |
|
100 * |
|
101 * @return Returns a refrence to the counter element structure. |
|
102 */ |
|
103 const TMulCoverFlowItem& CounterDimensions() const |
|
104 {return mData->mCounterDimensions;} |
|
105 |
|
106 /* |
|
107 * Returns whether the current template and orientation supports enhanced mode or not. |
|
108 * |
|
109 * @Returns true/false depending on whether the template supports or not. |
|
110 */ |
|
111 bool EnhancedTagParsed() const {return mData->mEnhancedSupportFlag;} |
|
112 |
|
113 /* |
|
114 * Returns whether the slider is enable or not for the current template and |
|
115 * orientation. |
|
116 * |
|
117 * @Returns true/false depending on whether enabled or not. |
|
118 */ |
|
119 bool IsSliderVisible() const {return mData->mSliderEnabled;} |
|
120 |
|
121 /* |
|
122 * Returns the maxvisible items to be in the respective template . |
|
123 * |
|
124 * @Returns int depending on the no of visble item count. |
|
125 */ |
|
126 int MaxVisibleCount() const {return mData->mMaxVisibleCount;} |
|
127 |
|
128 /** |
|
129 * Returns whether the template is UI on/off or not . |
|
130 * That is UI on/off flag is enabled in the template or not . |
|
131 * |
|
132 * @returns true if flag is enabled else false . |
|
133 */ |
|
134 bool IsUiOnOffFlagEnabled() const {return mData->mUiOnOffFlag;} |
|
135 |
|
136 /** |
|
137 * Returns the slider dimensions . |
|
138 * |
|
139 * @Returns TMulCoverFlowItem dimension of the slider |
|
140 */ |
|
141 const TMulCoverFlowItem& SliderDimension() {return mData->mSliderDimensions;} |
|
142 |
|
143 /** |
|
144 * Returns the video indicator dimension. |
|
145 * |
|
146 * @return Returns a refrence to the indicator dimension. |
|
147 */ |
|
148 const TMulCoverFlowItem& IndicatorDimension() const {return mData->mIndicatorDimensions;} |
|
149 |
|
150 /** |
|
151 * Returnt the size of the title window size. |
|
152 * |
|
153 */ |
|
154 const TSize& TitleWindowSize() {return mData->mTitleParentSize;} |
|
155 |
|
156 /** |
|
157 * Return the size of the detail window size. |
|
158 * |
|
159 */ |
|
160 const TSize& DetailWindowSize() {return mData->mDetailParentSize; } |
|
161 |
|
162 /** |
|
163 * Return the title maximum character font Width |
|
164 * |
|
165 */ |
|
166 int TitleMaxCharWidth() {return mData->mTitleFontMaxCharLength;} |
|
167 |
|
168 /** |
|
169 * Return the detail maximum character font Width |
|
170 */ |
|
171 int DetailMaxCharWidth() {return mData->mDetailFontMaxCharLength;} |
|
172 |
|
173 /** |
|
174 * Return the counter maximum character font Width |
|
175 */ |
|
176 int CounterMaxCharWidth() {return mData->mCounterFontMaxCharLength;} |
|
177 |
|
178 |
|
179 /** |
|
180 * Virtual function must be overriden by derived class. |
|
181 * Creates the visualisation based on the Orientation |
|
182 * also updates the visualisation on orientation change |
|
183 * |
|
184 * @param aIsLandscape, current orientation |
|
185 * @param aIsOrientationChange, based on flag decide to |
|
186 * create or update the visualisation |
|
187 */ |
|
188 virtual void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange = false); |
|
189 |
|
190 |
|
191 protected: |
|
192 |
|
193 /** |
|
194 * Get the window rect of the Imagevisual or layouts . |
|
195 * @Param aLayout layout which gives all the LCT data of |
|
196 * the visual(image or layout). |
|
197 * @Param aParentRect rect of the parent to the visual. |
|
198 */ |
|
199 TRect IconWindowRect(const TAknWindowLineLayout &aLayout, const TRect& aParentRect); |
|
200 |
|
201 /** |
|
202 * Get the window rect of the textvisual . |
|
203 * @Param aLayout layout which gives all the LCT data of |
|
204 * the textvisual. |
|
205 * @Param aParentRect rect of the parent to the visual |
|
206 */ |
|
207 TRect TextWindowRect(const TAknTextLineLayout& aLayout, const TRect& aParentRect); |
|
208 |
|
209 /** |
|
210 * Set the style to the textvisual |
|
211 * |
|
212 * @param aTextFontId the fontId to be set on textvisual. |
|
213 * @param textVisual refernce to textvisual. |
|
214 */ |
|
215 void SetTextStyle(int aTextFontId, CAlfTextVisual& textVisual); |
|
216 |
|
217 /** |
|
218 * Update the maximum character width of text font of textvisual |
|
219 * @Param textVisual , alftextvisual |
|
220 */ |
|
221 int UpdateMaxFontWidth(CAlfTextVisual* textVisual); |
|
222 |
|
223 /** |
|
224 * Applies brush on the specified visual . |
|
225 * The colour of the brush is aBrushColour. |
|
226 * @param aVisual visual on which brush has to be applied. |
|
227 * @param aBrushColour The brush colour. |
|
228 * @param aBrushOpacity The opacity to be applied on the brush. |
|
229 */ |
|
230 void ApplyBrush( CAlfTextVisual& aVisual,const TRgb& aBrushColour, |
|
231 float aBrushOpacity ); |
|
232 |
|
233 private: |
|
234 |
|
235 /** |
|
236 * Returns a font id for the specified style. |
|
237 * |
|
238 * @Param aFontStyle font style. |
|
239 * @Param aManager textstyle manager. |
|
240 */ |
|
241 TInt GetFontId(const UString &aFontStyle, CAlfTextStyleManager& aManager)const; |
|
242 |
|
243 |
|
244 protected: |
|
245 auto_ptr<TMulCoverFlowTemplateImpl> mData; |
|
246 |
|
247 }; |
|
248 |
|
249 |
|
250 // class Template 4 |
|
251 class MulCoverFlowTemplate4 : public MulCoverFlowTemplate |
|
252 { |
|
253 public: |
|
254 |
|
255 /** |
|
256 * Constructor |
|
257 */ |
|
258 MulCoverFlowTemplate4(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); |
|
259 |
|
260 /** |
|
261 * destructor |
|
262 */ |
|
263 ~MulCoverFlowTemplate4(); |
|
264 |
|
265 // From MulCoverFlowTemplate |
|
266 |
|
267 /** |
|
268 * @See CreateVisualisation of MulCoverFlowTemplate |
|
269 */ |
|
270 void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange=false); |
|
271 |
|
272 // new method |
|
273 |
|
274 /** |
|
275 * provides the dimension of the visual attribute (icon & video indicator) |
|
276 * based on the orientation. |
|
277 * |
|
278 * @param aAttribute, type of visual attribue |
|
279 * @param aIslandscape, current orientation |
|
280 */ |
|
281 static void GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, |
|
282 int& aHeight, int& aWidth); |
|
283 |
|
284 private: |
|
285 |
|
286 /** |
|
287 * create visualisation for potrait orientation |
|
288 * |
|
289 */ |
|
290 void CreatePrtStructure(); |
|
291 |
|
292 /** |
|
293 * create visualisation for landscape orientation |
|
294 * |
|
295 */ |
|
296 void CreateLscStructure(); |
|
297 |
|
298 /** |
|
299 * create counter visual and apply attribute |
|
300 * |
|
301 * @param acounterPaneVerityId, lct verity of counter visual. |
|
302 * @param aMainRect, parent rect for counter visual. |
|
303 */ |
|
304 void ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect); |
|
305 |
|
306 }; |
|
307 |
|
308 // class Template 1 |
|
309 class MulCoverFlowTemplate1 : public MulCoverFlowTemplate |
|
310 { |
|
311 public: |
|
312 |
|
313 /** |
|
314 * Constructor |
|
315 */ |
|
316 MulCoverFlowTemplate1(MulCoverFlowControl &aControl, MulBaseElement &aBaseElement); |
|
317 |
|
318 /** |
|
319 * destructor |
|
320 */ |
|
321 ~MulCoverFlowTemplate1(); |
|
322 |
|
323 // From MulCoverFlowTemplate |
|
324 |
|
325 /** |
|
326 * @See CreateVisualisation of MulCoverFlowTemplate |
|
327 */ |
|
328 void CreateVisualisation(bool aIsLandscape,bool aIsOrientationChange=false); |
|
329 |
|
330 // new method |
|
331 |
|
332 /** |
|
333 * provides the dimension of the visual attribute (icon & video indicator) |
|
334 * based on the orientation. |
|
335 * |
|
336 * @param aAttribute, type of visual attribue |
|
337 * @param aIslandscape, current orientation |
|
338 */ |
|
339 static void GetIconSize(mulvisualitem::TVisualAttribute aAttribute,bool aIslandscape, |
|
340 int& aHeight, int& aWidth); |
|
341 |
|
342 private: |
|
343 |
|
344 /** |
|
345 * create visualisation for potrait orientation |
|
346 */ |
|
347 void CreatePrtStructure(); |
|
348 |
|
349 /** |
|
350 * create visualisation for landscape orientation |
|
351 */ |
|
352 void CreateLscStructure(); |
|
353 |
|
354 /** |
|
355 * create counter visual and apply attribute |
|
356 * |
|
357 * @param acounterPaneVerityId, lct verity of counter visual. |
|
358 * @param aMainRect, parent rect for counter visual. |
|
359 */ |
|
360 void ApplyCounterAttribute(int acounterPaneVerityId,const TRect& aMainRect); |
|
361 |
|
362 /** |
|
363 * apply attribute on main text layout |
|
364 * |
|
365 * @param aMainRect, parent rect for main text layout |
|
366 */ |
|
367 void ApplyTextAttribute(const TRect& aMainRect); |
|
368 |
|
369 /** |
|
370 * create title text visual and apply attribute |
|
371 * |
|
372 * @param aVerityId, lct verity of title text. |
|
373 * @param aTextLayoutRect, parent rect for title text |
|
374 */ |
|
375 void ApplyTitleTextAttribute(int aVerityId,const TRect& aTextLayoutRect); |
|
376 |
|
377 /** |
|
378 * create detail text visual and apply attribute |
|
379 * |
|
380 * @param aVerityId, lct verity of detail text. |
|
381 * @param aTextLayoutRect, parent rect for detail text |
|
382 */ |
|
383 void ApplyDetailTextAttribute(int aVerityId,const TRect& aTextLayoutRect); |
|
384 |
|
385 /** |
|
386 * parse and apply the slider attribute |
|
387 * |
|
388 * @param aMainRect, parent rect for slider |
|
389 */ |
|
390 void ApplySliderAttribute(const TRect& aMainRect); |
|
391 }; |
|
392 |
|
393 |
|
394 }//namespace Alf |
|
395 #endif //__MULCOVERFLOWTEMPLATE_H |
|
396 |
|
397 //End of file |