textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutcursor.cpp
branchRCL_3
changeset 15 6c2c2d3ab788
parent 12 5e18d8c489d6
child 20 ebd48d2de13c
equal deleted inserted replaced
12:5e18d8c489d6 15:6c2c2d3ab788
   100 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   101 //
   101 //
   102 EXPORT_C void CFepUiCursor::SetPosition(const TPoint& aPosition)
   102 EXPORT_C void CFepUiCursor::SetPosition(const TPoint& aPosition)
   103     {
   103     {
   104     
   104     
   105     TBool isOn = iIsOn;
   105 	if( iPosition != aPosition )
   106     if (isOn)
   106 		{
   107         {
   107 		TBool isOn = iIsOn;
   108         SetOn(EFalse);
   108 		if (isOn)
   109         }
   109 			{
   110     iPosition=aPosition;
   110 			SetOn(EFalse);
   111     TPoint correction(KCursorPosCorrectionX,KCursorPosCorrectionY );
   111 
   112     TRect rect = TRect(iPosition + correction , TSize(KCursorWidth,iHeight));
   112 			}
   113     if(rect != iCursorRect)
   113 		iPosition=aPosition;
   114         {
   114 		TPoint correction(KCursorPosCorrectionX,KCursorPosCorrectionY );
   115         SetRect(rect);
   115 		TRect rect = TRect(iPosition + correction , TSize(KCursorWidth,iHeight));
   116         iCursorRect = rect;
   116 		if(rect != iCursorRect)
   117         //must update clip region again.
   117 			{
   118         for(TInt i = 0 ; i < RootControl()->PopCtrlList().Count(); ++i)
   118 			SetRect(rect);
   119             {
   119 			iCursorRect = rect;
   120             UpdateValidRegion(RootControl()->PopCtrlList()[i],EFalse);
   120 			//must update clip region again.
   121             }
   121 			for(TInt i = 0 ; i < RootControl()->PopCtrlList().Count(); ++i)
   122         }
   122 				{
   123         
   123 				UpdateValidRegion(RootControl()->PopCtrlList()[i],EFalse);
   124     if (isOn)
   124 				}
   125         {
   125 			}
   126         SetOn(ETrue);
   126 			
   127         }
   127 		if (isOn)
       
   128 			{
       
   129 			SetOn(ETrue);
       
   130 			}
       
   131 		}
       
   132 
   128     }
   133     }
   129 
   134 
   130 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   131 // CFepUiCursor::Position
   136 // CFepUiCursor::Position
   132 // get the cursor position
   137 // get the cursor position
   166         CancelDelayCursorShown();
   171         CancelDelayCursorShown();
   167         if ( iCursorBlinkingTimer->IsActive())
   172         if ( iCursorBlinkingTimer->IsActive())
   168             {
   173             {
   169             iCursorBlinkingTimer->Cancel();    
   174             iCursorBlinkingTimer->Cancel();    
   170             }
   175             }
       
   176         InvalidateInsertionPoint();
   171         }
   177         }
   172     else
   178     else
   173         {
   179         {
   174         if(iCursorTempDisabled)
   180         if(iCursorTempDisabled)
   175             {
   181             {
   182                    KCursorBlinkPerioid,TCallBack(CursorBlinkCallBack , this));
   188                    KCursorBlinkPerioid,TCallBack(CursorBlinkCallBack , this));
   183             }
   189             }
   184         }
   190         }
   185         
   191         
   186         // Invalidate InsertionPoint's rect, so it will be removed from editarea
   192         // Invalidate InsertionPoint's rect, so it will be removed from editarea
   187     InvalidateInsertionPoint();
   193     //InvalidateInsertionPoint();
   188     }
   194     }
   189 
   195 
   190 // ---------------------------------------------------------------------------
   196 // ---------------------------------------------------------------------------
   191 // CFepUiCursor::SetHeight
   197 // CFepUiCursor::SetHeight
   192 // Sets caret height
   198 // Sets caret height
   378 // (other items were commented in a header).
   384 // (other items were commented in a header).
   379 // ---------------------------------------------------------------------------
   385 // ---------------------------------------------------------------------------
   380 //
   386 //
   381 void CFepUiCursor::InvalidateInsertionPoint()
   387 void CFepUiCursor::InvalidateInsertionPoint()
   382     {    
   388     {    
   383     //if(AbleToDraw())
   389     if(AbleToDraw())
   384         {        
   390         {        
   385         Draw();
   391         Draw();
   386         //UpdateArea(iCursorRect,EFalse);
   392         //UpdateArea(iCursorRect,EFalse);
   387         
   393         
   388         UpdateCursorArea(iCursorRect,EFalse);
   394         UpdateCursorArea(iCursorRect,EFalse);
   435 void CFepUiCursor::HandleTimerOut(TInt /*aTimeType*/)
   441 void CFepUiCursor::HandleTimerOut(TInt /*aTimeType*/)
   436     {
   442     {
   437     iCursorTempDisabled = EFalse;
   443     iCursorTempDisabled = EFalse;
   438     iIsOn = ETrue;
   444     iIsOn = ETrue;
   439     //To avoid the ugly first shown, we draw the cursor directly here.
   445     //To avoid the ugly first shown, we draw the cursor directly here.
   440     InvalidateInsertionPoint();
   446     //InvalidateInsertionPoint();
   441     SetOn(ETrue, EFalse);    
   447     SetOn(ETrue, EFalse);    
   442     }
   448     }
   443     
   449     
   444     
   450     
   445 // ---------------------------------------------------------------------------
   451 // ---------------------------------------------------------------------------