textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp
branchRCL_3
changeset 9 e6a39382bb9c
parent 5 a47de9135b21
child 12 5e18d8c489d6
equal deleted inserted replaced
8:4eb1ae11334f 9:e6a39382bb9c
   251             {
   251             {
   252             TBool IsDimArrowKeys = *aData;
   252             TBool IsDimArrowKeys = *aData;
   253             vkbWindow->DimArrowKeys( IsDimArrowKeys );
   253             vkbWindow->DimArrowKeys( IsDimArrowKeys );
   254             }
   254             }
   255             break;
   255             break;
       
   256         case ECmdPenInputDimEnterKey:
       
   257             {
       
   258             TBool isDimEnterKey = *((TUint16*)( aData ));            
       
   259             vkbWindow->DimEnterKey( isDimEnterKey );            
       
   260             }
       
   261             break;
   256         case ECmdPenInputSetPromptText:
   262         case ECmdPenInputSetPromptText:
   257             {
   263             {
   258             if ( iLayoutType == EPluginInputModeFSQ )
   264             if ( iLayoutType == EPluginInputModeFSQ )
   259             TRAP_IGNORE(vkbWindow->SetPromptTextL(aData));
   265             TRAP_IGNORE(vkbWindow->SetPromptTextL(aData));
   260             }
   266             }
   398         
   404         
   399         if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) )
   405         if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) )
   400             { 
   406             { 
   401             if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
   407             if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
   402                 {
   408                 {
   403 				icf->HideBubble();
   409 				//icf->HideBubble();
   404                 CPeninputGenericVkbWindow* vkbWindow = 
   410                 CPeninputGenericVkbWindow* vkbWindow = 
   405                     static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   411                     static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   406                 vkbWindow->SetIndiWithTextFlag( ETrue );
   412                 vkbWindow->SetIndiWithTextFlag( ETrue );
   407                 vkbWindow->IndiBubbleWithText();
   413                 vkbWindow->IndiBubbleWithText();
   408                 
       
   409                 if ( vkbWindow->IndicatorData().iIndicatorImgID != 0 && 
       
   410                      vkbWindow->IndicatorData().iIndicatorMaskID != 0 && 
       
   411                      vkbWindow->IndicatorData().iIndicatorTextImgID != 0 &&
       
   412                      vkbWindow->IndicatorData().iIndicatorTextMaskID != 0 )
       
   413                     {
       
   414 					TRAP_IGNORE( vkbWindow->SetIndiBubbleImageL( 
       
   415                             vkbWindow->IndicatorData().iIndicatorImgID,
       
   416                             vkbWindow->IndicatorData().iIndicatorMaskID,
       
   417                             vkbWindow->IndicatorData().iIndicatorTextImgID,
       
   418                             vkbWindow->IndicatorData().iIndicatorTextMaskID ));
       
   419                     }
       
   420                 icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
   414                 icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
   421                 }
   415                 }
   422             else
   416             else
   423                 {
   417                 {
   424                 icf->HideBubble();
   418                 //icf->HideBubble();
   425                 CPeninputGenericVkbWindow* vkbWindow = 
   419                 CPeninputGenericVkbWindow* vkbWindow = 
   426                     static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   420                     static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   427                 vkbWindow->SetIndiWithTextFlag( EFalse );
   421                 vkbWindow->SetIndiWithTextFlag( EFalse );
   428                 vkbWindow->IndiBubbleWithoutText();
   422                 vkbWindow->IndiBubbleWithoutText();
   429                 
       
   430                 if ( vkbWindow->IndicatorData().iIndicatorImgID != 0 && 
       
   431                      vkbWindow->IndicatorData().iIndicatorMaskID != 0 && 
       
   432                      vkbWindow->IndicatorData().iIndicatorTextImgID != 0 &&
       
   433                      vkbWindow->IndicatorData().iIndicatorTextMaskID != 0 )
       
   434                     {
       
   435 					TRAP_IGNORE( vkbWindow->SetIndiBubbleImageL( 
       
   436                             vkbWindow->IndicatorData().iIndicatorImgID,
       
   437                             vkbWindow->IndicatorData().iIndicatorMaskID,
       
   438                             vkbWindow->IndicatorData().iIndicatorTextImgID,
       
   439                             vkbWindow->IndicatorData().iIndicatorTextMaskID));
       
   440                     }
       
   441                 
       
   442                 icf->ShowBubble(KEmptyString, icf->MsgBubbleCtrl()->Rect());
   423                 icf->ShowBubble(KEmptyString, icf->MsgBubbleCtrl()->Rect());
   443                 }
   424                 }
   444             }            
   425             }            
   445         else 
   426         else 
   446             {
   427             {
   530 //
   511 //
   531 void CPeninputGenericVkbLayout::HandleShowTooltipCmdL( TUint8* aData )
   512 void CPeninputGenericVkbLayout::HandleShowTooltipCmdL( TUint8* aData )
   532     {
   513     {
   533     CPeninputGenericVkbWindow* vkbWindow = 
   514     CPeninputGenericVkbWindow* vkbWindow = 
   534     				static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   515     				static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
   535     if ( !vkbWindow )
   516     if (!vkbWindow)
   536         {
   517         {
   537         return;
   518         return;
   538         }
   519         }
   539     
   520     
   540     TPtr8 buf8( aData, sizeof(TInt32), sizeof(TInt32) );
   521     TPtr8 buf8(aData, sizeof(TInt32), sizeof(TInt32));
   541     RDesReadStream readStream;
   522     RDesReadStream readStream;
   542     readStream.Open( buf8 );
   523     readStream.Open(buf8);
   543     CleanupClosePushL( readStream );
   524     CleanupClosePushL(readStream);
   544     TInt dataSize = readStream.ReadInt32L();
   525     TInt dataSize = readStream.ReadInt32L();
   545     CleanupStack::PopAndDestroy( &readStream );
   526     CleanupStack::PopAndDestroy(&readStream);
   546     if ( dataSize > 0 )
   527     if (dataSize > 0)
   547         {
   528         {
   548         TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32) );
   529         TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32));
   549         HBufC* tooltipText = ReadTextInfoHBufCL( dataAddress, 
   530         HBufC* tooltipText = ReadTextInfoHBufCL(dataAddress, (dataSize + 1) / 2);
   550                                                  ( dataSize + 1 )/ 2 );
   531         if (tooltipText)
   551         if ( tooltipText )
   532             {
   552             {
   533             CleanupStack::PushL(tooltipText);
   553             CleanupStack::PushL( tooltipText );
   534             vkbWindow->ShowTooltipL(*tooltipText);
   554             vkbWindow->ShowTooltipL( *tooltipText );
   535             CleanupStack::PopAndDestroy(tooltipText);
   555             CleanupStack::PopAndDestroy( tooltipText );
       
   556             }        
   536             }        
   557         }     
   537         }     
   558     }
   538     }
   559 
   539 
   560 // ---------------------------------------------------------------------------
   540 // ---------------------------------------------------------------------------
   571         }
   551         }
   572         
   552         
   573     // Read candidate data from a block of memory staring from aData
   553     // Read candidate data from a block of memory staring from aData
   574     // The format is activeIndex | count of candiates | 
   554     // The format is activeIndex | count of candiates | 
   575     // length 1 | text 1 | length 2 | text 2 |...
   555     // length 1 | text 1 | length 2 | text 2 |...
   576     TPtr8 buf8( aData, sizeof( TInt32 )*2, sizeof( TInt32 )*2 );
   556     TPtr8 buf8( aData, sizeof( TInt32 )* 3, sizeof( TInt32 )* 3 );
   577     RDesReadStream readStream;
   557     RDesReadStream readStream;
   578     readStream.Open( buf8 );
   558     readStream.Open( buf8 );
   579     CleanupClosePushL( readStream );
   559     CleanupClosePushL( readStream );
   580     // Get activeIndex
   560     // Get activeIndex
   581     TInt activeIndex = readStream.ReadInt32L();
   561     TInt activeIndex = readStream.ReadInt32L();
   582     // Get coutn of candidates
   562     // Get coutn of candidates
   583     TInt count = readStream.ReadInt32L();    
   563     TInt count = readStream.ReadInt32L();    
       
   564 	TInt langCode = readStream.ReadInt32L();
       
   565 	TInt align = TBidiText::ScriptDirectionality((TLanguage)langCode);
       
   566 	if(align != TBidiText::ELeftToRight)
       
   567 		align = CGraphicsContext::ERight;
       
   568 	else
       
   569 		align = CGraphicsContext::ELeft;
   584     CleanupStack::PopAndDestroy( &readStream );
   570     CleanupStack::PopAndDestroy( &readStream );
   585     
   571     
   586     CDesCArray* itemArray = NULL;
   572     CDesCArray* itemArray = NULL;
   587     if ( count > 0 )
   573     if ( count > 0 )
   588         {        
   574         {        
   589         TUint8* curPointer = aData + sizeof(TInt) * 2;
   575         TUint8* curPointer = aData + sizeof(TInt) * 3;
   590         itemArray = new (ELeave) CDesCArrayFlat( count );
   576         itemArray = new (ELeave) CDesCArrayFlat( count );
   591         CleanupStack::PushL( itemArray );
   577         CleanupStack::PushL( itemArray );
   592         for ( TInt i = 0; i < count; i++ )
   578         for ( TInt i = 0; i < count; i++ )
   593             {
   579             {
   594             // Get length
   580             // Get length
   612                     CleanupStack::PopAndDestroy( itemText ); 
   598                     CleanupStack::PopAndDestroy( itemText ); 
   613                     }     
   599                     }     
   614                 curPointer += textSize;
   600                 curPointer += textSize;
   615                 }
   601                 }
   616             }
   602             }
   617         vkbWindow->ShowCandidateListL( itemArray, activeIndex );
   603         vkbWindow->ShowCandidateListL( align, itemArray, activeIndex );
   618         CleanupStack::PopAndDestroy( itemArray );
   604         CleanupStack::PopAndDestroy( itemArray );
   619         }
   605         }
   620     else
   606     else
   621         {
   607         {
   622         // Open empty candidate list.
   608         // Open empty candidate list.
   623         vkbWindow->ShowCandidateListL( NULL, activeIndex );        
   609         vkbWindow->ShowCandidateListL( align, NULL, activeIndex );        
   624         }    
   610         }    
   625     }
   611     }
   626 
   612 
   627 
   613 
   628 // ---------------------------------------------------------------------------
   614 // ---------------------------------------------------------------------------