|
1 /* |
|
2 * Copyright (c) 2007 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: Constants for the matrixmenu |
|
15 * Version : %version: 22 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MMMARQUEEADAPTER_H |
|
22 #define MMMARQUEEADAPTER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include <AknMarqueeControl.h> |
|
28 #include <aknlayoutscalable_avkon.cdl.h> |
|
29 #include <eiklbx.h> |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Used by Multimedia Menu to display marquee |
|
34 * |
|
35 * @code |
|
36 * @endcode |
|
37 * @lib mmwidgets |
|
38 * @since S60 v3.0 |
|
39 * @ingroup group_mmwidgets |
|
40 */ |
|
41 NONSHARABLE_CLASS( CMmMarqueeAdapter ) : public CBase |
|
42 { |
|
43 |
|
44 |
|
45 private: |
|
46 /** |
|
47 * Used to keep currently drawn marquee element |
|
48 * @code |
|
49 * @endcode |
|
50 * @lib mmwidgets |
|
51 * @since S60 v3.0 |
|
52 * @ingroup group_mmwidgets |
|
53 */ |
|
54 NONSHARABLE_CLASS( CMmMarqueeElement ) : public CBase |
|
55 { |
|
56 |
|
57 friend class CMmMarqueeAdapter; |
|
58 |
|
59 // No implementation required |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Constructor |
|
64 * |
|
65 * @since S60 v3.0 |
|
66 * @param aElementRect The rect to draw marquee |
|
67 * @param aAlign Align of text |
|
68 * @param aFont Font |
|
69 * @param aColor Color |
|
70 * @param aIndex Item subcell index |
|
71 * @param aBaselineOffset Baseline offset |
|
72 */ |
|
73 CMmMarqueeElement ( |
|
74 TRect aElementRect, |
|
75 CGraphicsContext::TTextAlign aAlign, |
|
76 TAknLogicalFontId aFont, |
|
77 TRgb aColor, |
|
78 TInt aIndex, |
|
79 TInt aBaselineOffset ); |
|
80 |
|
81 /** |
|
82 * Destructor |
|
83 * |
|
84 * @since S60 v3.0 |
|
85 */ |
|
86 ~CMmMarqueeElement (); |
|
87 |
|
88 /** |
|
89 * Two-phased constructor. |
|
90 * |
|
91 * @since S60 v3.0 |
|
92 * @param aElementRect The rect to draw marquee. |
|
93 * @param aAlign Align of text. |
|
94 * @param aText Text do be drawn. |
|
95 * @param aFontId Font's id. |
|
96 * @param aColor Color. |
|
97 * @param aIndex Item subcell index. |
|
98 * @param aBaselineOffset Baseline offset. |
|
99 */ |
|
100 static CMmMarqueeElement* NewL ( |
|
101 TRect aElementRect, |
|
102 CGraphicsContext::TTextAlign aAlign, |
|
103 const TDesC& aText, |
|
104 TAknLogicalFontId aFontId, |
|
105 TRgb aColor, |
|
106 TInt aIndex, |
|
107 TInt aBaselineOffset ); |
|
108 |
|
109 |
|
110 /** |
|
111 * Setup marquee scroll data |
|
112 * |
|
113 * @since S60 v3.0 |
|
114 * @param aLoops Number of loops to be drawn |
|
115 * @param aScrollAmount Scroll amount |
|
116 * @param aScrollDelay Scroll delay |
|
117 */ |
|
118 void SetupMarqueeControlL( |
|
119 TInt aLoops, |
|
120 TInt aScrollAmount, |
|
121 TInt aScrollDelay ); |
|
122 |
|
123 |
|
124 private: |
|
125 |
|
126 /** |
|
127 * ConstructL construct marquee element |
|
128 * |
|
129 * @since S60 v3.0 |
|
130 * @param aText Text for element |
|
131 */ |
|
132 void ConstructL ( const TDesC& aText ); |
|
133 |
|
134 private: |
|
135 |
|
136 /** |
|
137 * Element rectangle ( according to item rect ) |
|
138 */ |
|
139 TRect iElementRect; |
|
140 |
|
141 /** |
|
142 * Align of text |
|
143 */ |
|
144 CGraphicsContext::TTextAlign iAlign; |
|
145 |
|
146 /** |
|
147 * LCT layouts map |
|
148 * Own |
|
149 */ |
|
150 HBufC* iText; |
|
151 |
|
152 /** |
|
153 * Font |
|
154 */ |
|
155 TAknLogicalFontId iFont; |
|
156 |
|
157 /** |
|
158 * Color |
|
159 */ |
|
160 TRgb iColor; |
|
161 |
|
162 /** |
|
163 * Loops to be drawn |
|
164 */ |
|
165 TInt iLoops; // default 1 |
|
166 |
|
167 /** |
|
168 * Scroll amount |
|
169 */ |
|
170 TInt iScrollAmount; // default 6 |
|
171 |
|
172 /** |
|
173 * Scroll delay |
|
174 */ |
|
175 TInt iScrollDelay; // default 1000000 |
|
176 |
|
177 /** |
|
178 * Marquee control |
|
179 * Own |
|
180 */ |
|
181 CAknMarqueeControl* iMarqueeControl; |
|
182 |
|
183 /** |
|
184 * Subcell index of marquee element |
|
185 */ |
|
186 TInt iSubcellIndex; |
|
187 |
|
188 /** |
|
189 * Baseline offset |
|
190 */ |
|
191 TInt iBaselineOffset; |
|
192 }; |
|
193 public: |
|
194 // Constructors and destructor |
|
195 |
|
196 /** |
|
197 * Destructor. |
|
198 */ |
|
199 ~CMmMarqueeAdapter (); |
|
200 |
|
201 /** |
|
202 * Two-phased constructor. |
|
203 */ |
|
204 static CMmMarqueeAdapter* NewL (); |
|
205 |
|
206 /** |
|
207 * Two-phased constructor. |
|
208 */ |
|
209 static CMmMarqueeAdapter* NewLC (); |
|
210 |
|
211 private: |
|
212 |
|
213 /** |
|
214 * Constructor for performing 1st stage construction |
|
215 */ |
|
216 CMmMarqueeAdapter (); |
|
217 |
|
218 /** |
|
219 * Default symbian 2nd stage constructor. |
|
220 */ |
|
221 void ConstructL (); |
|
222 |
|
223 |
|
224 public: |
|
225 |
|
226 /** |
|
227 * Adds marquee element to be drawn |
|
228 * |
|
229 * @since S60 v3.0 |
|
230 * @param aRect Rectangle where marquee is drawn |
|
231 * @param aText Marquee text |
|
232 * @param aFont Font |
|
233 * @param aColor Color |
|
234 * @param aAlign Align of text |
|
235 * @param aIndex Subcell index |
|
236 * @param aBaselineOffset Baseline offset |
|
237 * @param aCurrentlyDrawnItemIndex Currently drawn item index |
|
238 */ |
|
239 void AddMarqueeElementL (const TRect& aRect, const TDesC& aText, |
|
240 TAknLogicalFontId aFont, TRgb aColor, |
|
241 CGraphicsContext::TTextAlign aAlign, TInt aIndex, TInt aBaselineOffset, TInt aCurrentlyDrawnItemIndex); |
|
242 |
|
243 /** |
|
244 * Enables marquee |
|
245 * |
|
246 * @since S60 v3.0 |
|
247 * @param aEnable Enable/disable marquee |
|
248 */ |
|
249 void EnableMarquee( TBool aEnable ); |
|
250 |
|
251 /** |
|
252 * Draws marquee text. is called every time marque is scrolled |
|
253 * |
|
254 * @since S60 v3.0 |
|
255 * @param aGc Window graphics context. |
|
256 */ |
|
257 void DrawMarqueeL(CWindowGc & aGc); |
|
258 |
|
259 /** |
|
260 * Stops marquee drawing |
|
261 * |
|
262 * @since S60 v3.0 |
|
263 */ |
|
264 void StopMarqueeDrawing(TInt aIndex = -1); |
|
265 |
|
266 /** |
|
267 * Set listbox where marquee is drawn |
|
268 * |
|
269 * @since S60 v3.0 |
|
270 * @param aControl Listbox |
|
271 */ |
|
272 void SetControl( CEikListBox * aControl ); |
|
273 |
|
274 /** |
|
275 * Reveales if subcell marquee element already exists |
|
276 * |
|
277 * @since S60 v3.0 |
|
278 * @param aIndex Item subcell index |
|
279 * @return Does element exist in marquee adapter marquee elements array |
|
280 */ |
|
281 TBool SubcellMarqueeElementExists( TInt aIndex ); |
|
282 |
|
283 /** |
|
284 * Removes marquee elements from marquee adapter |
|
285 * |
|
286 * @since S60 v3.0 |
|
287 * @param aSubcellIndex Item subcell index |
|
288 */ |
|
289 void RemoveSubcellMarqueeElement(TInt aSubcellIndex); |
|
290 |
|
291 /** |
|
292 * Checks if marquee is enabled. |
|
293 * |
|
294 * @return ETrue if marquee enabled, EFalse otherwise. |
|
295 */ |
|
296 TBool IsMarqueeEnabled() const; |
|
297 |
|
298 private: |
|
299 |
|
300 /** |
|
301 * Called when marquee scroll increments |
|
302 * |
|
303 * @since S60 v3.0 |
|
304 * @param aControl Listbox where marquee is drawn |
|
305 * @return Was marqueee drawing successful |
|
306 */ |
|
307 static TInt RedrawEvent(TAny* aControl); |
|
308 |
|
309 private: //members |
|
310 |
|
311 /** |
|
312 * Array of marquee element |
|
313 */ |
|
314 RPointerArray< CMmMarqueeElement > iMarqueeElements; |
|
315 |
|
316 /** |
|
317 * Is marquee enabled |
|
318 */ |
|
319 TBool iMarqueeEnabled; |
|
320 |
|
321 /** |
|
322 * Listbox where marquee is drawn |
|
323 * Not own |
|
324 */ |
|
325 CEikListBox* iListbox; |
|
326 |
|
327 /** |
|
328 * Currently drawn item index |
|
329 */ |
|
330 TInt iCurrentMarqueeItemIndex; |
|
331 }; |
|
332 |
|
333 #endif // MMMARQUEEADAPTER_H |