239 TAknsQsnTextColorsIndex clrIndex; |
239 TAknsQsnTextColorsIndex clrIndex; |
240 clrIndex = EAknsCIQsnTextColorsCG20; |
240 clrIndex = EAknsCIQsnTextColorsCG20; |
241 |
241 |
242 if ( AknsUtils::AvkonSkinEnabled() ) |
242 if ( AknsUtils::AvkonSkinEnabled() ) |
243 { |
243 { |
244 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
244 AknsUtils::GetCachedColor( UiLayout()->SkinInstance(), |
245 color, KAknsIIDQsnTextColors, clrIndex ); |
245 color, KAknsIIDQsnTextColors, clrIndex ); |
246 } |
246 } |
247 |
247 |
248 textLayout.DrawText(*gc, iPageInfo->Des(), EFalse, color); |
248 textLayout.DrawText(*gc, iPageInfo->Des(), EFalse, color); |
249 } |
249 } |
344 UpdateNaviButtonStates(); |
344 UpdateNaviButtonStates(); |
345 } |
345 } |
346 |
346 |
347 EXPORT_C void CFepLayoutScrollableList::CalculateItemWidth() |
347 EXPORT_C void CFepLayoutScrollableList::CalculateItemWidth() |
348 { |
348 { |
|
349 TBuf<KDisplayTextLen> buf; |
|
350 CFont::TMeasureTextInput::TFlags flg = CFont::TMeasureTextInput::EFVisualOrder; |
|
351 if(iAlign == CGraphicsContext::ERight) |
|
352 flg = CFont::TMeasureTextInput::EFVisualOrderRightToLeft; |
|
353 |
|
354 const CFont* font = iFont; |
|
355 if(iTextLineSet) |
|
356 { |
|
357 TAknLayoutText textLayout; |
|
358 textLayout.LayoutText(TRect(0, 0, 1, 1), iTextLine); |
|
359 font = textLayout.Font(); |
|
360 } |
|
361 ASSERT(font); |
|
362 |
349 iItemSize.iWidth = iInitItemWidth; |
363 iItemSize.iWidth = iInitItemWidth; |
350 const RPointerArray<SItem>& allItems = ItemArray(); |
364 const RPointerArray<SItem>& allItems = ItemArray(); |
351 for( TInt i = 0; i < allItems.Count() ; ++i ) |
365 for(TInt i = 0; i < allItems.Count(); ++i) |
352 { |
366 { |
353 TInt itemWidth = iFont->TextWidthInPixels( allItems[i]->iText ); |
367 TInt itemWidth = AknBidiTextUtils::MeasureTextBoundsWidth( |
354 if( itemWidth > iItemSize.iWidth ) |
368 *font, allItems[i]->iText, flg); |
355 { |
369 if(itemWidth > iItemSize.iWidth) |
356 iItemSize.iWidth = itemWidth; |
370 iItemSize.iWidth = itemWidth; |
357 } |
|
358 } |
371 } |
359 |
372 |
360 TPixelsTwipsAndRotation ptScreenSize; |
373 TPixelsTwipsAndRotation ptScreenSize; |
361 CCoeEnv::Static()->ScreenDevice()-> |
374 CCoeEnv::Static()->ScreenDevice()-> |
362 GetDefaultScreenSizeAndRotation(ptScreenSize); |
375 GetDefaultScreenSizeAndRotation(ptScreenSize); |
429 |
442 |
430 // ----- draw bitmaps ----- |
443 // ----- draw bitmaps ----- |
431 gc->Activate(BitmapDevice()); |
444 gc->Activate(BitmapDevice()); |
432 |
445 |
433 // draw frame |
446 // draw frame |
434 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
447 MAknsSkinInstance* skin = UiLayout()->SkinInstance(); |
435 TRect innerRect = itemRect; |
448 TRect innerRect = itemRect; |
436 innerRect.Shrink(7, 7); |
449 innerRect.Shrink(7, 7); |
437 AknsDrawUtils::DrawFrame(skin, |
450 AknsDrawUtils::DrawFrame(skin, |
438 *gc, |
451 *gc, |
439 itemRect, |
452 itemRect, |
440 innerRect, |
453 innerRect, |
441 aItemActive ? iItemActiveFrId : iItemFrId, |
454 aItemActive ? iItemActiveFrId : iItemFrId, |
442 KAknsIIDDefault); |
455 KAknsIIDDefault); |
443 } |
456 } |
444 |
457 |
|
458 CFepLayoutChoiceList::SItem* item = ItemArray()[aItemIndex]; |
|
459 const CFont* font = iFont; |
|
460 TRgb color = iFontColor; |
|
461 TInt baseLine = iBaselineOffset; |
|
462 |
445 // draw text |
463 // draw text |
446 if (iTextLineSet) |
464 if (iTextLineSet) |
447 { |
465 { |
448 gc->SetBrushStyle(CGraphicsContext::ENullBrush); |
|
449 gc->SetBrushColor(KRgbBlack); |
|
450 TRgb color( KRgbBlack ); // sane default for nonskinned case |
|
451 |
|
452 TAknLayoutText textLayout; |
466 TAknLayoutText textLayout; |
453 textLayout.LayoutText(itemRect, |
467 textLayout.LayoutText(itemRect, iTextLine); |
454 iTextLine); |
468 |
455 TAknsQsnTextColorsIndex clrIndex; |
469 TAknsQsnTextColorsIndex clrIndex; |
456 clrIndex = isFocus ? EAknsCIQsnTextColorsCG10 : EAknsCIQsnTextColorsCG20; |
470 clrIndex = isFocus ? EAknsCIQsnTextColorsCG10 : EAknsCIQsnTextColorsCG20; |
457 |
471 |
458 if ( AknsUtils::AvkonSkinEnabled() ) |
472 color = KRgbBlack; |
459 { |
473 if (AknsUtils::AvkonSkinEnabled()) |
460 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), |
474 AknsUtils::GetCachedColor( UiLayout()->SkinInstance(), |
461 color, KAknsIIDQsnTextColors, clrIndex ); |
475 color, KAknsIIDQsnTextColors, clrIndex ); |
462 } |
476 font = textLayout.Font(); |
463 |
477 itemRect = textLayout.TextRect(); |
464 textLayout.DrawText(*gc, ItemArray()[aItemIndex]->iText, ETrue, color); |
478 baseLine = itemRect.Height() / 2 + font->AscentInPixels() / 2; |
465 } |
479 } |
466 else if (iFont) |
480 |
467 { |
481 if(font == NULL) |
468 gc->UseFont(iFont); |
482 return; |
469 |
483 |
470 gc->SetBrushStyle(CGraphicsContext::ENullBrush); |
484 gc->UseFont(font); |
471 gc->SetBrushColor(KRgbBlack); |
485 gc->SetBrushStyle(CGraphicsContext::ENullBrush); |
472 gc->SetPenColor(iFontColor); |
486 gc->SetBrushColor(KRgbBlack); |
473 gc->SetPenStyle(CGraphicsContext::ESolidPen); |
487 gc->SetPenColor(color); |
474 gc->SetPenSize(PenSize()); |
488 gc->SetPenStyle(CGraphicsContext::ESolidPen); |
475 |
489 gc->SetPenSize(PenSize()); |
476 if (iFont->TextWidthInPixels(ItemArray()[aItemIndex]->iText) > itemRect.Width()) |
490 |
477 { |
491 TBuf<KDisplayTextLen> buf; |
478 TBuf<KDisplayTextLen> buf; |
492 AknBidiTextUtils::ConvertToVisualAndClip(item->iText, buf, *iFont, |
479 AknBidiTextUtils::ConvertToVisualAndClip(ItemArray()[aItemIndex]->iText, |
493 itemRect.Width(), itemRect.Width()); |
480 buf, |
494 gc->DrawText(buf, itemRect, baseLine, iAlign); |
481 *iFont, |
495 gc->DiscardFont(); |
482 itemRect.Width(), |
|
483 itemRect.Width()); |
|
484 gc->DrawText(buf, |
|
485 itemRect, |
|
486 iBaselineOffset, |
|
487 CGraphicsContext::ELeft); |
|
488 } |
|
489 else |
|
490 { |
|
491 gc->DrawText(ItemArray()[aItemIndex]->iText, |
|
492 itemRect, |
|
493 iBaselineOffset, |
|
494 CGraphicsContext::ELeft); |
|
495 } |
|
496 |
|
497 gc->DiscardFont(); |
|
498 } |
|
499 } |
496 } |
500 |
497 |
501 EXPORT_C void CFepLayoutScrollableList::ConstructL() |
498 EXPORT_C void CFepLayoutScrollableList::ConstructL() |
502 { |
499 { |
503 CFepLayoutPopupWnd::ConstructL(); |
500 CFepLayoutPopupWnd::ConstructL(); |