|
1 /* |
|
2 * Copyright (c) 1997-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #if !defined(__EIKCLBD_H__) |
|
19 #define __EIKCLBD_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <gdi.h> |
|
23 |
|
24 #include <eiklbd.h> |
|
25 #include <avkon.hrh> |
|
26 #include <babitflags.h> // for TBitFlags32 |
|
27 |
|
28 class CWindowGc; |
|
29 class CGulIcon; |
|
30 class CColumnListBoxDataExtension; |
|
31 class MAknsControlContext; |
|
32 class CCoeControl; |
|
33 class TAknsItemID; |
|
34 class CAknsEffectAnim; |
|
35 class CAknsListBoxBackgroundControlContext; |
|
36 class CAknLayoutData; |
|
37 class TAknWindowLineLayout; |
|
38 class TAknTextLineLayout; |
|
39 class TAknWindowComponentLayout; |
|
40 class TAknTextComponentLayout; |
|
41 class MAknsSkinInstance; |
|
42 |
|
43 /** |
|
44 * A callback interface for overriding highlight animation input layer |
|
45 * preparation in derived classes. Usually drawing the background under the |
|
46 * highlight rect will yield the right kind of result. The size of the render |
|
47 * target is equal to item cell size. |
|
48 * |
|
49 * @since 3.0 |
|
50 */ |
|
51 class MColumnListBoxAnimBackgroundDrawer |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Draws the background under the current highlight. |
|
57 * |
|
58 * Should be implemented in the derived class . |
|
59 * |
|
60 * @param aGc bitmapped graphics context to be drawn. |
|
61 * @return @c ETrue if Succeeded. |
|
62 */ |
|
63 virtual TBool DrawHighlightAnimBackground( CFbsBitGc& aGc ) const = 0; |
|
64 }; |
|
65 |
|
66 /** |
|
67 * The @c CColumnListBoxData class handles the data required to draw a column |
|
68 * list box. |
|
69 * |
|
70 * The class performs drawing for @c CColumnListBoxItemDrawer. Columns are |
|
71 * numbered from 0 from left to right, and extra column data can be set |
|
72 * for each. |
|
73 * |
|
74 * N.B.: The standard width of a column drawn by @c CColumnListListBoxData is |
|
75 * 0 pixels, so at the very least a column width should be set for each column |
|
76 * in a column list box. |
|
77 * |
|
78 * This class is not intended for user derivation. |
|
79 */ |
|
80 class CColumnListBoxData : public CListBoxData |
|
81 { |
|
82 friend class CColumnListBoxDataExtension; |
|
83 public: |
|
84 |
|
85 /** |
|
86 * Represents the colours used within the border and for the optional |
|
87 * single pixel border outlines. |
|
88 * |
|
89 * These colours are stored using @c TRgb values. |
|
90 */ |
|
91 class TColors |
|
92 { |
|
93 public: |
|
94 |
|
95 /** |
|
96 * C++ default constructor. |
|
97 */ |
|
98 IMPORT_C TColors(); |
|
99 public: |
|
100 |
|
101 /** |
|
102 * Stores text Color. |
|
103 */ |
|
104 TRgb iText; |
|
105 |
|
106 /** |
|
107 * Stores background color. |
|
108 */ |
|
109 TRgb iBack; |
|
110 |
|
111 /** |
|
112 * Stores highLighted text color. |
|
113 */ |
|
114 TRgb iHighlightedText; |
|
115 |
|
116 /** |
|
117 * Stores highlighted background colour. |
|
118 */ |
|
119 TRgb iHighlightedBack; |
|
120 }; |
|
121 |
|
122 public: |
|
123 |
|
124 /** |
|
125 * Two-phased constructor. |
|
126 * |
|
127 * Allocates and constructs a column list box data object. |
|
128 * |
|
129 * Constructs an array in which the column data is held. |
|
130 * |
|
131 * @return New @c CColumnListBoxData. |
|
132 */ |
|
133 IMPORT_C static CColumnListBoxData* NewL(); |
|
134 |
|
135 /** |
|
136 * Destructor. |
|
137 */ |
|
138 IMPORT_C ~CColumnListBoxData(); |
|
139 |
|
140 public: |
|
141 |
|
142 /** |
|
143 * Gets the index of the last defined column. |
|
144 * |
|
145 * @return The index of the last defined column or @c KErrNotFound if no |
|
146 * column has been defined. |
|
147 */ |
|
148 IMPORT_C TInt LastColumn() const; |
|
149 |
|
150 /** |
|
151 * Gets the specified column’s width in pixels. |
|
152 * |
|
153 * @param aColumn The index of the column for which the width is obtained. |
|
154 * @return The specified column’s width in pixels. Zero is returned if no |
|
155 * column exists at the specified index. |
|
156 */ |
|
157 IMPORT_C TInt ColumnWidthPixel(TInt aColumn) const; |
|
158 |
|
159 /** |
|
160 * Sets the specified column’s width in pixels. |
|
161 * |
|
162 * If the column does not exist, one is added at the specified index, |
|
163 * with the specifed width. |
|
164 * |
|
165 * @param aColumn The index of the column for which the width is to be set. |
|
166 * @param aWidth The width in pixels. |
|
167 */ |
|
168 IMPORT_C void SetColumnWidthPixelL(TInt aColumn,TInt aWidth); |
|
169 |
|
170 /** |
|
171 * Not used in S60. |
|
172 */ |
|
173 IMPORT_C TInt ColumnHorizontalGap(TInt aColumn) const; |
|
174 |
|
175 /** |
|
176 * Not used in S60. |
|
177 */ |
|
178 IMPORT_C void SetColumnHorizontalGapL(TInt aColumn,TInt aGap); |
|
179 |
|
180 /** |
|
181 * Gets column's baseline. |
|
182 * |
|
183 * @param aColumn target column. |
|
184 * @return Vertical position. |
|
185 */ |
|
186 IMPORT_C TInt ColumnBaselinePos(TInt aColumn) const; |
|
187 |
|
188 /** |
|
189 * Sets columns baseline position. |
|
190 * |
|
191 * @param aColumn Target column. |
|
192 * @param aPos Wanted position. |
|
193 */ |
|
194 IMPORT_C void SetColumnBaselinePosL(TInt aColumn,TInt aPos); |
|
195 |
|
196 /** |
|
197 * Gets column's margins. |
|
198 * |
|
199 * @param aColumn Target column. |
|
200 * @return The columns margins. |
|
201 */ |
|
202 IMPORT_C TMargins ColumnMargins(TInt aColumn) const; |
|
203 |
|
204 /** |
|
205 * Sets column's margins. |
|
206 * |
|
207 * @param aColumn Target column. |
|
208 * @param aMargins Wanted margins. |
|
209 */ |
|
210 IMPORT_C void SetColumnMarginsL(TInt aColumn,TMargins aMargins); |
|
211 |
|
212 /** |
|
213 * Gets font used by the column. |
|
214 * |
|
215 * @param aColumn Target column. |
|
216 * @return Used font. |
|
217 */ |
|
218 IMPORT_C const CFont* ColumnFont(TInt aColumn) const; |
|
219 |
|
220 /** |
|
221 * Sets column's font. |
|
222 * |
|
223 * @param aColumn Target column. |
|
224 * @param aFont Wanted font. |
|
225 */ |
|
226 IMPORT_C void SetColumnFontL(TInt aColumn,const CFont* aFont); |
|
227 |
|
228 /** |
|
229 * Gets the text alignment for the specified column. |
|
230 * |
|
231 * @param aColumn The index of the column for which the alignment |
|
232 * is obtained. |
|
233 * @return The text alignment for the specified column. The default |
|
234 * is @c ELeft. |
|
235 */ |
|
236 IMPORT_C CGraphicsContext::TTextAlign ColumnAlignment(TInt aColumn) const; |
|
237 |
|
238 /** |
|
239 * Sets the text alignment for the specified column. |
|
240 * |
|
241 * If the column does not exist, it is added with the specified index |
|
242 * to the array. |
|
243 * |
|
244 * @param aColumn The index of the column for which alignment is set. |
|
245 * @param aAlign The text alignment to use. The default is @c ELeft. |
|
246 */ |
|
247 IMPORT_C void SetColumnAlignmentL(TInt aColumn, |
|
248 CGraphicsContext::TTextAlign aAlign); |
|
249 |
|
250 /** |
|
251 * Not used in S60. |
|
252 */ |
|
253 IMPORT_C CGraphicsContext::TPenStyle ColumnSeparatorStyle( |
|
254 TInt aColumn) const; |
|
255 /** |
|
256 * Not used in S60. |
|
257 */ |
|
258 IMPORT_C void SetColumnSeparatorStyleL(TInt aColumn, |
|
259 CGraphicsContext::TPenStyle aStyle); |
|
260 |
|
261 /** |
|
262 * Checks whether the column is optional. |
|
263 * |
|
264 * @param aColumn Target column. |
|
265 * @return @c ETrue if the column is optional. |
|
266 */ |
|
267 IMPORT_C TBool ColumnIsOptional(TInt aColumn) const; |
|
268 |
|
269 /** |
|
270 * Sets whether the column is optional. |
|
271 * |
|
272 * @param aColumn Target column. |
|
273 * @param aIsOptional Wanted setting, @c ETrue if column is optional. |
|
274 */ |
|
275 IMPORT_C void SetOptionalColumnL(TInt aColumn,TBool aIsOptional); |
|
276 |
|
277 /** |
|
278 * Checks whether the column contains graphics. |
|
279 * |
|
280 * @param aColumn Target column. |
|
281 * @return @c ETrue if column contains graphics. |
|
282 */ |
|
283 IMPORT_C TBool ColumnIsGraphics(TInt aColumn) const; |
|
284 |
|
285 /** |
|
286 * Sets whether the column shows graphics. |
|
287 * |
|
288 * @param aColumn Target column. |
|
289 * @param aIsGraphics Wanted setting. |
|
290 */ |
|
291 IMPORT_C void SetGraphicsColumnL(TInt aColumn,TBool aIsGraphics); |
|
292 |
|
293 /** |
|
294 * Checks if the column is a number. |
|
295 * |
|
296 * @param aColumn Target column. |
|
297 * @return @c ETrue if it is a number. |
|
298 */ |
|
299 IMPORT_C TBool ColumnIsNumber(TInt aColumn) const; |
|
300 |
|
301 /** |
|
302 * Sets whether the column is a number. |
|
303 * |
|
304 * @param aColumn Target columun. |
|
305 * @param aIsNumber Wanted setting. @c ETrue if it is a number. |
|
306 */ |
|
307 IMPORT_C void SetNumberColumnL(TInt aColumn,TBool aIsNumber); |
|
308 |
|
309 /** |
|
310 * Gets the icon array. |
|
311 * |
|
312 * These icons contain the bitmaps that are displayed in graphical columns. |
|
313 * |
|
314 * @return Pointer to the icon array. |
|
315 */ |
|
316 IMPORT_C CArrayPtr<CGulIcon>* IconArray() const; |
|
317 |
|
318 /** |
|
319 * Sets icon array. |
|
320 * |
|
321 * @param aArray Wanted icon collection . |
|
322 */ |
|
323 IMPORT_C void SetIconArray(CArrayPtr<CGulIcon>* aArray); |
|
324 |
|
325 /** |
|
326 * Gets TextClipGap, the gap between words in a text clip, for the |
|
327 * given column. |
|
328 * |
|
329 * @param aSubCellIndex Index to target column. |
|
330 * @return TextClipGap. |
|
331 */ |
|
332 IMPORT_C TInt ColumnTextClipGap(TInt aSubCellIndex) const; |
|
333 |
|
334 /** |
|
335 * Sets columns TextClipGap, the gap between words in a text clip. |
|
336 * |
|
337 * @param aSubCellIndex Index of the target column. |
|
338 * @param aSize Wanted TextClipGap size. |
|
339 */ |
|
340 IMPORT_C void SetColumnTextClipGapL(TInt aSubCellIndex, TInt aSize); |
|
341 |
|
342 /** |
|
343 * Gets the specified font for the specified column. |
|
344 * |
|
345 * @param aItemProperties Whether the required font is: |
|
346 * bold, italic, bold and italic or normal. |
|
347 * @param aColumn The index of the column for which the font is obtained. |
|
348 * @return The specified column’s, specified font. Null, the |
|
349 * default, if no font is set for the column. |
|
350 */ |
|
351 IMPORT_C CFont* Font(const TListItemProperties& aItemProperties, |
|
352 TInt aColumn) const; |
|
353 |
|
354 /** |
|
355 * Gets the specified column’s surrounding rectangle. |
|
356 * |
|
357 * @param aColumn The index of the column for which the rectangle |
|
358 * is obtained. |
|
359 * @param aRect On return contains the specified column’s rectangle. |
|
360 * @return @c ETrue if successful. @c EFalse if a non-existent column |
|
361 * was specified. |
|
362 */ |
|
363 IMPORT_C TBool MakeColumnRect( TInt aColumn, TRect& aRect ); |
|
364 |
|
365 /** |
|
366 * Draws a single row. |
|
367 * |
|
368 * The text @c aText is parsed into columns and is split using |
|
369 * @c KColumnListSeparator. Text or bitmaps are drawn according to whether |
|
370 * the column has been set as a graphical column |
|
371 * (see @c SetGraphicsColumnL()). Column cells within the row are drawn |
|
372 * from left to right. |
|
373 * |
|
374 * @param aItemProperties The properties of each column in the row. |
|
375 * @param aGc The graphics context to draw into. |
|
376 * @param aText The text to parse and draw. |
|
377 * @param aRect Bounding rectangle for the entire row. |
|
378 * @param aHighlight @c ETrue to draw the item highlighted. |
|
379 * @c EFalse otherwise. |
|
380 * @param aColors The colours to use if the item is highlighted. |
|
381 */ |
|
382 IMPORT_C virtual void Draw(const TListItemProperties& aItemProperties, |
|
383 CWindowGc& aGc, |
|
384 const TDesC* aText, |
|
385 const TRect& aRect, |
|
386 TBool aHighlight, |
|
387 const TColors& aColors) const; |
|
388 |
|
389 /** |
|
390 * internal |
|
391 */ |
|
392 void DrawSimple(const TListItemProperties& aItemProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight,const TColors& aColors) const; |
|
393 /** |
|
394 * Sets position of listbox line. |
|
395 * |
|
396 * @param aPosition Wanted position. |
|
397 */ |
|
398 IMPORT_C void SetSeparatorLinePosition( |
|
399 TAknSeparatorLinePosition aPosition); |
|
400 |
|
401 /** |
|
402 * Gives out separator line position. |
|
403 * |
|
404 * @return Separator position. |
|
405 */ |
|
406 IMPORT_C TAknSeparatorLinePosition SeparatorLinePosition() const; |
|
407 |
|
408 /** |
|
409 * |
|
410 * @deprecated |
|
411 * |
|
412 * Gives out layout data for separator line drawing. |
|
413 * |
|
414 * @return Requested layout data. |
|
415 */ |
|
416 IMPORT_C CAknLayoutData *LayoutData() const; |
|
417 |
|
418 /** |
|
419 * |
|
420 * @deprecated |
|
421 * |
|
422 * Checks if the layout has been initialized. |
|
423 * |
|
424 * @return @c ETrue if initialized. |
|
425 */ |
|
426 IMPORT_C TBool LayoutInit() const; |
|
427 |
|
428 /** |
|
429 * |
|
430 * @deprecated |
|
431 * |
|
432 * Sets the initialization . |
|
433 * |
|
434 * @param aValue Wanted value (@c ETrue = initialized). |
|
435 */ |
|
436 IMPORT_C void SetLayoutInit(TBool aValue) const; |
|
437 |
|
438 /** |
|
439 * Enables / disables underlining per text column, |
|
440 * if and only if @c TListItemProperties also has underlining enabled. |
|
441 * If this method is not called and @c TListItemProperties has underlining |
|
442 * enabled, drawing will revert to old style where only first text column |
|
443 * will be underlined. |
|
444 * |
|
445 * @since S60 3.0 |
|
446 * @param aUnderlinedColumns Bitmask of columns to be underlined. |
|
447 */ |
|
448 IMPORT_C void SetColumnUnderlined( TBitFlags32 aUnderlinedColumns ); |
|
449 |
|
450 private: |
|
451 struct SColumn |
|
452 { |
|
453 TInt iColumn; // Must be first entry |
|
454 TInt iWidth; |
|
455 TMargins iMargins; |
|
456 TInt iVerticalCap; |
|
457 const CFont* iBaseFont; |
|
458 TInt iActualFontIndex; |
|
459 TBool iGraphics; |
|
460 TBool iOptional; |
|
461 TInt iBaseline; |
|
462 CGraphicsContext::TTextAlign iAlign; |
|
463 CGraphicsContext::TPenStyle iSeparator; |
|
464 TInt iTextClipGap; |
|
465 TBool iNumberColumn; |
|
466 // the next are for storing x-coordinates of a column for the drawing algorithm. |
|
467 __MUTABLE TInt iX; |
|
468 __MUTABLE TInt iEndX; |
|
469 }; |
|
470 protected: |
|
471 |
|
472 /** |
|
473 * C++ default constructor. |
|
474 */ |
|
475 IMPORT_C CColumnListBoxData(); |
|
476 |
|
477 /** |
|
478 * A second phase constructor. |
|
479 * |
|
480 * Highlight animation will be created by default (if it is provided |
|
481 * by the skin). |
|
482 */ |
|
483 IMPORT_C void ConstructLD(); |
|
484 |
|
485 /** |
|
486 * Second phase constructor for subclasses that want to override highlight |
|
487 * animation creation. |
|
488 * |
|
489 * @since 3.0 |
|
490 * @param aAnimationIID Skin item identifier of the constructed animation. |
|
491 * Passing @c KAknsIIDNone will disable highlight animation. |
|
492 */ |
|
493 IMPORT_C void ConstructLD( const TAknsItemID& aAnimationIID ); |
|
494 |
|
495 private: |
|
496 |
|
497 IMPORT_C TInt ColumnX(TInt aColumn) const; |
|
498 IMPORT_C void SetColumnXL(TInt aColumn,TInt aX) const; // note, const! (do not affect external state) |
|
499 // |
|
500 IMPORT_C TInt ColumnEndX(TInt aColumn) const; |
|
501 IMPORT_C void SetColumnEndXL(TInt aColumn,TInt aEndX) const; // note, Const! |
|
502 |
|
503 void AddColumnL(TInt aColumn); |
|
504 SColumn& At(TInt aArrayIndex); |
|
505 const SColumn& At(TInt aArrayIndex) const; |
|
506 TBool FindColumnIndex(TInt& aArrayIndex,TInt aColumn) const; |
|
507 void FindColumnIndexOrAddL(TInt& aArrayIndex,TInt aColumn); |
|
508 TInt AddActualFontL(const CFont* aBaseFont); |
|
509 void SetUnderlineStyle( TListItemProperties aProperties, CWindowGc& aGc, TInt aColumn ) const; |
|
510 void DoConstructL( const TAknsItemID& aAnimationIID ); |
|
511 public: |
|
512 |
|
513 /** |
|
514 * Gets @c CCoeControl for component. |
|
515 * |
|
516 * @return Pointer to the used @c CCoeControl. |
|
517 */ |
|
518 IMPORT_C CCoeControl *Control() const; |
|
519 |
|
520 /** |
|
521 * Sets @c CCoeControl for current component. |
|
522 * |
|
523 * @param aControl Current listbox control instance, cannot be any |
|
524 * other control. |
|
525 */ |
|
526 IMPORT_C void SetControl(CCoeControl *aControl); |
|
527 |
|
528 /** |
|
529 * Gets background skin context. |
|
530 * |
|
531 * @return Component's skin control context. |
|
532 */ |
|
533 IMPORT_C MAknsControlContext* SkinBackgroundContext() const; |
|
534 |
|
535 /** |
|
536 * Sets background skin context. Changes ownership as well. |
|
537 * |
|
538 * @param aContext Wanted background skin control context. |
|
539 */ |
|
540 void SetSkinBackgroundContext( |
|
541 CAknsListBoxBackgroundControlContext *aContext); |
|
542 // takes ownership |
|
543 |
|
544 /** |
|
545 * Sets style for the skin fot list tiles. |
|
546 * |
|
547 * @param aId Wanted skins item ID. |
|
548 * @param aTileRect Skin tile size. |
|
549 */ |
|
550 IMPORT_C void SetSkinStyle(const TAknsItemID *aId, |
|
551 const TRect &aTileRect); |
|
552 |
|
553 /** |
|
554 * Sets skin style for the end of the list. |
|
555 * |
|
556 * @param aId Wanted skins item ID. |
|
557 * @param aRect Skin tile size. |
|
558 */ |
|
559 IMPORT_C void SetListEndSkinStyle(const TAknsItemID *aId, |
|
560 const TRect &aRect); |
|
561 |
|
562 /** |
|
563 * Sets skin for the highlighted frame. |
|
564 * |
|
565 * @param aFrameId Wanted skin's item ID for the frame. |
|
566 * @param aFrameCenterId Wanted skin's item ID for the center of the frame. |
|
567 */ |
|
568 IMPORT_C void SetSkinHighlightFrame(const TAknsItemID *aFrameId, |
|
569 const TAknsItemID *aFrameCenterId); |
|
570 |
|
571 /** |
|
572 * Enables/Disables skin. |
|
573 * |
|
574 * @param aEnabled Sets whether the skins are enable or disabled |
|
575 * @c ETrue for enabling skins. |
|
576 */ |
|
577 IMPORT_C void SetSkinEnabledL(TBool aEnabled); |
|
578 |
|
579 /** |
|
580 * Creates a pictograph interface for the @c CColumnListBoxData. |
|
581 */ |
|
582 void CreatePictographInterfaceL(); |
|
583 |
|
584 /** |
|
585 * Creates a marquee control for the @c CColumnListBoxData and redraw. |
|
586 */ |
|
587 void CreateMarqueeControlL(); |
|
588 |
|
589 /** |
|
590 * Resets marquee control. |
|
591 */ |
|
592 void ResetMarquee(); |
|
593 |
|
594 /** |
|
595 * Gets current marquee item index. |
|
596 * |
|
597 * @return Current marquee item index. |
|
598 */ |
|
599 TInt CurrentMarqueeItemIndex(); |
|
600 |
|
601 /** |
|
602 * Sets the index for current marquee item. |
|
603 * |
|
604 * @param aIndex Item index. |
|
605 */ |
|
606 void SetCurrentMarqueeItemIndex(TInt aIndex); |
|
607 |
|
608 /** |
|
609 * Enables or disables the marquee. |
|
610 * |
|
611 * @param aEnable @c ETrue = On. @c EFalse = Off. |
|
612 */ |
|
613 IMPORT_C void EnableMarqueeL(TBool aEnable); |
|
614 |
|
615 /** |
|
616 * Sets the font attached to the cell for each row separately. |
|
617 * |
|
618 * @param aRow Index number of the row. |
|
619 * @param aColumn Index number of the column. |
|
620 * @param aFont Font to be used. |
|
621 */ |
|
622 IMPORT_C void SetColumnFontForRowL(TInt aRow, |
|
623 TInt aColumn, |
|
624 const CFont* aFont); |
|
625 |
|
626 /** |
|
627 * Gets the font attached to the row and cell. |
|
628 * |
|
629 * @param aRow Index number of the row. |
|
630 * @param aColumn Index number of the column. |
|
631 * @return Font handle. |
|
632 */ |
|
633 IMPORT_C const CFont* RowAndColumnFont(TInt aRow,TInt aColumn) const; |
|
634 |
|
635 /** |
|
636 * Sets the current list item index. Since S60 2.6 causes highlight |
|
637 * animation tochange its background (only if the current item index |
|
638 * changes). Do not call this method if the index is not the current |
|
639 * item index. |
|
640 * |
|
641 * @since S60 2.6 |
|
642 * @param aIndex The new index for the current item. |
|
643 */ |
|
644 void SetCurrentItemIndex(TInt aIndex); |
|
645 |
|
646 /** |
|
647 * Sets the subcell icon size. |
|
648 * |
|
649 * @since S60 2.8 |
|
650 * @param aIndex Index of the sub cell. |
|
651 * @param aSize Size of the sub cell icon. |
|
652 */ |
|
653 IMPORT_C void SetSubCellIconSize(TInt aIndex, TSize aSize); |
|
654 |
|
655 /** |
|
656 * Gets subcell icon size. |
|
657 * |
|
658 * @param aIndex Index of the wanted subcell. |
|
659 * @return Size of the subcell. |
|
660 */ |
|
661 TSize GetSubCellIconSize(TInt aIndex); |
|
662 |
|
663 /** |
|
664 * Gets the highlight animation . |
|
665 * |
|
666 * @since S60 3.0 |
|
667 * @return @c CAknsEffectAnim that is used for when the highlighted list |
|
668 * is drawn. May return NULL, in this case the normal skinned |
|
669 * highlight should be drawn. This pointer is valid only during |
|
670 * the draw -> you should not store it locally outside draw scope. |
|
671 */ |
|
672 IMPORT_C const CAknsEffectAnim* HighlightAnim() const; |
|
673 |
|
674 /** |
|
675 * This method should be called before drawing animated highlight. It will |
|
676 * sync the animation with the background under the current highlight (only |
|
677 * when current item index has changed). |
|
678 * |
|
679 * @since S60 3.0 |
|
680 */ |
|
681 IMPORT_C void AboutToDrawHighlightAnim() const; |
|
682 |
|
683 /** |
|
684 * Sets the observer for overriding default highlight input layer drawing |
|
685 * functionality. Note that you should still call |
|
686 * @c AboutToDrawHighlightAnim (it will call the observer if it is set). |
|
687 * |
|
688 * @since S60 3.0 |
|
689 * @param aDrawer New background drawer. |
|
690 */ |
|
691 IMPORT_C void SetHighlightAnimBackgroundDrawer( |
|
692 MColumnListBoxAnimBackgroundDrawer* aDrawer ); |
|
693 |
|
694 /** |
|
695 * Changes item cell size & resizes highlight animation. Called by list |
|
696 * when item cell size changes. If you are using non-standard highlight |
|
697 * sizes make sure to sync the list item cell size. |
|
698 * |
|
699 * @since S60 3.0 |
|
700 * @param aSizeInPixels New size in pixels for the Item cell. |
|
701 */ |
|
702 IMPORT_C void SetItemCellSize( const TSize& aSizeInPixels ); |
|
703 |
|
704 /** |
|
705 * @return ETrue if highlight animation exists, EFalse otherwise. |
|
706 * |
|
707 * @since 3.1 |
|
708 */ |
|
709 IMPORT_C TBool HasHighlightAnim() const; |
|
710 /** |
|
711 * The preferred method for drawing highlight animation in derived classes. |
|
712 * Before calling this method you should check that highlight animation |
|
713 * exists by calling HasHighlightAnim. In case of draw failure you should |
|
714 * default to normal skinned highlight drawing. For example: |
|
715 * |
|
716 * TBool drawOk = EFalse; |
|
717 * |
|
718 * if( HasHighlightAnim() ) |
|
719 * { |
|
720 * drawOk = DrawHighlightAnim( gc, rect ); |
|
721 * } |
|
722 * |
|
723 * if( !drawOk ) |
|
724 * { |
|
725 * ...do normal skinned draw |
|
726 * } |
|
727 * |
|
728 * @param aGc Graphics context for blitting animation frame |
|
729 * @param aRect Target rect for blitting animation frame |
|
730 * @return The draw status, ETrue if drawing was ok, EFalse otherwise. |
|
731 * |
|
732 * @since 3.1 |
|
733 */ |
|
734 IMPORT_C TBool DrawHighlightAnim( CBitmapContext& aGc, const TRect& aRect ) const; |
|
735 |
|
736 void FocusGained(); |
|
737 |
|
738 /** |
|
739 * Called when the @c CColumnListBoxData is unselected. Informs the |
|
740 * @c CColumnListBoxData extension that the focus has been lost. |
|
741 */ |
|
742 void FocusLost(); |
|
743 |
|
744 /** |
|
745 * Handles changing of an resource. Only supports skin change. |
|
746 * |
|
747 * @param aType Defines the resource that has changed. |
|
748 */ |
|
749 void HandleResourceChange( TInt aType ); |
|
750 |
|
751 /** |
|
752 * Setup skin control context for handling background skins. |
|
753 * if no skin control context is found one is created. |
|
754 */ |
|
755 void SetupSkinContextL(); |
|
756 |
|
757 /** |
|
758 * Sets text colour. |
|
759 * |
|
760 * @param aTextColor Wanted colour. |
|
761 */ |
|
762 void SetESSTextColor(TRgb aTextColor); |
|
763 |
|
764 /** |
|
765 * Sets text colour for highlighted text. |
|
766 * |
|
767 * @param aHighlightedTextColor Wanted colour. |
|
768 */ |
|
769 void SetESSHighlightedTextColor(TRgb aHighlightedTextColor); |
|
770 |
|
771 IMPORT_C void SetGraphicSubCellL(TInt aSubCell,const TAknWindowLineLayout &aGraphicLayout); |
|
772 IMPORT_C void SetTextSubCellL(TInt aSubCell,const TAknTextLineLayout &aTextLayout); |
|
773 IMPORT_C void SetConditionalSubCellL(TInt aSubCell, const TAknTextLineLayout &aTextLayout,TInt aAffectedSubCell); |
|
774 IMPORT_C void SubCellsMightIntersect( const TBool aMightIntersect ); |
|
775 |
|
776 IMPORT_C void SetStretchableGraphicSubCellL(TInt aSubCell, |
|
777 const TAknWindowComponentLayout& aNormalLayout, |
|
778 const TAknWindowComponentLayout& aStretchedLayout); |
|
779 IMPORT_C void SetStretchableTextSubCellL(TInt aSubCell, |
|
780 const TAknTextComponentLayout& aNormalLayout, |
|
781 const TAknTextComponentLayout& aStretchedLayout); |
|
782 IMPORT_C void SetStretchableConditionalSubCellL(TInt aSubCell, |
|
783 const TAknTextComponentLayout& aNormalLayout, |
|
784 const TAknTextComponentLayout& aStretchedLayout, |
|
785 TInt aNormalSubCell, |
|
786 TInt aStretchedSubCell ); |
|
787 IMPORT_C void ResetSLSubCellArray(); |
|
788 TBool UsesScalableLayoutData() const; |
|
789 void EnableStretching(const TBool aEnabled); |
|
790 IMPORT_C TBool StretchingEnabled() const; |
|
791 protected: |
|
792 |
|
793 /** |
|
794 * Wraps the text drawing functinality with & without marquee into one |
|
795 * function, so that inherited classes can modify their own drawing |
|
796 * behaviour more easily. |
|
797 * |
|
798 * @since S60 2.8 |
|
799 * @param aGc Window graphics context controller. |
|
800 * @param aTextRect The area where the text is drawn. |
|
801 * @param aText The whole text. Not clipped. |
|
802 * @param aClippedText Clipped / truncated text. |
|
803 * @param aBaselineOffset An offset from the top of the box to the text |
|
804 * baseline. |
|
805 * @param aAlign The text alignment mode (default is left, rather |
|
806 * than centre or right). |
|
807 * @param aFont Wanted font. |
|
808 * @param aHighlight Does the current item have highlight. |
|
809 * @param aIsTextClipped Is the current item clipped. |
|
810 */ |
|
811 IMPORT_C void DrawText(CWindowGc& aGc, |
|
812 const TRect& aTextRect, |
|
813 const TDesC& aText, |
|
814 const TDesC& aClippedText, |
|
815 const TInt aBaselineOffset, |
|
816 const CGraphicsContext::TTextAlign aAlign, |
|
817 const CFont& aFont, |
|
818 const TBool aHighlight, |
|
819 const TBool aIsTextClipped) const; |
|
820 |
|
821 public: |
|
822 /** |
|
823 * Customizes marquee default behaviour. |
|
824 * |
|
825 * Use this before enabling marquee ( @c EnableMarqueeL() ), otherwise |
|
826 * marquee behaviour will change during animation. |
|
827 * |
|
828 * @since S60 2.8 |
|
829 * @param aLoops Max number of loops to be executed. |
|
830 * @param aScrollAmount The amount of pixels scrolled per |
|
831 * iteration. |
|
832 * @param aScrollDelay The interval between iterations. |
|
833 */ |
|
834 IMPORT_C void SetMarqueeParams(const TInt aLoops, |
|
835 const TInt aScrollAmount, |
|
836 const TInt aScrollDelay); |
|
837 |
|
838 /** |
|
839 * Customizes marquee default behaviour. |
|
840 * |
|
841 * @since S60 2.8 |
|
842 * @param aLoops Max number of loops to be executed. |
|
843 * @param aScrollAmount The amount of pixels scrolled per iteration. |
|
844 * @param aScrollDelay The interval between iterations. |
|
845 * @param aInterval The interval between frame updates. |
|
846 */ |
|
847 IMPORT_C void SetMarqueeParams(const TInt aLoops, |
|
848 const TInt aScrollAmount, |
|
849 const TInt aScrollDelay, |
|
850 const TInt aInterval); |
|
851 /** |
|
852 * Tells whether current item has clipped text cells |
|
853 * @since S60 3.2 |
|
854 * @return bitfield of clipped columns |
|
855 */ |
|
856 IMPORT_C TUint32 CurrentItemTextWasClipped() const; |
|
857 |
|
858 /** |
|
859 * Returns ETrue if kinetic scrolling is enabled. |
|
860 * @internal |
|
861 * @since S60 5.0 |
|
862 * @return ETrue if kinetic scrolling feature is enabled. |
|
863 */ |
|
864 TBool KineticScrollingEnabled() const; |
|
865 |
|
866 private: |
|
867 void DrawHighLight( CWindowGc& aGc, const TRect& aRect, |
|
868 TBool aHighlight, |
|
869 MAknsSkinInstance* aSkin ) const; |
|
870 |
|
871 void CheckIfSubCellsIntersect( TAknTextLineLayout* aLayouts, |
|
872 TBool* aResults, const TDesC& aText, |
|
873 const TRect& aItemRect ) const; |
|
874 /** |
|
875 * @internal helper |
|
876 */ |
|
877 void BitBltColored( CWindowGc& aGc, |
|
878 TBool aHighlight, |
|
879 const CGulIcon* aIcon, |
|
880 TInt aSubcell, |
|
881 TBool aColorIcon, |
|
882 const TRect& aGraphicRect ) const; |
|
883 |
|
884 |
|
885 |
|
886 private: |
|
887 CArrayFix<SColumn>* iColumnArray; |
|
888 CColumnListBoxDataExtension *iExtension; |
|
889 }; |
|
890 |
|
891 #endif // __EIKCLBD_H__ |
|
892 |
|
893 // End of File |