idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/src/xnnewstickercontrol.cpp
equal
deleted
inserted
replaced
420 // CXnNewstickerControl::Title |
420 // CXnNewstickerControl::Title |
421 // --------------------------------------------------------- |
421 // --------------------------------------------------------- |
422 // |
422 // |
423 const TDesC& CXnNewstickerControl::Title(TInt aIndex) |
423 const TDesC& CXnNewstickerControl::Title(TInt aIndex) |
424 { |
424 { |
425 if (aIndex < 0 || aIndex > iTitles.Count()) |
425 if (aIndex < 0 || aIndex >= iTitles.Count()) |
426 { |
426 { |
427 return KNullDesC; |
427 return KNullDesC; |
428 } |
428 } |
429 |
429 |
430 if (iTitles[aIndex]->IsSvgTitle()) |
430 if (iTitles[aIndex]->IsSvgTitle()) |
511 // CXnNewstickerControl::CurrentSvgTitle |
511 // CXnNewstickerControl::CurrentSvgTitle |
512 // --------------------------------------------------------- |
512 // --------------------------------------------------------- |
513 // |
513 // |
514 const TDesC8& CXnNewstickerControl::CurrentSvgTitle() |
514 const TDesC8& CXnNewstickerControl::CurrentSvgTitle() |
515 { |
515 { |
|
516 if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() ) |
|
517 { |
|
518 return KNullDesC8; |
|
519 } |
|
520 |
516 CTitleData* title = iTitles[iFirstDrawingTitleIndex]; |
521 CTitleData* title = iTitles[iFirstDrawingTitleIndex]; |
517 // Is it SVG title |
522 // Is it SVG title |
518 if (title->IsSvgTitle()) |
523 if (title->IsSvgTitle()) |
519 { |
524 { |
520 // Yes, advance the title index |
525 // Yes, advance the title index |
785 if(!gc || !background || !IsVisibleTitles() ) |
790 if(!gc || !background || !IsVisibleTitles() ) |
786 { |
791 { |
787 return; |
792 return; |
788 } |
793 } |
789 iFirstDrawingTitleIndex = GetNextTitleWithContent( iFirstDrawingTitleIndex ); |
794 iFirstDrawingTitleIndex = GetNextTitleWithContent( iFirstDrawingTitleIndex ); |
790 if ( iFirstDrawingTitleIndex < 0 ) |
795 if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() ) |
791 { |
796 { |
792 return; |
797 return; |
793 } |
798 } |
794 if (iTitles[iFirstDrawingTitleIndex]->IsSvgTitle()) |
799 if (iTitles[iFirstDrawingTitleIndex]->IsSvgTitle()) |
795 { |
800 { |
933 void CXnNewstickerControl::PrepareToDrawRtlL() |
938 void CXnNewstickerControl::PrepareToDrawRtlL() |
934 { |
939 { |
935 CBitmapContext* gc = iAdapter->BufferGc(); |
940 CBitmapContext* gc = iAdapter->BufferGc(); |
936 const CFbsBitmap* background = iAdapter->BackgroundBitmap(); |
941 const CFbsBitmap* background = iAdapter->BackgroundBitmap(); |
937 if(!gc || !background || !IsVisibleTitles() ) |
942 if(!gc || !background || !IsVisibleTitles() ) |
|
943 { |
|
944 return; |
|
945 } |
|
946 if ( iFirstDrawingTitleIndex < 0 || iFirstDrawingTitleIndex >= iTitles.Count() ) |
938 { |
947 { |
939 return; |
948 return; |
940 } |
949 } |
941 if (iTitles[iFirstDrawingTitleIndex]->IsSvgTitle()) |
950 if (iTitles[iFirstDrawingTitleIndex]->IsSvgTitle()) |
942 { |
951 { |
1084 // ----------------------------------------------------------------------------- |
1093 // ----------------------------------------------------------------------------- |
1085 // |
1094 // |
1086 void CXnNewstickerControl::DoScrollL() |
1095 void CXnNewstickerControl::DoScrollL() |
1087 { |
1096 { |
1088 // If there are no titles, don't do anything. |
1097 // If there are no titles, don't do anything. |
1089 if( !IsVisibleTitles() || iFirstDrawingTitleIndex < 0 ) |
1098 if( !IsVisibleTitles() || iFirstDrawingTitleIndex < 0 || |
|
1099 iFirstDrawingTitleIndex >= iTitles.Count() ) |
1090 { |
1100 { |
1091 return; |
1101 return; |
1092 } |
1102 } |
1093 |
1103 |
1094 iAdapter->DrawNow(); |
1104 iAdapter->DrawNow(); |
1315 if ( iAdapter->ScrollBehaviour() == CXnNewstickerAdapter::EScrollAlternate ) |
1325 if ( iAdapter->ScrollBehaviour() == CXnNewstickerAdapter::EScrollAlternate ) |
1316 { |
1326 { |
1317 const TInt count = iTitles.Count(); |
1327 const TInt count = iTitles.Count(); |
1318 TInt textWidth=0; |
1328 TInt textWidth=0; |
1319 const TInt rectWidth = iContentRect.Width(); |
1329 const TInt rectWidth = iContentRect.Width(); |
1320 if( iCurrentTitleIndex < count ) |
1330 if( iCurrentTitleIndex >= 0 && iCurrentTitleIndex < count ) |
1321 { |
1331 { |
1322 textWidth = iTitles[iCurrentTitleIndex]->TitleTextLengthInPixels(); |
1332 textWidth = iTitles[iCurrentTitleIndex]->TitleTextLengthInPixels(); |
1323 } |
1333 } |
1324 return ( textWidth < rectWidth ); |
1334 return ( textWidth < rectWidth ); |
1325 } |
1335 } |