|
1 /* |
|
2 * Copyright (c) 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: CCA customized control. Code has been modified to suit |
|
15 CCA requirements. See CFormattedCellListBoxData |
|
16 * in EIKCLBD.CPP. |
|
17 * Ensure that this piece of code is in sync with Avkon EIKFRLBD.CPP(CFormattedCellListBoxData) |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include <eikfrlbd.h> |
|
23 #include <aknlists.h> |
|
24 #include <AknMarqueeControl.h> |
|
25 #include <AknPictographInterface.h> |
|
26 #include <AknPictographDrawerInterface.h> |
|
27 #include <AknsEffectAnim.h> |
|
28 #include <AknsListBoxBackgroundControlContext.h> |
|
29 #include <AknsFrameBackgroundControlContext.h> |
|
30 #include <AknPanic.h> |
|
31 #include <AknBidiTextUtils.h> |
|
32 #include <centralrepository.h> |
|
33 #include <AvkonInternalCRKeys.h> |
|
34 #include <gulicon.h> |
|
35 #include <eikslbd.h> |
|
36 |
|
37 #include <aknlayoutscalable_avkon.cdl.h> |
|
38 #include <layoutmetadata.cdl.h> |
|
39 #include <aknphysics.h> |
|
40 #include <AknUtils.h> |
|
41 #include <AknFontId.h> |
|
42 #include <AknLayoutFont.h> |
|
43 |
|
44 #include <AknIconArray.h> |
|
45 #include <avkon.mbg> |
|
46 |
|
47 #include "ccappcommlaunchercustomlistboxdata.h" |
|
48 |
|
49 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
50 #include <aknlistloadertfx.h> |
|
51 #include <aknlistboxtfxinternal.h> |
|
52 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
53 |
|
54 |
|
55 #include <touchfeedback.h> |
|
56 #include <AknSmileyUtils.h> |
|
57 // there are 17(!) subcells in qdial grid (0 ... 16) |
|
58 const TInt KMaxSubCellIndex = 16 + 1; |
|
59 |
|
60 // colored tick marks support |
|
61 const TInt KColorIconFlag = -1; |
|
62 const TInt KColorIconIdx = 0; |
|
63 // smiley text place holder |
|
64 _LIT( KPlaceHolder, "\xFFF0i" ); |
|
65 |
|
66 /** |
|
67 * This class needs to be in .cpp file so that we do not accidentally make it |
|
68 * derivable; that would destroy all the binary compability advantages this |
|
69 * class has.. |
|
70 * |
|
71 * About animation usage: |
|
72 * All animation usage is implemented in this class. Animation is eye candy and |
|
73 * low priority when it comes to resources -> on resource failures animation |
|
74 * fails fast to release resources for more critical functionality. Also, no |
|
75 * attempt to (re)construct failed animation is made. |
|
76 * |
|
77 * User inactivity is not being observed. Only one animation is used. Extension |
|
78 * is CActive to make it possible to postpone animation deletion on animation |
|
79 * failure. |
|
80 */ |
|
81 NONSHARABLE_CLASS(CCCAppCommLauncherCustomListBoxDataExtension) : public CActive, |
|
82 public MAknPictographAnimatorCallBack, |
|
83 public MCoeForegroundObserver, |
|
84 public MAknsEffectAnimObserver, |
|
85 public MListBoxItemChangeObserver, |
|
86 public MAknSmileyObserver |
|
87 { |
|
88 public: |
|
89 enum TFlag |
|
90 { |
|
91 // Set if current item background should be copied to animation as |
|
92 // input layer. |
|
93 EFlagUpdateBg = 0, |
|
94 |
|
95 // Set if animation has been resized at least once |
|
96 EFlagHasLayers = 1, |
|
97 |
|
98 // Set if foreground has been gained. |
|
99 EFlagHasForeground = 2 |
|
100 }; |
|
101 |
|
102 enum TSubCellType |
|
103 { |
|
104 EAknSLGraphic, EAknSLText, EAknSLNumeric |
|
105 }; |
|
106 |
|
107 public: |
|
108 CCCAppCommLauncherCustomListBoxDataExtension(); |
|
109 void ConstructL(CCCAppCommLauncherCustomListBoxData* aListBoxData, |
|
110 const TAknsItemID& aAnimationIID); |
|
111 ~CCCAppCommLauncherCustomListBoxDataExtension(); |
|
112 void CreatePictographInterfaceL(); |
|
113 void CreateMarqueeControlL(); |
|
114 static TInt RedrawEvent(TAny* aControl); // Marquee draw callback |
|
115 TBool IsMarqueeOn(); |
|
116 struct SRowAndSubCell |
|
117 { |
|
118 TInt iIndex; // 24 bits for row and 8 bits for subcell |
|
119 const CFont* iFont; |
|
120 //TBool iUnderline; |
|
121 //TBool iStrikethrough; |
|
122 }; |
|
123 struct SSLSubCell |
|
124 { |
|
125 TInt iSubCell; // Must be first entry |
|
126 TAknTextLineLayout iTextLayout; |
|
127 TAknWindowLineLayout iGraphicLayout; |
|
128 TInt iSubCellType; |
|
129 TInt iConditionValue; // used with conditional layouts for not always drawn subcells |
|
130 TBool iSmileyCell; |
|
131 }; |
|
132 |
|
133 SRowAndSubCell& At(TInt aArrayIndex); |
|
134 const SRowAndSubCell& At(TInt aArrayIndex) const; |
|
135 void AddRowAndSubCellL(TInt aRow, TInt aSubCell); |
|
136 TInt |
|
137 FindRowAndSubCellIndex(TInt& aArrayIndex, TInt aRow, TInt aSubCell) const; |
|
138 void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex, TInt aRow, |
|
139 TInt aSubCell); |
|
140 |
|
141 SSLSubCell& AtSL(TInt aArrayIndex); |
|
142 const SSLSubCell& AtSL(TInt aArrayIndex) const; |
|
143 void AddSLSubCellL(TInt aSubCell); |
|
144 TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const; |
|
145 void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell); |
|
146 void ResetSLSubCellArray(); |
|
147 |
|
148 inline void NoAnimIfError(TInt aError); |
|
149 void TryCreateAnimation(); |
|
150 TBool SyncAnim(const TSize& aSize); |
|
151 TBool SyncAndDrawAnim(CBitmapContext& aGc, const TRect& aRect); |
|
152 MAknsControlContext* SkinBackgroundContext() const; |
|
153 void DeleteAnim(); |
|
154 void FocusGained(); |
|
155 void FocusLost(); |
|
156 void SkinChanged(); |
|
157 void SetControl(CCoeControl* aControl); |
|
158 |
|
159 // Implementation of MCoeForegroundObserver |
|
160 void HandleGainingForeground(); |
|
161 void HandleLosingForeground(); |
|
162 |
|
163 // Implementation of MAknsEffectAnimObserver |
|
164 void AnimFrameReady(TInt aError, TInt); |
|
165 |
|
166 // Implementation of MListBoxItemChangeObserver |
|
167 void ListBoxItemsChanged(CEikListBox* aListBox); |
|
168 |
|
169 // Overloads CActive::DoCancel |
|
170 void DoCancel(); |
|
171 // Overloads CActive::RunL |
|
172 void RunL(); |
|
173 |
|
174 void Play(); |
|
175 |
|
176 void CreateColorBitmapsL(TSize aSize); |
|
177 void CreateColorBitmapsL(); |
|
178 |
|
179 TBool DrawPressedDownEffectL(MAknsSkinInstance* aSkin, CWindowGc& aGc, |
|
180 const TRect& aOutRect, const TRect& aInnerRect) const; |
|
181 void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, |
|
182 const TAknLayoutText& aLayout, |
|
183 TBool aUseLogicalToVisualConversion, |
|
184 const TRgb &aColor); |
|
185 TInt ConvertTextToSmiley( TDes& aText ); |
|
186 void LoadMarkingIconsL(); |
|
187 private: |
|
188 // New internal methods |
|
189 TBool DrawHighlightBackground(CFbsBitGc& aGc); |
|
190 void PostDeleteAnimation(); |
|
191 void CreateAnimationL(); |
|
192 void DoResizeL(const TSize& aHighlightSize, TBool aAboutToStart); |
|
193 |
|
194 public: |
|
195 struct TSubCellExt |
|
196 { |
|
197 TInt iSubCell; // Must be first entry |
|
198 TBool iLayoutAlign; |
|
199 }; |
|
200 |
|
201 TInt AddSubCellExtL(TInt aSubCell); |
|
202 void FindSubCellExtIndexOrAddL(TInt& aArrayIndex, TInt aSubCell); |
|
203 |
|
204 void SetSubCellLayoutAlignmentL(TInt aSubCellIndex); |
|
205 |
|
206 TInt FindSubCellExtIndex(TInt& aArrayIndex, TInt aSubCell) const; |
|
207 TBool SubCellLayoutAlignment(TInt aSubCellIndex) const; |
|
208 public: // from MAknSmileyObserver |
|
209 void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon ); |
|
210 void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon ); |
|
211 private: |
|
212 // From MAknPictographAnimatorCallBack |
|
213 void DrawPictographArea(); |
|
214 |
|
215 public: |
|
216 CCoeControl *iControl; // not owned |
|
217 CCCAppCommLauncherCustomListBoxData* iListBoxData; // Not owned |
|
218 CAknsListBoxBackgroundControlContext* iSkinControlContext; |
|
219 TBool iSkinEnabled; |
|
220 const TAknsItemID *iSkinHighlightFrameId; |
|
221 const TAknsItemID *iSkinHighlightFrameCenterId; |
|
222 TBool iRespectFocus; |
|
223 // not used ? HBufC *iTempTextBuffer; |
|
224 TRect iSkinPopupInnerRect; |
|
225 TRect iSkinPopupOuterRect; |
|
226 CAknsFrameBackgroundControlContext* iPopupFrame; |
|
227 TBool iUseLogicalToVisualConversion; |
|
228 TInt16 iFirstWordWrappedSubcellIndex; |
|
229 TInt16 iSecondWordWrappedSubcellIndex; |
|
230 CAknPictographInterface* iPictoInterface; |
|
231 CAknMarqueeControl* iMarquee; |
|
232 CAknMarqueeControl* i2ndLineMarquee; |
|
233 TInt iCurrentItem; // Current list item index that marquee draws/has drawn. |
|
234 TInt iCurrentRow; // Current list row being drawn. // not true - cache of currentitemindex |
|
235 TInt iCurrentlyDrawnItemIndex; |
|
236 CArrayFix<SRowAndSubCell>* iRowAndSubCellArray; |
|
237 CArrayFix<SSLSubCell>* iSLSubCellArray; |
|
238 TBool iDrawBackground; // Determines if background should be drawn (transparency) |
|
239 TSize iSubCellIconSize[KMaxSubCellIndex]; // Store icon sizes for each subcell |
|
240 TAknSeparatorLinePosition iSeparatorLinePosition; |
|
241 CAknsEffectAnim* iAnimation; |
|
242 TBitFlags32 iAnimFlags; |
|
243 TRgb iHighlightedTextColor; |
|
244 TRgb iTextColor; |
|
245 TBool iDrawScrollbarBackground; |
|
246 TBool iSimpleList; |
|
247 |
|
248 TBool iUnderlineFlagSet; // underlining support for more than |
|
249 TBitFlags32 iUnderlineFlags; // one text subcell |
|
250 TBool iHideSecondRow; |
|
251 TBool iSubCellsMightIntersect; |
|
252 TBool iStretchingEnabled; |
|
253 TAknsItemID iAnimIID; |
|
254 MListBoxAnimBackgroundDrawer* iHighlightBgDrawer; |
|
255 TSize iAnimSize; // TODO Deprecating old style anim API and removing this |
|
256 // Drop shadows can be toggled on/off in |
|
257 // "transparent" lists (eg. transparent camera setting page). |
|
258 TBool iUseDropShadows; |
|
259 |
|
260 // highlight color skinning for setstyle lists - to be deprecated once correct color skinning is available |
|
261 TBool iUseHighligthIconSwapping; |
|
262 |
|
263 // colorskin highlight icons |
|
264 CFbsBitmap* iColorBmp; |
|
265 CFbsBitmap* iHiliBmp; |
|
266 TRgb iIconColor; |
|
267 TRgb iHiliIconColor; |
|
268 |
|
269 TInt iConditionalCells; |
|
270 |
|
271 // which columns of highlighted item have clipped text ? |
|
272 TUint32 iClippedSubcells; |
|
273 TUint32 iClippedByWrap; |
|
274 TBool iUseClippedByWrap; |
|
275 |
|
276 CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment |
|
277 |
|
278 TRect iMarginRect; |
|
279 TBool iKineticScrolling; |
|
280 CAknSmileyManager* iSmileyMan; |
|
281 TSize iSmileySize; // last set simley size |
|
282 CAknIconArray* iMarkingIconArray; |
|
283 }; |
|
284 |
|
285 /** |
|
286 * High priority is well argumented because running the active object will |
|
287 * result in animation deletion -> results in freeing resources. |
|
288 */ |
|
289 CCCAppCommLauncherCustomListBoxDataExtension::CCCAppCommLauncherCustomListBoxDataExtension() : |
|
290 CActive(EPriorityHigh) |
|
291 { |
|
292 } |
|
293 |
|
294 void CCCAppCommLauncherCustomListBoxDataExtension::ConstructL( |
|
295 CCCAppCommLauncherCustomListBoxData* aListBoxData, |
|
296 const TAknsItemID& aAnimationIID) |
|
297 { |
|
298 iListBoxData = aListBoxData; |
|
299 iRowAndSubCellArray = new (ELeave) CArrayFixFlat<SRowAndSubCell> (4); |
|
300 iSLSubCellArray = new (ELeave) CArrayFixFlat<SSLSubCell> (4); |
|
301 |
|
302 iSubCellExtArray = new (ELeave) CArrayFixFlat<TSubCellExt> (4); |
|
303 |
|
304 // bi-di algorithm support (NON_LEAVING_VERSION) |
|
305 // not used ? iTempTextBuffer = HBufC::NewL(256); |
|
306 iUseLogicalToVisualConversion = ETrue; |
|
307 |
|
308 iFirstWordWrappedSubcellIndex = -1; |
|
309 iSecondWordWrappedSubcellIndex = -1; |
|
310 |
|
311 iDrawBackground = ETrue; |
|
312 iSeparatorLinePosition = ENoLine; |
|
313 |
|
314 iAnimIID = aAnimationIID; |
|
315 CActiveScheduler::Add(this); |
|
316 TryCreateAnimation(); // Animations are created by default |
|
317 |
|
318 iTextColor = NULL; // just in case |
|
319 iHighlightedTextColor = NULL; // just in case |
|
320 iDrawScrollbarBackground = ETrue; |
|
321 |
|
322 #ifdef RD_LIST_STRETCH |
|
323 // check list stretching from cenrep |
|
324 CRepository* cenRep = CRepository::NewL(KCRUidAvkon); |
|
325 cenRep->Get(KAknAutomaticListStretching, iStretchingEnabled); |
|
326 delete cenRep; |
|
327 #endif |
|
328 |
|
329 iKineticScrolling = CAknPhysics::FeatureEnabled(); |
|
330 #ifdef RD_TOUCH2_MARKING |
|
331 LoadMarkingIconsL(); |
|
332 #endif // RD_TOUCH2_MARKING |
|
333 } |
|
334 |
|
335 CCCAppCommLauncherCustomListBoxDataExtension::~CCCAppCommLauncherCustomListBoxDataExtension() |
|
336 { |
|
337 Cancel(); |
|
338 |
|
339 // Stop receiving foreground events |
|
340 CCoeEnv* env = CCoeEnv::Static(); |
|
341 env->RemoveForegroundObserver(*this); |
|
342 delete iSmileyMan; |
|
343 |
|
344 delete iRowAndSubCellArray; |
|
345 iRowAndSubCellArray = NULL; |
|
346 delete iSLSubCellArray; |
|
347 iSLSubCellArray = NULL; |
|
348 delete iSubCellExtArray; |
|
349 iSubCellExtArray = NULL; |
|
350 delete iPopupFrame; |
|
351 delete iSkinControlContext; |
|
352 // not used ? delete iTempTextBuffer; |
|
353 delete iPictoInterface; |
|
354 delete iMarquee; |
|
355 delete i2ndLineMarquee; |
|
356 delete iAnimation; |
|
357 delete iColorBmp; |
|
358 delete iHiliBmp; |
|
359 |
|
360 if ( iMarkingIconArray ) |
|
361 { |
|
362 iMarkingIconArray->ResetAndDestroy(); |
|
363 } |
|
364 delete iMarkingIconArray; |
|
365 } |
|
366 |
|
367 void CCCAppCommLauncherCustomListBoxDataExtension::AddRowAndSubCellL(TInt aRow, |
|
368 TInt aSubCell) |
|
369 { |
|
370 SRowAndSubCell subcell; |
|
371 subcell.iIndex = (aRow << 8) | (aSubCell & 0xff); |
|
372 subcell.iFont = NULL; |
|
373 TKeyArrayFix key(0, ECmpTInt32); |
|
374 iRowAndSubCellArray->InsertIsqL(subcell, key); |
|
375 } |
|
376 |
|
377 CCCAppCommLauncherCustomListBoxDataExtension::SRowAndSubCell& |
|
378 CCCAppCommLauncherCustomListBoxDataExtension::At(TInt aArrayIndex) |
|
379 { |
|
380 /* SRowAndSubCell subcell; |
|
381 for (int a=0;a<iRowAndSubCellArray->Count();a++) |
|
382 subcell = iRowAndSubCellArray->At(a); */ |
|
383 |
|
384 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iRowAndSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
385 return (iRowAndSubCellArray->At(aArrayIndex)); |
|
386 } |
|
387 |
|
388 const CCCAppCommLauncherCustomListBoxDataExtension::SRowAndSubCell& |
|
389 CCCAppCommLauncherCustomListBoxDataExtension::At(TInt aArrayIndex) const |
|
390 { |
|
391 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iRowAndSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
392 return (iRowAndSubCellArray->At(aArrayIndex)); |
|
393 } |
|
394 |
|
395 TInt CCCAppCommLauncherCustomListBoxDataExtension::FindRowAndSubCellIndex( |
|
396 TInt& aArrayIndex, TInt aRow, TInt aSubCell) const |
|
397 { |
|
398 if (iRowAndSubCellArray->Count() == 0) |
|
399 return (KErrNotFound); |
|
400 TKeyArrayFix key(0, ECmpTInt32); |
|
401 SRowAndSubCell rowAndSubcell; |
|
402 rowAndSubcell.iIndex = (aRow << 8) | (aSubCell & 0xff); |
|
403 return (iRowAndSubCellArray->FindIsq(rowAndSubcell, key, aArrayIndex)); |
|
404 } |
|
405 |
|
406 void CCCAppCommLauncherCustomListBoxDataExtension::FindRowAndSubCellIndexOrAddL( |
|
407 TInt& aArrayIndex, TInt aRow, TInt aSubCell) |
|
408 { |
|
409 if (FindRowAndSubCellIndex(aArrayIndex, aRow, aSubCell) != 0) //==KErrNotFound) |
|
410 { |
|
411 AddRowAndSubCellL(aRow, aSubCell); |
|
412 FindRowAndSubCellIndex(aArrayIndex, aRow, aSubCell); |
|
413 } |
|
414 /* SRowAndSubCell rowAndSubcell; |
|
415 rowAndSubcell = iRowAndSubCellArray->At(aArrayIndex); */ |
|
416 } |
|
417 |
|
418 void CCCAppCommLauncherCustomListBoxDataExtension::AddSLSubCellL(TInt aSubCell) |
|
419 { |
|
420 SSLSubCell subcell; |
|
421 subcell.iSubCell = aSubCell; |
|
422 subcell.iTextLayout = NULL; |
|
423 subcell.iGraphicLayout = NULL; |
|
424 subcell.iSubCellType = 0; |
|
425 subcell.iConditionValue = -1; |
|
426 subcell.iSmileyCell = EFalse; |
|
427 |
|
428 TKeyArrayFix key(0, ECmpTInt32); |
|
429 iSLSubCellArray->InsertIsqL(subcell, key); |
|
430 } |
|
431 |
|
432 CCCAppCommLauncherCustomListBoxDataExtension::SSLSubCell& |
|
433 CCCAppCommLauncherCustomListBoxDataExtension::AtSL(TInt aArrayIndex) |
|
434 { |
|
435 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
436 return (iSLSubCellArray->At(aArrayIndex)); |
|
437 } |
|
438 |
|
439 const CCCAppCommLauncherCustomListBoxDataExtension::SSLSubCell& |
|
440 CCCAppCommLauncherCustomListBoxDataExtension::AtSL(TInt aArrayIndex) const |
|
441 { |
|
442 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
443 return (iSLSubCellArray->At(aArrayIndex)); |
|
444 } |
|
445 |
|
446 TInt CCCAppCommLauncherCustomListBoxDataExtension::FindSLSubCellIndex( |
|
447 TInt& aArrayIndex, TInt aSubCell) const |
|
448 { |
|
449 if (iSLSubCellArray->Count() == 0) |
|
450 return (KErrNotFound); |
|
451 TKeyArrayFix key(0, ECmpTInt32); |
|
452 SSLSubCell SLSubCell; |
|
453 SLSubCell.iSubCell = aSubCell; |
|
454 return (iSLSubCellArray->FindIsq(SLSubCell, key, aArrayIndex)); |
|
455 } |
|
456 |
|
457 void CCCAppCommLauncherCustomListBoxDataExtension::FindSLSubCellIndexOrAddL( |
|
458 TInt& aArrayIndex, TInt aSubCell) |
|
459 { |
|
460 if (FindSLSubCellIndex(aArrayIndex, aSubCell) != 0) //==KErrNotFound) |
|
461 { |
|
462 AddSLSubCellL(aSubCell); |
|
463 FindSLSubCellIndex(aArrayIndex, aSubCell); |
|
464 } |
|
465 } |
|
466 |
|
467 void CCCAppCommLauncherCustomListBoxDataExtension::ResetSLSubCellArray() |
|
468 { |
|
469 iSLSubCellArray->Reset(); |
|
470 iRowAndSubCellArray->Reset(); |
|
471 } |
|
472 |
|
473 void CCCAppCommLauncherCustomListBoxDataExtension::CreatePictographInterfaceL() |
|
474 { |
|
475 if (!iPictoInterface) |
|
476 { |
|
477 iPictoInterface = CAknPictographInterface::NewL(*iControl, *this); |
|
478 } |
|
479 } |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // CCCAppCommLauncherCustomListBoxDataExtension::NoAnimIfError |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 inline void CCCAppCommLauncherCustomListBoxDataExtension::NoAnimIfError( |
|
486 TInt aError) |
|
487 { |
|
488 if (KErrNone != aError) |
|
489 { |
|
490 DeleteAnim(); |
|
491 } |
|
492 } |
|
493 |
|
494 // ----------------------------------------------------------------------------- |
|
495 // CCCAppCommLauncherCustomListBoxDataExtension::TryCreateAnimation |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 void CCCAppCommLauncherCustomListBoxDataExtension::TryCreateAnimation() |
|
499 { |
|
500 if (!iControl) |
|
501 { |
|
502 return; |
|
503 } |
|
504 |
|
505 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
506 CEikListBox* list = static_cast<CEikListBox*> (iControl); |
|
507 CListBoxView* view = list->View(); |
|
508 if (!view || !view->ItemDrawer()) |
|
509 { |
|
510 return; |
|
511 } |
|
512 CWindowGc* gc = view->ItemDrawer()->Gc(); |
|
513 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal(gc); |
|
514 if (transApi && transApi->VerifyKml() == KErrNone) |
|
515 { |
|
516 return; |
|
517 } |
|
518 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
519 |
|
520 // Ideally we should not create animation if the list has zero items. |
|
521 // Unfortunately, this will cause problems elsewhere as setting item text |
|
522 // array to list requires not calling HandleItemAddition (or similar |
|
523 // method) -> in some situations animation would not be created at all as |
|
524 // we don't receive item change event. Fortunately, creating animation to |
|
525 // empty list doesn't carry much overhead as layer creation is delayed to |
|
526 // first render. |
|
527 |
|
528 if (!iAnimation) |
|
529 { |
|
530 // This must be the first call because animation does not exist. |
|
531 // Animation layers are created when the animation is rendered for the |
|
532 // first time. |
|
533 TRAPD( err, CreateAnimationL() ); |
|
534 NoAnimIfError(err); |
|
535 } |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CCCAppCommLauncherCustomListBoxDataExtension::SyncAnim |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 TBool CCCAppCommLauncherCustomListBoxDataExtension::SyncAnim(const TSize& aSize) |
|
543 { |
|
544 if (!iAnimation || aSize.iWidth <= 0 || aSize.iHeight <= 0) |
|
545 { |
|
546 return EFalse; |
|
547 } |
|
548 |
|
549 if (iAnimation->Size() != aSize || iAnimation->NeedsInputLayer()) |
|
550 { |
|
551 // Resizing will update animation background |
|
552 iAnimFlags.Clear(EFlagUpdateBg); |
|
553 // Animation exists but its size is out of sync or input layers have |
|
554 // been released |
|
555 TRAPD( err, DoResizeL( aSize, iAnimFlags.IsSet( EFlagHasForeground ) ) ); |
|
556 |
|
557 if (err) |
|
558 { |
|
559 DeleteAnim(); |
|
560 return EFalse; |
|
561 } |
|
562 iAnimFlags.Set(EFlagHasLayers); |
|
563 } |
|
564 |
|
565 // Highlight animation background needs update (current item has changed) |
|
566 if (iAnimFlags.IsSet(EFlagUpdateBg)) |
|
567 { |
|
568 iAnimFlags.Clear(EFlagUpdateBg); |
|
569 |
|
570 if (iAnimation->InputRgbGc()) |
|
571 { |
|
572 DrawHighlightBackground(*iAnimation->InputRgbGc()); |
|
573 // We need to update the output frame (otherwise the highlight |
|
574 // would drawn with the old output before the next new animation |
|
575 // frame). |
|
576 NoAnimIfError(iAnimation->UpdateOutput()); |
|
577 if (!iAnimation) |
|
578 { |
|
579 return EFalse; |
|
580 } |
|
581 } |
|
582 } |
|
583 |
|
584 return ETrue; |
|
585 } |
|
586 |
|
587 // ----------------------------------------------------------------------------- |
|
588 // CCCAppCommLauncherCustomListBoxDataExtension::SyncAndDrawAnim |
|
589 // ----------------------------------------------------------------------------- |
|
590 // |
|
591 TBool CCCAppCommLauncherCustomListBoxDataExtension::SyncAndDrawAnim( |
|
592 CBitmapContext& aGc, const TRect& aRect) |
|
593 { |
|
594 if (iAnimation) |
|
595 { |
|
596 // When application loses foreground or has not yet gained foreground |
|
597 // animation is in stopped state and input layers are not present. It |
|
598 // is possible that list is repainted in this situation. Calling |
|
599 // SyncAnim will create the non-present layers -> WSERV flush -> |
|
600 // flicker. To prevent flickering we just render the existing frame. |
|
601 // This can lead to incorrect draw if the current item index is changed |
|
602 // when the app has no foreground (very unlikely). If EFlagHasLayers is |
|
603 // not set we need to do SyncAnim because it is the first call to draw |
|
604 // (and flicker is not an issue). |
|
605 if (EAknsAnimStateStopped == iAnimation->State() && !iAnimFlags.IsSet( |
|
606 EFlagHasForeground) && iAnimFlags.IsSet(EFlagHasLayers) |
|
607 && !iAnimFlags.IsSet(EFlagUpdateBg)) |
|
608 { |
|
609 return iAnimation->Render(aGc, aRect); |
|
610 } |
|
611 } |
|
612 |
|
613 if (SyncAnim(aRect.Size())) |
|
614 { |
|
615 return iAnimation->Render(aGc, aRect); |
|
616 } |
|
617 |
|
618 return EFalse; |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CCCAppCommLauncherCustomListBoxDataExtension::SkinBackgroundContext |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 MAknsControlContext* CCCAppCommLauncherCustomListBoxDataExtension::SkinBackgroundContext() const |
|
626 { |
|
627 if (iSkinEnabled) |
|
628 return iSkinControlContext; |
|
629 else |
|
630 return NULL; |
|
631 } |
|
632 |
|
633 // ----------------------------------------------------------------------------- |
|
634 // CCCAppCommLauncherCustomListBoxDataExtension::DeleteAnim |
|
635 // ----------------------------------------------------------------------------- |
|
636 // |
|
637 void CCCAppCommLauncherCustomListBoxDataExtension::DeleteAnim() |
|
638 { |
|
639 // Stop receiving foreground events |
|
640 CCoeEnv* env = CCoeEnv::Static(); |
|
641 env->RemoveForegroundObserver(*this); |
|
642 |
|
643 delete iAnimation; |
|
644 iAnimation = NULL; |
|
645 } |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // CCCAppCommLauncherCustomListBoxDataExtension::FocusGained |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CCCAppCommLauncherCustomListBoxDataExtension::FocusGained() |
|
652 { |
|
653 Play(); |
|
654 } |
|
655 |
|
656 // ----------------------------------------------------------------------------- |
|
657 // CCCAppCommLauncherCustomListBoxDataExtension::FocusLost |
|
658 // ----------------------------------------------------------------------------- |
|
659 // |
|
660 void CCCAppCommLauncherCustomListBoxDataExtension::FocusLost() |
|
661 { |
|
662 if (iAnimation) |
|
663 { |
|
664 NoAnimIfError(iAnimation->Pause()); |
|
665 } |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // CCCAppCommLauncherCustomListBoxDataExtension::SkinChanged |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 void CCCAppCommLauncherCustomListBoxDataExtension::SkinChanged() |
|
673 { |
|
674 DeleteAnim(); |
|
675 TryCreateAnimation(); |
|
676 TRAP_IGNORE( CreateColorBitmapsL() ); |
|
677 #ifdef RD_TOUCH2_MARKING |
|
678 TRAP_IGNORE( LoadMarkingIconsL() ); |
|
679 #endif // RD_TOUCH2_MARKING |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CCCAppCommLauncherCustomListBoxDataExtension::SetControl |
|
684 // ----------------------------------------------------------------------------- |
|
685 // |
|
686 void CCCAppCommLauncherCustomListBoxDataExtension::SetControl( |
|
687 CCoeControl* aControl) |
|
688 { |
|
689 if (iControl) |
|
690 { |
|
691 CEikListBox* list = (CEikListBox*) iControl; |
|
692 list->RemoveItemChangeObserver(this); |
|
693 } |
|
694 |
|
695 iControl = aControl; |
|
696 |
|
697 if (iControl) |
|
698 { |
|
699 CEikListBox* list = (CEikListBox*) iControl; |
|
700 TRAP_IGNORE( list->AddItemChangeObserverL(this) ); |
|
701 |
|
702 if (!iAnimation) |
|
703 { |
|
704 TryCreateAnimation(); |
|
705 } |
|
706 |
|
707 if (iAnimation) |
|
708 { |
|
709 Play(); |
|
710 } |
|
711 } |
|
712 else |
|
713 { |
|
714 DeleteAnim(); |
|
715 } |
|
716 } |
|
717 |
|
718 // ----------------------------------------------------------------------------- |
|
719 // CCCAppCommLauncherCustomListBoxDataExtension::HandleGainingForeground |
|
720 // ----------------------------------------------------------------------------- |
|
721 // |
|
722 void CCCAppCommLauncherCustomListBoxDataExtension::HandleGainingForeground() |
|
723 { |
|
724 // Most of the time focus focus events happen between foreground events. |
|
725 // Unfortunately, there are embedded app related cases where this does not |
|
726 // always hold (it is possible to focus in non-foreground application or |
|
727 // gain foreground without getting a focus gained). Therefore animations |
|
728 // must be started here. This causes potential problem case: foreground |
|
729 // events are broadcasted to all animations, if there are multiple lists |
|
730 // that have focus the result will be multiple animations running at the |
|
731 // same time. |
|
732 iAnimFlags.Set(EFlagHasForeground); |
|
733 |
|
734 if (iAnimation) |
|
735 { |
|
736 // Because we are gaining foreground we must restore input layers |
|
737 // (which are released when animation stops to reduce memory usage). |
|
738 SyncAnim(iAnimation->Size()); |
|
739 } |
|
740 |
|
741 if (iControl) |
|
742 { |
|
743 if (iControl->IsFocused()) |
|
744 { |
|
745 Play(); |
|
746 } |
|
747 } |
|
748 } |
|
749 |
|
750 // ----------------------------------------------------------------------------- |
|
751 // CCCAppCommLauncherCustomListBoxDataExtension::HandleLosingForeground |
|
752 // ----------------------------------------------------------------------------- |
|
753 // |
|
754 void CCCAppCommLauncherCustomListBoxDataExtension::HandleLosingForeground() |
|
755 { |
|
756 iAnimFlags.Clear(EFlagHasForeground); |
|
757 if (iAnimation) |
|
758 { |
|
759 NoAnimIfError(iAnimation->Stop()); |
|
760 } |
|
761 } |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // CCCAppCommLauncherCustomListBoxDataExtension::AnimFrameReady |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 void CCCAppCommLauncherCustomListBoxDataExtension::AnimFrameReady(TInt aError, |
|
768 TInt) |
|
769 { |
|
770 if (KErrNone != aError) |
|
771 { |
|
772 // Animation has failed to run -> schedule the animation for |
|
773 // deletion to fall back to normal rendering. |
|
774 PostDeleteAnimation(); |
|
775 return; |
|
776 } |
|
777 |
|
778 // This situation should never happen because we start/stop animation when |
|
779 // the extension's control is set. |
|
780 if (!iControl) |
|
781 return; |
|
782 |
|
783 // From now on, we have a valid control pointer |
|
784 CEikListBox* list = static_cast<CEikListBox*> (iControl); |
|
785 CListBoxView* view = list->View(); |
|
786 |
|
787 if (!view) |
|
788 return; |
|
789 |
|
790 // We should not run animation when control is in certain states. When |
|
791 // control is in these states we idle the animation until the control state |
|
792 // becomes valid again. |
|
793 TBool invalid = !iControl->IsVisible() || iControl->IsDimmed() |
|
794 || (view->ItemDrawer()->Flags() |
|
795 & CListItemDrawer::EDisableHighlight); |
|
796 |
|
797 // Check for idling |
|
798 if (iAnimation->IsIdling()) |
|
799 { |
|
800 if (invalid) |
|
801 { |
|
802 // We are idling and the control is still invalid -> keep on |
|
803 // idling. |
|
804 return; |
|
805 } |
|
806 else |
|
807 { |
|
808 // Control is in valid state, animation should be continued |
|
809 TInt err = iAnimation->Continue(); |
|
810 if (err) |
|
811 PostDeleteAnimation(); |
|
812 return; |
|
813 } |
|
814 } |
|
815 else if (invalid) // Not idling and invalid control -> start idling |
|
816 { |
|
817 iAnimation->SetIdling(KAknsEffectAnimDefaultIdleInterval); |
|
818 // If the highlight has been disabled, render once to clear the |
|
819 // highlight (not returning in that case). |
|
820 if (!(view->ItemDrawer()->Flags() & CListItemDrawer::EDisableHighlight)) |
|
821 return; |
|
822 } |
|
823 |
|
824 // From now on, we have a valid control pointer and control has enabled |
|
825 // highlight, is visible and is not dimmed. |
|
826 |
|
827 // No items, no drawing |
|
828 if (list->Model()->NumberOfItems() == 0) |
|
829 return; |
|
830 |
|
831 if (iListBoxData->LastSubCell() < 0) |
|
832 return; |
|
833 |
|
834 TBool customGcInUse = list->GetGc() != &CEikonEnv::Static()->SystemGc(); |
|
835 |
|
836 // if remoteGc is in use (CCoeControl has custom gc set) |
|
837 // then draw the whole control as the transition system |
|
838 // expects the draw to be initiated from CONE control |
|
839 |
|
840 if (!customGcInUse) |
|
841 { |
|
842 // Repaint the highlighted cell only |
|
843 list->RedrawItem(view->CurrentItemIndex()); |
|
844 } |
|
845 else |
|
846 { |
|
847 CCoeControl* ctrl = (CCoeControl*) list; |
|
848 ctrl->DrawNow(); |
|
849 } |
|
850 |
|
851 } |
|
852 |
|
853 // ----------------------------------------------------------------------------- |
|
854 // CCCAppCommLauncherCustomListBoxDataExtension::ListBoxItemsChanged |
|
855 // |
|
856 // this is called from from: |
|
857 // - CEikListBox::Reset() |
|
858 // - CEikListBox::HandleItemRemoval{WithoutSelections}L() |
|
859 // - CEikListBox::HandleItemAdditionL() |
|
860 // - CEikListBox::FireItemChange() |
|
861 // In all cases: |
|
862 // - feedback areas might be invalid |
|
863 // - application is responsible for redrawing the listbox. |
|
864 // |
|
865 // since re-drawing listbox fixes feedback areas, those can be reset here. |
|
866 // ----------------------------------------------------------------------------- |
|
867 // |
|
868 void CCCAppCommLauncherCustomListBoxDataExtension::ListBoxItemsChanged( |
|
869 CEikListBox* aListBox) |
|
870 { |
|
871 |
|
872 TInt items = aListBox->Model()->NumberOfItems(); |
|
873 |
|
874 if (iAnimation) |
|
875 { |
|
876 if (0 == items) |
|
877 { |
|
878 DeleteAnim(); |
|
879 } |
|
880 else |
|
881 { |
|
882 Play(); |
|
883 } |
|
884 } |
|
885 else if (!iAnimation) |
|
886 { |
|
887 // Animation doesn't exist and we have > 0 items |
|
888 TryCreateAnimation(); |
|
889 } |
|
890 } |
|
891 |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CCCAppCommLauncherCustomListBoxDataExtension::DoCancel |
|
894 // ----------------------------------------------------------------------------- |
|
895 // |
|
896 void CCCAppCommLauncherCustomListBoxDataExtension::DoCancel() |
|
897 { |
|
898 // Required method, but not needed |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // CCCAppCommLauncherCustomListBoxDataExtension::RunL |
|
903 // Postponed animation deletion is done here. |
|
904 // ----------------------------------------------------------------------------- |
|
905 // |
|
906 void CCCAppCommLauncherCustomListBoxDataExtension::RunL() |
|
907 { |
|
908 DeleteAnim(); |
|
909 } |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // CCCAppCommLauncherCustomListBoxDataExtension::Play |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 void CCCAppCommLauncherCustomListBoxDataExtension::Play() |
|
916 { |
|
917 if (!iAnimation) |
|
918 { |
|
919 return; |
|
920 } |
|
921 |
|
922 // No need to start running/finished animation |
|
923 if (EAknsAnimStateRunning == iAnimation->State() || EAknsAnimStateFinished |
|
924 == iAnimation->State()) |
|
925 { |
|
926 return; |
|
927 } |
|
928 |
|
929 // Check that application is on foreground because there are cases where |
|
930 // focus changes are done after foreground is lost -> potentially leads to |
|
931 // multiple running animations. |
|
932 if (!iAnimFlags.IsSet(EFlagHasForeground)) |
|
933 { |
|
934 return; |
|
935 } |
|
936 |
|
937 // Animation cannot run if we don't have control (nowhere to draw) |
|
938 if (!iControl) |
|
939 { |
|
940 return; |
|
941 } |
|
942 |
|
943 // The control must also have the focus |
|
944 if (!iControl->IsFocused()) |
|
945 { |
|
946 return; |
|
947 } |
|
948 |
|
949 // Don't animate empty list |
|
950 CEikListBox* list = static_cast<CEikListBox*> (iControl); |
|
951 if (list->Model()->NumberOfItems() == 0) |
|
952 { |
|
953 return; |
|
954 } |
|
955 |
|
956 // All preconditions are met: we have animation, foreground, focus, more |
|
957 // than zero items and animation is either paused or stopped. Invisibility, |
|
958 // dimming and disabled highlight are handled by idling the animation (see |
|
959 // AnimFrameReady). |
|
960 |
|
961 if (EAknsAnimStatePaused == iAnimation->State()) |
|
962 { |
|
963 NoAnimIfError(iAnimation->Continue()); |
|
964 } |
|
965 else if (EAknsAnimStateStopped == iAnimation->State()) |
|
966 { |
|
967 NoAnimIfError(iAnimation->Start()); |
|
968 } |
|
969 } |
|
970 |
|
971 // ----------------------------------------------------------------------------- |
|
972 // CCCAppCommLauncherCustomListBoxDataExtension::DrawHighlightBackground |
|
973 // ----------------------------------------------------------------------------- |
|
974 // |
|
975 TBool CCCAppCommLauncherCustomListBoxDataExtension::DrawHighlightBackground( |
|
976 CFbsBitGc& aGc) |
|
977 { |
|
978 if (iHighlightBgDrawer) // Bg drawing is done externally (in derived class) |
|
979 { |
|
980 return iHighlightBgDrawer->DrawHighlightAnimBackground(aGc); |
|
981 } |
|
982 |
|
983 // Draw the background under the current highlight. This is simplified |
|
984 // drawing, we only grab a piece from the list background bitmap. |
|
985 CEikListBox* list = static_cast<CEikListBox*> (iControl); |
|
986 CListBoxView* view = list->View(); |
|
987 TRect itemRect; |
|
988 TInt index = view->CurrentItemIndex(); |
|
989 |
|
990 // It is possible that the animation is constructed when the list is |
|
991 // empty. In this case draw the first element background (drawing works ok |
|
992 // even if the list has no items). |
|
993 if (list->Model()->NumberOfItems() == 0) |
|
994 { |
|
995 index = 0; |
|
996 } |
|
997 itemRect.SetRect(view->ItemPos(index), iAnimation->Size()); |
|
998 |
|
999 MAknsControlContext* cc = AknsDrawUtils::ControlContext(iControl); |
|
1000 |
|
1001 if (!cc) |
|
1002 { |
|
1003 cc = SkinBackgroundContext(); |
|
1004 } |
|
1005 |
|
1006 TBool ret = AknsDrawUtils::DrawBackground( AknsUtils::SkinInstance(), cc, iControl, aGc, TPoint(0,0), |
|
1007 itemRect, KAknsDrawParamBottomLevelRGBOnly ); |
|
1008 return ret; |
|
1009 } |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // CCCAppCommLauncherCustomListBoxDataExtension::PostDeleteAnimation |
|
1013 // Schedules the animation for deletion by activating the extension itself. |
|
1014 // Deletion is postponed because in many error/failure occasions the caller has |
|
1015 // been animation and direct deletion is possibly not safe (because function |
|
1016 // stack would return through the deleted object). |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 // |
|
1019 void CCCAppCommLauncherCustomListBoxDataExtension::PostDeleteAnimation() |
|
1020 { |
|
1021 TRequestStatus* status = &iStatus; |
|
1022 User::RequestComplete(status, KErrNone); |
|
1023 SetActive(); |
|
1024 } |
|
1025 |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // CCCAppCommLauncherCustomListBoxDataExtension::CreateAnimationL |
|
1028 // ----------------------------------------------------------------------------- |
|
1029 // |
|
1030 void CCCAppCommLauncherCustomListBoxDataExtension::CreateAnimationL() |
|
1031 { |
|
1032 DeleteAnim(); |
|
1033 |
|
1034 // Check if derived class wants to disable highlight animation. Also, no |
|
1035 // highlight animation on lists that don't have background |
|
1036 if ((KAknsIIDNone == iAnimIID) |
|
1037 || !iListBoxData->IsBackgroundDrawingEnabled()) |
|
1038 { |
|
1039 return; |
|
1040 } |
|
1041 |
|
1042 // Create animation |
|
1043 CCoeEnv* env = CCoeEnv::Static(); |
|
1044 env->AddForegroundObserverL(*this); |
|
1045 |
|
1046 iAnimation = CAknsEffectAnim::NewL(this); |
|
1047 TBool ok = iAnimation->ConstructFromSkinL(iAnimIID); |
|
1048 |
|
1049 if (!ok) // Animation for the ID was not found from the skin |
|
1050 { |
|
1051 User::Leave(KErrNotFound); |
|
1052 } |
|
1053 |
|
1054 // Sync the local foreground flag state. Foreground state is stored locally |
|
1055 // because calling AppUi::IsForeground causes WSERV flush (shocking) and |
|
1056 // therefore it cannot be used in draw routines. |
|
1057 CAknAppUi* aui = static_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); |
|
1058 iAnimFlags.Assign(EFlagHasForeground, aui->IsForeground()); |
|
1059 |
|
1060 Play(); |
|
1061 } |
|
1062 |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 // CCCAppCommLauncherCustomListBoxDataExtension::DoResizeL |
|
1065 // ----------------------------------------------------------------------------- |
|
1066 // |
|
1067 void CCCAppCommLauncherCustomListBoxDataExtension::DoResizeL( |
|
1068 const TSize& aHighlightSize, TBool aAboutToStart) |
|
1069 { |
|
1070 iAnimation->BeginConfigInputLayersL(aHighlightSize, aAboutToStart); |
|
1071 |
|
1072 if (iAnimation->InputRgbGc()) |
|
1073 { |
|
1074 DrawHighlightBackground(*iAnimation->InputRgbGc()); |
|
1075 } |
|
1076 |
|
1077 iAnimation->EndConfigInputLayersL(); |
|
1078 } |
|
1079 |
|
1080 ///////////handling TSubCellExt,start |
|
1081 |
|
1082 TInt CCCAppCommLauncherCustomListBoxDataExtension::AddSubCellExtL(TInt aSubCell) |
|
1083 { |
|
1084 TSubCellExt subcell; |
|
1085 subcell.iSubCell = aSubCell; |
|
1086 subcell.iLayoutAlign = ETrue; |
|
1087 |
|
1088 TKeyArrayFix key(0, ECmpTInt); |
|
1089 return iSubCellExtArray->InsertIsqL(subcell, key); |
|
1090 |
|
1091 } |
|
1092 |
|
1093 void CCCAppCommLauncherCustomListBoxDataExtension::FindSubCellExtIndexOrAddL( |
|
1094 TInt& aArrayIndex, TInt aSubCell) |
|
1095 { |
|
1096 if (FindSubCellExtIndex(aArrayIndex, aSubCell) == KErrNotFound) |
|
1097 { |
|
1098 aArrayIndex = AddSubCellExtL(aSubCell); |
|
1099 //FindSubCellExtIndex(aArrayIndex,aSubCell); |
|
1100 } |
|
1101 } |
|
1102 |
|
1103 void CCCAppCommLauncherCustomListBoxDataExtension::SetSubCellLayoutAlignmentL( |
|
1104 TInt aSubCellIndex) |
|
1105 { |
|
1106 TInt index = 0; |
|
1107 FindSubCellExtIndexOrAddL(index, aSubCellIndex); |
|
1108 iSubCellExtArray->At(index).iLayoutAlign = EFalse; |
|
1109 } |
|
1110 |
|
1111 TInt CCCAppCommLauncherCustomListBoxDataExtension::FindSubCellExtIndex( |
|
1112 TInt& aArrayIndex, TInt aSubCell) const |
|
1113 { |
|
1114 if (aSubCell < 0 || iSubCellExtArray->Count() == 0) |
|
1115 return (KErrNotFound); |
|
1116 TKeyArrayFix key(0, ECmpTInt); |
|
1117 TSubCellExt subcell; |
|
1118 subcell.iSubCell = aSubCell; |
|
1119 TInt retVal = iSubCellExtArray->FindIsq(subcell, key, aArrayIndex); |
|
1120 if (retVal != 0) |
|
1121 { |
|
1122 return KErrNotFound; |
|
1123 } |
|
1124 |
|
1125 return retVal; |
|
1126 } |
|
1127 |
|
1128 TBool CCCAppCommLauncherCustomListBoxDataExtension::SubCellLayoutAlignment( |
|
1129 TInt aSubCellIndex) const |
|
1130 { |
|
1131 TInt index = 0; |
|
1132 if (FindSubCellExtIndex(index, aSubCellIndex) == KErrNotFound) |
|
1133 return (ETrue); |
|
1134 return (iSubCellExtArray->At(index).iLayoutAlign); |
|
1135 } |
|
1136 void CCCAppCommLauncherCustomListBoxDataExtension::SmileyStillImageLoaded( |
|
1137 CAknSmileyIcon* /*aSmileyIcon*/) |
|
1138 { |
|
1139 iControl->DrawDeferred(); |
|
1140 } |
|
1141 |
|
1142 void CCCAppCommLauncherCustomListBoxDataExtension::SmileyAnimationChanged( |
|
1143 CAknSmileyIcon* /*aSmileyIcon*/ ) |
|
1144 { |
|
1145 } |
|
1146 |
|
1147 ///////////handling TSubCellExt,end |
|
1148 |
|
1149 void CCCAppCommLauncherCustomListBoxDataExtension::DrawPictographArea() |
|
1150 { |
|
1151 // This callback is never invoked, if iControl is NULL. |
|
1152 iControl->DrawNow(); |
|
1153 } |
|
1154 |
|
1155 void CCCAppCommLauncherCustomListBoxDataExtension::CreateMarqueeControlL() |
|
1156 { |
|
1157 if (!iMarquee) |
|
1158 { |
|
1159 iMarquee = CAknMarqueeControl::NewL(); |
|
1160 } |
|
1161 |
|
1162 if (!i2ndLineMarquee) |
|
1163 { |
|
1164 i2ndLineMarquee = CAknMarqueeControl::NewL(); |
|
1165 } |
|
1166 } |
|
1167 |
|
1168 TInt CCCAppCommLauncherCustomListBoxDataExtension::RedrawEvent(TAny* aControl) |
|
1169 { |
|
1170 if (!((CCoeControl*) aControl)->IsVisible()) |
|
1171 { |
|
1172 return EFalse; |
|
1173 } |
|
1174 CEikFormattedCellListBox* listBox = (CEikFormattedCellListBox*) aControl; |
|
1175 if (listBox->CurrentItemIndex() >= 0) |
|
1176 { |
|
1177 listBox->RedrawItem(listBox->CurrentItemIndex()); |
|
1178 } |
|
1179 return ETrue; |
|
1180 } |
|
1181 |
|
1182 TBool CCCAppCommLauncherCustomListBoxDataExtension::IsMarqueeOn() |
|
1183 { |
|
1184 TBool isOn = EFalse; |
|
1185 if (iMarquee) |
|
1186 isOn = iMarquee->IsMarqueeOn(); |
|
1187 return isOn; |
|
1188 } |
|
1189 |
|
1190 TBool CCCAppCommLauncherCustomListBoxDataExtension::DrawPressedDownEffectL( |
|
1191 MAknsSkinInstance* aInstance, CWindowGc& aGc, const TRect& aOutRect, |
|
1192 const TRect& aInnerRect) const |
|
1193 { |
|
1194 return AknsDrawUtils::DrawFrame(aInstance, aGc, aOutRect, aInnerRect, |
|
1195 KAknsIIDQsnFrListPressed, KAknsIIDQsnFrListCenterPressed); |
|
1196 } |
|
1197 void CCCAppCommLauncherCustomListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc, |
|
1198 const TDesC& aSmileyText, |
|
1199 const TAknLayoutText& aLayout, |
|
1200 TBool aUseLogicalToVisualConversion, |
|
1201 const TRgb& aColor ) |
|
1202 { |
|
1203 //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1204 TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), |
|
1205 aLayout.Font()->HeightInPixels() ); |
|
1206 TSize s(l,l); |
|
1207 if ( iSmileySize != s ) |
|
1208 { |
|
1209 iSmileyMan->SetSize( s ); |
|
1210 iSmileySize = s; |
|
1211 } |
|
1212 aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor... |
|
1213 iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion ); |
|
1214 } |
|
1215 TInt CCCAppCommLauncherCustomListBoxDataExtension::ConvertTextToSmiley( TDes& aText) |
|
1216 { |
|
1217 //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1218 TInt count = 0; |
|
1219 TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ; |
|
1220 return err == KErrNone ? count : err; |
|
1221 } |
|
1222 |
|
1223 // ----------------------------------------------------------------------------- |
|
1224 // CCCAppCommLauncherCustomListBoxDataExtension::LoadMarkingIconsL |
|
1225 // ----------------------------------------------------------------------------- |
|
1226 // |
|
1227 void CCCAppCommLauncherCustomListBoxDataExtension::LoadMarkingIconsL() |
|
1228 { |
|
1229 #ifdef RD_TOUCH2_MARKING |
|
1230 if ( !iMarkingIconArray ) |
|
1231 { |
|
1232 iMarkingIconArray = new ( ELeave ) CAknIconArray( 2 ); |
|
1233 } |
|
1234 else |
|
1235 { |
|
1236 iMarkingIconArray->ResetAndDestroy(); |
|
1237 } |
|
1238 |
|
1239 CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), |
|
1240 KAknsIIDQgnPropCheckboxOn, |
|
1241 AknIconUtils::AvkonIconFileName(), |
|
1242 EMbmAvkonQgn_prop_checkbox_on, |
|
1243 EMbmAvkonQgn_prop_checkbox_on_mask ); |
|
1244 |
|
1245 CleanupStack::PushL( icon ); |
|
1246 iMarkingIconArray->AppendL( icon ); |
|
1247 CleanupStack::Pop( icon ); |
|
1248 |
|
1249 icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), |
|
1250 KAknsIIDQgnPropCheckboxOff, |
|
1251 AknIconUtils::AvkonIconFileName(), |
|
1252 EMbmAvkonQgn_prop_checkbox_off, |
|
1253 EMbmAvkonQgn_prop_checkbox_off_mask ); |
|
1254 |
|
1255 CleanupStack::PushL( icon ); |
|
1256 iMarkingIconArray->AppendL( icon ); |
|
1257 CleanupStack::Pop( icon ); |
|
1258 #endif // RD_TOUCH2_MARKING |
|
1259 } |
|
1260 |
|
1261 CCoeControl *CCCAppCommLauncherCustomListBoxData::Control() const |
|
1262 { |
|
1263 return iExtension->iControl; |
|
1264 } |
|
1265 |
|
1266 void CCCAppCommLauncherCustomListBoxData::SetSeparatorLinePosition( |
|
1267 TAknSeparatorLinePosition aPosition) |
|
1268 { |
|
1269 if (iExtension) |
|
1270 iExtension->iSeparatorLinePosition = aPosition; |
|
1271 } |
|
1272 TAknSeparatorLinePosition CCCAppCommLauncherCustomListBoxData::SeparatorLinePosition() const |
|
1273 { |
|
1274 if (iExtension) |
|
1275 return iExtension->iSeparatorLinePosition; |
|
1276 else |
|
1277 return ENoLine; |
|
1278 } |
|
1279 CAknLayoutData *CCCAppCommLauncherCustomListBoxData::LayoutData() const |
|
1280 { |
|
1281 return NULL; |
|
1282 } |
|
1283 |
|
1284 TBool CCCAppCommLauncherCustomListBoxData::LayoutInit() const |
|
1285 { |
|
1286 return EFalse; |
|
1287 } |
|
1288 void CCCAppCommLauncherCustomListBoxData::SetLayoutInit(TBool /*aValue*/) |
|
1289 { |
|
1290 } |
|
1291 |
|
1292 CCCAppCommLauncherCustomListBoxDataExtension *CCCAppCommLauncherCustomListBoxData::Extension() |
|
1293 { |
|
1294 return iExtension; |
|
1295 } |
|
1296 CCCAppCommLauncherCustomListBoxDataExtension *CCCAppCommLauncherCustomListBoxData::Extension() const |
|
1297 { |
|
1298 return iExtension; |
|
1299 } |
|
1300 |
|
1301 void CCCAppCommLauncherCustomListBoxData::SetControl( |
|
1302 CCoeControl *aControl) |
|
1303 { |
|
1304 iExtension->SetControl(aControl); |
|
1305 } |
|
1306 |
|
1307 MAknsControlContext* CCCAppCommLauncherCustomListBoxData::SkinBackgroundContext() const |
|
1308 { |
|
1309 if (iExtension->iSkinEnabled) |
|
1310 { |
|
1311 if (iExtension->iPopupFrame) |
|
1312 { |
|
1313 return iExtension->iPopupFrame; |
|
1314 } |
|
1315 else |
|
1316 { |
|
1317 return iExtension->iSkinControlContext; |
|
1318 } |
|
1319 } |
|
1320 else |
|
1321 { |
|
1322 return NULL; |
|
1323 } |
|
1324 } |
|
1325 |
|
1326 void CCCAppCommLauncherCustomListBoxData::SetSkinEnabledL( |
|
1327 TBool aEnabled) |
|
1328 { |
|
1329 CListBoxData::SetSkinEnabledL(aEnabled); |
|
1330 iExtension->iSkinEnabled = aEnabled; |
|
1331 } |
|
1332 |
|
1333 TBool CCCAppCommLauncherCustomListBoxData::SkinEnabled() const |
|
1334 { |
|
1335 return iExtension->iSkinEnabled; |
|
1336 } |
|
1337 |
|
1338 void CCCAppCommLauncherCustomListBoxData::SetSkinStyle( |
|
1339 const TAknsItemID *id, const TRect &aTileRect) |
|
1340 { |
|
1341 |
|
1342 if (iExtension->iSkinControlContext) |
|
1343 { |
|
1344 iExtension->iSkinControlContext->SetTiledBitmap(*id); |
|
1345 iExtension->iSkinControlContext->SetTiledRect(aTileRect); |
|
1346 } |
|
1347 } |
|
1348 void CCCAppCommLauncherCustomListBoxData::SetSkinParentPos( |
|
1349 const TPoint &aPos) |
|
1350 { |
|
1351 if (iExtension->iSkinControlContext) |
|
1352 { |
|
1353 iExtension->iSkinControlContext->SetParentPos(aPos); |
|
1354 } |
|
1355 } |
|
1356 void CCCAppCommLauncherCustomListBoxData::SetBackgroundSkinStyle( |
|
1357 const TAknsItemID *aId, const TRect &aRect) |
|
1358 { |
|
1359 if (iExtension->iSkinControlContext) |
|
1360 { |
|
1361 iExtension->iSkinControlContext->SetBitmap(*aId); |
|
1362 iExtension->iSkinControlContext->SetRect(aRect); |
|
1363 } |
|
1364 } |
|
1365 void CCCAppCommLauncherCustomListBoxData::SetListEndSkinStyle( |
|
1366 const TAknsItemID *aListEndId, const TRect &aRect) |
|
1367 { |
|
1368 if (iExtension->iSkinControlContext) |
|
1369 { |
|
1370 iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId); |
|
1371 iExtension->iSkinControlContext->SetBottomRect(aRect); |
|
1372 } |
|
1373 } |
|
1374 |
|
1375 void CCCAppCommLauncherCustomListBoxData::SetSkinHighlightFrame( |
|
1376 const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
|
1377 { |
|
1378 iExtension->iSkinHighlightFrameId = aFrameId; |
|
1379 iExtension->iSkinHighlightFrameCenterId = aFrameCenterId; |
|
1380 } |
|
1381 |
|
1382 void CCCAppCommLauncherCustomListBoxData::SetSkinPopupFrame( |
|
1383 const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
|
1384 { |
|
1385 if ( iExtension ) |
|
1386 { |
|
1387 if ( iExtension->iPopupFrame ) |
|
1388 { |
|
1389 iExtension->iPopupFrame->SetFrame(*aFrameId); |
|
1390 iExtension->iPopupFrame->SetCenter(*aFrameCenterId); |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 TRAPD(err, iExtension->iPopupFrame = CAknsFrameBackgroundControlContext::NewL( |
|
1395 KAknsIIDNone, |
|
1396 TRect(0,0,1,1), // these must be set by using SetSkinPopupFramePosition |
|
1397 TRect(0,0,1,1), |
|
1398 EFalse ) ); |
|
1399 if (!err) |
|
1400 { |
|
1401 iExtension->iPopupFrame->SetFrame(*aFrameId); |
|
1402 iExtension->iPopupFrame->SetCenter(*aFrameCenterId); |
|
1403 } |
|
1404 } |
|
1405 } |
|
1406 } |
|
1407 |
|
1408 void CCCAppCommLauncherCustomListBoxData::SetSkinPopupFramePosition( |
|
1409 const TRect &aOuterRect, const TRect &aInnerRect) |
|
1410 { |
|
1411 if (iExtension && iExtension->iPopupFrame) |
|
1412 iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect); |
|
1413 } |
|
1414 |
|
1415 void CCCAppCommLauncherCustomListBoxData::UseLogicalToVisualConversion( |
|
1416 TBool aUseConversion) |
|
1417 { |
|
1418 if (iExtension) |
|
1419 iExtension->iUseLogicalToVisualConversion = aUseConversion; |
|
1420 } |
|
1421 |
|
1422 void CCCAppCommLauncherCustomListBoxData::CreatePictographInterfaceL() |
|
1423 { |
|
1424 iExtension->CreatePictographInterfaceL(); |
|
1425 } |
|
1426 |
|
1427 void CCCAppCommLauncherCustomListBoxData::CreateMarqueeControlL() |
|
1428 { |
|
1429 TCallBack callBack( |
|
1430 CCCAppCommLauncherCustomListBoxDataExtension::RedrawEvent, |
|
1431 iExtension->iControl); |
|
1432 //iExtension->iMarquee = CAknMarqueeControl::NewL(); |
|
1433 iExtension->CreateMarqueeControlL(); |
|
1434 iExtension->iMarquee->SetRedrawCallBack(callBack); |
|
1435 iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack); |
|
1436 } |
|
1437 |
|
1438 const TInt KSubCellListBoxGranularity = 4; |
|
1439 const TInt KNoActualSubCellFont = -1; |
|
1440 |
|
1441 |
|
1442 CCCAppCommLauncherCustomListBoxData* CCCAppCommLauncherCustomListBoxData::NewL() |
|
1443 { |
|
1444 CCCAppCommLauncherCustomListBoxData* self = |
|
1445 new (ELeave) CCCAppCommLauncherCustomListBoxData; |
|
1446 self->ConstructLD(KAknsIIDQsnAnimList); |
|
1447 return (self); |
|
1448 } |
|
1449 |
|
1450 CCCAppCommLauncherCustomListBoxData::~CCCAppCommLauncherCustomListBoxData() |
|
1451 { |
|
1452 delete iExtension; |
|
1453 delete iSubCellArray; |
|
1454 if (iIconArray) |
|
1455 { |
|
1456 iIconArray->ResetAndDestroy(); |
|
1457 delete iIconArray; |
|
1458 } |
|
1459 } |
|
1460 |
|
1461 TSize CCCAppCommLauncherCustomListBoxData::SubCellSize( |
|
1462 TInt aSubCellIndex) const |
|
1463 { |
|
1464 TInt index = 0; |
|
1465 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1466 return TSize(0, 0); |
|
1467 return (iSubCellArray->At(index).iSize); |
|
1468 } |
|
1469 |
|
1470 void CCCAppCommLauncherCustomListBoxData::SetSubCellSizeL( |
|
1471 TInt aSubCellIndex, TSize aSize) |
|
1472 { |
|
1473 TInt index = 0; |
|
1474 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1475 At(index).iSize = aSize; |
|
1476 // if someone uses this api directly, revert to old draw |
|
1477 // new api will turn this to ETrue again. |
|
1478 UseScalableLayoutData(EFalse); |
|
1479 } |
|
1480 |
|
1481 TInt CCCAppCommLauncherCustomListBoxData::SubCellBaselinePos( |
|
1482 TInt aSubCellIndex) const |
|
1483 { |
|
1484 TInt index = 0; |
|
1485 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1486 return TInt(0); |
|
1487 return (iSubCellArray->At(index).iBaseline); |
|
1488 } |
|
1489 |
|
1490 void CCCAppCommLauncherCustomListBoxData::SetSubCellBaselinePosL( |
|
1491 TInt aSubCellIndex, TInt aPos) |
|
1492 { |
|
1493 TInt index = 0; |
|
1494 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1495 At(index).iBaseline = aPos; |
|
1496 } |
|
1497 |
|
1498 TInt CCCAppCommLauncherCustomListBoxData::SubCellTextClipGap( |
|
1499 TInt aSubCellIndex) const |
|
1500 { |
|
1501 TInt index; |
|
1502 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1503 return TInt(0); |
|
1504 return (iSubCellArray->At(index).iTextClipGap); |
|
1505 } |
|
1506 |
|
1507 void CCCAppCommLauncherCustomListBoxData::SetSubCellTextClipGapL( |
|
1508 TInt aSubCellIndex, TInt aGap) |
|
1509 { |
|
1510 TInt index; |
|
1511 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1512 At(index).iTextClipGap = aGap; |
|
1513 } |
|
1514 |
|
1515 TSize CCCAppCommLauncherCustomListBoxData::SubCellRealSize(TInt aSubCellIndex) const |
|
1516 { |
|
1517 TInt index = 0; |
|
1518 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1519 return TSize(0, 0); |
|
1520 return (iSubCellArray->At(index).iRealSize); |
|
1521 } |
|
1522 |
|
1523 void CCCAppCommLauncherCustomListBoxData::SetSubCellRealSize( |
|
1524 TInt aSubCellIndex, TSize aRealSize) const |
|
1525 { |
|
1526 TInt index = 0; |
|
1527 if (!(FindSubCellIndex(index, aSubCellIndex) == KErrNotFound)) |
|
1528 { |
|
1529 MUTABLE_CAST(TSize&,At(index).iRealSize) = aRealSize; |
|
1530 } |
|
1531 } |
|
1532 |
|
1533 TSize CCCAppCommLauncherCustomListBoxData::SubCellRealTextSize( |
|
1534 TInt aSubCellIndex) const |
|
1535 { |
|
1536 TInt index = 0; |
|
1537 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1538 return TSize(0, 0); |
|
1539 return (iSubCellArray->At(index).iRealTextSize); |
|
1540 } |
|
1541 |
|
1542 void CCCAppCommLauncherCustomListBoxData::SetSubCellRealTextSize( |
|
1543 TInt aSubCellIndex, TSize aRealTextSize) const |
|
1544 { |
|
1545 TInt index = 0; |
|
1546 if (!(FindSubCellIndex(index, aSubCellIndex) == KErrNotFound)) |
|
1547 { |
|
1548 MUTABLE_CAST(TSize&,At(index).iRealTextSize) = aRealTextSize; |
|
1549 } |
|
1550 } |
|
1551 |
|
1552 TPoint CCCAppCommLauncherCustomListBoxData::SubCellPosition( |
|
1553 TInt aSubCellIndex) const |
|
1554 { |
|
1555 TInt index = 0; |
|
1556 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1557 return TPoint(0, 0); |
|
1558 return (iSubCellArray->At(index).iPosition); |
|
1559 } |
|
1560 |
|
1561 void CCCAppCommLauncherCustomListBoxData::SetSubCellPositionL( |
|
1562 TInt aSubCellIndex, TPoint aPosition) |
|
1563 { |
|
1564 TInt index = 0; |
|
1565 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1566 At(index).iPosition = aPosition; |
|
1567 // if someone uses this api directly, revert to old draw |
|
1568 // new api will turn this to ETrue again. |
|
1569 UseScalableLayoutData(EFalse); |
|
1570 } |
|
1571 |
|
1572 TMargins CCCAppCommLauncherCustomListBoxData::SubCellMargins( |
|
1573 TInt aSubCellIndex) const |
|
1574 { |
|
1575 TInt index = 0; |
|
1576 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1577 { |
|
1578 TMargins tm = |
|
1579 { |
|
1580 0, 0, 0, 0 |
|
1581 }; |
|
1582 return tm; |
|
1583 } |
|
1584 return (iSubCellArray->At(index).iMargin); |
|
1585 } |
|
1586 |
|
1587 void CCCAppCommLauncherCustomListBoxData::SetSubCellMarginsL( |
|
1588 TInt aSubCellIndex, TMargins aMargins) |
|
1589 { |
|
1590 TInt index = 0; |
|
1591 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1592 At(index).iMargin = aMargins; |
|
1593 } |
|
1594 |
|
1595 const CFont* |
|
1596 CCCAppCommLauncherCustomListBoxData::SubCellFont(TInt aSubCellIndex) const |
|
1597 { |
|
1598 TInt index = 0; |
|
1599 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1600 return 0; |
|
1601 return (iSubCellArray->At(index).iBaseFont); |
|
1602 } |
|
1603 |
|
1604 void CCCAppCommLauncherCustomListBoxData::SetSubCellFontL( |
|
1605 TInt aSubCellIndex, const CFont* aFont) |
|
1606 { |
|
1607 #if 0 |
|
1608 TInt subcells=iSubCellArray->Count(); |
|
1609 #endif |
|
1610 TInt index = 0; |
|
1611 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1612 if (At(index).iBaseFont != aFont) |
|
1613 { |
|
1614 #if 0 |
|
1615 TInt actualFontIndex=0; |
|
1616 TRAPD(err, actualFontIndex=AddActualFontL(aFont)); |
|
1617 if (err) |
|
1618 { |
|
1619 if (subcells!=iSubCellArray->Count()) |
|
1620 { |
|
1621 iSubCellArray->Delete(index); |
|
1622 } |
|
1623 User::Leave(err); |
|
1624 } |
|
1625 At(index).iActualFontIndex=actualFontIndex; |
|
1626 #endif |
|
1627 At(index).iBaseFont = aFont; |
|
1628 } |
|
1629 } |
|
1630 |
|
1631 CGraphicsContext::TTextAlign CCCAppCommLauncherCustomListBoxData::SubCellAlignment( |
|
1632 TInt aSubCellIndex) const |
|
1633 { |
|
1634 TInt index = 0; |
|
1635 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1636 return CGraphicsContext::ELeft; |
|
1637 return (iSubCellArray->At(index).iAlign); |
|
1638 } |
|
1639 |
|
1640 void CCCAppCommLauncherCustomListBoxData::SetSubCellAlignmentL( |
|
1641 TInt aSubCellIndex, CGraphicsContext::TTextAlign aAlign) |
|
1642 { |
|
1643 TInt index = 0; |
|
1644 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1645 At(index).iAlign = aAlign; |
|
1646 |
|
1647 iExtension->SetSubCellLayoutAlignmentL(aSubCellIndex); |
|
1648 } |
|
1649 |
|
1650 const CCCAppCommLauncherCustomListBoxData::TColors & |
|
1651 CCCAppCommLauncherCustomListBoxData::SubCellColors(TInt aSubCellIndex) const |
|
1652 { |
|
1653 TInt index = 0; |
|
1654 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1655 return defaultcolors; |
|
1656 return (iSubCellArray->At(index).iColors); |
|
1657 } |
|
1658 |
|
1659 void CCCAppCommLauncherCustomListBoxData::SetSubCellColorsL( |
|
1660 TInt aSubCellIndex, const TColors & aColors) |
|
1661 { |
|
1662 TInt index = 0; |
|
1663 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1664 At(index).iColors = aColors; |
|
1665 At(index).iUseSubCellColors = ETrue; |
|
1666 } |
|
1667 |
|
1668 TBool CCCAppCommLauncherCustomListBoxData::UseSubCellColors( |
|
1669 TInt aSubCell) const |
|
1670 { |
|
1671 TInt index = 0; |
|
1672 if (FindSubCellIndex(index, aSubCell) == KErrNotFound) |
|
1673 return EFalse; |
|
1674 return At(index).iUseSubCellColors; |
|
1675 } |
|
1676 |
|
1677 CGraphicsContext::TPenStyle CCCAppCommLauncherCustomListBoxData::SubCellRightSeparatorStyle( |
|
1678 TInt aSubCellIndex) const |
|
1679 { |
|
1680 TInt index = 0; |
|
1681 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1682 return CGraphicsContext::ENullPen; |
|
1683 return (iSubCellArray->At(index).iRightSeparatorStyle); |
|
1684 } |
|
1685 |
|
1686 void CCCAppCommLauncherCustomListBoxData::SetSubCellRightSeparatorStyleL( |
|
1687 TInt aSubCellIndex, CGraphicsContext::TPenStyle aStyle) |
|
1688 { |
|
1689 TInt index = 0; |
|
1690 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1691 At(index).iRightSeparatorStyle = aStyle; |
|
1692 } |
|
1693 |
|
1694 TBool CCCAppCommLauncherCustomListBoxData::SubCellIsGraphics( |
|
1695 TInt aSubCellIndex) const |
|
1696 { |
|
1697 TInt index = 0; |
|
1698 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1699 return EFalse; |
|
1700 return (iSubCellArray->At(index).iGraphics); |
|
1701 } |
|
1702 |
|
1703 void CCCAppCommLauncherCustomListBoxData::SetGraphicsSubCellL( |
|
1704 TInt aSubCellIndex, TBool aIsGraphics) |
|
1705 { |
|
1706 TInt index = 0; |
|
1707 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1708 At(index).iGraphics = aIsGraphics; |
|
1709 // if someone uses this api directly, revert to old draw |
|
1710 // new api will turn this to ETrue again. |
|
1711 UseScalableLayoutData(EFalse); |
|
1712 } |
|
1713 |
|
1714 TBool CCCAppCommLauncherCustomListBoxData::SubCellIsNumberCell( |
|
1715 TInt aSubCellIndex) const |
|
1716 { |
|
1717 TInt index = 0; |
|
1718 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1719 return EFalse; |
|
1720 return (iSubCellArray->At(index).iNumberCell); |
|
1721 } |
|
1722 |
|
1723 void CCCAppCommLauncherCustomListBoxData::SetNumberCellL( |
|
1724 TInt aSubCellIndex, TBool aIsNumberCell) |
|
1725 { |
|
1726 TInt index = 0; |
|
1727 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1728 At(index).iNumberCell = aIsNumberCell; |
|
1729 } |
|
1730 |
|
1731 TBool CCCAppCommLauncherCustomListBoxData::SubCellIsTransparent( |
|
1732 TInt aSubCellIndex) const |
|
1733 { |
|
1734 TInt index = 0; |
|
1735 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1736 return EFalse; |
|
1737 return (iSubCellArray->At(index).iTransparent); |
|
1738 } |
|
1739 |
|
1740 void CCCAppCommLauncherCustomListBoxData::SetTransparentSubCellL( |
|
1741 TInt aSubCellIndex, TBool aIsTransparent) |
|
1742 { |
|
1743 TInt index = 0; |
|
1744 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1745 At(index).iTransparent = aIsTransparent; |
|
1746 } |
|
1747 |
|
1748 TBool CCCAppCommLauncherCustomListBoxData::SubCellIsNotAlwaysDrawn( |
|
1749 TInt aSubCellIndex) const |
|
1750 { |
|
1751 TInt index = 0; |
|
1752 if (FindSubCellIndex(index, aSubCellIndex) == KErrNotFound) |
|
1753 return EFalse; |
|
1754 return (iSubCellArray->At(index).iNotAlwaysDrawn); |
|
1755 } |
|
1756 |
|
1757 void CCCAppCommLauncherCustomListBoxData::SetNotAlwaysDrawnSubCellL( |
|
1758 TInt aSubCellIndex, TBool aIsNotAlwaysDrawn) |
|
1759 { |
|
1760 TInt index = 0; |
|
1761 FindSubCellIndexOrAddL(index, aSubCellIndex); |
|
1762 At(index).iNotAlwaysDrawn = aIsNotAlwaysDrawn; |
|
1763 } |
|
1764 |
|
1765 CArrayPtr<CGulIcon>* |
|
1766 CCCAppCommLauncherCustomListBoxData::IconArray() const |
|
1767 { |
|
1768 return iIconArray; |
|
1769 } |
|
1770 |
|
1771 void CCCAppCommLauncherCustomListBoxData::SetIconArrayL(CArrayPtr< |
|
1772 CGulIcon>* aArray) |
|
1773 { |
|
1774 iIconArray = aArray; |
|
1775 } |
|
1776 |
|
1777 void CCCAppCommLauncherCustomListBoxData::SetIconArray(CArrayPtr< |
|
1778 CGulIcon>* aArray) |
|
1779 { |
|
1780 iIconArray = aArray; |
|
1781 } |
|
1782 |
|
1783 TBool CCCAppCommLauncherCustomListBoxData::RespectFocus() const |
|
1784 { |
|
1785 if (iExtension) |
|
1786 return iExtension->iRespectFocus; |
|
1787 return EFalse; |
|
1788 } |
|
1789 |
|
1790 void CCCAppCommLauncherCustomListBoxData::SetRespectFocus(TBool aBool) |
|
1791 { |
|
1792 if (iExtension) |
|
1793 iExtension->iRespectFocus = aBool; |
|
1794 } |
|
1795 |
|
1796 CFont* |
|
1797 CCCAppCommLauncherCustomListBoxData::Font( |
|
1798 const TListItemProperties& /*aItemProperties*/, TInt aSubCellIndex) const |
|
1799 { |
|
1800 return const_cast<CFont*> (SubCellFont(aSubCellIndex)); |
|
1801 #if 0 |
|
1802 TInt index = 0; |
|
1803 if (FindSubCellIndex(index,aSubCellIndex)!=0/*KErrNotFound*/) |
|
1804 return(NULL); |
|
1805 TInt actualFontIndex=iSubCellArray->At(index).iActualFontIndex; |
|
1806 if (actualFontIndex==KNoActualSubCellFont) |
|
1807 return(NULL); |
|
1808 if ((aItemProperties.IsBold()) && (aItemProperties.IsItalics())) |
|
1809 { |
|
1810 return iBoldItalicFont.iFonts->At(actualFontIndex); |
|
1811 } |
|
1812 else if (aItemProperties.IsBold()) |
|
1813 { |
|
1814 return iBoldFont.iFonts->At(actualFontIndex); |
|
1815 } |
|
1816 else if (aItemProperties.IsItalics()) |
|
1817 { |
|
1818 return iItalicFont.iFonts->At(actualFontIndex); |
|
1819 } |
|
1820 else return iNormalFont.iFonts->At(actualFontIndex); |
|
1821 #endif |
|
1822 } |
|
1823 |
|
1824 void CCCAppCommLauncherCustomListBoxData::Draw( |
|
1825 TListItemProperties aProperties, CWindowGc& aGc, const TDesC* aText, |
|
1826 const TRect& aRect, TBool aHighlight, const TColors& aColors) const |
|
1827 { |
|
1828 DrawDefaultHighlight(aGc, aRect, aHighlight); |
|
1829 |
|
1830 // Draw the actual items. |
|
1831 DrawFormatted(aProperties, aGc, aText, aRect, aHighlight, aColors); |
|
1832 } |
|
1833 |
|
1834 void CCCAppCommLauncherCustomListBoxData::DrawFormatted( |
|
1835 TListItemProperties aProperties, CWindowGc& aGc, const TDesC* aText, |
|
1836 const TRect& aItemRect, TBool aHighlight, const TColors& aColors) const |
|
1837 { |
|
1838 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
|
1839 if (!view->ViewRect().Intersects(aItemRect)) |
|
1840 { |
|
1841 // outside of the clipping rect -> don't process this item |
|
1842 return; |
|
1843 } |
|
1844 if (aHighlight) |
|
1845 { |
|
1846 iExtension->iClippedSubcells = 0; |
|
1847 } |
|
1848 |
|
1849 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
1850 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
|
1851 if ( transApi ) |
|
1852 { |
|
1853 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
|
1854 if(transApi->EffectsDisabled()) |
|
1855 { |
|
1856 aGc.SetClippingRect( view->ViewRect() ); |
|
1857 } |
|
1858 } |
|
1859 #else |
|
1860 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
|
1861 aGc.SetClippingRect( view->ViewRect() ); |
|
1862 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
1863 if (UsesScalableLayoutData()) |
|
1864 { |
|
1865 /* this is a AvKon list or list is created using methods in aknlists.cpp |
|
1866 * which is _the_ way to set up a list |
|
1867 */ |
|
1868 DrawFormattedSimple(aProperties, aGc, aText, aItemRect, aHighlight, |
|
1869 aColors); |
|
1870 } |
|
1871 else |
|
1872 { |
|
1873 /* someone used directly the (unfortunately) exported methods |
|
1874 * from this file. These should be fixed in such way, that |
|
1875 * DrawFormattedOld could be removed. |
|
1876 */ |
|
1877 DrawFormattedOld(aProperties, aGc, aText, aItemRect, aHighlight, |
|
1878 aColors); |
|
1879 } |
|
1880 |
|
1881 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
1882 if (transApi) |
|
1883 { |
|
1884 if(transApi->EffectsDisabled()) |
|
1885 { |
|
1886 aGc.CancelClippingRect(); |
|
1887 } |
|
1888 |
|
1889 transApi->StopDrawing(); |
|
1890 } |
|
1891 #else |
|
1892 aGc.CancelClippingRect(); |
|
1893 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
1894 } |
|
1895 |
|
1896 void CCCAppCommLauncherCustomListBoxData::BitBltColored(CWindowGc& aGc, |
|
1897 TBool aHighlight, const CGulIcon* aIcon, TInt aSubcell, |
|
1898 TBool aColorIcon, const TRect& aGraphicRect) const |
|
1899 { |
|
1900 // se also eikclbd.cpp ( sigh ). |
|
1901 CFbsBitmap* bitmap(aIcon->Bitmap()); |
|
1902 CFbsBitmap* mask(aIcon->Mask()); |
|
1903 |
|
1904 // possibly colorskinnable icon. Check must be after SetSize() |
|
1905 TBool bw(bitmap->DisplayMode() == EGray2); |
|
1906 |
|
1907 // center graphics |
|
1908 TSize size = bitmap->SizeInPixels(); |
|
1909 TInt yDiff = (aGraphicRect.Height() - size.iHeight) / 2; |
|
1910 TInt xDiff = (aGraphicRect.Width() - size.iWidth) / 2; |
|
1911 TPoint posInBitmap(0, 0); |
|
1912 |
|
1913 if (xDiff < 0) // icon's width bigger than subcell's width |
|
1914 { // possible, if icon is not a aknicon |
|
1915 posInBitmap.iX = -xDiff; |
|
1916 xDiff = 0; |
|
1917 } |
|
1918 |
|
1919 if (yDiff < 0) // icon's height bigger than subcell's height |
|
1920 { |
|
1921 posInBitmap.iY = -yDiff; |
|
1922 yDiff = 0; |
|
1923 } |
|
1924 |
|
1925 TPoint bmpPos(aGraphicRect.iTl + TPoint(xDiff, yDiff)); |
|
1926 TRect sourcerect(posInBitmap, aGraphicRect.Size()); |
|
1927 |
|
1928 if (mask) |
|
1929 { |
|
1930 TInt i(0x01); |
|
1931 i = i << aSubcell; |
|
1932 if (((i & iExtension->iConditionalCells) && bw) || aColorIcon) |
|
1933 { |
|
1934 aGc.BitBltMasked(bmpPos, aHighlight ? iExtension->iHiliBmp |
|
1935 : iExtension->iColorBmp, TRect(posInBitmap, size), mask, |
|
1936 ETrue); |
|
1937 } |
|
1938 else |
|
1939 { |
|
1940 aGc.BitBltMasked(bmpPos, bitmap, sourcerect, mask, ETrue); |
|
1941 } |
|
1942 } |
|
1943 else |
|
1944 { |
|
1945 aGc.BitBlt(bmpPos, bitmap, sourcerect); |
|
1946 } |
|
1947 } |
|
1948 |
|
1949 void CCCAppCommLauncherCustomListBoxData::DrawFormattedSimple( |
|
1950 TListItemProperties& aProperties, CWindowGc& aGc, const TDesC* aText, |
|
1951 const TRect& aItemRect, TBool aHighlight, const TColors& aColors) const |
|
1952 { |
|
1953 TRect textRect(aItemRect); |
|
1954 const TColors *subcellColors = &aColors; |
|
1955 |
|
1956 TInt lastSubCell = Min(LastSubCell(), KMaxSubCellIndex); |
|
1957 |
|
1958 TInt subcell = 0; |
|
1959 TPtrC text; |
|
1960 TPtrC tempText; |
|
1961 TRect textShadowRect; // For transparent list |
|
1962 TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text. |
|
1963 MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() ); |
|
1964 if (!cc) |
|
1965 { |
|
1966 cc = SkinBackgroundContext(); |
|
1967 } |
|
1968 |
|
1969 TAknTextLineLayout textLines[KMaxSubCellIndex]; |
|
1970 TBool rectClipped[KMaxSubCellIndex]; |
|
1971 |
|
1972 Mem::FillZ( &rectClipped[0], KMaxSubCellIndex * sizeof( TBool ) ); |
|
1973 |
|
1974 if ( iExtension->iSubCellsMightIntersect ) |
|
1975 { |
|
1976 CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aItemRect ); |
|
1977 } |
|
1978 |
|
1979 TInt SCindex = 0; |
|
1980 |
|
1981 // This loop does the drawing. |
|
1982 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
1983 subcell=0; |
|
1984 FOREVER |
|
1985 { |
|
1986 if (subcell>lastSubCell) |
|
1987 { |
|
1988 break; |
|
1989 } |
|
1990 |
|
1991 TextUtils::ColumnText(text,subcell, aText); |
|
1992 if (text == KNullDesC) |
|
1993 { |
|
1994 // empty subcell, continue to draw next subcell |
|
1995 ++ subcell; |
|
1996 continue; |
|
1997 } |
|
1998 if (!iExtension) break; |
|
1999 if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break; |
|
2000 |
|
2001 if (UseSubCellColors(subcell)) |
|
2002 { |
|
2003 subcellColors = &SubCellColors(subcell); |
|
2004 } |
|
2005 else |
|
2006 { |
|
2007 subcellColors = &aColors; |
|
2008 } |
|
2009 |
|
2010 TRgb color; |
|
2011 |
|
2012 if (aHighlight) |
|
2013 { |
|
2014 color = subcellColors->iHighlightedText; |
|
2015 aGc.SetBrushColor(subcellColors->iHighlightedBack); |
|
2016 if ( AknsUtils::AvkonSkinEnabled() ) |
|
2017 { |
|
2018 if ( iExtension->iHighlightedTextColor != NULL ) |
|
2019 { |
|
2020 color = iExtension->iHighlightedTextColor; |
|
2021 } |
|
2022 } |
|
2023 } |
|
2024 else |
|
2025 { |
|
2026 color = subcellColors->iText; |
|
2027 aGc.SetBrushColor(subcellColors->iBack); |
|
2028 if ( AknsUtils::AvkonSkinEnabled() ) |
|
2029 { |
|
2030 if ( iExtension->iTextColor != NULL ) |
|
2031 { |
|
2032 color = iExtension->iTextColor; |
|
2033 } |
|
2034 } |
|
2035 } |
|
2036 |
|
2037 // graphics or text column |
|
2038 if (iExtension->AtSL(SCindex).iSubCellType == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText) |
|
2039 { |
|
2040 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); |
|
2041 const CFont* cellFont=Font(aProperties, subcell); |
|
2042 const CFont* tempFont=(cellFont) ? cellFont : NULL; |
|
2043 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont; |
|
2044 |
|
2045 TAknTextLineLayout textLineLayout = NULL; |
|
2046 |
|
2047 if ( rectClipped[subcell] ) |
|
2048 { |
|
2049 textLineLayout = textLines[subcell]; |
|
2050 } |
|
2051 else |
|
2052 { |
|
2053 // check if there are icons affecting this text layout |
|
2054 TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell |
|
2055 |
|
2056 if (gSC > -1) |
|
2057 { |
|
2058 TInt tempIndex; |
|
2059 while (gSC > -1) // when gSC == -1, we have found our graphical subcell |
|
2060 { |
|
2061 if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break; |
|
2062 TextUtils::ColumnText(tempText,gSC, aText); |
|
2063 if (tempText != KNullDesC) |
|
2064 { |
|
2065 textLineLayout = iExtension->AtSL(tempIndex).iTextLayout; |
|
2066 break; |
|
2067 } |
|
2068 gSC = iExtension->AtSL(tempIndex).iConditionValue; |
|
2069 } |
|
2070 } |
|
2071 |
|
2072 if (gSC == -1) // no affecting icons -> use default layout |
|
2073 { |
|
2074 textLineLayout = iExtension->AtSL(SCindex).iTextLayout; |
|
2075 } |
|
2076 } |
|
2077 |
|
2078 |
|
2079 CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq |
|
2080 TBool isLayoutAlignment = iExtension->SubCellLayoutAlignment(subcell); //gumq |
|
2081 if( !isLayoutAlignment ) |
|
2082 { |
|
2083 switch(align) |
|
2084 { |
|
2085 case CGraphicsContext::ELeft : |
|
2086 { |
|
2087 textLineLayout.iJ = ELayoutAlignLeft; |
|
2088 } |
|
2089 break; |
|
2090 case CGraphicsContext::ECenter: |
|
2091 { |
|
2092 textLineLayout.iJ = ELayoutAlignCenter; |
|
2093 } |
|
2094 break; |
|
2095 case CGraphicsContext::ERight: |
|
2096 { |
|
2097 textLineLayout.iJ = ELayoutAlignRight; |
|
2098 } |
|
2099 break; |
|
2100 default: break; |
|
2101 }; |
|
2102 } |
|
2103 |
|
2104 TAknLayoutText textLayout; |
|
2105 textLayout.LayoutText(textRect, textLineLayout, usedFont); |
|
2106 |
|
2107 SetUnderlineStyle( aProperties, aGc, subcell ); |
|
2108 |
|
2109 // * 2 == leave some room for marquee |
|
2110 const TInt maxlen( KMaxColumnDataLength * 3 ); |
|
2111 TBuf<maxlen> convBuf = text.Left(maxlen); |
|
2112 TBool smileyDraw = EFalse; |
|
2113 // do smiley convert before clipping. don't worry marquee now. |
|
2114 if ( iExtension->iSmileyMan && |
|
2115 iExtension->AtSL(SCindex).iSmileyCell && |
|
2116 iExtension->ConvertTextToSmiley( convBuf ) > 0 ) |
|
2117 { |
|
2118 smileyDraw = ETrue; |
|
2119 } |
|
2120 |
|
2121 // Note that this potentially modifies the text so its lenght in pixels |
|
2122 // might increase. Therefore, this should always be done before |
|
2123 // wrapping/clipping text. In some cases, WordWrapListItem is called |
|
2124 // before coming here. Is it certain that it is not done for number subcells? |
|
2125 |
|
2126 // Do number conversion if required. |
|
2127 if (SubCellIsNumberCell(subcell)) |
|
2128 { |
|
2129 AknTextUtils::LanguageSpecificNumberConversion(convBuf); |
|
2130 } |
|
2131 |
|
2132 // Check whether logical to visual conversion should be done here or not. |
|
2133 TBool bidiConv = |
|
2134 iExtension->iUseLogicalToVisualConversion && |
|
2135 subcell != iExtension->iFirstWordWrappedSubcellIndex && |
|
2136 subcell != iExtension->iSecondWordWrappedSubcellIndex; |
|
2137 |
|
2138 TBool doesNotFit( EFalse ); |
|
2139 if ( aHighlight ) |
|
2140 { |
|
2141 doesNotFit = usedFont->TextWidthInPixels( convBuf ) > textLayout.TextRect().Width(); |
|
2142 |
|
2143 if ( doesNotFit ) |
|
2144 { |
|
2145 iExtension->iClippedSubcells |= ( 1 << subcell ); |
|
2146 } |
|
2147 else |
|
2148 { |
|
2149 iExtension->iClippedSubcells &= ~( 1 << subcell ); |
|
2150 } |
|
2151 |
|
2152 if ( iExtension->iUseClippedByWrap ) // override if already clipped |
|
2153 |
|
2154 { |
|
2155 iExtension->iClippedSubcells = iExtension->iClippedByWrap; |
|
2156 } |
|
2157 } |
|
2158 |
|
2159 // marquee |
|
2160 CAknMarqueeControl* marquee = |
|
2161 subcell == 1 || subcell == 3 ? iExtension->iMarquee : |
|
2162 iExtension->i2ndLineMarquee; |
|
2163 TBool marqueeDisabled = |
|
2164 static_cast<CEikListBox*>( |
|
2165 Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; |
|
2166 |
|
2167 if ( aHighlight && iExtension->IsMarqueeOn() && doesNotFit && !marqueeDisabled ) |
|
2168 { |
|
2169 iExtension->iMarquee->UseLogicalToVisualConversion( bidiConv ); |
|
2170 |
|
2171 if ( marquee->DrawText( aGc, textRect, textLineLayout, convBuf, usedFont, color ) ) |
|
2172 { |
|
2173 // all the loops have been executed |
|
2174 textLayout.DrawText( aGc, convBuf, bidiConv, color ); |
|
2175 } |
|
2176 } |
|
2177 else |
|
2178 { |
|
2179 if ( marquee && marqueeDisabled ) |
|
2180 { |
|
2181 marquee->Stop(); |
|
2182 } |
|
2183 |
|
2184 if ( smileyDraw ) |
|
2185 { |
|
2186 TRect tr(textLayout.TextRect()); |
|
2187 iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color ); |
|
2188 } |
|
2189 else |
|
2190 { |
|
2191 textLayout.DrawText( aGc, convBuf, bidiConv, color ); |
|
2192 } |
|
2193 } |
|
2194 if ( iExtension->iPictoInterface ) |
|
2195 { |
|
2196 |
|
2197 TRect pictoRect = textLayout.TextRect(); |
|
2198 pictoRect.Normalize(); |
|
2199 if ( convBuf.Length() && bidiConv ) |
|
2200 { |
|
2201 TInt maxWidth = pictoRect.Size().iWidth; |
|
2202 TInt charsCanBeDisplayed = textLayout.Font()->TextCount( |
|
2203 convBuf, maxWidth ); |
|
2204 if ( charsCanBeDisplayed < convBuf.Length() ) |
|
2205 { |
|
2206 TInt clipCharWidth = textLayout.Font()->CharWidthInPixels( |
|
2207 KEllipsis /*aClipChar*/); |
|
2208 // Check how many characters fit in given space with truncation char. |
|
2209 charsCanBeDisplayed = textLayout.Font()->TextCount( |
|
2210 convBuf, maxWidth - clipCharWidth ); |
|
2211 |
|
2212 // This is "avkon rule": should not insert ellipsis right after a space. |
|
2213 if ( charsCanBeDisplayed> 1 && |
|
2214 convBuf[charsCanBeDisplayed - 1] == ' ' && |
|
2215 convBuf[charsCanBeDisplayed - 2] != ' ' ) |
|
2216 { |
|
2217 charsCanBeDisplayed--; |
|
2218 } |
|
2219 |
|
2220 TInt pictoRectWidth = textLayout.Font()->TextWidthInPixels( |
|
2221 convBuf.Left( charsCanBeDisplayed ) ); |
|
2222 pictoRect.SetWidth( pictoRectWidth ); |
|
2223 } |
|
2224 } |
|
2225 |
|
2226 /*iExtension->iPictoInterface->Interface()->DrawPictographsInText( |
|
2227 aGc, *usedFont, convBuf, |
|
2228 pictoRect, |
|
2229 textLayout.BaselineOffset(), |
|
2230 textLayout.Align(), |
|
2231 0 );*/ //qiang |
|
2232 } |
|
2233 |
|
2234 aGc.SetUnderlineStyle( EUnderlineOff ); |
|
2235 } |
|
2236 else // Graphics subcell |
|
2237 |
|
2238 { |
|
2239 TLex lex(text); |
|
2240 TInt index; |
|
2241 TInt indexValue; |
|
2242 |
|
2243 indexValue=lex.Val(index); |
|
2244 |
|
2245 if (indexValue!=KErrNone) |
|
2246 { |
|
2247 // wrong icon index |
|
2248 ++ subcell; |
|
2249 continue; |
|
2250 } |
|
2251 |
|
2252 //__ASSERT_DEBUG(indexValue==KErrNone, Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); |
|
2253 |
|
2254 TBool colorIcon( EFalse ); |
|
2255 if ( index == KColorIconFlag ) |
|
2256 { |
|
2257 if ( iExtension->iColorBmp && iExtension->iHiliBmp ) |
|
2258 { |
|
2259 colorIcon = ETrue; |
|
2260 } |
|
2261 index = KColorIconIdx; |
|
2262 } |
|
2263 |
|
2264 if( !iIconArray ) |
|
2265 { |
|
2266 ++ subcell; |
|
2267 continue; |
|
2268 } |
|
2269 |
|
2270 if (aHighlight && (index> 0xffff)) |
|
2271 { |
|
2272 index = index >> 16; // we have different icon for highlight |
|
2273 } |
|
2274 |
|
2275 index = index & 0xffff; // mask off possible highlight icon |
|
2276 //__ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); |
|
2277 |
|
2278 TAknWindowLineLayout graphicLayout = iExtension->AtSL(SCindex).iGraphicLayout; |
|
2279 TAknLayoutRect graphicRect; |
|
2280 |
|
2281 graphicRect.LayoutRect(textRect,graphicLayout); |
|
2282 TSize graphicSize( graphicRect.Rect().Size() ); |
|
2283 |
|
2284 if (index>=0 && iIconArray) |
|
2285 { |
|
2286 CGulIcon* icon=(*iIconArray)[index]; |
|
2287 CFbsBitmap* bitmap=icon->Bitmap(); |
|
2288 // Sometimes we get fake bitmap... |
|
2289 if ( bitmap ) |
|
2290 { |
|
2291 TSize size( bitmap->SizeInPixels() ); // set size if not already |
|
2292 if ( size.iWidth != graphicSize.iWidth && size.iHeight != graphicSize.iHeight ) |
|
2293 { |
|
2294 AknIconUtils::SetSize( bitmap, |
|
2295 graphicSize, |
|
2296 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
2297 } |
|
2298 BitBltColored( aGc, aHighlight, icon, subcell, colorIcon, graphicRect.Rect() ); |
|
2299 aGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
2300 } |
|
2301 } |
|
2302 } |
|
2303 ++subcell; |
|
2304 } |
|
2305 |
|
2306 // Clear information of wordwrapped and bidi-reordered subcells. |
|
2307 const_cast<CCCAppCommLauncherCustomListBoxData*>( this )-> |
|
2308 SetWordWrappedSubcellIndices( -1, -1 ); |
|
2309 } |
|
2310 |
|
2311 CCCAppCommLauncherCustomListBoxData::CCCAppCommLauncherCustomListBoxData() : |
|
2312 CListBoxData() |
|
2313 { |
|
2314 } |
|
2315 |
|
2316 void CCCAppCommLauncherCustomListBoxData::ConstructLD() |
|
2317 { |
|
2318 TRAPD( err, DoConstructL( KAknsIIDQsnAnimList ) ); |
|
2319 if (err) |
|
2320 { |
|
2321 delete (this); |
|
2322 User::Leave(err); |
|
2323 } |
|
2324 } |
|
2325 |
|
2326 void CCCAppCommLauncherCustomListBoxData::ConstructLD( |
|
2327 const TAknsItemID& aAnimationIID) |
|
2328 { |
|
2329 TRAPD( err, DoConstructL( aAnimationIID ) ); |
|
2330 if (err) |
|
2331 { |
|
2332 delete (this); |
|
2333 User::Leave(err); |
|
2334 } |
|
2335 } |
|
2336 |
|
2337 void CCCAppCommLauncherCustomListBoxData::DoConstructL( |
|
2338 const TAknsItemID& aAnimationIID) |
|
2339 { |
|
2340 iSubCellArray = new (ELeave) CArrayFixFlat<SSubCell> ( |
|
2341 KSubCellListBoxGranularity); |
|
2342 iExtension = new (ELeave) CCCAppCommLauncherCustomListBoxDataExtension; |
|
2343 |
|
2344 iExtension->iSkinEnabled = AknsUtils::AvkonSkinEnabled(); |
|
2345 SetupSkinContextL(); |
|
2346 |
|
2347 // Preallocate so that SizeChanged() methods do not leave so often. |
|
2348 CListBoxData::ConstructL(NULL); |
|
2349 iExtension->ConstructL(this, aAnimationIID); |
|
2350 CListBoxData::SetSkinBackgroundControlContextL( |
|
2351 iExtension->iSkinControlContext); |
|
2352 AddSubCellL(0); |
|
2353 AddSubCellL(1); |
|
2354 AddSubCellL(2); |
|
2355 AddSubCellL(3); |
|
2356 AddSubCellL(4); |
|
2357 } |
|
2358 |
|
2359 TInt CCCAppCommLauncherCustomListBoxData::LastSubCell() const |
|
2360 { |
|
2361 TInt count = iSubCellArray->Count(); |
|
2362 if (!count) |
|
2363 return (KErrNotFound); |
|
2364 return (At(count - 1).iSubCell); |
|
2365 } |
|
2366 |
|
2367 void CCCAppCommLauncherCustomListBoxData::AddSubCellL(TInt aSubCell) |
|
2368 { |
|
2369 SSubCell subcell; |
|
2370 TMargins m = |
|
2371 { |
|
2372 0, 0, 0, 0 |
|
2373 }; |
|
2374 subcell.iSubCell = aSubCell; |
|
2375 subcell.iWidth = 0; |
|
2376 subcell.iMargin = m; |
|
2377 subcell.iBaseFont = NULL; |
|
2378 subcell.iActualFontIndex = KNoActualSubCellFont; |
|
2379 subcell.iGraphics = EFalse; |
|
2380 subcell.iTransparent = EFalse; |
|
2381 subcell.iNotAlwaysDrawn = EFalse; |
|
2382 subcell.iRightSeparatorStyle = CGraphicsContext::ENullPen; |
|
2383 subcell.iAlign = CGraphicsContext::ELeft; |
|
2384 subcell.iPosition = TPoint(0, 0); |
|
2385 subcell.iBaseline = 0; |
|
2386 subcell.iSize = TSize(0, 0); |
|
2387 subcell.iUseSubCellColors = EFalse; |
|
2388 subcell.iTextClipGap = 0; |
|
2389 subcell.iNumberCell = 0; |
|
2390 TKeyArrayFix key(0, ECmpTInt); |
|
2391 iSubCellArray->InsertIsqL(subcell, key); |
|
2392 } |
|
2393 |
|
2394 CCCAppCommLauncherCustomListBoxData::SSubCell& |
|
2395 CCCAppCommLauncherCustomListBoxData::At(TInt aArrayIndex) |
|
2396 { |
|
2397 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
2398 return (iSubCellArray->At(aArrayIndex)); |
|
2399 } |
|
2400 |
|
2401 const CCCAppCommLauncherCustomListBoxData::SSubCell& |
|
2402 CCCAppCommLauncherCustomListBoxData::At(TInt aArrayIndex) const |
|
2403 { |
|
2404 //__ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
|
2405 return (iSubCellArray->At(aArrayIndex)); |
|
2406 } |
|
2407 |
|
2408 TInt CCCAppCommLauncherCustomListBoxData::FindSubCellIndex(TInt& aArrayIndex, |
|
2409 TInt aSubCell) const |
|
2410 { |
|
2411 if (aSubCell < 0 || iSubCellArray->Count() == 0) |
|
2412 return (KErrNotFound); |
|
2413 TKeyArrayFix key(0, ECmpTInt); |
|
2414 SSubCell subcell; |
|
2415 subcell.iSubCell = aSubCell; |
|
2416 TInt retVal = iSubCellArray->FindIsq(subcell, key, aArrayIndex); |
|
2417 if (retVal != 0) |
|
2418 { |
|
2419 return KErrNotFound; |
|
2420 } |
|
2421 |
|
2422 return retVal; |
|
2423 } |
|
2424 |
|
2425 void CCCAppCommLauncherCustomListBoxData::FindSubCellIndexOrAddL( |
|
2426 TInt& aArrayIndex, TInt aSubCell) |
|
2427 { |
|
2428 if (FindSubCellIndex(aArrayIndex, aSubCell) == KErrNotFound) |
|
2429 { |
|
2430 AddSubCellL(aSubCell); |
|
2431 FindSubCellIndex(aArrayIndex, aSubCell); |
|
2432 } |
|
2433 } |
|
2434 |
|
2435 CCCAppCommLauncherCustomListBoxData::TColors::TColors() : |
|
2436 iText(KRgbBlack), iBack(KRgbWhite), iHighlightedText(KRgbWhite), iHighlightedBack( |
|
2437 KRgbBlack), |
|
2438 iRightSeparatorColor(AKN_LAF_COLOR_STATIC(215)) |
|
2439 { |
|
2440 } |
|
2441 |
|
2442 TInt CCCAppCommLauncherCustomListBoxData::AddActualFontL(const CFont* aBaseFont) |
|
2443 { |
|
2444 if (!iNormalFont.iFonts) |
|
2445 { |
|
2446 iNormalFont.iFonts = new (ELeave) CArrayPtrFlat<CFont> (1); |
|
2447 iBoldFont.iFonts = new (ELeave) CArrayPtrFlat<CFont> (1); |
|
2448 iItalicFont.iFonts = new (ELeave) CArrayPtrFlat<CFont> (1); |
|
2449 iBoldItalicFont.iFonts = new (ELeave) CArrayPtrFlat<CFont> (1); |
|
2450 } |
|
2451 |
|
2452 // Reserves extra space for each font array. |
|
2453 TInt fontCount = iNormalFont.iFonts->Count() + 1; |
|
2454 iNormalFont.iFonts->SetReserveL(fontCount); |
|
2455 iBoldFont.iFonts->SetReserveL(fontCount); |
|
2456 iItalicFont.iFonts->SetReserveL(fontCount); |
|
2457 iBoldItalicFont.iFonts->SetReserveL(fontCount); |
|
2458 |
|
2459 // Add Fonts. |
|
2460 ConstructFontL(aBaseFont, TFontStyle(EPostureUpright, EStrokeWeightNormal, |
|
2461 EPrintPosNormal), iNormalFont); |
|
2462 ConstructFontL(aBaseFont, TFontStyle(EPostureUpright, EStrokeWeightBold, |
|
2463 EPrintPosNormal), iBoldFont); |
|
2464 ConstructFontL(aBaseFont, TFontStyle(EPostureItalic, EStrokeWeightNormal, |
|
2465 EPrintPosNormal), iItalicFont); |
|
2466 ConstructFontL(aBaseFont, TFontStyle(EPostureItalic, EStrokeWeightBold, |
|
2467 EPrintPosNormal), iBoldItalicFont); |
|
2468 |
|
2469 return fontCount - 1; |
|
2470 } |
|
2471 |
|
2472 void CCCAppCommLauncherCustomListBoxData::DrawDefaultHighlight(CWindowGc &aGc, |
|
2473 const TRect &aItemRect, TBool aHighlight) const |
|
2474 { |
|
2475 // When this flag set, draw pressed down state and don't use animation. |
|
2476 // There are several derived CListboxData in this file. All of them do |
|
2477 // this same thing. |
|
2478 CListBoxView* view = |
|
2479 static_cast<CEikListBox*> (iExtension->iControl)->View(); |
|
2480 TBool pressedDown = view->ItemDrawer()->Flags() |
|
2481 & CListItemDrawer::EPressedDownState; |
|
2482 |
|
2483 if (aHighlight) |
|
2484 { |
|
2485 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
2486 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal(&aGc); |
|
2487 if (transApi) |
|
2488 { |
|
2489 transApi->Invalidate(MAknListBoxTfxInternal::EListHighlight); |
|
2490 if (!transApi->BeginRedraw(MAknListBoxTfxInternal::EListHighlight, |
|
2491 aItemRect)) |
|
2492 { |
|
2493 // No need to execute drawing if no drawing will occur |
|
2494 transApi->EndRedraw(MAknListBoxTfxInternal::EListHighlight); |
|
2495 return; |
|
2496 } |
|
2497 transApi->StartDrawing(MAknListBoxTfxInternal::EListHighlight); |
|
2498 |
|
2499 } |
|
2500 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
2501 TBool highlightDrawn = EFalse; |
|
2502 |
|
2503 TAknLayoutRect outerRect; |
|
2504 TAknLayoutRect innerRect; |
|
2505 outerRect.LayoutRect( |
|
2506 aItemRect, |
|
2507 TAknWindowComponentLayout::Compose( |
|
2508 AknLayoutScalable_Avkon::list_highlight_pane_cp1(), |
|
2509 AknLayoutScalable_Avkon::list_highlight_pane_g10_cp1()).LayoutLine()); |
|
2510 innerRect.LayoutRect( |
|
2511 aItemRect, |
|
2512 TAknWindowComponentLayout::Compose( |
|
2513 AknLayoutScalable_Avkon::list_highlight_pane_cp1(), |
|
2514 AknLayoutScalable_Avkon::list_highlight_pane_g1_cp1()).LayoutLine()); |
|
2515 |
|
2516 if (iExtension->iAnimation) // animated highlight |
|
2517 { |
|
2518 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
2519 highlightDrawn = iExtension->SyncAndDrawAnim(aGc, outerRect.Rect()); |
|
2520 } |
|
2521 |
|
2522 if (!highlightDrawn) // normal skinned highlight |
|
2523 { |
|
2524 if (pressedDown) |
|
2525 { |
|
2526 TRAP_IGNORE( highlightDrawn = iExtension->DrawPressedDownEffectL( |
|
2527 AknsUtils::SkinInstance(), aGc, outerRect.Rect(), |
|
2528 innerRect.Rect()) ); |
|
2529 } |
|
2530 else |
|
2531 { |
|
2532 MAknsControlContext *cc = AknsDrawUtils::ControlContext( |
|
2533 Control()); |
|
2534 |
|
2535 if (!cc) |
|
2536 { |
|
2537 cc = SkinBackgroundContext(); |
|
2538 } |
|
2539 |
|
2540 if (cc) |
|
2541 { |
|
2542 |
|
2543 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
2544 |
|
2545 highlightDrawn = AknsDrawUtils::DrawFrame( |
|
2546 AknsUtils::SkinInstance(), aGc, outerRect.Rect(), |
|
2547 innerRect.Rect(), |
|
2548 *iExtension->iSkinHighlightFrameId, |
|
2549 *iExtension->iSkinHighlightFrameCenterId); |
|
2550 } |
|
2551 } |
|
2552 } |
|
2553 |
|
2554 if (!highlightDrawn) // legacy fallback |
|
2555 { |
|
2556 TRgb color(AKN_LAF_COLOR( 244 )); |
|
2557 aGc.SetPenColor(color); |
|
2558 aGc.SetBrushColor(color); |
|
2559 aGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
2560 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
2561 aGc.DrawRect(aItemRect); |
|
2562 } |
|
2563 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
2564 if (transApi) |
|
2565 { |
|
2566 transApi->StopDrawing(); |
|
2567 transApi->EndRedraw(MAknListBoxTfxInternal::EListHighlight); |
|
2568 } |
|
2569 #endif |
|
2570 } |
|
2571 } |
|
2572 |
|
2573 void CCCAppCommLauncherCustomListBoxData::DrawSettingHighlight(CWindowGc &aGc, |
|
2574 const TRect &aItemRect, TBool aHighlight) const |
|
2575 { |
|
2576 DrawDefaultHighlight(aGc, aItemRect, aHighlight); |
|
2577 } |
|
2578 |
|
2579 void CCCAppCommLauncherCustomListBoxData::DrawPopupHighlight(CWindowGc &aGc, |
|
2580 const TRect &aItemRect, TBool aHighlight) const |
|
2581 { |
|
2582 DrawDefaultHighlight(aGc, aItemRect, aHighlight); |
|
2583 } |
|
2584 |
|
2585 void CCCAppCommLauncherCustomListBoxData::DrawPopupFrame(CWindowGc &aGc) const |
|
2586 { |
|
2587 CCoeControl* control = Control(); |
|
2588 |
|
2589 if (control) |
|
2590 { |
|
2591 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
2592 |
|
2593 TBool done = AknsDrawUtils::Background(AknsUtils::SkinInstance(), |
|
2594 iExtension->iPopupFrame, control, aGc, control->Rect()); |
|
2595 |
|
2596 if (!done) |
|
2597 { |
|
2598 aGc.Clear(control->Rect()); |
|
2599 } |
|
2600 } |
|
2601 } |
|
2602 |
|
2603 void CCCAppCommLauncherCustomListBoxData::SetWordWrappedSubcellIndices( |
|
2604 TInt aFirstIndex, TInt aSecondIndex) |
|
2605 { |
|
2606 iExtension->iFirstWordWrappedSubcellIndex = (TInt16) aFirstIndex; |
|
2607 iExtension->iSecondWordWrappedSubcellIndex = (TInt16) aSecondIndex; |
|
2608 } |
|
2609 |
|
2610 void CCCAppCommLauncherCustomListBoxData::EnableMarqueeL(TBool aEnable) |
|
2611 { |
|
2612 // CreateMarqueeControlL does nothing if marquee already exists, |
|
2613 // so let's just call it just in case. |
|
2614 CreateMarqueeControlL(); |
|
2615 iExtension->iMarquee->EnableMarquee(aEnable); |
|
2616 iExtension->i2ndLineMarquee->EnableMarquee(aEnable); |
|
2617 } |
|
2618 |
|
2619 // Two versions to eliminate compiler warnings. |
|
2620 #ifdef __WINS__ |
|
2621 const TBool CCCAppCommLauncherCustomListBoxData::IsMarqueeOn() |
|
2622 { |
|
2623 return iExtension->IsMarqueeOn(); |
|
2624 } |
|
2625 #else |
|
2626 TBool CCCAppCommLauncherCustomListBoxData::IsMarqueeOn() |
|
2627 { |
|
2628 return iExtension->IsMarqueeOn(); |
|
2629 } |
|
2630 #endif // __WINS__ |
|
2631 |
|
2632 void CCCAppCommLauncherCustomListBoxData::FocusGained() |
|
2633 { |
|
2634 iExtension->FocusGained(); |
|
2635 } |
|
2636 |
|
2637 void CCCAppCommLauncherCustomListBoxData::FocusLost() |
|
2638 { |
|
2639 iExtension->FocusLost(); |
|
2640 } |
|
2641 |
|
2642 void CCCAppCommLauncherCustomListBoxData::HandleResourceChange(TInt aType) |
|
2643 { |
|
2644 // Animation is skin dependent, whenever skin changes animation changes |
|
2645 // too. |
|
2646 if (KAknsMessageSkinChange == aType) |
|
2647 { |
|
2648 iExtension->SkinChanged(); |
|
2649 } |
|
2650 else if (aType == KEikDynamicLayoutVariantSwitch) |
|
2651 { |
|
2652 // What is under highlight may have changed -> we need to update |
|
2653 // highlight background to animation. |
|
2654 iExtension->iAnimFlags.Set( |
|
2655 CCCAppCommLauncherCustomListBoxDataExtension::EFlagUpdateBg); |
|
2656 } |
|
2657 else if( ( aType == KEikMessageUnfadeWindows ) || |
|
2658 ( aType == KEikMessageFadeAllWindows ) ) |
|
2659 { |
|
2660 if( iExtension->iMarquee ) |
|
2661 { |
|
2662 iExtension->iMarquee->HandleResourceChange( aType ); |
|
2663 } |
|
2664 if( iExtension->i2ndLineMarquee ) |
|
2665 { |
|
2666 iExtension->i2ndLineMarquee->HandleResourceChange( aType ); |
|
2667 } |
|
2668 } |
|
2669 } |
|
2670 // ----------------------------------------------------------------------------- |
|
2671 // CCCAppCommLauncherCustomListBoxData::HighlightAnim |
|
2672 // ----------------------------------------------------------------------------- |
|
2673 // |
|
2674 const CAknsEffectAnim* CCCAppCommLauncherCustomListBoxData::HighlightAnim() const |
|
2675 { |
|
2676 if (iExtension) |
|
2677 return iExtension->iAnimation; |
|
2678 return NULL; |
|
2679 } |
|
2680 |
|
2681 // ----------------------------------------------------------------------------- |
|
2682 // CCCAppCommLauncherCustomListBoxData::AboutToDrawHighlightAnim |
|
2683 // ----------------------------------------------------------------------------- |
|
2684 // |
|
2685 void CCCAppCommLauncherCustomListBoxData::AboutToDrawHighlightAnim() const |
|
2686 { |
|
2687 if (!iExtension) |
|
2688 { |
|
2689 return; |
|
2690 } |
|
2691 if (!iExtension->iAnimation || !iExtension->iControl) |
|
2692 { |
|
2693 return; |
|
2694 } |
|
2695 |
|
2696 CEikListBox* list = static_cast<CEikListBox*> (iExtension->iControl); |
|
2697 CListBoxView* view = list->View(); |
|
2698 if (!view) |
|
2699 { |
|
2700 return; |
|
2701 } |
|
2702 |
|
2703 if (view->CurrentItemIndex() != iExtension->iCurrentRow) |
|
2704 { |
|
2705 iExtension->iAnimFlags.Set( |
|
2706 CCCAppCommLauncherCustomListBoxDataExtension::EFlagUpdateBg); |
|
2707 iExtension->iCurrentRow = view->CurrentItemIndex(); |
|
2708 } |
|
2709 |
|
2710 iExtension->SyncAnim(iExtension->iAnimSize); |
|
2711 } |
|
2712 |
|
2713 // ----------------------------------------------------------------------------- |
|
2714 // CCCAppCommLauncherCustomListBoxData::SetHighlightAnimBackgroundDrawer |
|
2715 // ----------------------------------------------------------------------------- |
|
2716 // |
|
2717 void CCCAppCommLauncherCustomListBoxData::SetHighlightAnimBackgroundDrawer( |
|
2718 MListBoxAnimBackgroundDrawer* aDrawer) |
|
2719 { |
|
2720 if (iExtension) |
|
2721 { |
|
2722 iExtension->iHighlightBgDrawer = aDrawer; |
|
2723 } |
|
2724 } |
|
2725 |
|
2726 // ----------------------------------------------------------------------------- |
|
2727 // CCCAppCommLauncherCustomListBoxData::SetItemCellSize |
|
2728 // ----------------------------------------------------------------------------- |
|
2729 // |
|
2730 void CCCAppCommLauncherCustomListBoxData::SetItemCellSize( |
|
2731 const TSize& aSize) |
|
2732 { |
|
2733 if (iExtension) |
|
2734 { |
|
2735 if (iExtension->iAnimSize != aSize) |
|
2736 { |
|
2737 iExtension->Play(); |
|
2738 } |
|
2739 iExtension->iAnimSize = aSize; |
|
2740 } |
|
2741 } |
|
2742 |
|
2743 // ----------------------------------------------------------------------------- |
|
2744 // CCCAppCommLauncherCustomListBoxData::HasHighlightAnim |
|
2745 // ----------------------------------------------------------------------------- |
|
2746 // |
|
2747 TBool CCCAppCommLauncherCustomListBoxData::HasHighlightAnim() const |
|
2748 { |
|
2749 if (!iExtension) |
|
2750 return EFalse; |
|
2751 if (!iExtension->iAnimation) |
|
2752 return EFalse; |
|
2753 return ETrue; |
|
2754 } |
|
2755 |
|
2756 // ----------------------------------------------------------------------------- |
|
2757 // CCCAppCommLauncherCustomListBoxData::DrawHighlightAnim |
|
2758 // ----------------------------------------------------------------------------- |
|
2759 // |
|
2760 TBool CCCAppCommLauncherCustomListBoxData::DrawHighlightAnim( |
|
2761 CBitmapContext& aGc, const TRect& aRect) const |
|
2762 { |
|
2763 if (!iExtension) |
|
2764 return EFalse; |
|
2765 |
|
2766 if (!iExtension->iAnimation) |
|
2767 return EFalse; |
|
2768 |
|
2769 return iExtension->SyncAndDrawAnim(aGc, aRect); |
|
2770 } |
|
2771 |
|
2772 void CCCAppCommLauncherCustomListBoxData::ResetMarquee() |
|
2773 { |
|
2774 if (iExtension->iMarquee) |
|
2775 { |
|
2776 iExtension->iMarquee->Reset(); |
|
2777 } |
|
2778 if (iExtension->i2ndLineMarquee) |
|
2779 { |
|
2780 iExtension->i2ndLineMarquee->Reset(); |
|
2781 } |
|
2782 } |
|
2783 |
|
2784 TInt CCCAppCommLauncherCustomListBoxData::CurrentMarqueeItemIndex() |
|
2785 { |
|
2786 return iExtension->iCurrentItem; |
|
2787 } |
|
2788 |
|
2789 void CCCAppCommLauncherCustomListBoxData::SetCurrentMarqueeItemIndex( |
|
2790 TInt aIndex) |
|
2791 { |
|
2792 iExtension->iCurrentItem = aIndex; |
|
2793 } |
|
2794 |
|
2795 void CCCAppCommLauncherCustomListBoxData::SetCurrentItemIndex(TInt aIndex) |
|
2796 { |
|
2797 if (iExtension->iCurrentRow != aIndex) |
|
2798 { |
|
2799 iExtension->iAnimFlags.Set( |
|
2800 CCCAppCommLauncherCustomListBoxDataExtension::EFlagUpdateBg); |
|
2801 } |
|
2802 iExtension->iCurrentRow = aIndex; |
|
2803 } |
|
2804 |
|
2805 void CCCAppCommLauncherCustomListBoxData::SetCurrentlyDrawnItemIndex( |
|
2806 TInt aIndex) |
|
2807 { |
|
2808 if (iExtension) |
|
2809 { |
|
2810 iExtension->iCurrentlyDrawnItemIndex = aIndex; |
|
2811 } |
|
2812 } |
|
2813 |
|
2814 const CFont* |
|
2815 CCCAppCommLauncherCustomListBoxData::RowAndSubCellFont(TInt aRow, |
|
2816 TInt aSubCellIndex) const |
|
2817 { |
|
2818 if (!iExtension) |
|
2819 return 0; |
|
2820 TInt index = 0; |
|
2821 if (iExtension->FindRowAndSubCellIndex(index, aRow, aSubCellIndex) != 0) |
|
2822 return 0; |
|
2823 return (iExtension->At(index).iFont); |
|
2824 } |
|
2825 |
|
2826 void CCCAppCommLauncherCustomListBoxData::SetSubCellFontForRowL( |
|
2827 TInt aRowIndex, TInt aSubCellIndex, const CFont* aFont) |
|
2828 { |
|
2829 if (!iExtension) |
|
2830 return; |
|
2831 TInt index = 0; |
|
2832 iExtension->FindRowAndSubCellIndexOrAddL(index, aRowIndex, aSubCellIndex); |
|
2833 iExtension->At(index).iFont = aFont; |
|
2834 } |
|
2835 |
|
2836 /** |
|
2837 * Enables / disables transparency effect, ie. does the listbox draw it's own background or not. |
|
2838 * @param aDrawBackground EFalse enables transparency |
|
2839 */ |
|
2840 void CCCAppCommLauncherCustomListBoxData::SetDrawBackground( |
|
2841 const TBool aDrawBackground) |
|
2842 { |
|
2843 iExtension->iDrawBackground = aDrawBackground; |
|
2844 if (!aDrawBackground) |
|
2845 { |
|
2846 iExtension->DeleteAnim(); |
|
2847 } |
|
2848 } |
|
2849 |
|
2850 /** |
|
2851 * Is the listbox drawing the background itself or not (= "transparency") |
|
2852 */ |
|
2853 TBool CCCAppCommLauncherCustomListBoxData::IsBackgroundDrawingEnabled() const |
|
2854 { |
|
2855 return iExtension->iDrawBackground; |
|
2856 } |
|
2857 |
|
2858 /** |
|
2859 * Enables / disables drawing background after scrollbar |
|
2860 * @param aDrawBackground default ETrue |
|
2861 */ |
|
2862 void CCCAppCommLauncherCustomListBoxData::SetDrawScrollbarBackground( |
|
2863 const TBool aDrawBackground) |
|
2864 { |
|
2865 iExtension->iDrawScrollbarBackground = aDrawBackground; |
|
2866 } |
|
2867 |
|
2868 /** |
|
2869 * Is the listbox drawing the background after scrollbar or not |
|
2870 */ |
|
2871 TBool CCCAppCommLauncherCustomListBoxData::IsScrollbarBackgroundDrawingEnabled() const |
|
2872 { |
|
2873 return iExtension->iDrawScrollbarBackground; |
|
2874 } |
|
2875 |
|
2876 void CCCAppCommLauncherCustomListBoxData::SetMarqueeParams( |
|
2877 const TInt aLoops, const TInt aScrollAmount, const TInt aScrollDelay, |
|
2878 const TInt aInterval) |
|
2879 { |
|
2880 if (iExtension->iMarquee) |
|
2881 { |
|
2882 iExtension->iMarquee->SetLoops(aLoops); |
|
2883 iExtension->iMarquee->SetSpeedInPixels(aScrollAmount); |
|
2884 iExtension->iMarquee->SetDelay(aScrollDelay); |
|
2885 iExtension->iMarquee->SetInterval(aInterval); |
|
2886 } |
|
2887 if (iExtension->i2ndLineMarquee) |
|
2888 { |
|
2889 iExtension->i2ndLineMarquee->SetLoops(aLoops); |
|
2890 iExtension->i2ndLineMarquee->SetSpeedInPixels(aScrollAmount); |
|
2891 iExtension->i2ndLineMarquee->SetDelay(aScrollDelay); |
|
2892 iExtension->i2ndLineMarquee->SetInterval(aInterval); |
|
2893 } |
|
2894 } |
|
2895 |
|
2896 void CCCAppCommLauncherCustomListBoxData::SetSubCellIconSize( |
|
2897 TInt aIndex, TSize aSize) |
|
2898 { |
|
2899 if ( iExtension && aIndex < KMaxSubCellIndex && aIndex >= 0 ) |
|
2900 { |
|
2901 iExtension->iSubCellIconSize[aIndex] = aSize; |
|
2902 } |
|
2903 } |
|
2904 |
|
2905 TSize CCCAppCommLauncherCustomListBoxData::GetSubCellIconSize(TInt aIndex) |
|
2906 { |
|
2907 if ( iExtension && aIndex < KMaxSubCellIndex && aIndex >= 0 ) |
|
2908 { |
|
2909 return iExtension->iSubCellIconSize[aIndex]; |
|
2910 } |
|
2911 return TSize(0, 0); |
|
2912 } |
|
2913 |
|
2914 void CCCAppCommLauncherCustomListBoxData::SetupSkinContextL() |
|
2915 { |
|
2916 //__ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
2917 |
|
2918 // list's own rect cannot be used since it might be unknown at this point |
|
2919 TRect mainPane; |
|
2920 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPane); |
|
2921 |
|
2922 TRect mainPaneRect(mainPane.Size()); |
|
2923 |
|
2924 if (!iExtension->iSkinControlContext) |
|
2925 { |
|
2926 iExtension->iSkinControlContext |
|
2927 = CAknsListBoxBackgroundControlContext::NewL( |
|
2928 KAknsIIDQsnBgAreaMainListGene, mainPaneRect, EFalse, // Changed to EFalse: See TSW defect avao-6eelpv |
|
2929 KAknsIIDNone, mainPaneRect); |
|
2930 } |
|
2931 else |
|
2932 { |
|
2933 iExtension->iSkinControlContext->SetRect(mainPaneRect); |
|
2934 } |
|
2935 |
|
2936 if (iExtension->iPopupFrame) |
|
2937 { |
|
2938 iExtension->iPopupFrame->SetRect(mainPaneRect); |
|
2939 } |
|
2940 |
|
2941 iExtension->iSkinHighlightFrameId = &KAknsIIDQsnFrList; |
|
2942 iExtension->iSkinHighlightFrameCenterId = &KAknsIIDQsnFrListCenter; |
|
2943 } |
|
2944 |
|
2945 // extended skin support |
|
2946 void CCCAppCommLauncherCustomListBoxData::SetESSTextColor( |
|
2947 TAknsQsnTextColorsIndex aIndex) |
|
2948 { |
|
2949 TRgb color; |
|
2950 |
|
2951 TInt error = AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, |
|
2952 KAknsIIDQsnTextColors, aIndex); |
|
2953 if (!error && iExtension) |
|
2954 { |
|
2955 iExtension->iTextColor = color; |
|
2956 } |
|
2957 } |
|
2958 |
|
2959 // extended skin support |
|
2960 void CCCAppCommLauncherCustomListBoxData::SetESSHighlightedTextColor( |
|
2961 TAknsQsnTextColorsIndex aIndex) |
|
2962 { |
|
2963 TRgb color; |
|
2964 |
|
2965 TInt error = AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, |
|
2966 KAknsIIDQsnTextColors, aIndex); |
|
2967 if (!error) |
|
2968 { |
|
2969 iExtension->iHighlightedTextColor = color; |
|
2970 } |
|
2971 } |
|
2972 |
|
2973 void CCCAppCommLauncherCustomListBoxData::SetGraphicSubCellL(TInt aSubCell, |
|
2974 const TAknWindowLineLayout &aGraphicLayout) |
|
2975 { |
|
2976 if (!iExtension) |
|
2977 return; |
|
2978 CEikFormattedCellListBox* list = |
|
2979 static_cast<CEikFormattedCellListBox*> (iExtension->iControl); |
|
2980 // this does happen with caknsetstyle, caknform(wide)style lists. |
|
2981 // eventually they'll get here again with list!=0, so this check is enough |
|
2982 if (!list) |
|
2983 return; |
|
2984 |
|
2985 TInt index = 0; |
|
2986 iExtension->FindSLSubCellIndexOrAddL(index, aSubCell); |
|
2987 iExtension->AtSL(index).iTextLayout = NULL; |
|
2988 iExtension->AtSL(index).iGraphicLayout = aGraphicLayout; |
|
2989 iExtension->AtSL(index).iSubCellType |
|
2990 = CCCAppCommLauncherCustomListBoxDataExtension::EAknSLGraphic; |
|
2991 |
|
2992 // For compabitility - needed at least for text wrapping. |
|
2993 // Beware - some of these WILL be overriden if you got here trough |
|
2994 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
|
2995 // & friends. |
|
2996 TAknLayoutRect r; |
|
2997 |
|
2998 r.LayoutRect(list->View()->ItemDrawer()->ItemCellSize(), aGraphicLayout); |
|
2999 SetSubCellSizeL(aSubCell, r.Rect().Size()); |
|
3000 SetSubCellPositionL(aSubCell, r.Rect().iTl); |
|
3001 SetSubCellAlignmentL(aSubCell, CGraphicsContext::ECenter); |
|
3002 SetGraphicsSubCellL(aSubCell, ETrue); |
|
3003 UseScalableLayoutData(ETrue); |
|
3004 if (iExtension->iMarginRect == TRect::EUninitialized) |
|
3005 { |
|
3006 iExtension->iMarginRect = r.Rect(); |
|
3007 } |
|
3008 else |
|
3009 { |
|
3010 iExtension->iMarginRect.BoundingRect(r.Rect()); |
|
3011 } |
|
3012 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3013 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( |
|
3014 list->View()->ItemDrawer()->Gc()); |
|
3015 if (transApi) |
|
3016 { |
|
3017 transApi->SetPosition(MAknListBoxTfxInternal::EListTLMargin, |
|
3018 iExtension->iMarginRect.iTl); |
|
3019 TSize size = list->View()->ItemDrawer()->ItemCellSize(); |
|
3020 TPoint br(size.AsPoint() - iExtension->iMarginRect.iBr); |
|
3021 transApi->SetPosition(MAknListBoxTfxInternal::EListBRMargin, br); |
|
3022 } |
|
3023 #endif |
|
3024 } |
|
3025 |
|
3026 void CCCAppCommLauncherCustomListBoxData::SetTextSubCellL(TInt aSubCell, |
|
3027 const TAknTextLineLayout &aTextLayout) |
|
3028 { |
|
3029 if (!iExtension) |
|
3030 return; |
|
3031 CEikFormattedCellListBox* list = |
|
3032 static_cast<CEikFormattedCellListBox*> (iExtension->iControl); |
|
3033 // this does happen with caknsetstyle, caknform(wide)style lists. |
|
3034 // eventually they'll get here again with list!=0, so this check is enough |
|
3035 if (!list) |
|
3036 return; |
|
3037 |
|
3038 TInt index = 0; |
|
3039 iExtension->FindSLSubCellIndexOrAddL(index, aSubCell); |
|
3040 iExtension->AtSL(index).iTextLayout = aTextLayout; |
|
3041 iExtension->AtSL(index).iGraphicLayout = NULL; |
|
3042 iExtension->AtSL(index).iSubCellType |
|
3043 = CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText; |
|
3044 |
|
3045 // For compabitility - needed at least for text wrapping. |
|
3046 // Beware - some of these WILL be overriden if you got here trough |
|
3047 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
|
3048 // & friends. |
|
3049 TAknLayoutText t; |
|
3050 t.LayoutText(list->View()->ItemDrawer()->ItemCellSize(), aTextLayout); |
|
3051 SetSubCellSizeL(aSubCell, t.TextRect().Size()); |
|
3052 SetSubCellPositionL(aSubCell, t.TextRect().iTl); |
|
3053 SetSubCellFontL(aSubCell, t.Font()); |
|
3054 SetSubCellAlignmentL(aSubCell, AknLayoutUtils::TextAlignFromId( |
|
3055 aTextLayout.iJ)); |
|
3056 TInt B = CorrectBaseline( |
|
3057 list->View()->ItemDrawer()->ItemCellSize().iHeight, aTextLayout.iB, |
|
3058 aTextLayout.FontId()); |
|
3059 SetSubCellBaselinePosL(aSubCell, B); |
|
3060 UseScalableLayoutData(ETrue); |
|
3061 if (iExtension->iMarginRect == TRect::EUninitialized) |
|
3062 { |
|
3063 iExtension->iMarginRect = t.TextRect(); |
|
3064 } |
|
3065 else |
|
3066 { |
|
3067 iExtension->iMarginRect.BoundingRect(t.TextRect()); |
|
3068 } |
|
3069 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3070 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( |
|
3071 list->View()->ItemDrawer()->Gc()); |
|
3072 if (transApi) |
|
3073 { |
|
3074 transApi->SetPosition(MAknListBoxTfxInternal::EListTLMargin, |
|
3075 iExtension->iMarginRect.iTl); |
|
3076 TSize size = list->View()->ItemDrawer()->ItemCellSize(); |
|
3077 TPoint br(size.AsPoint() - iExtension->iMarginRect.iBr); |
|
3078 transApi->SetPosition(MAknListBoxTfxInternal::EListBRMargin, br); |
|
3079 } |
|
3080 #endif |
|
3081 |
|
3082 } |
|
3083 |
|
3084 |
|
3085 TInt CCCAppCommLauncherCustomListBoxData::CorrectBaseline(TInt aParentHeight, TInt aBaseline, TInt aFontId) |
|
3086 { |
|
3087 TInt B = aBaseline; |
|
3088 |
|
3089 if( TAknFontId::IsEncodedFont(aFontId) && aFontId != ELayoutEmpty ) // This tells us that the font id has come from scalable layout API |
|
3090 { |
|
3091 TInt b = aBaseline; |
|
3092 if (IsParentRelative(b)) { b = aParentHeight - ELayoutP + b; } |
|
3093 |
|
3094 const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId(aFontId); |
|
3095 TInt descent = font->BaselineToTextPaneBottom(); |
|
3096 |
|
3097 // calculate distance down from top of parent to bottom of maximal glyph |
|
3098 TInt top2bog = aParentHeight - b; |
|
3099 |
|
3100 // distance down to baseline is distance down to bottom of glyph minus descent |
|
3101 // A further 1 is subtracted to account for the definition of baseline in the |
|
3102 // Series 60 pre-2.8 layout specifications. |
|
3103 B = top2bog - descent - 1; |
|
3104 } |
|
3105 |
|
3106 return B; |
|
3107 } |
|
3108 TBool CCCAppCommLauncherCustomListBoxData::IsParentRelative(TInt aVal) |
|
3109 { |
|
3110 return aVal > ELayoutP-ELayoutPRange && aVal <= ELayoutP; |
|
3111 } |
|
3112 |
|
3113 void CCCAppCommLauncherCustomListBoxData::SetConditionalSubCellL(TInt aSubCell, |
|
3114 const TAknTextLineLayout &aTextLayout, TInt aAffectedSubCell) |
|
3115 { |
|
3116 // iConditionValue of affected subcell (=text subcell, which has different layouts) |
|
3117 // contains index of graphical subcell, which existence should be checked first. |
|
3118 // This graphical subcell has in iConditionValue index of graphical subcell, |
|
3119 // which existence should be checked second etc. Each graphical subcell can |
|
3120 // affect only to 1 text subcell (or none). |
|
3121 |
|
3122 // for compabitility - needed at least for text wrapping |
|
3123 SetNotAlwaysDrawnSubCellL(aSubCell, ETrue); |
|
3124 |
|
3125 if (!iExtension) |
|
3126 return; |
|
3127 |
|
3128 TInt i = 0x01; |
|
3129 i = i << aSubCell; |
|
3130 iExtension->iConditionalCells = iExtension->iConditionalCells | i; |
|
3131 |
|
3132 TInt graphicalIndex = 0; |
|
3133 if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell) != 0) |
|
3134 return; // subcell not found |
|
3135 // conditional layoutline can be only added to graphical subcells |
|
3136 if (iExtension->AtSL(graphicalIndex).iSubCellType |
|
3137 != CCCAppCommLauncherCustomListBoxDataExtension::EAknSLGraphic) |
|
3138 return; |
|
3139 |
|
3140 TInt textIndex = 0; // index of affected subcell |
|
3141 if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell) != 0) |
|
3142 return; // subcell not found |
|
3143 // affected subcell can only be text subcell |
|
3144 if (iExtension->AtSL(textIndex).iSubCellType |
|
3145 == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLGraphic) |
|
3146 return; |
|
3147 |
|
3148 TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain |
|
3149 |
|
3150 while (gSC > -1) |
|
3151 { |
|
3152 if (iExtension->FindSLSubCellIndex(textIndex, gSC) != 0) |
|
3153 return; // subcell not found |
|
3154 gSC = iExtension->AtSL(textIndex).iConditionValue; |
|
3155 } |
|
3156 iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain |
|
3157 iExtension->AtSL(graphicalIndex).iTextLayout = aTextLayout; |
|
3158 |
|
3159 iExtension->CreateColorBitmapsL(SubCellSize(aSubCell)); |
|
3160 |
|
3161 TRect r(SubCellPosition(aSubCell), SubCellSize(aSubCell)); |
|
3162 if (iExtension->iMarginRect == TRect::EUninitialized) |
|
3163 { |
|
3164 iExtension->iMarginRect = r; |
|
3165 } |
|
3166 else |
|
3167 { |
|
3168 iExtension->iMarginRect.BoundingRect(r); |
|
3169 } |
|
3170 CEikFormattedCellListBox* list = |
|
3171 static_cast<CEikFormattedCellListBox*> (iExtension->iControl); |
|
3172 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3173 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( |
|
3174 list->View()->ItemDrawer()->Gc()); |
|
3175 if (transApi) |
|
3176 { |
|
3177 transApi->SetPosition(MAknListBoxTfxInternal::EListTLMargin, |
|
3178 iExtension->iMarginRect.iTl); |
|
3179 TSize size = list->View()->ItemDrawer()->ItemCellSize(); |
|
3180 TPoint br(size.AsPoint() - iExtension->iMarginRect.iBr); |
|
3181 transApi->SetPosition(MAknListBoxTfxInternal::EListBRMargin, br); |
|
3182 } |
|
3183 #endif |
|
3184 } |
|
3185 |
|
3186 // ----------------------------------------------------------------------------- |
|
3187 // CCCAppCommLauncherCustomListBoxData::UsesScalableLayoutData |
|
3188 // ----------------------------------------------------------------------------- |
|
3189 // |
|
3190 TBool CCCAppCommLauncherCustomListBoxData::UsesScalableLayoutData() const |
|
3191 { |
|
3192 if (iExtension) |
|
3193 return iExtension->iSimpleList; |
|
3194 |
|
3195 return EFalse; |
|
3196 } |
|
3197 void CCCAppCommLauncherCustomListBoxData::UseScalableLayoutData(TBool aUse) |
|
3198 { |
|
3199 if (iExtension) |
|
3200 { |
|
3201 if (!aUse && iExtension->iSimpleList) |
|
3202 { |
|
3203 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
3204 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
|
3205 MAknListBoxTfxInternal* transApi = |
|
3206 CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); |
|
3207 if ( transApi ) |
|
3208 { |
|
3209 transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) ); |
|
3210 transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) ); |
|
3211 } |
|
3212 #endif |
|
3213 } |
|
3214 iExtension->iSimpleList = aUse; |
|
3215 } |
|
3216 } |
|
3217 |
|
3218 void CCCAppCommLauncherCustomListBoxData::SetSubcellUnderlined( |
|
3219 TBitFlags32 aUnderlinedCells) |
|
3220 { |
|
3221 if (iExtension) |
|
3222 { |
|
3223 iExtension->iUnderlineFlagSet = ETrue; |
|
3224 iExtension->iUnderlineFlags = aUnderlinedCells; |
|
3225 } |
|
3226 } |
|
3227 |
|
3228 void CCCAppCommLauncherCustomListBoxData::SetUnderlineStyle( |
|
3229 TListItemProperties aProperties, CWindowGc& aGc, TInt aSubCell) const |
|
3230 { |
|
3231 if (!iExtension) |
|
3232 { |
|
3233 return; |
|
3234 } |
|
3235 |
|
3236 if (!iExtension->iUnderlineFlagSet) |
|
3237 { |
|
3238 // underlining is already either on or off and |
|
3239 // hardcoded off turning will ensure old style |
|
3240 // behaviour |
|
3241 return; |
|
3242 } |
|
3243 |
|
3244 if (aProperties.IsUnderlined() && iExtension->iUnderlineFlagSet |
|
3245 && iExtension->iUnderlineFlags.IsSet(aSubCell)) |
|
3246 { |
|
3247 aGc.SetUnderlineStyle(EUnderlineOn); |
|
3248 } |
|
3249 else |
|
3250 { |
|
3251 aGc.SetUnderlineStyle(EUnderlineOff); |
|
3252 } |
|
3253 } |
|
3254 |
|
3255 void CCCAppCommLauncherCustomListBoxData::UseHighlightIconSwapping(TBool aUse) |
|
3256 { |
|
3257 if (iExtension) |
|
3258 { |
|
3259 iExtension->iUseHighligthIconSwapping = aUse; |
|
3260 } |
|
3261 } |
|
3262 |
|
3263 TBool CCCAppCommLauncherCustomListBoxData::UseHighlightIconSwapping() const |
|
3264 { |
|
3265 if (iExtension) |
|
3266 { |
|
3267 return iExtension->iUseHighligthIconSwapping; |
|
3268 } |
|
3269 return EFalse; |
|
3270 } |
|
3271 |
|
3272 // ----------------------------------------------------------------------------- |
|
3273 // CCCAppCommLauncherCustomListBoxData::SetStretchableGraphicSubCellL |
|
3274 // ----------------------------------------------------------------------------- |
|
3275 // |
|
3276 void CCCAppCommLauncherCustomListBoxData::SetStretchableGraphicSubCellL( |
|
3277 TInt aSubCell, const TAknWindowComponentLayout& aNormalLayout, |
|
3278 const TAknWindowComponentLayout& aStretchedLayout) |
|
3279 { |
|
3280 if (Layout_Meta_Data::IsLandscapeOrientation() |
|
3281 && Layout_Meta_Data::IsListStretchingEnabled() |
|
3282 && StretchingEnabled()) |
|
3283 { |
|
3284 SetGraphicSubCellL(aSubCell, aStretchedLayout.LayoutLine()); |
|
3285 } |
|
3286 else |
|
3287 { |
|
3288 SetGraphicSubCellL(aSubCell, aNormalLayout.LayoutLine()); |
|
3289 } |
|
3290 } |
|
3291 |
|
3292 // ----------------------------------------------------------------------------- |
|
3293 // CCCAppCommLauncherCustomListBoxData::SetStretchableTextSubCellL |
|
3294 // ----------------------------------------------------------------------------- |
|
3295 // |
|
3296 void CCCAppCommLauncherCustomListBoxData::SetStretchableTextSubCellL( |
|
3297 TInt aSubCell, const TAknTextComponentLayout& aNormalLayout, |
|
3298 const TAknTextComponentLayout& aStretchedLayout) |
|
3299 { |
|
3300 if (Layout_Meta_Data::IsLandscapeOrientation() |
|
3301 && Layout_Meta_Data::IsListStretchingEnabled() |
|
3302 && StretchingEnabled()) |
|
3303 { |
|
3304 SetTextSubCellL(aSubCell, aStretchedLayout.LayoutLine()); |
|
3305 } |
|
3306 else |
|
3307 { |
|
3308 SetTextSubCellL(aSubCell, aNormalLayout.LayoutLine()); |
|
3309 } |
|
3310 } |
|
3311 |
|
3312 // ----------------------------------------------------------------------------- |
|
3313 // CCCAppCommLauncherCustomListBoxData::SetStretchableConditionalSubCellL |
|
3314 // ----------------------------------------------------------------------------- |
|
3315 // |
|
3316 void CCCAppCommLauncherCustomListBoxData::SetStretchableConditionalSubCellL( |
|
3317 TInt aSubCell, const TAknTextComponentLayout& aNormalLayout, |
|
3318 const TAknTextComponentLayout& aStretchedLayout, TInt aNormalSubCell, |
|
3319 TInt aStretchedSubCell) |
|
3320 { |
|
3321 if (Layout_Meta_Data::IsLandscapeOrientation() |
|
3322 && Layout_Meta_Data::IsListStretchingEnabled() |
|
3323 && StretchingEnabled()) |
|
3324 { |
|
3325 SetConditionalSubCellL(aSubCell, aStretchedLayout.LayoutLine(), |
|
3326 aStretchedSubCell); |
|
3327 } |
|
3328 else |
|
3329 { |
|
3330 SetConditionalSubCellL(aSubCell, aNormalLayout.LayoutLine(), |
|
3331 aNormalSubCell); |
|
3332 } |
|
3333 } |
|
3334 |
|
3335 // ----------------------------------------------------------------------------- |
|
3336 // CCCAppCommLauncherCustomListBoxData::ResetSLSubCellArray |
|
3337 // ----------------------------------------------------------------------------- |
|
3338 // |
|
3339 void CCCAppCommLauncherCustomListBoxData::ResetSLSubCellArray() |
|
3340 { |
|
3341 if (!iExtension) |
|
3342 { |
|
3343 return; |
|
3344 } |
|
3345 |
|
3346 iExtension->iMarginRect = TRect::EUninitialized; |
|
3347 |
|
3348 UseScalableLayoutData(EFalse); |
|
3349 iExtension->ResetSLSubCellArray(); |
|
3350 // This function gets called always when size changes, so here is called |
|
3351 // SetupSkinContextL to update the layout rect of the background skin |
|
3352 // context (mainpane rect can change for example if toolbar is hidden. |
|
3353 TRAP_IGNORE( SetupSkinContextL() ); |
|
3354 } |
|
3355 |
|
3356 // ----------------------------------------------------------------------------- |
|
3357 // CCCAppCommLauncherCustomListBoxData::StretchingEnabled |
|
3358 // ----------------------------------------------------------------------------- |
|
3359 // |
|
3360 TBool CCCAppCommLauncherCustomListBoxData::StretchingEnabled() const |
|
3361 { |
|
3362 #ifdef RD_LIST_STRETCH |
|
3363 if (!iExtension) |
|
3364 { |
|
3365 return EFalse; |
|
3366 } |
|
3367 |
|
3368 return iExtension->iStretchingEnabled; |
|
3369 #else |
|
3370 return EFalse; |
|
3371 #endif // #ifdef RD_LIST_STRETCH |
|
3372 } |
|
3373 |
|
3374 #ifdef RD_LIST_STRETCH |
|
3375 // ----------------------------------------------------------------------------- |
|
3376 // CCCAppCommLauncherCustomListBoxData::EnableStretching |
|
3377 // ----------------------------------------------------------------------------- |
|
3378 // |
|
3379 void CCCAppCommLauncherCustomListBoxData::EnableStretching(const TBool aEnabled) |
|
3380 { |
|
3381 if (!iExtension) |
|
3382 { |
|
3383 return; |
|
3384 } |
|
3385 |
|
3386 iExtension->iStretchingEnabled = aEnabled; |
|
3387 } |
|
3388 |
|
3389 // ----------------------------------------------------------------------------- |
|
3390 // CCCAppCommLauncherCustomListBoxData::HideSecondRow |
|
3391 // ----------------------------------------------------------------------------- |
|
3392 // |
|
3393 void CCCAppCommLauncherCustomListBoxData::HideSecondRow(const TBool aHide) |
|
3394 { |
|
3395 if (!iExtension) |
|
3396 { |
|
3397 return; |
|
3398 } |
|
3399 |
|
3400 iExtension->iHideSecondRow = aHide; |
|
3401 } |
|
3402 #endif // RD_LIST_STRETCH |
|
3403 // ----------------------------------------------------------------------------- |
|
3404 // CCCAppCommLauncherCustomListBoxData::SecondRowHidden |
|
3405 // ----------------------------------------------------------------------------- |
|
3406 // |
|
3407 TBool CCCAppCommLauncherCustomListBoxData::SecondRowHidden() const |
|
3408 { |
|
3409 if (!iExtension) |
|
3410 { |
|
3411 return EFalse; |
|
3412 } |
|
3413 |
|
3414 return iExtension->iHideSecondRow; |
|
3415 } |
|
3416 |
|
3417 // ----------------------------------------------------------------------------- |
|
3418 // CCCAppCommLauncherCustomListBoxData::ToggleDropShadows |
|
3419 // ----------------------------------------------------------------------------- |
|
3420 // |
|
3421 void CCCAppCommLauncherCustomListBoxData::ToggleDropShadows(const TBool aEnable) |
|
3422 { |
|
3423 if (!iExtension) |
|
3424 { |
|
3425 return; |
|
3426 } |
|
3427 iExtension->iUseDropShadows = aEnable; |
|
3428 } |
|
3429 |
|
3430 // ----------------------------------------------------------------------------- |
|
3431 // CCCAppCommLauncherCustomListBoxData::CheckIfSubCellsIntersect |
|
3432 // ----------------------------------------------------------------------------- |
|
3433 // |
|
3434 void CCCAppCommLauncherCustomListBoxData::CheckIfSubCellsIntersect( |
|
3435 TAknTextLineLayout* aLayouts, TBool* aResults, const TDesC& aText, |
|
3436 const TRect& aItemRect) const |
|
3437 { |
|
3438 TInt subCell = 0; |
|
3439 TInt subCell2; |
|
3440 TInt subCellIndex; |
|
3441 TInt subCellIndex2; |
|
3442 TInt lastSubCell = Min(KMaxSubCellIndex, LastSubCell()); |
|
3443 TPtrC text; |
|
3444 TBool isEmpty[KMaxSubCellIndex]; |
|
3445 |
|
3446 // cache the empty text states |
|
3447 while (ETrue) |
|
3448 { |
|
3449 if (subCell > lastSubCell) |
|
3450 { |
|
3451 break; |
|
3452 } |
|
3453 |
|
3454 TextUtils::ColumnText(text, subCell, &aText); |
|
3455 |
|
3456 if (text == KNullDesC && SubCellIsNotAlwaysDrawn(subCell)) |
|
3457 { |
|
3458 isEmpty[subCell] = ETrue; |
|
3459 } |
|
3460 else |
|
3461 { |
|
3462 isEmpty[subCell] = EFalse; |
|
3463 } |
|
3464 |
|
3465 ++subCell; |
|
3466 } |
|
3467 |
|
3468 subCell = 0; |
|
3469 |
|
3470 while (ETrue) |
|
3471 { |
|
3472 if (subCell > lastSubCell) |
|
3473 { |
|
3474 break; |
|
3475 } |
|
3476 |
|
3477 if (iExtension->FindSLSubCellIndex(subCellIndex, subCell) != 0) |
|
3478 { |
|
3479 break; |
|
3480 } |
|
3481 |
|
3482 if (isEmpty[subCell]) |
|
3483 { |
|
3484 ++subCell; |
|
3485 continue; |
|
3486 } |
|
3487 |
|
3488 TRect bRect(SubCellPosition(subCell), SubCellSize(subCell)); |
|
3489 |
|
3490 for (subCell2 = subCell + 1; subCell2 <= lastSubCell; ++subCell2) |
|
3491 { |
|
3492 if (isEmpty[subCell2]) |
|
3493 { |
|
3494 continue; |
|
3495 } |
|
3496 |
|
3497 if (iExtension->FindSLSubCellIndex(subCellIndex2, subCell2) != 0) |
|
3498 { |
|
3499 break; |
|
3500 } |
|
3501 |
|
3502 TRect bRect2(SubCellPosition(subCell2), SubCellSize(subCell2)); |
|
3503 |
|
3504 if ( bRect.Intersects( bRect2 ) && !SubCellIsTransparent( subCell ) && !SubCellIsTransparent( subCell2 ) ) |
|
3505 { |
|
3506 aResults[subCell] = ETrue; |
|
3507 |
|
3508 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
3509 { |
|
3510 bRect.iBr.iX = bRect2.iTl.iX; |
|
3511 } |
|
3512 else |
|
3513 { |
|
3514 bRect.iTl.iX = bRect2.iBr.iX; |
|
3515 } |
|
3516 } |
|
3517 } |
|
3518 |
|
3519 if ( aResults[subCell] ) |
|
3520 { |
|
3521 if ( iExtension->AtSL( subCellIndex ).iSubCellType == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText ) |
|
3522 { |
|
3523 TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout; |
|
3524 |
|
3525 textLine.iW = bRect.Width(); |
|
3526 |
|
3527 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
3528 { |
|
3529 textLine.ir = aItemRect.iBr.iX - bRect.iBr.iX; |
|
3530 } |
|
3531 else |
|
3532 { |
|
3533 textLine.il = bRect.iTl.iX - aItemRect.iTl.iX; |
|
3534 } |
|
3535 |
|
3536 aLayouts[subCell] = textLine; |
|
3537 } |
|
3538 } |
|
3539 |
|
3540 ++subCell; |
|
3541 } |
|
3542 } |
|
3543 |
|
3544 // ----------------------------------------------------------------------------- |
|
3545 // CCCAppCommLauncherCustomListBoxData::SubCellsMightIntersect |
|
3546 // ----------------------------------------------------------------------------- |
|
3547 // |
|
3548 void CCCAppCommLauncherCustomListBoxData::SubCellsMightIntersect( |
|
3549 const TBool aMightIntersect) |
|
3550 { |
|
3551 iExtension->iSubCellsMightIntersect = aMightIntersect; |
|
3552 } |
|
3553 |
|
3554 void CCCAppCommLauncherCustomListBoxDataExtension::CreateColorBitmapsL() |
|
3555 { |
|
3556 if (iColorBmp) |
|
3557 { |
|
3558 CreateColorBitmapsL(iColorBmp->SizeInPixels()); |
|
3559 } |
|
3560 } |
|
3561 |
|
3562 void CCCAppCommLauncherCustomListBoxDataExtension::CreateColorBitmapsL( |
|
3563 TSize aSize) |
|
3564 { |
|
3565 TRgb color, hiliColor; |
|
3566 TInt error; |
|
3567 // icon #13 main area additional list icons #215 |
|
3568 // icon #16 list highlight additional list iconsform checkbox, radio button #215 |
|
3569 |
|
3570 error = AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, |
|
3571 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG13); |
|
3572 if (error) |
|
3573 return; |
|
3574 |
|
3575 error = AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), hiliColor, |
|
3576 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG16); |
|
3577 if (error) |
|
3578 return; |
|
3579 |
|
3580 if (iColorBmp && iColorBmp->SizeInPixels() == aSize && color == iIconColor |
|
3581 && hiliColor == iHiliIconColor) |
|
3582 { |
|
3583 return; |
|
3584 } |
|
3585 |
|
3586 iIconColor = color; |
|
3587 iHiliIconColor = hiliColor; |
|
3588 |
|
3589 if (!iColorBmp) |
|
3590 { |
|
3591 iColorBmp = new (ELeave) CFbsBitmap(); |
|
3592 iColorBmp->Create(aSize, |
|
3593 CCoeEnv::Static()->ScreenDevice()->DisplayMode()); |
|
3594 } |
|
3595 else if (iColorBmp->SizeInPixels() != aSize) |
|
3596 { |
|
3597 iColorBmp->Resize(aSize); |
|
3598 } |
|
3599 if (!iHiliBmp) |
|
3600 { |
|
3601 iHiliBmp = new (ELeave) CFbsBitmap(); |
|
3602 iHiliBmp->Create(aSize, |
|
3603 CCoeEnv::Static()->ScreenDevice()->DisplayMode()); |
|
3604 } |
|
3605 else if (iHiliBmp->SizeInPixels() != aSize) |
|
3606 { |
|
3607 iHiliBmp->Resize(aSize); |
|
3608 } |
|
3609 |
|
3610 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
3611 CleanupStack::PushL(fbsBitGc); |
|
3612 |
|
3613 CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL(iColorBmp); |
|
3614 CleanupStack::PushL(bmpDevice); |
|
3615 fbsBitGc->Activate(bmpDevice); |
|
3616 fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
3617 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
3618 fbsBitGc->SetBrushColor(color); |
|
3619 fbsBitGc->Clear(); |
|
3620 CleanupStack::PopAndDestroy(bmpDevice); |
|
3621 bmpDevice = NULL; |
|
3622 |
|
3623 bmpDevice = CFbsBitmapDevice::NewL(iHiliBmp); |
|
3624 CleanupStack::PushL(bmpDevice); |
|
3625 fbsBitGc->Activate(bmpDevice); |
|
3626 fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
3627 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
3628 fbsBitGc->SetBrushColor(hiliColor); |
|
3629 fbsBitGc->Clear(); |
|
3630 CleanupStack::PopAndDestroy(bmpDevice); |
|
3631 bmpDevice = NULL; |
|
3632 |
|
3633 CleanupStack::PopAndDestroy(fbsBitGc); |
|
3634 } |
|
3635 |
|
3636 void CCCAppCommLauncherCustomListBoxData::DrawFormattedOld( |
|
3637 TListItemProperties& aProperties, CWindowGc& aGc, const TDesC* aText, |
|
3638 const TRect& aItemRect, TBool aHighlight, const TColors& aColors) const |
|
3639 { |
|
3640 TRect aRect(aItemRect); |
|
3641 const TColors *subcellColors = &aColors; |
|
3642 |
|
3643 TInt lastSubCell = LastSubCell(); |
|
3644 if (lastSubCell == KErrNotFound) |
|
3645 { |
|
3646 aGc.UseFont(CEikonEnv::Static()->NormalFont()); |
|
3647 aGc.DrawText(TPtrC(), aRect, 0); // use draw text so that don't need to change pen color/style |
|
3648 aGc.DiscardFont(); // Release the font cache |
|
3649 return; |
|
3650 } |
|
3651 const CFont* font = SubCellFont(0); |
|
3652 if (font == NULL) |
|
3653 { |
|
3654 font = CEikonEnv::Static()->NormalFont(); |
|
3655 } |
|
3656 |
|
3657 TInt extraVerticalSpace = (aRect.Height() - font->HeightInPixels()); |
|
3658 TInt baseLineOffset = extraVerticalSpace / 2 + font->AscentInPixels(); |
|
3659 TRect textRect = aRect; |
|
3660 textRect.iBr.iX = aRect.iTl.iX; |
|
3661 TInt subcell = 0; |
|
3662 TInt subcell2 = 0; |
|
3663 TPtrC text; |
|
3664 TBool textNull[30]; |
|
3665 TRgb bmpBackColor, bmpForeColor; |
|
3666 TRect textShadowRect; // For transparent list |
|
3667 TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text. |
|
3668 MAknsControlContext *cc = AknsDrawUtils::ControlContext(Control()); |
|
3669 TBool layoutMirrored = AknLayoutUtils::LayoutMirrored(); |
|
3670 TBool skinEnabled = AknsUtils::AvkonSkinEnabled(); |
|
3671 |
|
3672 if (!cc) |
|
3673 { |
|
3674 cc = SkinBackgroundContext(); |
|
3675 } |
|
3676 |
|
3677 |
|
3678 Mem::FillZ(textNull, sizeof(textNull)); |
|
3679 |
|
3680 // cache the text states. |
|
3681 subcell = 0; |
|
3682 for (;;) |
|
3683 { |
|
3684 if (subcell > lastSubCell) |
|
3685 { |
|
3686 break; |
|
3687 } |
|
3688 |
|
3689 TextUtils::ColumnText(text, subcell, aText); |
|
3690 if (text == KNullDesC && SubCellIsNotAlwaysDrawn(subcell)) |
|
3691 { |
|
3692 textNull[subcell] = ETrue; |
|
3693 } |
|
3694 |
|
3695 subcell++; |
|
3696 } |
|
3697 |
|
3698 // this loop handles rectangles that are clipped because of other subcells. |
|
3699 subcell = 0; |
|
3700 |
|
3701 for (;;) |
|
3702 { |
|
3703 if (subcell > lastSubCell) |
|
3704 { |
|
3705 break; |
|
3706 } |
|
3707 |
|
3708 if (textNull[subcell]) |
|
3709 { |
|
3710 ++subcell; |
|
3711 continue; |
|
3712 } |
|
3713 |
|
3714 TRect bRect(SubCellPosition(subcell), SubCellSize(subcell)); |
|
3715 TMargins m(SubCellMargins(subcell)); |
|
3716 TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); |
|
3717 |
|
3718 for (subcell2 = subcell + 1; subcell2 <= lastSubCell; subcell2++) |
|
3719 { |
|
3720 if (textNull[subcell2]) |
|
3721 { |
|
3722 continue; |
|
3723 } |
|
3724 |
|
3725 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! |
|
3726 TRect bRect2 = TRect(SubCellPosition(subcell2),SubCellSize(subcell2)); |
|
3727 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !SubCellIsTransparent(subcell) && !SubCellIsTransparent(subcell2)) |
|
3728 { |
|
3729 if (!layoutMirrored) |
|
3730 { |
|
3731 cRect.iBr.iX = bRect2.iTl.iX; |
|
3732 bRect.iBr.iX = bRect2.iTl.iX; |
|
3733 } |
|
3734 else |
|
3735 { |
|
3736 cRect.iTl.iX = bRect2.iBr.iX; |
|
3737 bRect.iTl.iX = bRect2.iBr.iX; |
|
3738 } |
|
3739 } |
|
3740 } |
|
3741 SetSubCellRealTextSize(subcell, cRect.Size()); |
|
3742 SetSubCellRealSize(subcell, bRect.Size()); |
|
3743 subcell++; |
|
3744 } |
|
3745 |
|
3746 // This loop does the drawing. |
|
3747 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
3748 subcell = 0; |
|
3749 for (;;) |
|
3750 { |
|
3751 if (subcell > lastSubCell) |
|
3752 { |
|
3753 break; |
|
3754 } |
|
3755 |
|
3756 if (textNull[subcell]) |
|
3757 { |
|
3758 ++subcell; |
|
3759 continue; |
|
3760 } |
|
3761 |
|
3762 // SetPosition, SetSize and margins support |
|
3763 TRect bRect(SubCellPosition(subcell), SubCellRealSize(subcell)); |
|
3764 TMargins m(SubCellMargins(subcell)); |
|
3765 TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),SubCellRealTextSize(subcell)); |
|
3766 |
|
3767 |
|
3768 if (bRect.iBr.iX == 0) |
|
3769 { |
|
3770 ++subcell; |
|
3771 continue; |
|
3772 } |
|
3773 |
|
3774 if (layoutMirrored) |
|
3775 { |
|
3776 TRect bRect = TRect(SubCellPosition(subcell),SubCellSize(subcell)); |
|
3777 TRect cRect2 = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); |
|
3778 |
|
3779 |
|
3780 TInt shift = (cRect2.Size() - SubCellRealTextSize(subcell)).iWidth; |
|
3781 cRect.iTl.iX += shift; |
|
3782 cRect.iBr.iX += shift; |
|
3783 } |
|
3784 |
|
3785 textRect.SetRect(aItemRect.iTl + cRect.iTl, cRect.Size()); |
|
3786 |
|
3787 if (UseSubCellColors(subcell)) |
|
3788 { |
|
3789 subcellColors = &SubCellColors(subcell); |
|
3790 } |
|
3791 else |
|
3792 { |
|
3793 subcellColors = &aColors; |
|
3794 } |
|
3795 |
|
3796 if (aHighlight) |
|
3797 { |
|
3798 aGc.SetPenColor(subcellColors->iHighlightedText); |
|
3799 aGc.SetBrushColor(subcellColors->iHighlightedBack); |
|
3800 bmpBackColor = subcellColors->iHighlightedBack; |
|
3801 bmpForeColor = subcellColors->iHighlightedText; |
|
3802 if (skinEnabled && iExtension) |
|
3803 { |
|
3804 if (iExtension->iHighlightedTextColor != NULL) |
|
3805 { |
|
3806 aGc.SetPenColor(iExtension->iHighlightedTextColor); |
|
3807 bmpForeColor = iExtension->iHighlightedTextColor; |
|
3808 } |
|
3809 } |
|
3810 } |
|
3811 else |
|
3812 { |
|
3813 aGc.SetPenColor(subcellColors->iText); |
|
3814 aGc.SetBrushColor(subcellColors->iBack); |
|
3815 bmpBackColor = subcellColors->iBack; |
|
3816 bmpForeColor = subcellColors->iText; |
|
3817 |
|
3818 if (skinEnabled && iExtension) |
|
3819 { |
|
3820 if (iExtension->iTextColor != NULL) |
|
3821 { |
|
3822 aGc.SetPenColor(iExtension->iTextColor); |
|
3823 bmpForeColor = iExtension->iTextColor; |
|
3824 } |
|
3825 } |
|
3826 } |
|
3827 |
|
3828 aGc.SetBrushStyle(CGraphicsContext::ENullBrush); |
|
3829 |
|
3830 // The following draws subcells to textRect |
|
3831 if (textRect.iBr.iX != textRect.iTl.iX) |
|
3832 { |
|
3833 TextUtils::ColumnText(text, subcell, aText); |
|
3834 |
|
3835 // graphics or text column |
|
3836 CGraphicsContext::TTextAlign align = SubCellAlignment(subcell); |
|
3837 if (!SubCellIsGraphics(subcell)) |
|
3838 { |
|
3839 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); |
|
3840 const CFont* cellFont=Font(aProperties, subcell); |
|
3841 const CFont* tempFont=(cellFont) ? cellFont : font; |
|
3842 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont; |
|
3843 aGc.UseFont(usedFont); |
|
3844 SetUnderlineStyle(aProperties, aGc, subcell); |
|
3845 |
|
3846 // baseline calc needed for each cell. |
|
3847 baseLineOffset = SubCellBaselinePos(subcell); |
|
3848 baseLineOffset -= cRect.iTl.iY; |
|
3849 if (!baseLineOffset) |
|
3850 { |
|
3851 baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels(); |
|
3852 } |
|
3853 |
|
3854 TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf = |
|
3855 text.Left(KMaxColumnDataLength); |
|
3856 |
|
3857 // Note that this potentially modifies the text so its lenght in pixels |
|
3858 // might increase. Therefore, this should always be done before |
|
3859 // wrapping/clipping text. In some cases, WordWrapListItem is called |
|
3860 // before coming here. Is it certain that it is not done for number subcells? |
|
3861 if (SubCellIsNumberCell(subcell)) |
|
3862 { |
|
3863 AknTextUtils::LanguageSpecificNumberConversion(clipbuf); |
|
3864 } |
|
3865 |
|
3866 TBool clipped(EFalse); |
|
3867 TInt clipgap = SubCellTextClipGap(subcell); |
|
3868 |
|
3869 if ( iExtension->iUseLogicalToVisualConversion && |
|
3870 subcell != iExtension->iFirstWordWrappedSubcellIndex && |
|
3871 subcell != iExtension->iSecondWordWrappedSubcellIndex ) |
|
3872 { |
|
3873 TInt maxClipWidth = textRect.Size().iWidth + clipgap; |
|
3874 |
|
3875 clipped = AknBidiTextUtils::ConvertToVisualAndClip( |
|
3876 text.Left(KMaxColumnDataLength), |
|
3877 clipbuf, |
|
3878 *usedFont, |
|
3879 textRect.Size().iWidth, |
|
3880 maxClipWidth ); |
|
3881 } |
|
3882 |
|
3883 if (clipped) |
|
3884 { |
|
3885 if (!layoutMirrored) |
|
3886 { |
|
3887 textRect.iBr.iX += clipgap; |
|
3888 } |
|
3889 else |
|
3890 { |
|
3891 textRect.iTl.iX -= clipgap; |
|
3892 } |
|
3893 } |
|
3894 |
|
3895 if (aHighlight) |
|
3896 { |
|
3897 if (clipped) |
|
3898 { |
|
3899 iExtension->iClippedSubcells |= (1 << subcell); |
|
3900 } |
|
3901 else |
|
3902 { |
|
3903 iExtension->iClippedSubcells &= ~(1 << subcell); |
|
3904 } |
|
3905 |
|
3906 if (iExtension->iUseClippedByWrap) // override if already clipped |
|
3907 { |
|
3908 iExtension->iClippedSubcells = iExtension->iClippedByWrap; |
|
3909 } |
|
3910 } |
|
3911 |
|
3912 CAknMarqueeControl* marquee = |
|
3913 subcell == 1 ? iExtension->iMarquee : |
|
3914 iExtension->i2ndLineMarquee; |
|
3915 |
|
3916 TBool marqueeDisabled = |
|
3917 static_cast<CEikListBox*>( |
|
3918 Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; |
|
3919 |
|
3920 if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled ) |
|
3921 { |
|
3922 // Let marquee know if it needs to do bidi conversion. |
|
3923 marquee->UseLogicalToVisualConversion( clipped ); |
|
3924 |
|
3925 if ( marquee->DrawText( aGc, textRect, text, baseLineOffset, align, *usedFont ) ) |
|
3926 { |
|
3927 // All the loops have been executed -> the text needs to be truncated. |
|
3928 aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); |
|
3929 } |
|
3930 } |
|
3931 else |
|
3932 { |
|
3933 if (marquee && marqueeDisabled) |
|
3934 { |
|
3935 marquee->Stop(); |
|
3936 } |
|
3937 |
|
3938 if (IsBackgroundDrawingEnabled()) |
|
3939 { |
|
3940 aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); |
|
3941 } |
|
3942 else // "Transparent" list, draw text shadow first, then the actual text. |
|
3943 { |
|
3944 textShadowRect = textRect; |
|
3945 textShadowRect.Move( 1, 1 ); |
|
3946 aGc.SetPenColor( textShadowColour ); |
|
3947 aGc.DrawText( clipbuf, textShadowRect, baseLineOffset, align, 0 ); |
|
3948 if ( aHighlight ) |
|
3949 { |
|
3950 aGc.SetPenColor( subcellColors->iHighlightedText ); |
|
3951 } |
|
3952 else |
|
3953 { |
|
3954 aGc.SetPenColor( subcellColors->iText ); |
|
3955 } |
|
3956 aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); |
|
3957 } |
|
3958 } |
|
3959 |
|
3960 if (iExtension->iPictoInterface) |
|
3961 { |
|
3962 iExtension->iPictoInterface->Interface()->DrawPictographsInText( |
|
3963 aGc, *usedFont, clipbuf, textRect, baseLineOffset, align, 0 ); |
|
3964 } |
|
3965 // disable underline after first text. |
|
3966 // at least phonebook uses this. See SetSubcellUnderlined to override |
|
3967 aGc.SetUnderlineStyle(EUnderlineOff); |
|
3968 aGc.DiscardFont(); // Release the font cache |
|
3969 } |
|
3970 else // Graphics subcell |
|
3971 { |
|
3972 TLex lex(text); |
|
3973 TInt index; |
|
3974 //__ASSERT_ALWAYS(lex.Val(index)==KErrNone,Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); |
|
3975 //__ASSERT_DEBUG(iIconArray, Panic(EAknPanicOutOfRange)); |
|
3976 if (index == KColorIconFlag) |
|
3977 index = KColorIconIdx; |
|
3978 //__ASSERT_DEBUG((index>=0 && index<iIconArray->Count()),Panic(EAknPanicFormattedCellListInvalidBitmapIndex)); |
|
3979 TRect bmpRect; |
|
3980 bmpRect.iTl = textRect.iTl; |
|
3981 |
|
3982 if (index >= 0 && iIconArray) |
|
3983 { |
|
3984 CGulIcon* icon = (*iIconArray)[index]; |
|
3985 CFbsBitmap* bitmap = icon->Bitmap(); |
|
3986 |
|
3987 if (iExtension) |
|
3988 { |
|
3989 TInt w, h; |
|
3990 TSize sz = bitmap->SizeInPixels(); |
|
3991 |
|
3992 w = iExtension->iSubCellIconSize[subcell].iWidth; |
|
3993 h = iExtension->iSubCellIconSize[subcell].iHeight; |
|
3994 |
|
3995 if (h != 0 && w != 0 && !(sz.iWidth == w || sz.iHeight |
|
3996 == h)) |
|
3997 { |
|
3998 AknIconUtils::SetSize(bitmap, |
|
3999 iExtension->iSubCellIconSize[subcell], |
|
4000 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
4001 } |
|
4002 else if (sz.iWidth == 0 || sz.iHeight == 0) // check if size is set at all |
|
4003 { |
|
4004 // just in case fallback |
|
4005 AknIconUtils::SetSize(bitmap, textRect.Size(), |
|
4006 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
4007 } |
|
4008 } |
|
4009 |
|
4010 TSize size = bitmap->SizeInPixels(); |
|
4011 |
|
4012 if (size.iWidth > textRect.Size().iWidth) |
|
4013 { |
|
4014 size.iWidth = textRect.Size().iWidth; |
|
4015 } |
|
4016 |
|
4017 if (size.iHeight > textRect.Size().iHeight) |
|
4018 { |
|
4019 size.iHeight = textRect.Size().iHeight; |
|
4020 } |
|
4021 |
|
4022 TPoint bmpPos = textRect.iTl; |
|
4023 bmpPos.iY += (textRect.Height() - size.iHeight) >> 1; |
|
4024 switch (align) |
|
4025 { |
|
4026 case ELeft: |
|
4027 break; |
|
4028 case ECenter: |
|
4029 bmpPos.iX += (textRect.Width() - size.iWidth) >> 1; |
|
4030 break; |
|
4031 case ERight: |
|
4032 bmpPos.iX = textRect.iBr.iX - size.iWidth; |
|
4033 break; |
|
4034 } |
|
4035 bmpRect = TRect(bmpPos, size); |
|
4036 TPoint posInBitmap = TPoint(0,0) + bitmap->SizeInPixels() - textRect.Size(); |
|
4037 posInBitmap.iX /= 2; |
|
4038 posInBitmap.iY /= 2; |
|
4039 if (posInBitmap.iX < 0) |
|
4040 { |
|
4041 posInBitmap.iX = 0; |
|
4042 } |
|
4043 if (posInBitmap.iY < 0) |
|
4044 { |
|
4045 posInBitmap.iY = 0; |
|
4046 } |
|
4047 TRect rect(posInBitmap, textRect.Size()); |
|
4048 |
|
4049 if (icon->Mask()) |
|
4050 { |
|
4051 aGc.BitBltMasked(bmpPos, bitmap, rect, icon->Mask(), |
|
4052 ETrue); |
|
4053 } |
|
4054 else |
|
4055 { |
|
4056 aGc.BitBlt(bmpPos, bitmap, rect); |
|
4057 } |
|
4058 } |
|
4059 aGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
4060 } |
|
4061 } |
|
4062 aGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
4063 ++subcell; |
|
4064 } |
|
4065 |
|
4066 // Clear information of wordwrapped and bidi-reordered subcells. |
|
4067 const_cast<CCCAppCommLauncherCustomListBoxData*> (this)-> SetWordWrappedSubcellIndices( |
|
4068 -1, -1); |
|
4069 } |
|
4070 |
|
4071 void CCCAppCommLauncherCustomListBoxData::SetClippedByWrap( |
|
4072 TUint32 aClippedCells, TBool aUseClippedByWrap) |
|
4073 { |
|
4074 if (iExtension) |
|
4075 { |
|
4076 iExtension->iClippedByWrap = aClippedCells; |
|
4077 iExtension->iUseClippedByWrap = aUseClippedByWrap; |
|
4078 } |
|
4079 } |
|
4080 |
|
4081 TUint32 CCCAppCommLauncherCustomListBoxData::CurrentItemTextWasClipped() const |
|
4082 { |
|
4083 return iExtension ? iExtension->iClippedSubcells : 0; |
|
4084 } |
|
4085 |
|
4086 TBool CCCAppCommLauncherCustomListBoxData::KineticScrollingEnabled() const |
|
4087 { |
|
4088 if (iExtension) |
|
4089 { |
|
4090 return iExtension->iKineticScrolling; |
|
4091 } |
|
4092 return EFalse; |
|
4093 } |
|
4094 |
|
4095 CEikListBox* CCCAppCommLauncherCustomListBoxData::ListBox() const |
|
4096 { |
|
4097 if (iExtension && iExtension->iControl) |
|
4098 { |
|
4099 return static_cast<CEikListBox*> (iExtension->iControl); |
|
4100 } |
|
4101 return NULL; |
|
4102 } |
|
4103 void CCCAppCommLauncherCustomListBoxData::InitSmileyL() |
|
4104 { |
|
4105 //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4106 if ( iExtension && !iExtension->iSmileyMan ) |
|
4107 { |
|
4108 iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension ); |
|
4109 } |
|
4110 } |
|
4111 |
|
4112 void CCCAppCommLauncherCustomListBoxData::SetSmileySubCellL( TInt aSubCell ) |
|
4113 { |
|
4114 //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4115 TInt index = 0; |
|
4116 if ( iExtension ) |
|
4117 { |
|
4118 iExtension->FindSLSubCellIndexOrAddL( index,aSubCell ); |
|
4119 iExtension->AtSL(index).iSmileyCell = ETrue; |
|
4120 } |
|
4121 } |
|
4122 // End of File |
|
4123 |