48 #include <aknlistboxtfxinternal.h> |
48 #include <aknlistboxtfxinternal.h> |
49 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
49 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
50 |
50 |
51 |
51 |
52 #include <touchfeedback.h> |
52 #include <touchfeedback.h> |
|
53 #include <AknSmileyUtils.h> |
53 // there are 17(!) subcells in qdial grid (0 ... 16) |
54 // there are 17(!) subcells in qdial grid (0 ... 16) |
54 const TInt KMaxSubCellIndex = 16 + 1; |
55 const TInt KMaxSubCellIndex = 16 + 1; |
55 |
56 |
56 // colored tick marks support |
57 // colored tick marks support |
57 const TInt KColorIconFlag = -1; |
58 const TInt KColorIconFlag = -1; |
58 const TInt KColorIconIdx = 0; |
59 const TInt KColorIconIdx = 0; |
|
60 // smiley text place holder |
|
61 _LIT( KPlaceHolder, "\xFFF0i" ); |
59 |
62 |
60 /** |
63 /** |
61 * This class needs to be in .cpp file so that we do not accidentally make it |
64 * This class needs to be in .cpp file so that we do not accidentally make it |
62 * derivable; that would destroy all the binary compability advantages this |
65 * derivable; that would destroy all the binary compability advantages this |
63 * class has.. |
66 * class has.. |
74 */ |
77 */ |
75 NONSHARABLE_CLASS(CCCAppCommLauncherCustomListBoxDataExtension) : public CActive, |
78 NONSHARABLE_CLASS(CCCAppCommLauncherCustomListBoxDataExtension) : public CActive, |
76 public MAknPictographAnimatorCallBack, |
79 public MAknPictographAnimatorCallBack, |
77 public MCoeForegroundObserver, |
80 public MCoeForegroundObserver, |
78 public MAknsEffectAnimObserver, |
81 public MAknsEffectAnimObserver, |
79 public MListBoxItemChangeObserver |
82 public MListBoxItemChangeObserver, |
|
83 public MAknSmileyObserver |
80 { |
84 { |
81 public: |
85 public: |
82 enum TFlag |
86 enum TFlag |
83 { |
87 { |
84 // Set if current item background should be copied to animation as |
88 // Set if current item background should be copied to animation as |
118 TInt iSubCell; // Must be first entry |
122 TInt iSubCell; // Must be first entry |
119 TAknTextLineLayout iTextLayout; |
123 TAknTextLineLayout iTextLayout; |
120 TAknWindowLineLayout iGraphicLayout; |
124 TAknWindowLineLayout iGraphicLayout; |
121 TInt iSubCellType; |
125 TInt iSubCellType; |
122 TInt iConditionValue; // used with conditional layouts for not always drawn subcells |
126 TInt iConditionValue; // used with conditional layouts for not always drawn subcells |
|
127 TBool iSmileyCell; |
123 }; |
128 }; |
124 |
129 |
125 SRowAndSubCell& At(TInt aArrayIndex); |
130 SRowAndSubCell& At(TInt aArrayIndex); |
126 const SRowAndSubCell& At(TInt aArrayIndex) const; |
131 const SRowAndSubCell& At(TInt aArrayIndex) const; |
127 void AddRowAndSubCellL(TInt aRow, TInt aSubCell); |
132 void AddRowAndSubCellL(TInt aRow, TInt aSubCell); |
168 void CreateColorBitmapsL(TSize aSize); |
173 void CreateColorBitmapsL(TSize aSize); |
169 void CreateColorBitmapsL(); |
174 void CreateColorBitmapsL(); |
170 |
175 |
171 TBool DrawPressedDownEffectL(MAknsSkinInstance* aSkin, CWindowGc& aGc, |
176 TBool DrawPressedDownEffectL(MAknsSkinInstance* aSkin, CWindowGc& aGc, |
172 const TRect& aOutRect, const TRect& aInnerRect) const; |
177 const TRect& aOutRect, const TRect& aInnerRect) const; |
|
178 void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, |
|
179 const TAknLayoutText& aLayout, |
|
180 TBool aUseLogicalToVisualConversion, |
|
181 const TRgb &aColor); |
|
182 TInt ConvertTextToSmiley( TDes& aText ); |
173 private: |
183 private: |
174 // New internal methods |
184 // New internal methods |
175 TBool DrawHighlightBackground(CFbsBitGc& aGc); |
185 TBool DrawHighlightBackground(CFbsBitGc& aGc); |
176 void PostDeleteAnimation(); |
186 void PostDeleteAnimation(); |
177 void CreateAnimationL(); |
187 void CreateAnimationL(); |
189 |
199 |
190 void SetSubCellLayoutAlignmentL(TInt aSubCellIndex); |
200 void SetSubCellLayoutAlignmentL(TInt aSubCellIndex); |
191 |
201 |
192 TInt FindSubCellExtIndex(TInt& aArrayIndex, TInt aSubCell) const; |
202 TInt FindSubCellExtIndex(TInt& aArrayIndex, TInt aSubCell) const; |
193 TBool SubCellLayoutAlignment(TInt aSubCellIndex) const; |
203 TBool SubCellLayoutAlignment(TInt aSubCellIndex) const; |
194 |
204 public: // from MAknSmileyObserver |
|
205 void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon ); |
|
206 void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon ); |
195 private: |
207 private: |
196 // From MAknPictographAnimatorCallBack |
208 // From MAknPictographAnimatorCallBack |
197 void DrawPictographArea(); |
209 void DrawPictographArea(); |
198 |
210 |
199 public: |
211 public: |
259 |
271 |
260 CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment |
272 CArrayFix<TSubCellExt>* iSubCellExtArray; //for subcell alignment |
261 |
273 |
262 TRect iMarginRect; |
274 TRect iMarginRect; |
263 TBool iKineticScrolling; |
275 TBool iKineticScrolling; |
|
276 CAknSmileyManager* iSmileyMan; |
|
277 TSize iSmileySize; // last set simley size |
264 }; |
278 }; |
265 |
279 |
266 /** |
280 /** |
267 * High priority is well argumented because running the active object will |
281 * High priority is well argumented because running the active object will |
268 * result in animation deletion -> results in freeing resources. |
282 * result in animation deletion -> results in freeing resources. |
315 Cancel(); |
329 Cancel(); |
316 |
330 |
317 // Stop receiving foreground events |
331 // Stop receiving foreground events |
318 CCoeEnv* env = CCoeEnv::Static(); |
332 CCoeEnv* env = CCoeEnv::Static(); |
319 env->RemoveForegroundObserver(*this); |
333 env->RemoveForegroundObserver(*this); |
|
334 delete iSmileyMan; |
320 |
335 |
321 delete iRowAndSubCellArray; |
336 delete iRowAndSubCellArray; |
322 iRowAndSubCellArray = NULL; |
337 iRowAndSubCellArray = NULL; |
323 delete iSLSubCellArray; |
338 delete iSLSubCellArray; |
324 iSLSubCellArray = NULL; |
339 iSLSubCellArray = NULL; |
392 subcell.iSubCell = aSubCell; |
407 subcell.iSubCell = aSubCell; |
393 subcell.iTextLayout = NULL; |
408 subcell.iTextLayout = NULL; |
394 subcell.iGraphicLayout = NULL; |
409 subcell.iGraphicLayout = NULL; |
395 subcell.iSubCellType = 0; |
410 subcell.iSubCellType = 0; |
396 subcell.iConditionValue = -1; |
411 subcell.iConditionValue = -1; |
|
412 subcell.iSmileyCell = EFalse; |
397 |
413 |
398 TKeyArrayFix key(0, ECmpTInt32); |
414 TKeyArrayFix key(0, ECmpTInt32); |
399 iSLSubCellArray->InsertIsqL(subcell, key); |
415 iSLSubCellArray->InsertIsqL(subcell, key); |
400 } |
416 } |
401 |
417 |
1098 TInt index = 0; |
1114 TInt index = 0; |
1099 if (FindSubCellExtIndex(index, aSubCellIndex) == KErrNotFound) |
1115 if (FindSubCellExtIndex(index, aSubCellIndex) == KErrNotFound) |
1100 return (ETrue); |
1116 return (ETrue); |
1101 return (iSubCellExtArray->At(index).iLayoutAlign); |
1117 return (iSubCellExtArray->At(index).iLayoutAlign); |
1102 } |
1118 } |
|
1119 void CCCAppCommLauncherCustomListBoxDataExtension::SmileyStillImageLoaded( |
|
1120 CAknSmileyIcon* /*aSmileyIcon*/) |
|
1121 { |
|
1122 iControl->DrawDeferred(); |
|
1123 } |
|
1124 |
|
1125 void CCCAppCommLauncherCustomListBoxDataExtension::SmileyAnimationChanged( |
|
1126 CAknSmileyIcon* /*aSmileyIcon*/ ) |
|
1127 { |
|
1128 } |
1103 |
1129 |
1104 ///////////handling TSubCellExt,end |
1130 ///////////handling TSubCellExt,end |
1105 |
1131 |
1106 void CCCAppCommLauncherCustomListBoxDataExtension::DrawPictographArea() |
1132 void CCCAppCommLauncherCustomListBoxDataExtension::DrawPictographArea() |
1107 { |
1133 { |
1149 const TRect& aInnerRect) const |
1175 const TRect& aInnerRect) const |
1150 { |
1176 { |
1151 return AknsDrawUtils::DrawFrame(aInstance, aGc, aOutRect, aInnerRect, |
1177 return AknsDrawUtils::DrawFrame(aInstance, aGc, aOutRect, aInnerRect, |
1152 KAknsIIDQsnFrListPressed, KAknsIIDQsnFrListCenterPressed); |
1178 KAknsIIDQsnFrListPressed, KAknsIIDQsnFrListCenterPressed); |
1153 } |
1179 } |
|
1180 void CCCAppCommLauncherCustomListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc, |
|
1181 const TDesC& aSmileyText, |
|
1182 const TAknLayoutText& aLayout, |
|
1183 TBool aUseLogicalToVisualConversion, |
|
1184 const TRgb& aColor ) |
|
1185 { |
|
1186 //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1187 TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), |
|
1188 aLayout.Font()->HeightInPixels() ); |
|
1189 TSize s(l,l); |
|
1190 if ( iSmileySize != s ) |
|
1191 { |
|
1192 iSmileyMan->SetSize( s ); |
|
1193 iSmileySize = s; |
|
1194 } |
|
1195 aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor... |
|
1196 iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion ); |
|
1197 } |
|
1198 TInt CCCAppCommLauncherCustomListBoxDataExtension::ConvertTextToSmiley( TDes& aText) |
|
1199 { |
|
1200 //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1201 TInt count = 0; |
|
1202 TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ; |
|
1203 return err == KErrNone ? count : err; |
|
1204 } |
1154 |
1205 |
1155 CCoeControl *CCCAppCommLauncherCustomListBoxData::Control() const |
1206 CCoeControl *CCCAppCommLauncherCustomListBoxData::Control() const |
1156 { |
1207 { |
1157 return iExtension->iControl; |
1208 return iExtension->iControl; |
1158 } |
1209 } |
1999 textLayout.LayoutText(textRect, textLineLayout, usedFont); |
2050 textLayout.LayoutText(textRect, textLineLayout, usedFont); |
2000 |
2051 |
2001 SetUnderlineStyle( aProperties, aGc, subcell ); |
2052 SetUnderlineStyle( aProperties, aGc, subcell ); |
2002 |
2053 |
2003 // * 2 == leave some room for marquee |
2054 // * 2 == leave some room for marquee |
2004 const TInt maxlen( KMaxColumnDataLength * 2 ); |
2055 const TInt maxlen( KMaxColumnDataLength * 3 ); |
2005 TBuf<maxlen> convBuf = text.Left(maxlen); |
2056 TBuf<maxlen> convBuf = text.Left(maxlen); |
|
2057 TBool smileyDraw = EFalse; |
|
2058 // do smiley convert before clipping. don't worry marquee now. |
|
2059 if ( iExtension->iSmileyMan && |
|
2060 iExtension->AtSL(SCindex).iSmileyCell && |
|
2061 iExtension->ConvertTextToSmiley( convBuf ) > 0 ) |
|
2062 { |
|
2063 smileyDraw = ETrue; |
|
2064 } |
2006 |
2065 |
2007 // Note that this potentially modifies the text so its lenght in pixels |
2066 // Note that this potentially modifies the text so its lenght in pixels |
2008 // might increase. Therefore, this should always be done before |
2067 // might increase. Therefore, this should always be done before |
2009 // wrapping/clipping text. In some cases, WordWrapListItem is called |
2068 // wrapping/clipping text. In some cases, WordWrapListItem is called |
2010 // before coming here. Is it certain that it is not done for number subcells? |
2069 // before coming here. Is it certain that it is not done for number subcells? |
2065 if ( marquee && marqueeDisabled ) |
2124 if ( marquee && marqueeDisabled ) |
2066 { |
2125 { |
2067 marquee->Stop(); |
2126 marquee->Stop(); |
2068 } |
2127 } |
2069 |
2128 |
2070 textLayout.DrawText( aGc, convBuf, bidiConv, color ); |
2129 if ( smileyDraw ) |
2071 } |
2130 { |
2072 |
2131 TRect tr(textLayout.TextRect()); |
|
2132 iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color ); |
|
2133 } |
|
2134 else |
|
2135 { |
|
2136 textLayout.DrawText( aGc, convBuf, bidiConv, color ); |
|
2137 } |
|
2138 } |
2073 if ( iExtension->iPictoInterface ) |
2139 if ( iExtension->iPictoInterface ) |
2074 { |
2140 { |
2075 |
2141 |
2076 TRect pictoRect = textLayout.TextRect(); |
2142 TRect pictoRect = textLayout.TextRect(); |
2077 pictoRect.Normalize(); |
2143 pictoRect.Normalize(); |
3976 { |
4043 { |
3977 return static_cast<CEikListBox*> (iExtension->iControl); |
4044 return static_cast<CEikListBox*> (iExtension->iControl); |
3978 } |
4045 } |
3979 return NULL; |
4046 return NULL; |
3980 } |
4047 } |
3981 |
4048 void CCCAppCommLauncherCustomListBoxData::InitSmileyL() |
|
4049 { |
|
4050 //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4051 if ( iExtension && !iExtension->iSmileyMan ) |
|
4052 { |
|
4053 iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension ); |
|
4054 } |
|
4055 } |
|
4056 |
|
4057 void CCCAppCommLauncherCustomListBoxData::SetSmileySubCellL( TInt aSubCell ) |
|
4058 { |
|
4059 //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4060 TInt index = 0; |
|
4061 if ( iExtension ) |
|
4062 { |
|
4063 iExtension->FindSLSubCellIndexOrAddL( index,aSubCell ); |
|
4064 iExtension->AtSL(index).iSmileyCell = ETrue; |
|
4065 } |
|
4066 } |
3982 // End of File |
4067 // End of File |
3983 |
4068 |