32 #include <eikslbd.h> |
38 #include <eikslbd.h> |
33 #include "AknDebug.h" |
39 #include "AknDebug.h" |
34 #include <aknlayoutscalable_avkon.cdl.h> |
40 #include <aknlayoutscalable_avkon.cdl.h> |
35 #include <layoutmetadata.cdl.h> |
41 #include <layoutmetadata.cdl.h> |
36 #include <aknphysics.h> |
42 #include <aknphysics.h> |
|
43 #include <AknIconArray.h> |
|
44 #include <avkon.mbg> |
37 |
45 |
38 |
46 |
39 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
47 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
40 #include <aknlistloadertfx.h> |
48 #include <aknlistloadertfx.h> |
41 #include <aknlistboxtfxinternal.h> |
49 #include <aknlistboxtfxinternal.h> |
42 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
50 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
43 |
51 |
44 #include <touchfeedback.h> |
52 #include <touchfeedback.h> |
|
53 #include <AknSmileyUtils.h> |
45 #include "akntrace.h" |
54 #include "akntrace.h" |
46 |
55 |
47 // there are 17(!) subcells in qdial grid (0 ... 16) |
56 // there are 17(!) subcells in qdial grid (0 ... 16) |
48 const TInt KMaxSubCellIndex = 16 + 1; |
57 const TInt KMaxSubCellIndex = 16 + 1; |
49 |
58 |
50 // colored tick marks support |
59 // colored tick marks support |
51 const TInt KColorIconFlag = -1; |
60 const TInt KColorIconFlag = -1; |
52 const TInt KColorIconIdx = 0; |
61 const TInt KColorIconIdx = 0; |
|
62 |
|
63 // Number of icons in marking mode icon array |
|
64 const TInt KMarkingModeIconArraySize = 2; |
|
65 |
|
66 // smiley text place holder |
|
67 _LIT( KPlaceHolder, "\xFFF0i" ); |
53 |
68 |
54 /** |
69 /** |
55 * This class needs to be in .cpp file so that we do not accidentally make it |
70 * This class needs to be in .cpp file so that we do not accidentally make it |
56 * derivable; that would destroy all the binary compability advantages this |
71 * derivable; that would destroy all the binary compability advantages this |
57 * class has.. |
72 * class has.. |
115 TInt iSubCell; // Must be first entry |
131 TInt iSubCell; // Must be first entry |
116 TAknTextLineLayout iTextLayout; |
132 TAknTextLineLayout iTextLayout; |
117 TAknWindowLineLayout iGraphicLayout; |
133 TAknWindowLineLayout iGraphicLayout; |
118 TInt iSubCellType; |
134 TInt iSubCellType; |
119 TInt iConditionValue; // used with conditional layouts for not always drawn subcells |
135 TInt iConditionValue; // used with conditional layouts for not always drawn subcells |
|
136 TBool iSmileyCell; |
120 }; |
137 }; |
121 |
138 |
122 SRowAndSubCell& At(TInt aArrayIndex); |
139 SRowAndSubCell& At(TInt aArrayIndex); |
123 const SRowAndSubCell& At(TInt aArrayIndex) const; |
140 const SRowAndSubCell& At(TInt aArrayIndex) const; |
124 void AddRowAndSubCellL(TInt aRow,TInt aSubCell); |
141 void AddRowAndSubCellL(TInt aRow,TInt aSubCell); |
125 TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const; |
142 TInt FindRowAndSubCellIndex(TInt& aArrayIndex,TInt aRow,TInt aSubCell) const; |
126 void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell); |
143 void FindRowAndSubCellIndexOrAddL(TInt& aArrayIndex,TInt aRow,TInt aSubCell); |
127 |
144 |
128 SSLSubCell& AtSL(TInt aArrayIndex); |
145 SSLSubCell& SLAt(TInt aArrayIndex); |
129 const SSLSubCell& AtSL(TInt aArrayIndex) const; |
146 const SSLSubCell& SLAt(TInt aArrayIndex) const; |
130 void AddSLSubCellL(TInt aSubCell); |
147 void AddSLSubCellL(TInt aSubCell); |
131 TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const; |
148 TInt FindSLSubCellIndex(TInt& aArrayIndex, TInt aSubCell) const; |
132 void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell); |
149 void FindSLSubCellIndexOrAddL(TInt& aArrayIndex, TInt aSubCell); |
133 void ResetSLSubCellArray(); |
150 void ResetSLSubCellArray(); |
134 |
151 |
401 subcell.iSubCell = aSubCell; |
439 subcell.iSubCell = aSubCell; |
402 subcell.iTextLayout = NULL; |
440 subcell.iTextLayout = NULL; |
403 subcell.iGraphicLayout = NULL; |
441 subcell.iGraphicLayout = NULL; |
404 subcell.iSubCellType = 0; |
442 subcell.iSubCellType = 0; |
405 subcell.iConditionValue = -1; |
443 subcell.iConditionValue = -1; |
|
444 subcell.iSmileyCell = EFalse; |
406 |
445 |
407 TKeyArrayFix key(0,ECmpTInt32); |
446 TKeyArrayFix key(0,ECmpTInt32); |
408 iSLSubCellArray->InsertIsqL(subcell,key); |
447 iSLSubCellArray->InsertIsqL(subcell,key); |
409 } |
448 } |
410 |
449 |
411 |
450 |
412 CFormattedCellListBoxDataExtension::SSLSubCell& |
451 CFormattedCellListBoxDataExtension::SSLSubCell& |
413 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) |
452 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) |
414 { |
453 { |
415 __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
454 __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
416 return(iSLSubCellArray->At(aArrayIndex)); |
455 return(iSLSubCellArray->At(aArrayIndex)); |
417 } |
456 } |
418 |
457 |
419 const CFormattedCellListBoxDataExtension::SSLSubCell& |
458 const CFormattedCellListBoxDataExtension::SSLSubCell& |
420 CFormattedCellListBoxDataExtension::AtSL(TInt aArrayIndex) const |
459 CFormattedCellListBoxDataExtension::SLAt(TInt aArrayIndex) const |
421 { |
460 { |
422 __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
461 __ASSERT_DEBUG(aArrayIndex>=0 && aArrayIndex<iSLSubCellArray->Count(),Panic(EAknPanicOutOfRange)); |
423 return(iSLSubCellArray->At(aArrayIndex)); |
462 return(iSLSubCellArray->At(aArrayIndex)); |
424 } |
463 } |
425 |
464 |
1247 aInnerRect, |
1296 aInnerRect, |
1248 KAknsIIDQsnFrListPressed, |
1297 KAknsIIDQsnFrListPressed, |
1249 KAknsIIDQsnFrListCenterPressed ); |
1298 KAknsIIDQsnFrListCenterPressed ); |
1250 } |
1299 } |
1251 |
1300 |
|
1301 void CFormattedCellListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc, |
|
1302 const TDesC& aSmileyText, |
|
1303 const TAknLayoutText& aLayout, |
|
1304 TBool aUseLogicalToVisualConversion, |
|
1305 const TRgb& aColor ) |
|
1306 { |
|
1307 __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1308 TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), |
|
1309 aLayout.Font()->HeightInPixels() ); |
|
1310 TSize s(l,l); |
|
1311 if ( iSmileySize != s ) |
|
1312 { |
|
1313 iSmileyMan->SetSize( s ); |
|
1314 iSmileySize = s; |
|
1315 } |
|
1316 aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor... |
|
1317 iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion ); |
|
1318 } |
|
1319 TInt CFormattedCellListBoxDataExtension::ConvertTextToSmiley( TDes& aText) |
|
1320 { |
|
1321 __ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed)); |
|
1322 TInt count = 0; |
|
1323 TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ; |
|
1324 return err == KErrNone ? count : err; |
|
1325 } |
|
1326 |
|
1327 |
|
1328 // ----------------------------------------------------------------------------- |
|
1329 // CFormattedCellListBoxDataExtension::LoadMarkingIconsL |
|
1330 // ----------------------------------------------------------------------------- |
|
1331 // |
|
1332 void CFormattedCellListBoxDataExtension::LoadMarkingIconsL() |
|
1333 { |
|
1334 if ( !iMarkingIconArray ) |
|
1335 { |
|
1336 iMarkingIconArray = new ( ELeave ) CAknIconArray( |
|
1337 KMarkingModeIconArraySize ); |
|
1338 } |
|
1339 else |
|
1340 { |
|
1341 iMarkingIconArray->ResetAndDestroy(); |
|
1342 } |
|
1343 |
|
1344 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1345 const TDesC& avkonIconFile = AknIconUtils::AvkonIconFileName(); |
|
1346 |
|
1347 CGulIcon* icon = AknsUtils::CreateGulIconL( skin, |
|
1348 KAknsIIDQgnPropCheckboxOn, |
|
1349 avkonIconFile, |
|
1350 EMbmAvkonQgn_prop_checkbox_on, |
|
1351 EMbmAvkonQgn_prop_checkbox_on_mask ); |
|
1352 |
|
1353 CleanupStack::PushL( icon ); |
|
1354 iMarkingIconArray->AppendL( icon ); |
|
1355 CleanupStack::Pop( icon ); |
|
1356 |
|
1357 icon = AknsUtils::CreateGulIconL( skin, |
|
1358 KAknsIIDQgnPropCheckboxOff, |
|
1359 avkonIconFile, |
|
1360 EMbmAvkonQgn_prop_checkbox_off, |
|
1361 EMbmAvkonQgn_prop_checkbox_off_mask ); |
|
1362 |
|
1363 CleanupStack::PushL( icon ); |
|
1364 iMarkingIconArray->AppendL( icon ); |
|
1365 CleanupStack::Pop( icon ); |
|
1366 } |
|
1367 |
1252 |
1368 |
1253 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const |
1369 EXPORT_C CCoeControl *CFormattedCellListBoxData::Control() const |
1254 { |
1370 { |
|
1371 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1255 return iExtension->iControl; |
1372 return iExtension->iControl; |
1256 } |
1373 } |
1257 |
1374 |
1258 EXPORT_C void CFormattedCellListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition) |
1375 EXPORT_C void CFormattedCellListBoxData::SetSeparatorLinePosition(TAknSeparatorLinePosition aPosition) |
1259 { |
1376 { |
1260 if (iExtension) |
1377 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1261 iExtension->iSeparatorLinePosition = aPosition; |
1378 iExtension->iSeparatorLinePosition = aPosition; |
1262 } |
1379 } |
1263 EXPORT_C TAknSeparatorLinePosition CFormattedCellListBoxData::SeparatorLinePosition() const |
1380 EXPORT_C TAknSeparatorLinePosition CFormattedCellListBoxData::SeparatorLinePosition() const |
1264 { |
1381 { |
1265 if (iExtension) |
1382 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1266 return iExtension->iSeparatorLinePosition; |
1383 return iExtension->iSeparatorLinePosition; |
1267 else |
|
1268 return ENoLine; |
|
1269 } |
1384 } |
1270 EXPORT_C CAknLayoutData *CFormattedCellListBoxData::LayoutData() const |
1385 EXPORT_C CAknLayoutData *CFormattedCellListBoxData::LayoutData() const |
1271 { |
1386 { |
1272 return NULL; |
1387 return NULL; |
1273 } |
1388 } |
1308 } |
1425 } |
1309 |
1426 |
1310 |
1427 |
1311 EXPORT_C void CFormattedCellListBoxData::SetSkinEnabledL(TBool aEnabled) |
1428 EXPORT_C void CFormattedCellListBoxData::SetSkinEnabledL(TBool aEnabled) |
1312 { |
1429 { |
|
1430 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1313 CListBoxData::SetSkinEnabledL(aEnabled); |
1431 CListBoxData::SetSkinEnabledL(aEnabled); |
1314 iExtension->iSkinEnabled = aEnabled; |
1432 iExtension->iSkinEnabled = aEnabled; |
1315 } |
1433 } |
1316 |
1434 |
1317 EXPORT_C TBool CFormattedCellListBoxData::SkinEnabled() const |
1435 EXPORT_C TBool CFormattedCellListBoxData::SkinEnabled() const |
1318 { |
1436 { |
|
1437 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1319 return iExtension->iSkinEnabled; |
1438 return iExtension->iSkinEnabled; |
1320 } |
1439 } |
1321 |
1440 |
1322 EXPORT_C void CFormattedCellListBoxData::SetSkinStyle(const TAknsItemID *id, const TRect &aTileRect) |
1441 EXPORT_C void CFormattedCellListBoxData::SetSkinStyle(const TAknsItemID *id, const TRect &aTileRect) |
1323 { |
1442 { |
1324 |
1443 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1325 if (iExtension->iSkinControlContext) |
1444 if (iExtension->iSkinControlContext) |
1326 { |
1445 { |
1327 iExtension->iSkinControlContext->SetTiledBitmap(*id); |
1446 iExtension->iSkinControlContext->SetTiledBitmap(*id); |
1328 iExtension->iSkinControlContext->SetTiledRect(aTileRect); |
1447 iExtension->iSkinControlContext->SetTiledRect(aTileRect); |
1329 } |
1448 } |
1330 } |
1449 } |
1331 EXPORT_C void CFormattedCellListBoxData::SetSkinParentPos(const TPoint &aPos) |
1450 EXPORT_C void CFormattedCellListBoxData::SetSkinParentPos(const TPoint &aPos) |
1332 { |
1451 { |
|
1452 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1333 if (iExtension->iSkinControlContext) |
1453 if (iExtension->iSkinControlContext) |
1334 { |
1454 { |
1335 iExtension->iSkinControlContext->SetParentPos(aPos); |
1455 iExtension->iSkinControlContext->SetParentPos(aPos); |
1336 } |
1456 } |
1337 } |
1457 } |
1338 EXPORT_C void CFormattedCellListBoxData::SetBackgroundSkinStyle(const TAknsItemID *aId, const TRect &aRect) |
1458 EXPORT_C void CFormattedCellListBoxData::SetBackgroundSkinStyle(const TAknsItemID *aId, const TRect &aRect) |
1339 { |
1459 { |
|
1460 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1340 if (iExtension->iSkinControlContext) |
1461 if (iExtension->iSkinControlContext) |
1341 { |
1462 { |
1342 iExtension->iSkinControlContext->SetBitmap(*aId); |
1463 iExtension->iSkinControlContext->SetBitmap(*aId); |
1343 iExtension->iSkinControlContext->SetRect(aRect); |
1464 iExtension->iSkinControlContext->SetRect(aRect); |
1344 } |
1465 } |
1345 } |
1466 } |
1346 EXPORT_C void CFormattedCellListBoxData::SetListEndSkinStyle(const TAknsItemID *aListEndId, const TRect &aRect) |
1467 EXPORT_C void CFormattedCellListBoxData::SetListEndSkinStyle(const TAknsItemID *aListEndId, const TRect &aRect) |
1347 { |
1468 { |
|
1469 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1348 if (iExtension->iSkinControlContext) |
1470 if (iExtension->iSkinControlContext) |
1349 { |
1471 { |
1350 iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId); |
1472 iExtension->iSkinControlContext->SetBottomBitmap(*aListEndId); |
1351 iExtension->iSkinControlContext->SetBottomRect(aRect); |
1473 iExtension->iSkinControlContext->SetBottomRect(aRect); |
1352 } |
1474 } |
1353 } |
1475 } |
1354 |
1476 |
1355 EXPORT_C void CFormattedCellListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
1477 EXPORT_C void CFormattedCellListBoxData::SetSkinHighlightFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
1356 { |
1478 { |
|
1479 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1357 iExtension->iSkinHighlightFrameId = aFrameId; |
1480 iExtension->iSkinHighlightFrameId = aFrameId; |
1358 iExtension->iSkinHighlightFrameCenterId = aFrameCenterId; |
1481 iExtension->iSkinHighlightFrameCenterId = aFrameCenterId; |
1359 } |
1482 } |
1360 |
1483 |
1361 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
1484 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFrame(const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId) |
1362 { |
1485 { |
1363 if (iExtension && iExtension->iPopupFrame) |
1486 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
1487 if ( iExtension->iPopupFrame) |
1364 { |
1488 { |
1365 iExtension->iPopupFrame->SetFrame(*aFrameId); |
1489 iExtension->iPopupFrame->SetFrame(*aFrameId); |
1366 iExtension->iPopupFrame->SetCenter(*aFrameCenterId); |
1490 iExtension->iPopupFrame->SetCenter(*aFrameCenterId); |
1367 } |
1491 } |
1368 else |
1492 else |
1380 } |
1504 } |
1381 } |
1505 } |
1382 |
1506 |
1383 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFramePosition(const TRect &aOuterRect, const TRect &aInnerRect) |
1507 EXPORT_C void CFormattedCellListBoxData::SetSkinPopupFramePosition(const TRect &aOuterRect, const TRect &aInnerRect) |
1384 { |
1508 { |
1385 if (iExtension && iExtension->iPopupFrame) |
1509 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
1510 if ( iExtension->iPopupFrame) |
1386 iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect); |
1511 iExtension->iPopupFrame->SetFrameRects(aOuterRect, aInnerRect); |
1387 } |
1512 } |
1388 |
1513 |
1389 EXPORT_C void CFormattedCellListBoxData::UseLogicalToVisualConversion( |
1514 EXPORT_C void CFormattedCellListBoxData::UseLogicalToVisualConversion( |
1390 TBool aUseConversion ) |
1515 TBool aUseConversion ) |
1391 { |
1516 { |
1392 if (iExtension) |
1517 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1393 iExtension->iUseLogicalToVisualConversion = aUseConversion; |
1518 iExtension->iUseLogicalToVisualConversion = aUseConversion; |
1394 } |
1519 } |
1395 |
1520 |
1396 void CFormattedCellListBoxData::CreatePictographInterfaceL() |
1521 void CFormattedCellListBoxData::CreatePictographInterfaceL() |
1397 { |
1522 { |
|
1523 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1398 iExtension->CreatePictographInterfaceL(); |
1524 iExtension->CreatePictographInterfaceL(); |
1399 } |
1525 } |
1400 |
1526 |
1401 void CFormattedCellListBoxData::CreateMarqueeControlL() |
1527 void CFormattedCellListBoxData::CreateMarqueeControlL() |
1402 { |
1528 { |
|
1529 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
1403 TCallBack callBack(CFormattedCellListBoxDataExtension::RedrawEvent, iExtension->iControl); |
1530 TCallBack callBack(CFormattedCellListBoxDataExtension::RedrawEvent, iExtension->iControl); |
1404 //iExtension->iMarquee = CAknMarqueeControl::NewL(); |
1531 //iExtension->iMarquee = CAknMarqueeControl::NewL(); |
1405 iExtension->CreateMarqueeControlL(); |
1532 iExtension->CreateMarqueeControlL(); |
1406 iExtension->iMarquee->SetRedrawCallBack(callBack); |
1533 iExtension->iMarquee->SetRedrawCallBack(callBack); |
1407 iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack); |
1534 iExtension->i2ndLineMarquee->SetRedrawCallBack(callBack); |
2199 const TRect& aItemRect, |
2327 const TRect& aItemRect, |
2200 TBool aHighlight, |
2328 TBool aHighlight, |
2201 const TColors& aColors ) const |
2329 const TColors& aColors ) const |
2202 { |
2330 { |
2203 _AKNTRACE_FUNC_ENTER; |
2331 _AKNTRACE_FUNC_ENTER; |
2204 _AKNTRACE("DrawFormatted: aText=%S, aItemRect=(%d,%d,%d,%d)", |
2332 _AKNTRACE("DrawFormatted: aItemRect=(%d,%d,%d,%d)", |
2205 aText, aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, |
2333 aItemRect.iTl.iX, aItemRect.iTl.iY, aItemRect.iBr.iX, |
2206 aItemRect.iBr.iY); |
2334 aItemRect.iBr.iY); |
2207 |
2335 |
2208 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
2336 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
2337 __ASSERT_DEBUG( iExtension->iControl, Panic( EAknPanicNullPointer )); |
|
2338 |
|
2339 CEikListBox* listbox = static_cast<CEikListBox*>( iExtension->iControl ); |
|
2340 CListBoxView* view = listbox->View(); |
|
2341 |
2209 if (!view->ViewRect().Intersects(aItemRect)) |
2342 if (!view->ViewRect().Intersects(aItemRect)) |
2210 { |
2343 { |
2211 // outside of the clipping rect -> don't process this item |
2344 // outside of the clipping rect -> don't process this item |
2212 return; |
2345 return; |
2213 } |
2346 } |
2214 |
2347 |
2215 if ( aHighlight ) |
2348 if ( aHighlight ) |
2216 { |
2349 { |
2217 iExtension->iClippedSubcells = 0; |
2350 iExtension->iClippedSubcells = 0; |
2218 } |
2351 } |
|
2352 |
|
2353 TBool backgroundDrawingSuppressed = listbox->BackgroundDrawingSuppressed(); |
2219 |
2354 |
2220 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2355 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
2221 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
2356 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
2222 if ( transApi ) |
2357 if ( transApi && !backgroundDrawingSuppressed ) |
2223 { |
2358 { |
2224 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
2359 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
2225 if(transApi->EffectsDisabled()) |
2360 if(transApi->EffectsDisabled()) |
2226 { |
2361 { |
2227 aGc.SetClippingRect( view->ViewRect() ); |
2362 aGc.SetClippingRect( view->ViewRect() ); |
2228 } |
2363 } |
2229 } |
2364 } |
2230 #else |
2365 #else |
2231 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
2366 if ( !backgroundDrawingSuppressed ) |
2232 aGc.SetClippingRect( view->ViewRect() ); |
2367 { |
|
2368 aGc.SetClippingRect( view->ViewRect() ); |
|
2369 } |
2233 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
2370 #endif //RD_UI_TRANSITION_EFFECTS_LIST |
2234 |
2371 TRect vr(view->ViewRect()); |
|
2372 _AKNTRACE("Clipping: Width %d, (%d,%d)", vr.Width(), vr.iTl.iX, vr.iBr.iX ); |
2235 if ( UsesScalableLayoutData() ) |
2373 if ( UsesScalableLayoutData() ) |
2236 { |
2374 { |
2237 /* this is a AvKon list or list is created using methods in aknlists.cpp |
2375 /* this is a AvKon list or list is created using methods in aknlists.cpp |
2238 * which is _the_ way to set up a list |
2376 * which is _the_ way to set up a list |
2239 */ |
2377 */ |
2678 const_cast<CFormattedCellListBoxData*>( this )-> |
2844 const_cast<CFormattedCellListBoxData*>( this )-> |
2679 SetWordWrappedSubcellIndices( -1, -1 ); |
2845 SetWordWrappedSubcellIndices( -1, -1 ); |
2680 _AKNTRACE_FUNC_EXIT; |
2846 _AKNTRACE_FUNC_EXIT; |
2681 } |
2847 } |
2682 |
2848 |
|
2849 // ----------------------------------------------------------------------------- |
|
2850 // CFormattedCellListBoxData::DrawMarkingModeIcons |
|
2851 // ----------------------------------------------------------------------------- |
|
2852 // |
|
2853 void CFormattedCellListBoxData::DrawMarkingModeIcons( |
|
2854 TListItemProperties& aProperties, |
|
2855 CWindowGc& aGc, |
|
2856 TRect& aItemRect ) const |
|
2857 { |
|
2858 CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); |
|
2859 TRect textRect( aItemRect ); |
|
2860 |
|
2861 if ( listbox->View()->ItemDrawer()->Flags() |
|
2862 & CListItemDrawer::EMarkingModeEnabled |
|
2863 && !aProperties.IsSelectionHidden() |
|
2864 && iExtension->iMarkingIconArray |
|
2865 && iExtension->iMarkingIconArray->Count() |
|
2866 == KMarkingModeIconArraySize ) |
|
2867 { |
|
2868 if ( AknLayoutUtils::LayoutMirrored() ) |
|
2869 { |
|
2870 textRect.iBr.iX -= |
|
2871 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2872 0 ).LayoutLine().ir; |
|
2873 } |
|
2874 else |
|
2875 { |
|
2876 textRect.iTl.iX += |
|
2877 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( |
|
2878 0 ).LayoutLine().il; |
|
2879 } |
|
2880 |
|
2881 TAknLayoutRect layoutRect; |
|
2882 layoutRect.LayoutRect( aItemRect, |
|
2883 AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) ); |
|
2884 |
|
2885 // unchecked icon |
|
2886 CGulIcon* icon = ( *iExtension->iMarkingIconArray )[1]; |
|
2887 |
|
2888 if ( listbox->View()->ItemIsSelected( |
|
2889 iExtension->iCurrentlyDrawnItemIndex ) ) |
|
2890 { |
|
2891 icon = ( *iExtension->iMarkingIconArray )[0]; |
|
2892 } |
|
2893 |
|
2894 CFbsBitmap* bitmap = icon->Bitmap(); |
|
2895 |
|
2896 if ( bitmap ) |
|
2897 { |
|
2898 TSize size( bitmap->SizeInPixels() ); // set size if not already |
|
2899 TSize targetSize( layoutRect.Rect().Size() ); |
|
2900 |
|
2901 if ( size.iWidth != targetSize.iWidth && |
|
2902 size.iHeight != targetSize.iHeight ) |
|
2903 { |
|
2904 AknIconUtils::SetSize( bitmap, targetSize, |
|
2905 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
2906 } |
|
2907 aGc.BitBltMasked( layoutRect.Rect().iTl, |
|
2908 bitmap, |
|
2909 TRect( layoutRect.Rect().Size() ), |
|
2910 icon->Mask(), EFalse ); |
|
2911 } |
|
2912 aItemRect = textRect; |
|
2913 } |
|
2914 } |
2683 |
2915 |
2684 EXPORT_C |
2916 EXPORT_C |
2685 CFormattedCellListBoxData::CFormattedCellListBoxData() |
2917 CFormattedCellListBoxData::CFormattedCellListBoxData() |
2686 : CListBoxData() |
2918 : CListBoxData() |
2687 { |
2919 { |
2843 |
3075 |
2844 EXPORT_C void CPopupFormattedListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const |
3076 EXPORT_C void CPopupFormattedListBoxData::Draw(TListItemProperties aProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,TBool aHighlight, const TColors& aColors) const |
2845 { |
3077 { |
2846 _AKNTRACE_FUNC_ENTER; |
3078 _AKNTRACE_FUNC_ENTER; |
2847 const TRect &aItemRect = aRect; |
3079 const TRect &aItemRect = aRect; |
2848 |
3080 |
2849 DrawPopupHighlight(aGc, aItemRect, aHighlight); |
3081 DrawDefaultHighlight( aGc, aItemRect, aHighlight ); |
2850 |
3082 |
2851 // Draw the actual items. |
3083 // Draw the actual items. |
2852 DrawFormatted(aProperties,aGc,aText,aItemRect,aHighlight,aColors); |
3084 DrawFormatted(aProperties,aGc,aText,aItemRect,aHighlight,aColors); |
2853 _AKNTRACE_FUNC_EXIT; |
3085 _AKNTRACE_FUNC_EXIT; |
2854 } |
3086 } |
2855 |
3087 |
2856 void CFormattedCellListBoxData::DrawDefaultHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const |
3088 void CFormattedCellListBoxData::DrawDefaultHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const |
2857 { |
3089 { |
2858 _AKNTRACE_FUNC_ENTER; |
3090 _AKNTRACE_FUNC_ENTER; |
|
3091 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
3092 |
2859 // When this flag set, draw pressed down state and don't use animation. |
3093 // When this flag set, draw pressed down state and don't use animation. |
2860 // There are several derived CListboxData in this file. All of them do |
3094 // There are several derived CListboxData in this file. All of them do |
2861 // this same thing. |
3095 // this same thing. |
2862 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
3096 CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View(); |
2863 TBool pressedDown = view->ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState; |
3097 TBool pressedDown = view->ItemDrawer()->Flags() & CListItemDrawer::EPressedDownState; |
2946 #endif |
3180 #endif |
2947 } |
3181 } |
2948 _AKNTRACE_FUNC_EXIT; |
3182 _AKNTRACE_FUNC_EXIT; |
2949 } |
3183 } |
2950 |
3184 |
2951 void CFormattedCellListBoxData::DrawSettingHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const |
|
2952 { |
|
2953 _AKNTRACE_FUNC_ENTER; |
|
2954 DrawDefaultHighlight( aGc, aItemRect, aHighlight ); |
|
2955 _AKNTRACE_FUNC_EXIT; |
|
2956 } |
|
2957 |
|
2958 void CFormattedCellListBoxData::DrawPopupHighlight(CWindowGc &aGc, const TRect &aItemRect, TBool aHighlight) const |
|
2959 { |
|
2960 _AKNTRACE_FUNC_ENTER; |
|
2961 DrawDefaultHighlight( aGc, aItemRect, aHighlight ); |
|
2962 _AKNTRACE_FUNC_EXIT; |
|
2963 } |
|
2964 |
|
2965 void CFormattedCellListBoxData::DrawPopupFrame(CWindowGc &aGc) const |
|
2966 { |
|
2967 _AKNTRACE_FUNC_ENTER; |
|
2968 CCoeControl* control = Control(); |
|
2969 |
|
2970 if ( control ) |
|
2971 { |
|
2972 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
2973 |
|
2974 TBool done = AknsDrawUtils::Background( AknsUtils::SkinInstance(), |
|
2975 iExtension->iPopupFrame, |
|
2976 control, |
|
2977 aGc, |
|
2978 control->Rect() ); |
|
2979 |
|
2980 if ( !done ) |
|
2981 { |
|
2982 aGc.Clear( control->Rect() ); |
|
2983 } |
|
2984 } |
|
2985 _AKNTRACE_FUNC_EXIT; |
|
2986 } |
|
2987 |
3185 |
2988 void CFormattedCellListBoxData::SetWordWrappedSubcellIndices( |
3186 void CFormattedCellListBoxData::SetWordWrappedSubcellIndices( |
2989 TInt aFirstIndex, |
3187 TInt aFirstIndex, |
2990 TInt aSecondIndex ) |
3188 TInt aSecondIndex ) |
2991 { |
3189 { |
|
3190 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
2992 iExtension->iFirstWordWrappedSubcellIndex = (TInt16)aFirstIndex; |
3191 iExtension->iFirstWordWrappedSubcellIndex = (TInt16)aFirstIndex; |
2993 iExtension->iSecondWordWrappedSubcellIndex = (TInt16)aSecondIndex; |
3192 iExtension->iSecondWordWrappedSubcellIndex = (TInt16)aSecondIndex; |
2994 } |
3193 } |
2995 |
3194 |
2996 EXPORT_C void CFormattedCellListBoxData::EnableMarqueeL(TBool aEnable) |
3195 EXPORT_C void CFormattedCellListBoxData::EnableMarqueeL(TBool aEnable) |
2997 { |
3196 { |
|
3197 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
2998 // CreateMarqueeControlL does nothing if marquee already exists, |
3198 // CreateMarqueeControlL does nothing if marquee already exists, |
2999 // so let's just call it just in case. |
3199 // so let's just call it just in case. |
3000 CreateMarqueeControlL(); |
3200 CreateMarqueeControlL(); |
3001 iExtension->iMarquee->EnableMarquee(aEnable); |
3201 iExtension->iMarquee->EnableMarquee(aEnable); |
3002 iExtension->i2ndLineMarquee->EnableMarquee(aEnable); |
3202 iExtension->i2ndLineMarquee->EnableMarquee(aEnable); |
3004 |
3204 |
3005 // Two versions to eliminate compiler warnings. |
3205 // Two versions to eliminate compiler warnings. |
3006 #ifdef __WINS__ |
3206 #ifdef __WINS__ |
3007 EXPORT_C const TBool CFormattedCellListBoxData::IsMarqueeOn() |
3207 EXPORT_C const TBool CFormattedCellListBoxData::IsMarqueeOn() |
3008 { |
3208 { |
|
3209 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3009 return iExtension->IsMarqueeOn(); |
3210 return iExtension->IsMarqueeOn(); |
3010 } |
3211 } |
3011 #else |
3212 #else |
3012 EXPORT_C TBool CFormattedCellListBoxData::IsMarqueeOn() |
3213 EXPORT_C TBool CFormattedCellListBoxData::IsMarqueeOn() |
3013 { |
3214 { |
|
3215 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3014 return iExtension->IsMarqueeOn(); |
3216 return iExtension->IsMarqueeOn(); |
3015 } |
3217 } |
3016 #endif // __WINS__ |
3218 #endif // __WINS__ |
3017 |
3219 |
3018 |
3220 |
3019 void CFormattedCellListBoxData::FocusGained() |
3221 void CFormattedCellListBoxData::FocusGained() |
3020 { |
3222 { |
|
3223 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3021 iExtension->FocusGained(); |
3224 iExtension->FocusGained(); |
3022 } |
3225 } |
3023 |
3226 |
3024 void CFormattedCellListBoxData::FocusLost() |
3227 void CFormattedCellListBoxData::FocusLost() |
3025 { |
3228 { |
|
3229 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3026 iExtension->FocusLost(); |
3230 iExtension->FocusLost(); |
3027 } |
3231 } |
3028 |
3232 |
3029 void CFormattedCellListBoxData::HandleResourceChange( TInt aType ) |
3233 void CFormattedCellListBoxData::HandleResourceChange( TInt aType ) |
3030 { |
3234 { |
3031 _AKNTRACE_FUNC_ENTER; |
3235 _AKNTRACE_FUNC_ENTER; |
|
3236 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3032 // Animation is skin dependent, whenever skin changes animation changes |
3237 // Animation is skin dependent, whenever skin changes animation changes |
3033 // too. |
3238 // too. |
3034 if( KAknsMessageSkinChange == aType ) |
3239 if( KAknsMessageSkinChange == aType ) |
3035 { |
3240 { |
3036 iExtension->SkinChanged(); |
3241 iExtension->SkinChanged(); |
3103 // ----------------------------------------------------------------------------- |
3304 // ----------------------------------------------------------------------------- |
3104 // |
3305 // |
3105 EXPORT_C void CFormattedCellListBoxData::SetHighlightAnimBackgroundDrawer( |
3306 EXPORT_C void CFormattedCellListBoxData::SetHighlightAnimBackgroundDrawer( |
3106 MListBoxAnimBackgroundDrawer* aDrawer ) |
3307 MListBoxAnimBackgroundDrawer* aDrawer ) |
3107 { |
3308 { |
3108 if( iExtension ) |
3309 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3109 { |
3310 iExtension->iHighlightBgDrawer = aDrawer; |
3110 iExtension->iHighlightBgDrawer = aDrawer; |
|
3111 } |
|
3112 } |
3311 } |
3113 |
3312 |
3114 // ----------------------------------------------------------------------------- |
3313 // ----------------------------------------------------------------------------- |
3115 // CFormattedCellListBoxData::SetItemCellSize |
3314 // CFormattedCellListBoxData::SetItemCellSize |
3116 // ----------------------------------------------------------------------------- |
3315 // ----------------------------------------------------------------------------- |
3117 // |
3316 // |
3118 EXPORT_C void CFormattedCellListBoxData::SetItemCellSize( const TSize& aSize ) |
3317 EXPORT_C void CFormattedCellListBoxData::SetItemCellSize( const TSize& aSize ) |
3119 { |
3318 { |
3120 if( iExtension ) |
3319 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3121 { |
3320 if( iExtension->iAnimSize != aSize ) |
3122 if( iExtension->iAnimSize != aSize ) |
3321 { |
3123 { |
3322 iExtension->Play(); |
3124 iExtension->Play(); |
3323 } |
3125 } |
3324 iExtension->iAnimSize = aSize; |
3126 iExtension->iAnimSize = aSize; |
|
3127 } |
|
3128 } |
3325 } |
3129 |
3326 |
3130 // ----------------------------------------------------------------------------- |
3327 // ----------------------------------------------------------------------------- |
3131 // CFormattedCellListBoxData::HasHighlightAnim |
3328 // CFormattedCellListBoxData::HasHighlightAnim |
3132 // ----------------------------------------------------------------------------- |
3329 // ----------------------------------------------------------------------------- |
3133 // |
3330 // |
3134 EXPORT_C TBool CFormattedCellListBoxData::HasHighlightAnim() const |
3331 EXPORT_C TBool CFormattedCellListBoxData::HasHighlightAnim() const |
3135 { |
3332 { |
3136 if( !iExtension ) |
3333 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3137 return EFalse; |
3334 return ( iExtension->iAnimation != NULL ); |
3138 if( !iExtension->iAnimation ) |
|
3139 return EFalse; |
|
3140 return ETrue; |
|
3141 } |
3335 } |
3142 |
3336 |
3143 // ----------------------------------------------------------------------------- |
3337 // ----------------------------------------------------------------------------- |
3144 // CFormattedCellListBoxData::DrawHighlightAnim |
3338 // CFormattedCellListBoxData::DrawHighlightAnim |
3145 // ----------------------------------------------------------------------------- |
3339 // ----------------------------------------------------------------------------- |
3146 // |
3340 // |
3147 EXPORT_C TBool CFormattedCellListBoxData::DrawHighlightAnim( |
3341 EXPORT_C TBool CFormattedCellListBoxData::DrawHighlightAnim( |
3148 CBitmapContext& aGc, const TRect& aRect ) const |
3342 CBitmapContext& aGc, const TRect& aRect ) const |
3149 { |
3343 { |
3150 if( !iExtension ) |
3344 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3151 return EFalse; |
|
3152 |
|
3153 if( !iExtension->iAnimation ) |
3345 if( !iExtension->iAnimation ) |
3154 return EFalse; |
3346 return EFalse; |
3155 |
3347 |
3156 return iExtension->SyncAndDrawAnim( aGc, aRect ); |
3348 return iExtension->SyncAndDrawAnim( aGc, aRect ); |
3157 } |
3349 } |
3158 |
3350 |
3159 void CFormattedCellListBoxData::ResetMarquee() |
3351 void CFormattedCellListBoxData::ResetMarquee() |
3160 { |
3352 { |
|
3353 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3161 if (iExtension->iMarquee) |
3354 if (iExtension->iMarquee) |
3162 { |
3355 { |
3163 iExtension->iMarquee->Reset(); |
3356 iExtension->iMarquee->Reset(); |
3164 } |
3357 } |
3165 if (iExtension->i2ndLineMarquee) |
3358 if (iExtension->i2ndLineMarquee) |
3193 |
3389 |
3194 void CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex( TInt aIndex ) |
3390 void CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex( TInt aIndex ) |
3195 { |
3391 { |
3196 _AKNTRACE("CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex aIndex=%d", |
3392 _AKNTRACE("CFormattedCellListBoxData::SetCurrentlyDrawnItemIndex aIndex=%d", |
3197 aIndex); |
3393 aIndex); |
3198 if ( iExtension ) |
3394 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3199 { |
3395 iExtension->iCurrentlyDrawnItemIndex = aIndex; |
3200 iExtension->iCurrentlyDrawnItemIndex = aIndex; |
|
3201 } |
|
3202 } |
3396 } |
3203 |
3397 |
3204 EXPORT_C const CFont* |
3398 EXPORT_C const CFont* |
3205 CFormattedCellListBoxData::RowAndSubCellFont(TInt aRow,TInt aSubCellIndex) const |
3399 CFormattedCellListBoxData::RowAndSubCellFont(TInt aRow,TInt aSubCellIndex) const |
3206 { |
3400 { |
3207 if (!iExtension) return 0; |
3401 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3208 TInt index = 0; |
3402 TInt index = 0; |
3209 if (iExtension->FindRowAndSubCellIndex(index,aRow,aSubCellIndex)!=0) |
3403 if (iExtension->FindRowAndSubCellIndex(index,aRow,aSubCellIndex)!=0) |
3210 return 0; |
3404 return 0; |
3211 return(iExtension->At(index).iFont); |
3405 return(iExtension->At(index).iFont); |
3212 } |
3406 } |
3213 |
3407 |
3214 EXPORT_C void CFormattedCellListBoxData::SetSubCellFontForRowL(TInt aRowIndex, |
3408 EXPORT_C void CFormattedCellListBoxData::SetSubCellFontForRowL(TInt aRowIndex, |
3215 TInt aSubCellIndex, |
3409 TInt aSubCellIndex, |
3216 const CFont* aFont) |
3410 const CFont* aFont) |
3217 { |
3411 { |
3218 if (!iExtension) return; |
3412 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3219 TInt index = 0; |
3413 TInt index = 0; |
3220 iExtension->FindRowAndSubCellIndexOrAddL(index,aRowIndex,aSubCellIndex); |
3414 iExtension->FindRowAndSubCellIndexOrAddL(index,aRowIndex,aSubCellIndex); |
3221 iExtension->At(index).iFont=aFont; |
3415 iExtension->At(index).iFont=aFont; |
3222 } |
3416 } |
3223 |
3417 |
3237 /** |
3432 /** |
3238 * Is the listbox drawing the background itself or not (= "transparency") |
3433 * Is the listbox drawing the background itself or not (= "transparency") |
3239 */ |
3434 */ |
3240 TBool CFormattedCellListBoxData::IsBackgroundDrawingEnabled() const |
3435 TBool CFormattedCellListBoxData::IsBackgroundDrawingEnabled() const |
3241 { |
3436 { |
|
3437 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3242 return iExtension->iDrawBackground; |
3438 return iExtension->iDrawBackground; |
3243 } |
3439 } |
3244 |
3440 |
3245 |
3441 |
3246 /** |
3442 /** |
3247 * Enables / disables drawing background after scrollbar |
3443 * Enables / disables drawing background after scrollbar |
3248 * @param aDrawBackground default ETrue |
3444 * @param aDrawBackground default ETrue |
3249 */ |
3445 */ |
3250 void CFormattedCellListBoxData::SetDrawScrollbarBackground(const TBool aDrawBackground) |
3446 void CFormattedCellListBoxData::SetDrawScrollbarBackground(const TBool aDrawBackground) |
3251 { |
3447 { |
|
3448 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3252 iExtension->iDrawScrollbarBackground = aDrawBackground; |
3449 iExtension->iDrawScrollbarBackground = aDrawBackground; |
3253 } |
3450 } |
3254 |
3451 |
3255 /** |
3452 /** |
3256 * Is the listbox drawing the background after scrollbar or not |
3453 * Is the listbox drawing the background after scrollbar or not |
3257 */ |
3454 */ |
3258 TBool CFormattedCellListBoxData::IsScrollbarBackgroundDrawingEnabled() const |
3455 TBool CFormattedCellListBoxData::IsScrollbarBackgroundDrawingEnabled() const |
3259 { |
3456 { |
|
3457 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3260 return iExtension->iDrawScrollbarBackground; |
3458 return iExtension->iDrawScrollbarBackground; |
3261 } |
3459 } |
3262 |
3460 |
3263 |
3461 |
3264 EXPORT_C void CFormattedCellListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, |
3462 EXPORT_C void CFormattedCellListBoxData::SetMarqueeParams(const TInt aLoops, const TInt aScrollAmount, |
3265 const TInt aScrollDelay, const TInt aInterval) |
3463 const TInt aScrollDelay, const TInt aInterval) |
3266 { |
3464 { |
|
3465 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3267 if ( iExtension->iMarquee ) |
3466 if ( iExtension->iMarquee ) |
3268 { |
3467 { |
3269 iExtension->iMarquee->SetLoops( aLoops ); |
3468 iExtension->iMarquee->SetLoops( aLoops ); |
3270 iExtension->iMarquee->SetSpeedInPixels( aScrollAmount ); |
3469 iExtension->iMarquee->SetSpeedInPixels( aScrollAmount ); |
3271 iExtension->iMarquee->SetDelay( aScrollDelay ); |
3470 iExtension->iMarquee->SetDelay( aScrollDelay ); |
3390 |
3594 |
3391 |
3595 |
3392 void CFormattedCellListBoxData::SetGraphicSubCellL( TInt aSubCell, |
3596 void CFormattedCellListBoxData::SetGraphicSubCellL( TInt aSubCell, |
3393 const TAknWindowLineLayout &aGraphicLayout ) |
3597 const TAknWindowLineLayout &aGraphicLayout ) |
3394 { |
3598 { |
3395 if ( !iExtension ) return; |
3599 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3396 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3600 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3397 // this does happen with caknsetstyle, caknform(wide)style lists. |
3601 // this does happen with caknsetstyle, caknform(wide)style lists. |
3398 // eventually they'll get here again with list!=0, so this check is enough |
3602 // eventually they'll get here again with list!=0, so this check is enough |
3399 if ( !list ) return; |
3603 if ( !list ) return; |
3400 |
3604 |
3401 TInt index = 0; |
3605 TInt index = 0; |
3402 iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); |
3606 iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); |
3403 iExtension->AtSL(index).iTextLayout=NULL; |
3607 iExtension->SLAt(index).iTextLayout=NULL; |
3404 iExtension->AtSL(index).iGraphicLayout=aGraphicLayout; |
3608 iExtension->SLAt(index).iGraphicLayout=aGraphicLayout; |
3405 iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic; |
3609 iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLGraphic; |
3406 |
3610 |
3407 // For compabitility - needed at least for text wrapping. |
3611 // For compabitility - needed at least for text wrapping. |
3408 // Beware - some of these WILL be overriden if you got here trough |
3612 // Beware - some of these WILL be overriden if you got here trough |
3409 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
3613 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
3410 // & friends. |
3614 // & friends. |
3439 } |
3643 } |
3440 |
3644 |
3441 void CFormattedCellListBoxData::SetTextSubCellL( TInt aSubCell, |
3645 void CFormattedCellListBoxData::SetTextSubCellL( TInt aSubCell, |
3442 const TAknTextLineLayout &aTextLayout ) |
3646 const TAknTextLineLayout &aTextLayout ) |
3443 { |
3647 { |
3444 if (!iExtension) return; |
3648 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3445 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3649 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3446 // this does happen with caknsetstyle, caknform(wide)style lists. |
3650 // this does happen with caknsetstyle, caknform(wide)style lists. |
3447 // eventually they'll get here again with list!=0, so this check is enough |
3651 // eventually they'll get here again with list!=0, so this check is enough |
3448 if ( !list ) return; |
3652 if ( !list ) return; |
3449 |
3653 |
3450 TInt index = 0; |
3654 TInt index = 0; |
3451 iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); |
3655 iExtension->FindSLSubCellIndexOrAddL(index,aSubCell); |
3452 iExtension->AtSL(index).iTextLayout=aTextLayout; |
3656 iExtension->SLAt(index).iTextLayout=aTextLayout; |
3453 iExtension->AtSL(index).iGraphicLayout=NULL; |
3657 iExtension->SLAt(index).iGraphicLayout=NULL; |
3454 iExtension->AtSL(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText; |
3658 iExtension->SLAt(index).iSubCellType=CFormattedCellListBoxDataExtension::EAknSLText; |
3455 |
3659 |
3456 |
3660 |
3457 // For compabitility - needed at least for text wrapping. |
3661 // For compabitility - needed at least for text wrapping. |
3458 // Beware - some of these WILL be overriden if you got here trough |
3662 // Beware - some of these WILL be overriden if you got here trough |
3459 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
3663 // old layout methods like AknListBoxLayouts::SetupFormTextCell() |
3492 |
3696 |
3493 void CFormattedCellListBoxData::SetConditionalSubCellL(TInt aSubCell, |
3697 void CFormattedCellListBoxData::SetConditionalSubCellL(TInt aSubCell, |
3494 const TAknTextLineLayout &aTextLayout, |
3698 const TAknTextLineLayout &aTextLayout, |
3495 TInt aAffectedSubCell) |
3699 TInt aAffectedSubCell) |
3496 { |
3700 { |
|
3701 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3497 // iConditionValue of affected subcell (=text subcell, which has different layouts) |
3702 // iConditionValue of affected subcell (=text subcell, which has different layouts) |
3498 // contains index of graphical subcell, which existence should be checked first. |
3703 // contains index of graphical subcell, which existence should be checked first. |
3499 // This graphical subcell has in iConditionValue index of graphical subcell, |
3704 // This graphical subcell has in iConditionValue index of graphical subcell, |
3500 // which existence should be checked second etc. Each graphical subcell can |
3705 // which existence should be checked second etc. Each graphical subcell can |
3501 // affect only to 1 text subcell (or none). |
3706 // affect only to 1 text subcell (or none). |
3502 |
3707 |
3503 // for compabitility - needed at least for text wrapping |
3708 // for compabitility - needed at least for text wrapping |
3504 SetNotAlwaysDrawnSubCellL( aSubCell, ETrue ); |
3709 SetNotAlwaysDrawnSubCellL( aSubCell, ETrue ); |
3505 |
3710 |
3506 if (!iExtension) return; |
|
3507 |
|
3508 TInt i = 0x01; |
3711 TInt i = 0x01; |
3509 i = i << aSubCell; |
3712 i = i << aSubCell; |
3510 iExtension->iConditionalCells = iExtension->iConditionalCells | i; |
3713 iExtension->iConditionalCells = iExtension->iConditionalCells | i; |
3511 |
3714 |
3512 TInt graphicalIndex = 0; |
3715 TInt graphicalIndex = 0; |
3513 if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found |
3716 if (iExtension->FindSLSubCellIndex(graphicalIndex, aSubCell)!=0) return; // subcell not found |
3514 // conditional layoutline can be only added to graphical subcells |
3717 // conditional layoutline can be only added to graphical subcells |
3515 if (iExtension->AtSL(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return; |
3718 if (iExtension->SLAt(graphicalIndex).iSubCellType!=CFormattedCellListBoxDataExtension::EAknSLGraphic) return; |
3516 |
3719 |
3517 TInt textIndex = 0; // index of affected subcell |
3720 TInt textIndex = 0; // index of affected subcell |
3518 if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found |
3721 if (iExtension->FindSLSubCellIndex(textIndex, aAffectedSubCell)!=0) return; // subcell not found |
3519 // affected subcell can only be text subcell |
3722 // affected subcell can only be text subcell |
3520 if (iExtension->AtSL(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return; |
3723 if (iExtension->SLAt(textIndex).iSubCellType==CFormattedCellListBoxDataExtension::EAknSLGraphic) return; |
3521 |
3724 |
3522 TInt gSC = iExtension->AtSL(textIndex).iConditionValue; // text subcell to be added in priority chain |
3725 TInt gSC = iExtension->SLAt(textIndex).iConditionValue; // text subcell to be added in priority chain |
3523 |
3726 |
3524 while (gSC > -1) |
3727 while (gSC > -1) |
3525 { |
3728 { |
3526 if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found |
3729 if (iExtension->FindSLSubCellIndex(textIndex, gSC)!=0) return; // subcell not found |
3527 gSC = iExtension->AtSL(textIndex).iConditionValue; |
3730 gSC = iExtension->SLAt(textIndex).iConditionValue; |
3528 } |
3731 } |
3529 iExtension->AtSL(textIndex).iConditionValue = aSubCell; // add next subcell to chain |
3732 iExtension->SLAt(textIndex).iConditionValue = aSubCell; // add next subcell to chain |
3530 iExtension->AtSL(graphicalIndex).iTextLayout=aTextLayout; |
3733 iExtension->SLAt(graphicalIndex).iTextLayout=aTextLayout; |
3531 |
3734 |
3532 iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) ); |
3735 iExtension->CreateColorBitmapsL( SubCellSize( aSubCell ) ); |
3533 |
3736 |
3534 TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) ); |
3737 TRect r( SubCellPosition( aSubCell ), SubCellSize( aSubCell ) ); |
3535 if ( iExtension->iMarginRect == TRect::EUninitialized ) |
3738 if ( iExtension->iMarginRect == TRect::EUninitialized ) |
3559 // CFormattedCellListBoxData::UsesScalableLayoutData |
3762 // CFormattedCellListBoxData::UsesScalableLayoutData |
3560 // ----------------------------------------------------------------------------- |
3763 // ----------------------------------------------------------------------------- |
3561 // |
3764 // |
3562 TBool CFormattedCellListBoxData::UsesScalableLayoutData() const |
3765 TBool CFormattedCellListBoxData::UsesScalableLayoutData() const |
3563 { |
3766 { |
3564 if (iExtension) |
3767 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3565 return iExtension->iSimpleList; |
3768 return iExtension->iSimpleList; |
3566 |
|
3567 return EFalse; |
|
3568 } |
3769 } |
3569 void CFormattedCellListBoxData::UseScalableLayoutData( TBool aUse ) |
3770 void CFormattedCellListBoxData::UseScalableLayoutData( TBool aUse ) |
3570 { |
3771 { |
3571 if ( iExtension ) |
3772 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3572 { |
3773 if ( !aUse && iExtension->iSimpleList ) |
3573 if ( !aUse && iExtension->iSimpleList ) |
3774 { |
3574 { |
|
3575 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3775 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
3576 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3776 CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl ); |
3577 MAknListBoxTfxInternal* transApi = |
3777 MAknListBoxTfxInternal* transApi = |
3578 CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); |
3778 CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() ); |
3579 if ( transApi ) |
3779 if ( transApi ) |
3580 { |
3780 { |
3581 transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) ); |
3781 transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) ); |
3582 transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) ); |
3782 transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) ); |
3583 } |
3783 } |
3584 #endif |
3784 #endif |
3585 } |
3785 } |
3586 iExtension->iSimpleList = aUse; |
3786 iExtension->iSimpleList = aUse; |
3587 } |
|
3588 } |
3787 } |
3589 |
3788 |
3590 EXPORT_C void CFormattedCellListBoxData::SetSubcellUnderlined( TBitFlags32 aUnderlinedCells ) |
3789 EXPORT_C void CFormattedCellListBoxData::SetSubcellUnderlined( TBitFlags32 aUnderlinedCells ) |
3591 { |
3790 { |
3592 if ( iExtension ) |
3791 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3593 { |
3792 iExtension->iUnderlineFlagSet = ETrue; |
3594 iExtension->iUnderlineFlagSet = ETrue; |
3793 iExtension->iUnderlineFlags = aUnderlinedCells; |
3595 iExtension->iUnderlineFlags = aUnderlinedCells; |
|
3596 } |
|
3597 } |
3794 } |
3598 |
3795 |
3599 void CFormattedCellListBoxData::SetUnderlineStyle( TListItemProperties aProperties, |
3796 void CFormattedCellListBoxData::SetUnderlineStyle( TListItemProperties aProperties, |
3600 CWindowGc& aGc, |
3797 CWindowGc& aGc, |
3601 TInt aSubCell ) const |
3798 TInt aSubCell ) const |
3602 { |
3799 { |
3603 if ( !iExtension ) |
3800 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3604 { |
|
3605 return; |
|
3606 } |
|
3607 |
|
3608 if ( !iExtension->iUnderlineFlagSet ) |
3801 if ( !iExtension->iUnderlineFlagSet ) |
3609 { |
3802 { |
3610 // underlining is already either on or off and |
3803 // underlining is already either on or off and |
3611 // hardcoded off turning will ensure old style |
3804 // hardcoded off turning will ensure old style |
3612 // behaviour |
3805 // behaviour |
3693 const TAknTextComponentLayout& aNormalLayout, |
3881 const TAknTextComponentLayout& aNormalLayout, |
3694 const TAknTextComponentLayout& aStretchedLayout, |
3882 const TAknTextComponentLayout& aStretchedLayout, |
3695 TInt aNormalSubCell, |
3883 TInt aNormalSubCell, |
3696 TInt aStretchedSubCell ) |
3884 TInt aStretchedSubCell ) |
3697 { |
3885 { |
|
3886 _AKNTRACE_FUNC_ENTER; |
3698 if ( Layout_Meta_Data::IsLandscapeOrientation() && |
3887 if ( Layout_Meta_Data::IsLandscapeOrientation() && |
3699 Layout_Meta_Data::IsListStretchingEnabled() && |
3888 Layout_Meta_Data::IsListStretchingEnabled() && |
3700 StretchingEnabled() ) |
3889 StretchingEnabled() ) |
3701 { |
3890 { |
|
3891 _AKNTRACE("Layout_Meta_Data::IsListStretchingEnabled"); |
3702 SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell ); |
3892 SetConditionalSubCellL( aSubCell, aStretchedLayout.LayoutLine(), aStretchedSubCell ); |
3703 } |
3893 } |
3704 else |
3894 else |
3705 { |
3895 { |
3706 SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell ); |
3896 SetConditionalSubCellL( aSubCell, aNormalLayout.LayoutLine(), aNormalSubCell ); |
3707 } |
3897 } |
|
3898 _AKNTRACE_FUNC_EXIT; |
3708 } |
3899 } |
3709 |
3900 |
3710 |
3901 |
3711 // ----------------------------------------------------------------------------- |
3902 // ----------------------------------------------------------------------------- |
3712 // CFormattedCellListBoxData::ResetSLSubCellArray |
3903 // CFormattedCellListBoxData::ResetSLSubCellArray |
3713 // ----------------------------------------------------------------------------- |
3904 // ----------------------------------------------------------------------------- |
3714 // |
3905 // |
3715 void CFormattedCellListBoxData::ResetSLSubCellArray() |
3906 void CFormattedCellListBoxData::ResetSLSubCellArray() |
3716 { |
3907 { |
3717 if ( !iExtension ) |
3908 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3718 { |
|
3719 return; |
|
3720 } |
|
3721 |
|
3722 iExtension->iMarginRect = TRect::EUninitialized; |
3909 iExtension->iMarginRect = TRect::EUninitialized; |
3723 |
3910 |
3724 UseScalableLayoutData( EFalse ); |
3911 UseScalableLayoutData( EFalse ); |
3725 iExtension->ResetSLSubCellArray(); |
3912 iExtension->ResetSLSubCellArray(); |
3726 // This function gets called always when size changes, so here is called |
3913 // This function gets called always when size changes, so here is called |
3752 // CFormattedCellListBoxData::EnableStretching |
3935 // CFormattedCellListBoxData::EnableStretching |
3753 // ----------------------------------------------------------------------------- |
3936 // ----------------------------------------------------------------------------- |
3754 // |
3937 // |
3755 void CFormattedCellListBoxData::EnableStretching( const TBool aEnabled ) |
3938 void CFormattedCellListBoxData::EnableStretching( const TBool aEnabled ) |
3756 { |
3939 { |
3757 if ( !iExtension ) |
3940 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3758 { |
|
3759 return; |
|
3760 } |
|
3761 |
|
3762 iExtension->iStretchingEnabled = aEnabled; |
3941 iExtension->iStretchingEnabled = aEnabled; |
3763 } |
3942 } |
3764 |
3943 |
3765 // ----------------------------------------------------------------------------- |
3944 // ----------------------------------------------------------------------------- |
3766 // CFormattedCellListBoxData::HideSecondRow |
3945 // CFormattedCellListBoxData::HideSecondRow |
3767 // ----------------------------------------------------------------------------- |
3946 // ----------------------------------------------------------------------------- |
3768 // |
3947 // |
3769 void CFormattedCellListBoxData::HideSecondRow( const TBool aHide ) |
3948 void CFormattedCellListBoxData::HideSecondRow( const TBool aHide ) |
3770 { |
3949 { |
3771 if ( !iExtension ) |
3950 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3772 { |
|
3773 return; |
|
3774 } |
|
3775 |
|
3776 iExtension->iHideSecondRow = aHide; |
3951 iExtension->iHideSecondRow = aHide; |
3777 } |
3952 } |
3778 #endif // RD_LIST_STRETCH |
3953 #endif // RD_LIST_STRETCH |
3779 |
3954 |
3780 // ----------------------------------------------------------------------------- |
3955 // ----------------------------------------------------------------------------- |
3781 // CFormattedCellListBoxData::SecondRowHidden |
3956 // CFormattedCellListBoxData::SecondRowHidden |
3782 // ----------------------------------------------------------------------------- |
3957 // ----------------------------------------------------------------------------- |
3783 // |
3958 // |
3784 TBool CFormattedCellListBoxData::SecondRowHidden() const |
3959 TBool CFormattedCellListBoxData::SecondRowHidden() const |
3785 { |
3960 { |
3786 if ( !iExtension ) |
3961 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3787 { |
|
3788 return EFalse; |
|
3789 } |
|
3790 |
|
3791 return iExtension->iHideSecondRow; |
3962 return iExtension->iHideSecondRow; |
3792 } |
3963 } |
3793 |
3964 |
3794 // ----------------------------------------------------------------------------- |
3965 // ----------------------------------------------------------------------------- |
3795 // CFormattedCellListBoxData::ToggleDropShadows |
3966 // CFormattedCellListBoxData::ToggleDropShadows |
3796 // ----------------------------------------------------------------------------- |
3967 // ----------------------------------------------------------------------------- |
3797 // |
3968 // |
3798 void CFormattedCellListBoxData::ToggleDropShadows( const TBool aEnable ) |
3969 void CFormattedCellListBoxData::ToggleDropShadows( const TBool aEnable ) |
3799 { |
3970 { |
3800 if ( !iExtension ) |
3971 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
3801 { |
|
3802 return; |
|
3803 } |
|
3804 iExtension->iUseDropShadows = aEnable; |
3972 iExtension->iUseDropShadows = aEnable; |
3805 } |
3973 } |
3806 |
3974 |
3807 // ----------------------------------------------------------------------------- |
3975 // ----------------------------------------------------------------------------- |
3808 // CFormattedCellListBoxData::CheckIfSubCellsIntersect |
3976 // CFormattedCellListBoxData::CheckIfSubCellsIntersect |
4023 CleanupStack::PopAndDestroy( fbsBitGc ); |
4193 CleanupStack::PopAndDestroy( fbsBitGc ); |
4024 _AKNTRACE_FUNC_EXIT; |
4194 _AKNTRACE_FUNC_EXIT; |
4025 } |
4195 } |
4026 |
4196 |
4027 |
4197 |
|
4198 struct TCellInfo |
|
4199 { |
|
4200 TBool iTextNull; |
|
4201 TPtrC iTextPtr; |
|
4202 }; |
|
4203 |
4028 void |
4204 void |
4029 CFormattedCellListBoxData::DrawFormattedOld( TListItemProperties& aProperties, |
4205 CFormattedCellListBoxData::DrawFormattedOld( TListItemProperties& aProperties, |
4030 CWindowGc& aGc, |
4206 CWindowGc& aGc, |
4031 const TDesC* aText, |
4207 const TDesC* aText, |
4032 const TRect& aItemRect, |
4208 const TRect& aItemRect, |
4033 TBool aHighlight, |
4209 TBool aHighlight, |
4034 const TColors& aColors ) const |
4210 const TColors& aColors ) const |
4035 { |
4211 { |
4036 _AKNTRACE_FUNC_ENTER; |
4212 _AKNTRACE_FUNC_ENTER; |
4037 TRect aRect(aItemRect); |
4213 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
4038 const TColors *subcellColors = &aColors; |
4214 _AKNTRACE( "DrawFormattedOld: aText=%S, aItemRect=(%d,%d,%d,%d)", |
4039 |
4215 aText, aItemRect.iTl.iX, |
4040 TInt lastSubCell=LastSubCell(); |
4216 aItemRect.iTl.iY, |
4041 if (lastSubCell==KErrNotFound) |
4217 aItemRect.iBr.iX, |
4042 { |
4218 aItemRect.iBr.iY ); |
4043 aGc.UseFont(CEikonEnv::Static()->NormalFont()); |
4219 |
4044 aGc.DrawText(TPtrC(),aRect,0); // use draw text so that don't need to change pen color/style |
4220 TRect itemRect( aItemRect ); |
|
4221 |
|
4222 TInt lastSubCell = LastSubCell(); |
|
4223 if ( lastSubCell == KErrNotFound ) |
|
4224 { |
|
4225 aGc.UseFont( CEikonEnv::Static()->NormalFont() ); |
|
4226 // Use draw text so that there's no need to change pen color/style. |
|
4227 aGc.DrawText( TPtrC(), itemRect, 0 ); |
4045 aGc.DiscardFont(); // Release the font cache |
4228 aGc.DiscardFont(); // Release the font cache |
|
4229 _AKNTRACE_FUNC_EXIT; |
4046 return; |
4230 return; |
4047 } |
4231 } |
|
4232 |
|
4233 CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); |
|
4234 |
|
4235 DrawMarkingModeIcons( aProperties, aGc, itemRect ); |
|
4236 TInt iconOffset = aItemRect.Width() - itemRect.Width(); |
|
4237 |
|
4238 const TColors* subcellColors = &aColors; |
|
4239 |
4048 const CFont* font=SubCellFont(0); |
4240 const CFont* font=SubCellFont(0); |
4049 if (font==NULL) |
4241 if (font==NULL) |
4050 { |
4242 { |
4051 font=CEikonEnv::Static()->NormalFont(); |
4243 font=CEikonEnv::Static()->NormalFont(); |
4052 } |
4244 } |
4053 |
4245 |
4054 TInt extraVerticalSpace=(aRect.Height()-font->HeightInPixels()); |
4246 TRect textRect( itemRect ); |
4055 TInt baseLineOffset=extraVerticalSpace/2+font->AscentInPixels(); |
4247 textRect.iBr.iX = itemRect.iTl.iX; |
4056 TRect textRect=aRect; |
|
4057 textRect.iBr.iX=aRect.iTl.iX; |
|
4058 TInt subcell=0; |
4248 TInt subcell=0; |
4059 TInt subcell2=0; |
4249 TInt subcell2=0; |
4060 TPtrC text; |
4250 |
4061 TBool textNull[30]; |
4251 TCellInfo textNull[30]; |
4062 TRgb bmpBackColor, bmpForeColor; |
|
4063 TRect textShadowRect; // For transparent list |
4252 TRect textShadowRect; // For transparent list |
4064 TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text. |
4253 TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text. |
4065 |
4254 |
4066 MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() ); |
|
4067 TBool layoutMirrored = AknLayoutUtils::LayoutMirrored(); |
4255 TBool layoutMirrored = AknLayoutUtils::LayoutMirrored(); |
4068 TBool skinEnabled = AknsUtils::AvkonSkinEnabled(); |
4256 TBool skinEnabled = AknsUtils::AvkonSkinEnabled(); |
4069 |
4257 |
4070 if (!cc) |
|
4071 { |
|
4072 cc = SkinBackgroundContext(); |
|
4073 } |
|
4074 |
|
4075 Mem::FillZ( textNull, sizeof( textNull ) ); |
|
4076 |
4258 |
4077 // cache the text states. |
4259 // cache the text states. |
4078 subcell = 0; |
4260 subcell = 0; |
|
4261 |
|
4262 SSubCell defaultCell; |
|
4263 TMargins tm = {0,0,0,0}; |
|
4264 defaultCell.iPosition = TPoint(0,0); |
|
4265 defaultCell.iSize = TSize(0,0); |
|
4266 defaultCell.iRealSize = TSize(0,0); |
|
4267 defaultCell.iRealTextSize = TSize(0,0); |
|
4268 defaultCell.iMargin = tm; |
|
4269 defaultCell.iUseSubCellColors = EFalse; |
|
4270 defaultCell.iColors = defaultcolors; |
|
4271 defaultCell.iGraphics = EFalse; |
|
4272 defaultCell.iAlign = CGraphicsContext::ELeft; |
|
4273 defaultCell.iBaseline = 0; |
|
4274 defaultCell.iNumberCell = EFalse; |
|
4275 defaultCell.iTextClipGap = 0; |
|
4276 defaultCell.iNotAlwaysDrawn = EFalse; |
|
4277 defaultCell.iTransparent = EFalse; |
|
4278 defaultCell.iBaseFont = 0; |
|
4279 SSubCell* sc; |
|
4280 |
|
4281 |
4079 for(;;) |
4282 for(;;) |
4080 { |
4283 { |
4081 if (subcell>lastSubCell) |
4284 if (subcell>lastSubCell) |
4082 { |
4285 { |
4083 break; |
4286 break; |
4084 } |
4287 } |
4085 |
4288 |
4086 TextUtils::ColumnText(text,subcell, aText); |
4289 TInt subcellindex = 0; |
4087 if (text == KNullDesC && SubCellIsNotAlwaysDrawn(subcell)) |
4290 TInt subcellfound = 0; |
4088 { |
4291 subcellfound = FindSubCellIndex(subcellindex,subcell); |
4089 textNull[subcell] = ETrue; |
4292 if (subcellfound != KErrNotFound) |
|
4293 { |
|
4294 sc = &(iSubCellArray->At(subcellindex)); |
|
4295 } |
|
4296 else |
|
4297 { |
|
4298 sc = &defaultCell; |
|
4299 } |
|
4300 |
|
4301 TextUtils::ColumnText(textNull[subcell].iTextPtr,subcell, aText); |
|
4302 |
|
4303 if (textNull[subcell].iTextPtr == KNullDesC && sc->iNotAlwaysDrawn) |
|
4304 { |
|
4305 textNull[subcell].iTextNull = ETrue; |
|
4306 } |
|
4307 else |
|
4308 { |
|
4309 textNull[subcell].iTextNull = EFalse; |
4090 } |
4310 } |
4091 |
4311 |
4092 subcell++; |
4312 subcell++; |
4093 } |
4313 } |
4094 |
4314 |
4100 if (subcell>lastSubCell) |
4320 if (subcell>lastSubCell) |
4101 { |
4321 { |
4102 break; |
4322 break; |
4103 } |
4323 } |
4104 |
4324 |
4105 if (textNull[subcell]) |
4325 if (textNull[subcell].iTextNull) |
4106 { |
4326 { |
4107 ++subcell; |
4327 ++subcell; |
4108 continue; |
4328 continue; |
4109 } |
4329 } |
4110 |
4330 |
4111 TRect bRect(SubCellPosition(subcell),SubCellSize(subcell)); |
4331 TInt subcellindex = 0; |
4112 TMargins m(SubCellMargins(subcell)); |
4332 TInt subcellfound = 0; |
4113 TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); |
4333 subcellfound = FindSubCellIndex(subcellindex,subcell); |
|
4334 if (subcellfound != KErrNotFound) |
|
4335 { |
|
4336 sc = &(iSubCellArray->At(subcellindex)); |
|
4337 } |
|
4338 else |
|
4339 { |
|
4340 sc = &defaultCell; |
|
4341 } |
4114 |
4342 |
4115 for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) |
4343 TRect bRect = TRect(sc->iPosition,sc->iSize); |
4116 { |
4344 bRect.iBr.iX -= iconOffset; |
4117 if (textNull[subcell2]) |
4345 TMargins m = sc->iMargin; |
|
4346 TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); |
|
4347 const TBool istrans = sc->iTransparent; |
|
4348 if (!layoutMirrored) |
|
4349 { |
|
4350 for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) |
4118 { |
4351 { |
4119 continue; |
4352 if (textNull[subcell2].iTextNull) |
4120 } |
4353 { |
4121 |
4354 continue; |
4122 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! |
4355 } |
4123 TRect bRect2 = TRect(SubCellPosition(subcell2),SubCellSize(subcell2)); |
4356 |
4124 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !SubCellIsTransparent(subcell) && !SubCellIsTransparent(subcell2)) |
4357 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! |
4125 { |
4358 TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) ); |
4126 if (!layoutMirrored) |
4359 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) |
4127 { |
4360 { |
4128 cRect.iBr.iX = bRect2.iTl.iX; |
4361 cRect.iBr.iX = bRect2.iTl.iX; |
4129 bRect.iBr.iX = bRect2.iTl.iX; |
4362 bRect.iBr.iX = bRect2.iTl.iX; |
4130 } |
4363 } |
4131 else |
4364 } |
|
4365 } |
|
4366 else |
|
4367 { |
|
4368 for (subcell2=subcell+1; subcell2<=lastSubCell; subcell2++) |
|
4369 { |
|
4370 if (textNull[subcell2].iTextNull) |
|
4371 { |
|
4372 continue; |
|
4373 } |
|
4374 |
|
4375 // This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing! |
|
4376 TRect bRect2( SubCellPosition( subcell2 ), SubCellSize( subcell2 ) ); |
|
4377 if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !istrans && !SubCellIsTransparent(subcell2)) |
4132 { |
4378 { |
4133 cRect.iTl.iX = bRect2.iBr.iX; |
4379 cRect.iTl.iX = bRect2.iBr.iX; |
4134 bRect.iTl.iX = bRect2.iBr.iX; |
4380 bRect.iTl.iX = bRect2.iBr.iX; |
4135 } |
4381 } |
4136 } |
4382 } |
4137 } |
4383 } |
4138 SetSubCellRealTextSize(subcell, cRect.Size()); |
4384 SetSubCellRealTextSize(subcell, cRect.Size()); |
4139 SetSubCellRealSize(subcell, bRect.Size()); |
4385 SetSubCellRealSize(subcell, bRect.Size()); |
|
4386 sc->iRealTextSize = cRect.Size(); |
|
4387 sc->iRealSize = bRect.Size(); |
4140 subcell++; |
4388 subcell++; |
4141 } |
4389 } |
4142 |
4390 |
4143 // This loop does the drawing. |
4391 // This loop does the drawing. |
4144 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
4392 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
4148 if (subcell>lastSubCell) |
4396 if (subcell>lastSubCell) |
4149 { |
4397 { |
4150 break; |
4398 break; |
4151 } |
4399 } |
4152 |
4400 |
4153 if (textNull[subcell]) |
4401 if (textNull[subcell].iTextNull) |
4154 { |
4402 { |
4155 ++ subcell; |
4403 ++ subcell; |
4156 continue; |
4404 continue; |
4157 } |
4405 } |
4158 |
4406 |
|
4407 |
|
4408 TInt subcellindex = 0; |
|
4409 TInt subcellfound = 0; |
|
4410 subcellfound = FindSubCellIndex(subcellindex,subcell); |
|
4411 if (subcellfound != KErrNotFound) |
|
4412 { |
|
4413 sc = &(iSubCellArray->At(subcellindex)); |
|
4414 } |
|
4415 else |
|
4416 { |
|
4417 sc = &defaultCell; |
|
4418 } |
|
4419 |
4159 // SetPosition, SetSize and margins support |
4420 // SetPosition, SetSize and margins support |
4160 TRect bRect(SubCellPosition(subcell),SubCellRealSize(subcell)); |
4421 TRect bRect = TRect(sc->iPosition,sc->iRealSize); |
4161 TMargins m(SubCellMargins(subcell)); |
4422 TMargins m = sc->iMargin; |
4162 TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),SubCellRealTextSize(subcell)); |
4423 TRect cRect = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),sc->iRealTextSize); |
4163 |
4424 |
4164 |
4425 |
4165 if (bRect.iBr.iX == 0) |
4426 if (bRect.iBr.iX == 0) |
4166 { |
4427 { |
4167 ++subcell; |
4428 ++subcell; |
4168 continue; |
4429 continue; |
4169 } |
4430 } |
4170 |
4431 |
4171 if ( layoutMirrored ) |
4432 if ( layoutMirrored ) |
4172 { |
4433 { |
4173 TRect bRect = TRect(SubCellPosition(subcell),SubCellSize(subcell)); |
4434 TRect bRect( sc->iPosition, sc->iSize ); |
4174 TRect cRect2 = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop)); |
4435 bRect.iBr.iX -= iconOffset; |
|
4436 TRect cRect2( bRect.iTl + TSize( m.iLeft, m.iTop ), |
|
4437 bRect.Size() - TSize( m.iRight + m.iLeft, |
|
4438 m.iBottom + m.iTop ) ); |
4175 |
4439 |
4176 TInt shift = (cRect2.Size() - SubCellRealTextSize(subcell)).iWidth; |
4440 TInt shift = (cRect2.Size() - sc->iRealTextSize).iWidth; |
4177 cRect.iTl.iX += shift; |
4441 cRect.iTl.iX += shift; |
4178 cRect.iBr.iX += shift; |
4442 cRect.iBr.iX += shift; |
4179 } |
4443 } |
4180 |
4444 |
4181 textRect.SetRect(aItemRect.iTl+cRect.iTl,cRect.Size()); |
4445 textRect = TRect( itemRect.iTl + cRect.iTl, cRect.Size() ); |
4182 |
4446 |
4183 if (UseSubCellColors(subcell)) |
4447 if (sc->iUseSubCellColors) |
4184 { |
4448 { |
4185 subcellColors = &SubCellColors(subcell); |
4449 subcellColors = &sc->iColors; |
4186 } |
4450 } |
4187 else |
4451 else |
4188 { |
4452 { |
4189 subcellColors = &aColors; |
4453 subcellColors = &aColors; |
4190 } |
4454 } |
4191 |
4455 CListBoxView* view = listbox->View(); |
|
4456 TBool useOverrideColor = view->ItemDrawer()->Flags() & CListItemDrawer::EUseOverrideSkinTextColor; |
4192 if (aHighlight) |
4457 if (aHighlight) |
4193 { |
4458 { |
4194 aGc.SetPenColor(subcellColors->iHighlightedText); |
4459 aGc.SetPenColor(subcellColors->iHighlightedText); |
4195 aGc.SetBrushColor(subcellColors->iHighlightedBack); |
4460 aGc.SetBrushColor(subcellColors->iHighlightedBack); |
4196 bmpBackColor = subcellColors->iHighlightedBack; |
4461 if ( skinEnabled && !useOverrideColor ) |
4197 bmpForeColor = subcellColors->iHighlightedText; |
|
4198 if ( skinEnabled && iExtension ) |
|
4199 { |
4462 { |
4200 if ( iExtension->iHighlightedTextColor != NULL ) |
4463 if ( iExtension->iHighlightedTextColor != NULL ) |
4201 { |
4464 { |
4202 aGc.SetPenColor( iExtension->iHighlightedTextColor ); |
4465 aGc.SetPenColor( iExtension->iHighlightedTextColor ); |
4203 bmpForeColor = iExtension->iHighlightedTextColor; |
|
4204 } |
4466 } |
4205 } |
4467 } |
4206 } |
4468 } |
4207 else |
4469 else |
4208 { |
4470 { |
4209 aGc.SetPenColor(subcellColors->iText); |
4471 aGc.SetPenColor(subcellColors->iText); |
4210 aGc.SetBrushColor(subcellColors->iBack); |
4472 aGc.SetBrushColor(subcellColors->iBack); |
4211 bmpBackColor = subcellColors->iBack; |
|
4212 bmpForeColor = subcellColors->iText; |
|
4213 |
4473 |
4214 if ( skinEnabled && iExtension ) |
4474 if ( skinEnabled && !useOverrideColor ) |
4215 { |
4475 { |
4216 if ( iExtension->iTextColor != NULL ) |
4476 if ( iExtension->iTextColor != NULL ) |
4217 { |
4477 { |
4218 aGc.SetPenColor( iExtension->iTextColor ); |
4478 aGc.SetPenColor( iExtension->iTextColor ); |
4219 bmpForeColor = iExtension->iTextColor; |
|
4220 } |
4479 } |
4221 } |
4480 } |
4222 } |
4481 } |
4223 |
4482 |
4224 aGc.SetBrushStyle(CGraphicsContext::ENullBrush); |
4483 aGc.SetBrushStyle(CGraphicsContext::ENullBrush); |
4225 |
4484 |
4226 // The following draws subcells to textRect |
4485 // The following draws subcells to textRect |
4227 if (textRect.iBr.iX!=textRect.iTl.iX) |
4486 if (textRect.iBr.iX!=textRect.iTl.iX) |
4228 { |
4487 { |
4229 TextUtils::ColumnText(text,subcell,aText); |
|
4230 |
|
4231 // graphics or text column |
4488 // graphics or text column |
4232 CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); |
4489 CGraphicsContext::TTextAlign align=sc->iAlign; |
4233 if (!SubCellIsGraphics(subcell)) |
4490 if (!sc->iGraphics) |
4234 { |
4491 { |
4235 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); |
4492 const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell); |
4236 const CFont* cellFont=Font(aProperties, subcell); |
4493 const CFont* cellFont=sc->iBaseFont; |
4237 const CFont* tempFont=(cellFont) ? cellFont : font; |
4494 const CFont* tempFont=(cellFont) ? cellFont : font; |
4238 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont; |
4495 const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont; |
4239 aGc.UseFont(usedFont); |
4496 aGc.UseFont(usedFont); |
4240 SetUnderlineStyle( aProperties, aGc, subcell ); |
4497 SetUnderlineStyle( aProperties, aGc, subcell ); |
4241 |
4498 |
4242 // baseline calc needed for each cell. |
4499 // baseline calc needed for each cell. |
4243 baseLineOffset = SubCellBaselinePos(subcell); |
4500 TInt baseLineOffset = sc->iBaseline; |
4244 baseLineOffset -= cRect.iTl.iY; |
4501 baseLineOffset -= cRect.iTl.iY; |
4245 if (!baseLineOffset) |
4502 if (!baseLineOffset) |
4246 { |
4503 { |
4247 baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels(); |
4504 baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels(); |
4248 } |
4505 } |
4249 |
4506 |
4250 TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf = |
4507 TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf;// = sc->iColumnText.Left(KMaxColumnDataLength); |
4251 text.Left(KMaxColumnDataLength); |
|
4252 |
4508 |
4253 // Note that this potentially modifies the text so its lenght in pixels |
4509 // Note that this potentially modifies the text so its lenght in pixels |
4254 // might increase. Therefore, this should always be done before |
4510 // might increase. Therefore, this should always be done before |
4255 // wrapping/clipping text. In some cases, WordWrapListItem is called |
4511 // wrapping/clipping text. In some cases, WordWrapListItem is called |
4256 // before coming here. Is it certain that it is not done for number subcells? |
4512 // before coming here. Is it certain that it is not done for number subcells? |
4257 if (SubCellIsNumberCell(subcell)) |
4513 TBool bufset = EFalse; |
|
4514 if (sc->iNumberCell) |
4258 { |
4515 { |
|
4516 clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength); |
4259 AknTextUtils::LanguageSpecificNumberConversion(clipbuf); |
4517 AknTextUtils::LanguageSpecificNumberConversion(clipbuf); |
|
4518 bufset = ETrue; |
4260 } |
4519 } |
4261 |
4520 |
4262 TBool clipped( EFalse ); |
4521 TBool clipped( EFalse ); |
4263 TInt clipgap = SubCellTextClipGap( subcell ); |
4522 TInt clipgap = sc->iTextClipGap; |
4264 |
4523 |
4265 if ( iExtension->iUseLogicalToVisualConversion && |
4524 if ( iExtension->iUseLogicalToVisualConversion && |
4266 subcell != iExtension->iFirstWordWrappedSubcellIndex && |
4525 subcell != iExtension->iFirstWordWrappedSubcellIndex && |
4267 subcell != iExtension->iSecondWordWrappedSubcellIndex ) |
4526 subcell != iExtension->iSecondWordWrappedSubcellIndex ) |
4268 { |
4527 { |
4269 TInt maxClipWidth = textRect.Size().iWidth + clipgap; |
4528 TInt maxClipWidth = textRect.Size().iWidth + clipgap; |
4270 |
4529 |
4271 clipped = AknBidiTextUtils::ConvertToVisualAndClip( |
4530 clipped = AknBidiTextUtils::ConvertToVisualAndClip( |
4272 text.Left(KMaxColumnDataLength), |
4531 textNull[subcell].iTextPtr.Left(KMaxColumnDataLength), |
4273 clipbuf, |
4532 clipbuf, |
4274 *usedFont, |
4533 *usedFont, |
4275 textRect.Size().iWidth, |
4534 textRect.Width(), |
4276 maxClipWidth ); |
4535 maxClipWidth ); |
|
4536 } |
|
4537 else if (!bufset) |
|
4538 { |
|
4539 clipbuf = textNull[subcell].iTextPtr.Left(KMaxColumnDataLength); |
4277 } |
4540 } |
4278 |
4541 |
4279 if (clipped) |
4542 if (clipped) |
4280 { |
4543 { |
4281 if (!layoutMirrored) |
4544 if (!layoutMirrored) |
4308 CAknMarqueeControl* marquee = |
4571 CAknMarqueeControl* marquee = |
4309 subcell == 1 ? iExtension->iMarquee : |
4572 subcell == 1 ? iExtension->iMarquee : |
4310 iExtension->i2ndLineMarquee; |
4573 iExtension->i2ndLineMarquee; |
4311 |
4574 |
4312 TBool marqueeDisabled = |
4575 TBool marqueeDisabled = |
4313 static_cast<CEikListBox*>( |
4576 listbox->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; |
4314 Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee; |
|
4315 |
4577 |
4316 if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled ) |
4578 if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled ) |
4317 { |
4579 { |
4318 // Let marquee know if it needs to do bidi conversion. |
4580 // Let marquee know if it needs to do bidi conversion. |
4319 marquee->UseLogicalToVisualConversion( clipped ); |
4581 marquee->UseLogicalToVisualConversion( clipped ); |
4320 |
4582 |
4321 if ( marquee->DrawText( aGc, textRect, text, baseLineOffset, align, *usedFont ) ) |
4583 if ( marquee->DrawText( aGc, textRect, textNull[subcell].iTextPtr, baseLineOffset, align, *usedFont ) ) |
4322 { |
4584 { |
4323 // All the loops have been executed -> the text needs to be truncated. |
4585 // All the loops have been executed -> the text needs to be truncated. |
4324 aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); |
4586 aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 ); |
4325 } |
4587 } |
4326 } |
4588 } |
4377 if (index>=0 && iIconArray) |
4639 if (index>=0 && iIconArray) |
4378 { |
4640 { |
4379 CGulIcon* icon=(*iIconArray)[index]; |
4641 CGulIcon* icon=(*iIconArray)[index]; |
4380 CFbsBitmap* bitmap=icon->Bitmap(); |
4642 CFbsBitmap* bitmap=icon->Bitmap(); |
4381 |
4643 |
4382 if ( iExtension ) |
4644 |
|
4645 TInt w, h; |
|
4646 TSize sz = bitmap->SizeInPixels(); |
|
4647 |
|
4648 w = iExtension->iSubCellIconSize[subcell].iWidth; |
|
4649 h = iExtension->iSubCellIconSize[subcell].iHeight; |
|
4650 |
|
4651 if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) ) |
4383 { |
4652 { |
4384 TInt w, h; |
4653 AknIconUtils::SetSize( bitmap, |
4385 TSize sz = bitmap->SizeInPixels(); |
4654 iExtension->iSubCellIconSize[subcell], |
4386 |
4655 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
4387 w = iExtension->iSubCellIconSize[subcell].iWidth; |
|
4388 h = iExtension->iSubCellIconSize[subcell].iHeight; |
|
4389 |
|
4390 if (h != 0 && w != 0 && !( sz.iWidth == w || sz.iHeight == h ) ) |
|
4391 { |
|
4392 AknIconUtils::SetSize( bitmap, |
|
4393 iExtension->iSubCellIconSize[subcell], |
|
4394 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
4395 } |
|
4396 else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all |
|
4397 { |
|
4398 // just in case fallback |
|
4399 AknIconUtils::SetSize( bitmap, |
|
4400 textRect.Size(), |
|
4401 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
4402 } |
|
4403 } |
4656 } |
|
4657 else if ( sz.iWidth == 0 || sz.iHeight == 0 ) // check if size is set at all |
|
4658 { |
|
4659 // just in case fallback |
|
4660 AknIconUtils::SetSize( bitmap, |
|
4661 textRect.Size(), |
|
4662 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
4663 } |
|
4664 |
4404 |
4665 |
4405 TSize size=bitmap->SizeInPixels(); |
4666 TSize size=bitmap->SizeInPixels(); |
4406 |
4667 |
4407 if (size.iWidth>textRect.Size().iWidth) |
4668 if (size.iWidth>textRect.Width()) |
4408 { |
4669 { |
4409 size.iWidth = textRect.Size().iWidth; |
4670 size.iWidth = textRect.Width(); |
4410 } |
4671 } |
4411 |
4672 |
4412 if (size.iHeight>textRect.Size().iHeight) |
4673 if (size.iHeight>textRect.Height()) |
4413 { |
4674 { |
4414 size.iHeight = textRect.Size().iHeight; |
4675 size.iHeight = textRect.Height(); |
4415 } |
4676 } |
4416 |
4677 |
4417 TPoint bmpPos=textRect.iTl; |
4678 TPoint bmpPos=textRect.iTl; |
4418 bmpPos.iY+=(textRect.Height()-size.iHeight)>>1; |
4679 bmpPos.iY+=(textRect.Height()-size.iHeight)>>1; |
4419 switch (align) |
4680 switch (align) |
4463 _AKNTRACE_FUNC_EXIT; |
4724 _AKNTRACE_FUNC_EXIT; |
4464 } |
4725 } |
4465 |
4726 |
4466 void CFormattedCellListBoxData::SetClippedByWrap( TUint32 aClippedCells, TBool aUseClippedByWrap ) |
4727 void CFormattedCellListBoxData::SetClippedByWrap( TUint32 aClippedCells, TBool aUseClippedByWrap ) |
4467 { |
4728 { |
|
4729 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
4730 iExtension->iClippedByWrap = aClippedCells; |
|
4731 iExtension->iUseClippedByWrap = aUseClippedByWrap; |
|
4732 } |
|
4733 |
|
4734 EXPORT_C TUint32 CFormattedCellListBoxData::CurrentItemTextWasClipped() const |
|
4735 { |
|
4736 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
4737 return iExtension->iClippedSubcells; |
|
4738 } |
|
4739 |
|
4740 |
|
4741 |
|
4742 TBool CFormattedCellListBoxData::KineticScrollingEnabled() const |
|
4743 { |
|
4744 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
4745 return iExtension->iKineticScrolling; |
|
4746 } |
|
4747 |
|
4748 |
|
4749 CEikListBox* CFormattedCellListBoxData::ListBox() const |
|
4750 { |
|
4751 __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer )); |
|
4752 if ( iExtension->iControl ) |
|
4753 { |
|
4754 return static_cast<CEikListBox*>( iExtension->iControl ); |
|
4755 } |
|
4756 return NULL; |
|
4757 } |
|
4758 void CFormattedCellListBoxData::InitSmileyL() |
|
4759 { |
|
4760 __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4761 if ( !iExtension->iSmileyMan ) |
|
4762 { |
|
4763 iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension ); |
|
4764 } |
|
4765 } |
|
4766 |
|
4767 void CFormattedCellListBoxData::SetSmileySubCellL( TInt aSubCell ) |
|
4768 { |
|
4769 __ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed )); |
|
4770 TInt index = 0; |
4468 if ( iExtension ) |
4771 if ( iExtension ) |
4469 { |
4772 { |
4470 iExtension->iClippedByWrap = aClippedCells; |
4773 iExtension->FindSLSubCellIndexOrAddL( index,aSubCell ); |
4471 iExtension->iUseClippedByWrap = aUseClippedByWrap; |
4774 iExtension->SLAt(index).iSmileyCell = ETrue; |
4472 } |
4775 } |
4473 } |
4776 } |
4474 |
4777 #ifdef __ARMCC__ |
4475 EXPORT_C TUint32 CFormattedCellListBoxData::CurrentItemTextWasClipped() const |
4778 #pragma pop |
4476 { |
4779 #endif // __ARMCC__ |
4477 return iExtension ? iExtension->iClippedSubcells : 0; |
|
4478 } |
|
4479 |
|
4480 |
|
4481 |
|
4482 TBool CFormattedCellListBoxData::KineticScrollingEnabled() const |
|
4483 { |
|
4484 if ( iExtension ) |
|
4485 { |
|
4486 return iExtension->iKineticScrolling; |
|
4487 } |
|
4488 return EFalse; |
|
4489 } |
|
4490 |
|
4491 |
|
4492 CEikListBox* CFormattedCellListBoxData::ListBox() const |
|
4493 { |
|
4494 if ( iExtension && iExtension->iControl ) |
|
4495 { |
|
4496 return static_cast<CEikListBox*>( iExtension->iControl ); |
|
4497 } |
|
4498 return NULL; |
|
4499 } |
|
4500 |
|
4501 |
4780 |
4502 // End of File |
4781 // End of File |