textinput/peninputgenericitut/src/peninputgenericitutwindow.cpp
branchRCL_3
changeset 10 6defe5d1bd39
parent 8 6ceef9a83b1a
child 12 4eb1ae11334f
equal deleted inserted replaced
8:6ceef9a83b1a 10:6defe5d1bd39
  1470 
  1470 
  1471     CleanupStack::PopAndDestroy(dataBuf);
  1471     CleanupStack::PopAndDestroy(dataBuf);
  1472 	  CleanupStack::PopAndDestroy(&readStream);
  1472 	  CleanupStack::PopAndDestroy(&readStream);
  1473     }
  1473     }
  1474 
  1474 
       
  1475 void CGenericItutWindow::SetSpellDisplayContentL( TUint8* aData )
       
  1476 	{
       
  1477 	RDesReadStream readStream;
       
  1478 
       
  1479 	TPtr8 countPtr( aData, 3 * sizeof(TInt), 3 * sizeof(TInt));
       
  1480 	readStream.Open( countPtr );
       
  1481 	CleanupClosePushL( readStream );
       
  1482 	
       
  1483 	const TInt dataCount = readStream.ReadInt32L();
       
  1484 	const TInt icfTextCount = readStream.ReadInt32L();
       
  1485 	const TInt promptTextCount = readStream.ReadInt32L();
       
  1486 	CleanupStack::PopAndDestroy( &readStream );
       
  1487 	
       
  1488 	TPtr8 ptr( aData + 3 * sizeof(TInt), 
       
  1489 		dataCount + icfTextCount + promptTextCount, 
       
  1490 		dataCount + icfTextCount + promptTextCount );
       
  1491 	
       
  1492     readStream.Open( ptr );
       
  1493     CleanupClosePushL(readStream);
       
  1494     
       
  1495     HBufC8* dataBuf = HBufC8::NewLC( dataCount );
       
  1496     TPtr8 dataBufPtr = dataBuf->Des();
       
  1497     readStream.ReadL( dataBufPtr, dataCount );
       
  1498     
       
  1499     TFepSpellICFDisplayContent* pContent = 
       
  1500     		reinterpret_cast<TFepSpellICFDisplayContent*>(
       
  1501     				const_cast<TUint8*>(dataBufPtr.Ptr()));
       
  1502     
       
  1503     TFepInputContextFieldData icfData;
       
  1504 	icfData.iCmd = EPeninputICFInitial;
       
  1505 	icfData.iCurSel.iCursorPos = pContent->iCurPos;
       
  1506 	icfData.iCursorSelVisible = ETrue;
       
  1507 	icfData.iCursorVisibility = ETrue;
       
  1508     		
       
  1509     if ( icfTextCount > 0 )
       
  1510     	{
       
  1511 		HBufC* textIcfBuf;
       
  1512 		textIcfBuf = HBufC::NewLC( icfTextCount/2 );
       
  1513 		TPtr textBufPtr = textIcfBuf->Des();
       
  1514 		readStream.ReadL( textBufPtr, icfTextCount/2 );
       
  1515 		
       
  1516 		icfData.iLength = icfTextCount;
       
  1517 		icfData.iText.Set( textIcfBuf->Des());
       
  1518 		
       
  1519 		iICF->SetTextL( icfData );
       
  1520 		
       
  1521 		CleanupStack::PopAndDestroy( textIcfBuf );
       
  1522     	}
       
  1523     else
       
  1524     	{
       
  1525 		icfData.iLength = 0;
       
  1526 		icfData.iText.Set( KNullDesC );
       
  1527 		
       
  1528 		iICF->SetTextL( icfData );
       
  1529     	}
       
  1530     
       
  1531     if ( promptTextCount > 0 )
       
  1532     	{
       
  1533 		HBufC* textPromptBuf;
       
  1534 		textPromptBuf = HBufC::NewLC( promptTextCount/2 );
       
  1535 		TPtr promptBufPtr = textPromptBuf->Des();
       
  1536 		readStream.ReadL( promptBufPtr, promptTextCount/2 );
       
  1537 		
       
  1538 		iICF->SetPromptTextL( textPromptBuf->Des(), ETrue );	
       
  1539 		
       
  1540 		CleanupStack::PopAndDestroy( textPromptBuf );
       
  1541     	}
       
  1542     else
       
  1543     	{
       
  1544 		iICF->SetPromptTextL( KNullDesC, ETrue );
       
  1545     	}
       
  1546     
       
  1547     CleanupStack::PopAndDestroy( dataBuf );
       
  1548 	CleanupStack::PopAndDestroy( &readStream );
       
  1549 	}
       
  1550 
  1475 TInt CGenericItutWindow::PenInputType()
  1551 TInt CGenericItutWindow::PenInputType()
  1476     {
  1552     {
  1477     return EPluginInputModeItut;
  1553     return EPluginInputModeItut;
  1478     }
  1554     }
  1479 
  1555 
  1657     	    }
  1733     	    }
  1658     	}
  1734     	}
  1659 
  1735 
  1660     iICF->Hide(EFalse);    
  1736     iICF->Hide(EFalse);    
  1661     
  1737     
  1662     if ( IsPortraitWest() && (!iDataMgr->IsChineseGlobalLanguage()))
  1738     if ( IsPortraitWest() && (!iDataMgr->IsChineseSpellMode()))
  1663         {
  1739         {
  1664         iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
  1740         iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
  1665         iIndiWithText = EFalse;
  1741         iIndiWithText = EFalse;
  1666         IndiBubbleWithoutText();
  1742         IndiBubbleWithoutText();
  1667         }
  1743         }
  1683     ControlSizeChanged(ECtrlIdClose, ECloseRect, ECloseInnerRect, ETrue);
  1759     ControlSizeChanged(ECtrlIdClose, ECloseRect, ECloseInnerRect, ETrue);
  1684    						  	
  1760    						  	
  1685     // resize all controls
  1761     // resize all controls
  1686     SetCtrlRect(iStandardItutKp, EKeypadRect); 
  1762     SetCtrlRect(iStandardItutKp, EKeypadRect); 
  1687     
  1763     
       
  1764     iStandardItutKp->SetTextLineLayout(
       
  1765         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
       
  1766         EPosLeft);
       
  1767     iStandardItutKp->SetTextLineLayout(
       
  1768         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine1)),
       
  1769         EPosRight1);
       
  1770     iStandardItutKp->SetTextLineLayout(
       
  1771         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine2)),
       
  1772         EPosRight2);
       
  1773     iStandardItutKp->SetTextLineLayout(
       
  1774         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
       
  1775         EPosRight3);
       
  1776     
       
  1777     RPointerArray<CVirtualKey>& keys = 
       
  1778         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
       
  1779     RArray<TRect>& cellRects = 
       
  1780         TItutDataConverter::AnyToRectArray(iDataMgr->RequestData(EKeypadCellRects));
       
  1781 
       
  1782     for (TInt i = 0 ; i < keys.Count(); i++)
       
  1783         {
       
  1784         keys[i]->SetRect(cellRects[i]);
       
  1785         TRect innerrect = cellRects[i];
       
  1786         innerrect.Shrink(TSize(4, 4));
       
  1787         keys[i]->SetInnerRect(innerrect);
       
  1788         }
       
  1789 	// set key background image size
       
  1790 	TSize curSize = cellRects[0].Size();
       
  1791 	if( iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal) )
       
  1792 		{
       
  1793 		TSize size = iStandardItutKp->NonIrregularKeyBitmap(EKeyBmpNormal)->SizeInPixels();
       
  1794 		if( curSize != size )	
       
  1795 			{
       
  1796 	        for ( TInt i = 0; i <= EKeyBmpLastType; i++ )
       
  1797 	            {
       
  1798 	            if( iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i) )
       
  1799 	            	{
       
  1800 	                AknIconUtils::SetSize( 
       
  1801                                    iStandardItutKp->NonIrregularKeyBitmap((TVirtualKeyBmpType)i), 
       
  1802                                    curSize, EAspectRatioNotPreserved );                    		
       
  1803 	            	}
       
  1804 	            }	
       
  1805 			}
       
  1806 		}
  1688     // Handle control res when language direction changing here.
  1807     // Handle control res when language direction changing here.
  1689     if( iDataMgr->IsLangDirectionSwitch() || 
  1808     if( iDataMgr->IsLangDirectionSwitch() || 
  1690     	( bSizeChanged && iDataMgr->IsRtoLLanguage() ) )
  1809     	( bSizeChanged && iDataMgr->IsRtoLLanguage() ) )
  1691     	{
  1810     	{
  1692     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );
  1811     	HandleButtonResOnLangDirChange( ECtrlIdBackspace );