662 AddControlL(iPuncCandsList); |
671 AddControlL(iPuncCandsList); |
663 iPuncCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected); |
672 iPuncCandsList->SetEventIdForCandidateSelected(EItutCmdCandidateSelected); |
664 iPuncCandsList->SetDropdownListImgID(candiDrawInfo); |
673 iPuncCandsList->SetDropdownListImgID(candiDrawInfo); |
665 iPuncCandsList->Hide(ETrue); |
674 iPuncCandsList->Hide(ETrue); |
666 } |
675 } |
|
676 |
|
677 // --------------------------------------------------------------------------- |
|
678 // CSplitItutWindow::ConstructIcfFromResourceL |
|
679 // --------------------------------------------------------------------------- |
|
680 // |
|
681 void CSplitItutWindow::ConstructIcfFromResourceL() |
|
682 { |
|
683 if (!iICF->ResourceId()) |
|
684 { |
|
685 return; |
|
686 } |
|
687 |
|
688 TResourceReader icfreader; |
|
689 CCoeEnv::Static()->CreateResourceReaderLC(icfreader, iICF->ResourceId()); |
|
690 TInt32 colorMajorSkinId = icfreader.ReadInt32(); |
|
691 TInt skinitemid = icfreader.ReadInt16(); |
|
692 TInt coloridx = icfreader.ReadInt16(); |
|
693 |
|
694 TAknsItemID colorid; |
|
695 colorid.Set(TInt(colorMajorSkinId), skinitemid); |
|
696 |
|
697 TRgb icftextcolor; |
|
698 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
699 TInt error = AknsUtils::GetCachedColor( skininstance, |
|
700 icftextcolor, |
|
701 colorid, |
|
702 coloridx ); |
|
703 |
|
704 if ( error != KErrNone ) |
|
705 { |
|
706 icftextcolor = TRgb( KDefaultIcfTextColor ); |
|
707 } |
|
708 |
|
709 iICF->SetTextColorL( icftextcolor ); |
|
710 |
|
711 // Set highlight color |
|
712 TRgb icfhightlightcolor; |
|
713 error = AknsUtils::GetCachedColor( skininstance, |
|
714 icfhightlightcolor, |
|
715 KAknsIIDQsnHighlightColors, |
|
716 EAknsCIQsnHighlightColorsCG2 ); |
|
717 if ( error == KErrNone ) |
|
718 { |
|
719 iICF->SetTextSelColorL( icfhightlightcolor ); |
|
720 } |
|
721 |
|
722 skinitemid = icfreader.ReadInt16(); |
|
723 coloridx = icfreader.ReadInt16(); |
|
724 |
|
725 colorid.Set(TInt(colorMajorSkinId), skinitemid); |
|
726 |
|
727 TRgb icfframecolor; |
|
728 error = AknsUtils::GetCachedColor(skininstance, |
|
729 icfframecolor, |
|
730 colorid, |
|
731 coloridx); |
|
732 |
|
733 if ( error != KErrNone ) |
|
734 { |
|
735 icfframecolor = TRgb(KDefaultIcfFrameColor); |
|
736 } |
|
737 |
|
738 iICF->SetBorderColor( icfframecolor ); |
|
739 CleanupStack::PopAndDestroy( 1 ); // icfreader |
|
740 } |
|
741 |
|
742 |
|
743 // --------------------------------------------------------------------------- |
|
744 // CSplitItutWindow::CreateICFL |
|
745 // --------------------------------------------------------------------------- |
|
746 // |
|
747 void CSplitItutWindow::CreateICFL() |
|
748 { |
|
749 CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EIcfFont)); |
|
750 TRect rect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESpellICFRect)); |
|
751 |
|
752 // Create ICF |
|
753 iICF = CFepLayoutMultiLineIcf::NewL( rect, |
|
754 iLayoutOwner, |
|
755 ECtrlIdICF, |
|
756 iDataMgr->iIcfTextHeight, |
|
757 icffont->FontMaxHeight(), |
|
758 icffont ); |
|
759 |
|
760 iICF->SetFocus(ETrue); |
|
761 iICF->SetResourceId( R_SPLIT_ITUT_ICF ); |
|
762 ConstructIcfFromResourceL(); |
|
763 iICF->SetBgImgSkinId( KAknsIIDQsnFrCall2Rect ); |
|
764 |
|
765 AddControlL( iICF ); |
|
766 |
|
767 // Set indicator parameters |
|
768 TAknWindowLineLayout iBubbleSize = AknLayoutScalable_Apps::popup_char_count_window().LayoutLine(); |
|
769 TAknTextLineLayout iBubbleTextLayout = AknLayoutScalable_Apps::popup_char_count_window_t1(0).LayoutLine(); |
|
770 |
|
771 iICF->MsgBubbleCtrl()->SetTextFormat(iBubbleTextLayout); |
|
772 iICF->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
773 |
|
774 //Change the ID when ID into release |
|
775 iICF->MsgBubbleCtrl()->SetBitmapParam( NULL, |
|
776 NULL, |
|
777 KAknsIIDQsnFrInputPreviewSideL, |
|
778 KAknsIIDQsnFrInputPreviewMiddle, |
|
779 KAknsIIDQsnFrInputPreviewSideR ); |
|
780 iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH)); |
|
781 |
|
782 iICF->MsgBubbleCtrl()->SetTextL( KEmptyString ); |
|
783 |
|
784 iICF->SetTextMargin( iDataMgr->iIcfTextLeftMargin, |
|
785 iDataMgr->iIcfTextRightMargin, |
|
786 iDataMgr->iIcfTextTopMargin, |
|
787 iDataMgr->iIcfTextBottomMargin ); |
|
788 |
|
789 iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin ); |
|
790 |
|
791 SetIndiBubble(); |
|
792 iICF->Hide( ETrue ); |
|
793 } |
|
794 |
667 |
795 |
668 // --------------------------------------------------------------------------- |
796 // --------------------------------------------------------------------------- |
669 // CSplitItutWindow::ConstructL |
797 // CSplitItutWindow::ConstructL |
670 // --------------------------------------------------------------------------- |
798 // --------------------------------------------------------------------------- |
671 // |
799 // |
672 void CSplitItutWindow::ConstructL() |
800 void CSplitItutWindow::ConstructL() |
673 { |
801 { |
674 iBmpRotator = CPeninputSyncBitmapRotator::NewL(); |
802 iBmpRotator = CPeninputSyncBitmapRotator::NewL(); |
675 CreateAllButtonL(); |
803 CreateAllButtonL(); |
676 CreateItutKeypadL(); |
804 CreateItutKeypadL(); |
|
805 CreateICFL(); |
677 } |
806 } |
678 |
807 |
679 // --------------------------------------------------------------------------- |
808 // --------------------------------------------------------------------------- |
680 // CSplitItutWindow::AddControlL |
809 // CSplitItutWindow::AddControlL |
681 // --------------------------------------------------------------------------- |
810 // --------------------------------------------------------------------------- |
928 { |
1063 { |
929 HandleButtonResOnLangDirChange( ECtrlIdBackspace ); |
1064 HandleButtonResOnLangDirChange( ECtrlIdBackspace ); |
930 iDataMgr->SetLangDirectionSwitch( EFalse ); |
1065 iDataMgr->SetLangDirectionSwitch( EFalse ); |
931 } |
1066 } |
932 } |
1067 } |
|
1068 |
|
1069 // --------------------------------------------------------------------------- |
|
1070 // CSplitItutWindow::ApplyVariantLafDataForSpellL |
|
1071 // --------------------------------------------------------------------------- |
|
1072 // |
|
1073 void CSplitItutWindow::ApplyVariantLafDataForSpellL() |
|
1074 { |
|
1075 TBool bSizeChanged = EFalse; |
|
1076 ControlSizeChanged( ECtrlIdArrowLeft, EArrowLeftRect, ELeftInnerRect, ETrue ); |
|
1077 ControlSizeChanged( ECtrlIdArrowRight, EArrowRightRect, ERightInnerRect, ETrue ); |
|
1078 |
|
1079 bSizeChanged = ControlSizeChanged( ECtrlIdBackspace, ESpellBackSpcae, |
|
1080 ESpellBackSpcaeInner, ETrue ); |
|
1081 |
|
1082 // resize all controls |
|
1083 SetCtrlRect( iBackgroundCtrl, EBackgroundRect ); |
|
1084 SetCtrlRect( iStandardItutKp, EKeypadRect, ETrue ); |
|
1085 |
|
1086 // Handle control res when language direction changing here. |
|
1087 if ( iDataMgr->IsLangDirectionSwitch() || |
|
1088 ( bSizeChanged && iDataMgr->IsRtoLLanguage())) |
|
1089 { |
|
1090 HandleButtonResOnLangDirChange( ECtrlIdBackspace ); |
|
1091 iDataMgr->SetLangDirectionSwitch( EFalse ); |
|
1092 } |
|
1093 |
|
1094 CFont* icffont = TItutDataConverter::AnyToFont(iDataMgr->RequestData( EIcfFont )); |
|
1095 iICF->Hide( ETrue ); |
|
1096 iICF->SizeChangedL( TItutDataConverter::AnyToRect( iDataMgr->RequestData( ESpellICFRect )), |
|
1097 iDataMgr->iIcfTextHeight, |
|
1098 icffont->FontMaxHeight(), |
|
1099 icffont ); |
|
1100 iICF->Hide( EFalse ); |
|
1101 } |
|
1102 |
933 |
1103 |
934 // --------------------------------------------------------------------------- |
1104 // --------------------------------------------------------------------------- |
935 // CSplitItutWindow::ResizeCandidateList |
1105 // CSplitItutWindow::ResizeCandidateList |
936 // --------------------------------------------------------------------------- |
1106 // --------------------------------------------------------------------------- |
937 // |
1107 // |
1273 |
1443 |
1274 unicodesArr1.Close(); |
1444 unicodesArr1.Close(); |
1275 unicodesInt.Close(); |
1445 unicodesInt.Close(); |
1276 |
1446 |
1277 } |
1447 } |
|
1448 |
|
1449 void CSplitItutWindow::UpdateIndiBubbleL( TUint8* aData ) |
|
1450 { |
|
1451 RDesReadStream readStream; |
|
1452 TFepIndicatorInfo indicatorData; |
|
1453 |
|
1454 TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) ); |
|
1455 readStream.Open(countPtr); |
|
1456 CleanupClosePushL(readStream); |
|
1457 |
|
1458 indicatorData.iIndicatorImgID = readStream.ReadInt32L(); |
|
1459 indicatorData.iIndicatorMaskID = readStream.ReadInt32L(); |
|
1460 indicatorData.iIndicatorTextImgID = readStream.ReadInt32L(); |
|
1461 indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L(); |
|
1462 |
|
1463 CleanupStack::PopAndDestroy(&readStream); |
|
1464 |
|
1465 if ( indicatorData.iIndicatorImgID != 0 && |
|
1466 indicatorData.iIndicatorMaskID != 0 && |
|
1467 indicatorData.iIndicatorTextImgID != 0 && |
|
1468 indicatorData.iIndicatorTextMaskID != 0) |
|
1469 { |
|
1470 iDataMgr->SetIndicatorData( indicatorData ); |
|
1471 iImDimensionSet = ETrue; |
|
1472 |
|
1473 SetIndiBubbleImageL( indicatorData.iIndicatorImgID, |
|
1474 indicatorData.iIndicatorMaskID, |
|
1475 indicatorData.iIndicatorTextImgID, |
|
1476 indicatorData.iIndicatorTextMaskID ); |
|
1477 |
|
1478 TBuf<100> text; |
|
1479 iICF->MsgBubbleCtrl()->GetText( text ); |
|
1480 iICF->ShowBubble( text, iICF->MsgBubbleCtrl()->Rect()); |
|
1481 } |
|
1482 } |
|
1483 |
|
1484 // --------------------------------------------------------------------------- |
|
1485 // CSplitItutWindow::CalIndicatorRect |
|
1486 // --------------------------------------------------------------------------- |
|
1487 // |
|
1488 void CSplitItutWindow::CalIndicatorRect(const TRect& aBoundRect, |
|
1489 TRect& aRealRect1, |
|
1490 TRect& aRealRect2, |
|
1491 TIndicatorAlign aAlign) |
|
1492 { |
|
1493 if (!iImDimensionSet) |
|
1494 { |
|
1495 return; |
|
1496 } |
|
1497 |
|
1498 TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight; |
|
1499 TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight; |
|
1500 TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, |
|
1501 aBoundRect.Size().iHeight ); |
|
1502 TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, |
|
1503 aBoundRect.Size().iHeight ); |
|
1504 // check if the length of img > bound rect width |
|
1505 TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth; |
|
1506 if( nTotalWidth > aBoundRect.Size().iWidth ) |
|
1507 { |
|
1508 TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth; |
|
1509 imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect; |
|
1510 imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth; |
|
1511 imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText; |
|
1512 // make sure the height of two rect is equal |
|
1513 imgSizeIndi.iHeight = imgSizeText.iHeight; |
|
1514 } |
|
1515 if( aAlign == EIndiAlignRight ) |
|
1516 { |
|
1517 aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY), |
|
1518 imgSizeText); |
|
1519 aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
1520 imgSizeIndi); |
|
1521 } |
|
1522 else if( aAlign == EIndiAlignCenter ) |
|
1523 { |
|
1524 TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2; |
|
1525 TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2; |
|
1526 aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, |
|
1527 aBoundRect.iTl.iY + offsetY), |
|
1528 imgSizeText ); |
|
1529 aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
1530 imgSizeIndi ); |
|
1531 } |
|
1532 else if( aAlign == EIndiAlignLeft ) |
|
1533 { |
|
1534 aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi ); |
|
1535 aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText ); |
|
1536 } |
|
1537 } |
|
1538 |
|
1539 // --------------------------------------------------------------------------- |
|
1540 // CSplitItutWindow::SetPromptTextL |
|
1541 // --------------------------------------------------------------------------- |
|
1542 // |
|
1543 void CSplitItutWindow::SetPromptTextL( TUint8* aData ) |
|
1544 { |
|
1545 RDesReadStream readStream; |
|
1546 |
|
1547 TPtr8 countPtr( aData, 2*sizeof(TInt), 2*sizeof(TInt)); |
|
1548 readStream.Open(countPtr); |
|
1549 CleanupClosePushL(readStream); |
|
1550 const TInt dataCount = readStream.ReadInt32L(); |
|
1551 const TInt textCount = readStream.ReadInt32L(); |
|
1552 CleanupStack::PopAndDestroy(&readStream); |
|
1553 |
|
1554 TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
1555 readStream.Open(ptr); |
|
1556 CleanupClosePushL(readStream); |
|
1557 |
|
1558 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
1559 TPtr8 dataBufPtr = dataBuf->Des(); |
|
1560 readStream.ReadL(dataBufPtr, dataCount); |
|
1561 |
|
1562 TFepPromptText* pIcfData = |
|
1563 reinterpret_cast<TFepPromptText*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
1564 |
|
1565 HBufC* textBuf; |
|
1566 if ( textCount > 0 ) |
|
1567 { |
|
1568 textBuf = HBufC::NewLC( textCount/2 ); |
|
1569 TPtr textBufPtr = textBuf->Des(); |
|
1570 readStream.ReadL( textBufPtr, textCount/2 ); |
|
1571 |
|
1572 const HBufC* icfPromptText = iICF->PromptText(); |
|
1573 |
|
1574 if (!icfPromptText || icfPromptText->Compare( textBuf->Des()) != 0 ) |
|
1575 { |
|
1576 iICF->SetPromptTextL( textBuf->Des(), pIcfData->iCleanContent ); |
|
1577 } |
|
1578 CleanupStack::PopAndDestroy( textBuf ); |
|
1579 } |
|
1580 else |
|
1581 { |
|
1582 iICF->SetPromptTextL( KNullDesC, pIcfData->iCleanContent ); |
|
1583 } |
|
1584 |
|
1585 CleanupStack::PopAndDestroy( dataBuf ); |
|
1586 CleanupStack::PopAndDestroy( &readStream ); |
|
1587 } |
|
1588 |
|
1589 // --------------------------------------------------------------------------- |
|
1590 // CSplitItutWindow::SetIndiBubbleImageL |
|
1591 // --------------------------------------------------------------------------- |
|
1592 // |
|
1593 void CSplitItutWindow::SetIndiBubbleImageL( const TInt aImgID1, |
|
1594 const TInt aMaskID1, |
|
1595 const TInt aImgID2, |
|
1596 const TInt aMaskID2 ) |
|
1597 { |
|
1598 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
1599 |
|
1600 CFbsBitmap* bmp1 = NULL; |
|
1601 CFbsBitmap* mask1 = NULL; |
|
1602 |
|
1603 TInt colorIndex = EAknsCIQsnIconColorsCG30; |
|
1604 |
|
1605 AknsUtils::CreateColorIconL( skininstance, |
|
1606 KAknsIIDQsnIconColors, |
|
1607 KAknsIIDQsnIconColors, |
|
1608 colorIndex, |
|
1609 bmp1, |
|
1610 mask1, |
|
1611 AknIconUtils::AvkonIconFileName(), |
|
1612 aImgID1, |
|
1613 aMaskID1, |
|
1614 KRgbGray ); |
|
1615 CleanupStack::PushL( bmp1 ); |
|
1616 CleanupStack::PushL( mask1 ); |
|
1617 |
|
1618 AknIconUtils::GetContentDimensions( bmp1, iIndicatorSize ); |
|
1619 |
|
1620 CFbsBitmap* bmp2 = NULL; |
|
1621 CFbsBitmap* mask2 = NULL; |
|
1622 AknsUtils::CreateColorIconL( skininstance, |
|
1623 KAknsIIDQsnIconColors, |
|
1624 KAknsIIDQsnIconColors, |
|
1625 colorIndex, |
|
1626 bmp2, |
|
1627 mask2, |
|
1628 AknIconUtils::AvkonIconFileName(), |
|
1629 aImgID2, |
|
1630 aMaskID2, |
|
1631 KRgbGray ); |
|
1632 |
|
1633 CleanupStack::PushL( bmp2 ); |
|
1634 CleanupStack::PushL( mask2 ); |
|
1635 |
|
1636 AknIconUtils::GetContentDimensions( bmp2, iIndicatorTextSize ); |
|
1637 |
|
1638 TRect boundRect; |
|
1639 boundRect = TItutDataConverter::AnyToRect( |
|
1640 iDataMgr->RequestData( EIndiIconWithoutTextRect )); |
|
1641 |
|
1642 TRect imgrect, textrect; |
|
1643 |
|
1644 CalIndicatorRect( boundRect, imgrect, textrect, EIndiAlignCenter ); |
|
1645 AknIconUtils::SetSize( bmp1, imgrect.Size(), EAspectRatioNotPreserved ); |
|
1646 AknIconUtils::SetSize( mask1, imgrect.Size(), EAspectRatioNotPreserved ); |
|
1647 AknIconUtils::SetSize( bmp2, textrect.Size(), EAspectRatioNotPreserved) ; |
|
1648 AknIconUtils::SetSize( mask2, textrect.Size(), EAspectRatioNotPreserved ); |
|
1649 |
|
1650 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256); |
|
1651 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
|
1652 |
|
1653 iICF->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, |
|
1654 KAknsIIDQsnFrInputPreviewSideL, |
|
1655 KAknsIIDQsnFrInputPreviewMiddle, |
|
1656 KAknsIIDQsnFrInputPreviewSideR ); |
|
1657 |
|
1658 CleanupStack::PopAndDestroy( mask2 ); |
|
1659 CleanupStack::PopAndDestroy( bmp2 ); |
|
1660 CleanupStack::PopAndDestroy( mask1 ); |
|
1661 CleanupStack::PopAndDestroy( bmp1 ); |
|
1662 } |
|
1663 |
|
1664 // --------------------------------------------------------------------------- |
|
1665 // CSplitItutWindow::SetIndiBubble |
|
1666 // --------------------------------------------------------------------------- |
|
1667 // |
|
1668 void CSplitItutWindow::SetIndiBubble() |
|
1669 { |
|
1670 if ( iICF ) |
|
1671 { |
|
1672 TRect bubbleRect = TItutDataConverter::AnyToRect( |
|
1673 iDataMgr->RequestData( EIndiPaneWithoutTextRect )); |
|
1674 TRect iconRect = TItutDataConverter::AnyToRect( |
|
1675 iDataMgr->RequestData( EIndiIconWithoutTextRect )); |
|
1676 |
|
1677 TSize offset( 0, 6 ); |
|
1678 TSize size( iconRect.Width(), iconRect.Height()); |
|
1679 |
|
1680 iICF->MsgBubbleCtrl()->SetRect( bubbleRect ); |
|
1681 iICF->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size ); |
|
1682 } |
|
1683 } |
|
1684 |
1278 // End Of File |
1685 // End Of File |