textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp
branchRCL_3
changeset 19 ac7e4d1d9209
parent 15 6c2c2d3ab788
child 20 ebd48d2de13c
equal deleted inserted replaced
18:b1ea1642412e 19:ac7e4d1d9209
    70     if ( iAutoRefreshTimer && iAutoRefreshTimer->IsActive() )
    70     if ( iAutoRefreshTimer && iAutoRefreshTimer->IsActive() )
    71         {
    71         {
    72         iAutoRefreshTimer->Cancel();
    72         iAutoRefreshTimer->Cancel();
    73         }
    73         }
    74     delete iAutoRefreshTimer; 
    74     delete iAutoRefreshTimer; 
    75 	iPopRegion.Close();
    75     
    76 	iBubblesArea.Close();
    76 
    77     iBubblesMaskArea.Close();
    77 	Clean();
    78 	iBubblesPos.Close();
    78 
    79     
    79     
    80 	delete iCursorWnd;   
    80 	delete iCursorWnd;   
    81 }
    81 }
    82 
    82 
    83 void CPenUiWndCtrl::ConstructL()
    83 void CPenUiWndCtrl::ConstructL()
   101     iAutoRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   101     iAutoRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   102 
   102 
   103     iCursorWnd = new (ELeave) CCursorWindow(this);
   103     iCursorWnd = new (ELeave) CCursorWindow(this);
   104     //iCursorWnd->ConstructL(this);
   104     //iCursorWnd->ConstructL(this);
   105     iCursorWnd->SetContainerWindowL(*this);
   105     iCursorWnd->SetContainerWindowL(*this);
       
   106     
       
   107     // Update the cursor color
       
   108     SetCursorColor();
   106     
   109     
   107     MakeVisible( EFalse );
   110     MakeVisible( EFalse );
   108 }
   111 }
   109 
   112 
   110 
   113 
   121         rect.Intersection(iLayoutClipRect);
   124         rect.Intersection(iLayoutClipRect);
   122         TPoint pos = rect.iTl - iLayoutClipRect.iTl;
   125         TPoint pos = rect.iTl - iLayoutClipRect.iTl;
   123         gc.BitBlt(pos, iBitmap, rect);
   126         gc.BitBlt(pos, iBitmap, rect);
   124 #ifdef FIX_FOR_NGA
   127 #ifdef FIX_FOR_NGA
   125         //draw bubble
   128         //draw bubble
   126         for (TInt i = 0; i < iBubblesArea.Count(); ++i)
   129         for ( TInt i = 0; i < iBubblesCtrl.Count(); ++i )
   127             {
   130             {
   128             gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   131             gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   129             }
   132             }
   130 #endif   
   133 #endif   
   131         return;
   134         return;
   133         //gc.SetClippingRect( iLayoutClipRect );
   136         //gc.SetClippingRect( iLayoutClipRect );
   134         }
   137         }
   135 #ifdef FIX_FOR_NGA
   138 #ifdef FIX_FOR_NGA
   136     gc.BitBlt(TPoint(0, 0), iBitmap, Rect());
   139     gc.BitBlt(TPoint(0, 0), iBitmap, Rect());
   137     //draw bubble
   140     //draw bubble
   138     for (TInt i = 0; i < iBubblesArea.Count(); ++i)
   141     for ( TInt i = 0; i < iBubblesCtrl.Count(); ++i )
   139         {
   142         {
   140         gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   143         gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   141         }
   144         }
   142 #else    
   145 #else    
   143     gc.BitBlt(aRect.iTl,iBitmap,aRect);
   146     gc.BitBlt(aRect.iTl,iBitmap,aRect);
   163     }
   166     }
   164 
   167 
   165 void CPenUiWndCtrl::Clean()
   168 void CPenUiWndCtrl::Clean()
   166     {
   169     {
   167     iCursorBmp = NULL;
   170     iCursorBmp = NULL;
   168     iBubblesArea.Reset();
   171     iBubblesArea.Close();
   169     iBubblesPos.Reset();
   172     iBubblesCtrl.Close();
       
   173     iBubblesPos.Close();
   170 	iBubblesMaskArea.Close();
   174 	iBubblesMaskArea.Close();
   171 	iPopRegion.Close();
   175 	iPopRegion.Close();
   172     iChangedBmp= NULL;
   176     iChangedBmp= NULL;
   173     iBackground = EFalse;
   177     iBackground = EFalse;
   174     iNotUpdating = EFalse;
   178     iNotUpdating = EFalse;
   191    
   195    
   192     CWindowGc& gc = SystemGc();
   196     CWindowGc& gc = SystemGc();
   193     iParent->DrawCursor(gc);  
   197     iParent->DrawCursor(gc);  
   194     }
   198     }
   195 
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CPenUiWndCtrl::SetCursorColor
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 void CPenUiWndCtrl::SetCursorColor()
       
   205 	{
       
   206 	// Set default cursor color to black
       
   207 	TRgb color( KRgbBlack );
       
   208 	// if the skin is enabled
       
   209     if ( AknsUtils::AvkonSkinEnabled())
       
   210         {
       
   211         // Get the text color under current theme
       
   212         AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
   213 	                               color, 
       
   214 	                               KAknsIIDQsnTextColors, 
       
   215 	                               EAknsCIQsnTextColorsCG60 );
       
   216         }
       
   217     
       
   218     // Set the cursor color
       
   219     iCursorColor = color;
       
   220 	}
       
   221 
   196 void CPenUiWndCtrl::DrawCursor(CWindowGc& aGc) const
   222 void CPenUiWndCtrl::DrawCursor(CWindowGc& aGc) const
   197     {
   223     {
   198     aGc.SetPenColor(KRgbBlack);
   224     aGc.SetPenColor( iCursorColor );
   199     aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
   225     aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
   200     aGc.SetBrushColor(KRgbBlack);
   226     aGc.SetBrushColor( iCursorColor );
   201     aGc.SetDrawMode(CGraphicsContext::EDrawModeNOTSCREEN);
   227     aGc.SetDrawMode(CGraphicsContext::EDrawModeNOTSCREEN);
   202     aGc.SetPenStyle(CGraphicsContext::ESolidPen);
   228     aGc.SetPenStyle(CGraphicsContext::ESolidPen);
   203     aGc.SetPenSize( TSize(1,1));
   229     aGc.SetPenSize( TSize(1,1));
   204     
   230     
   205     TRect drawRect = iCursorRect;
   231     TRect drawRect = iCursorRect;
   248         iCursorRect = aRect;
   274         iCursorRect = aRect;
   249         iCursorWnd->SetRect(iCursorRect);
   275         iCursorWnd->SetRect(iCursorRect);
   250         }
   276         }
   251     iCursorWnd->SetCursorVisible(aOnFlag);
   277     iCursorWnd->SetCursorVisible(aOnFlag);
   252     }
   278     }
   253 	
   279 
   254 void CPenUiWndCtrl::UpdateBubble(const CFbsBitmap* aBmp,const CFbsBitmap* aMask,
   280 // ---------------------------------------------------------------------------
   255                                                 const TRect& aPos,TBool aFlag)
   281 // CPenUiWndCtrl::UpdateBubble
   256     {
   282 // ---------------------------------------------------------------------------
   257     TInt idx = iBubblesArea.Find(aBmp);
   283 //
       
   284 void CPenUiWndCtrl::UpdateBubble( const TUint32 aCtrl, 
       
   285 		                          const CFbsBitmap* aBmp,
       
   286 		                          const CFbsBitmap* aMask,
       
   287                                   const TRect& aPos,
       
   288                                   TBool aFlag )
       
   289     {
       
   290 
       
   291 	// Check whether the Ctrl address is exist
       
   292 	TInt idx = iBubblesCtrl.Find( aCtrl );
       
   293 
   258     
   294     
   259     if(aFlag)
   295     if(aFlag)
   260         {
   296         {
   261         if(KErrNotFound == idx)
   297         if(KErrNotFound == idx)
   262             {
   298             {
       
   299 
       
   300             iBubblesCtrl.Append( aCtrl );
       
   301 
   263             iBubblesArea.Append(aBmp);
   302             iBubblesArea.Append(aBmp);
   264             iBubblesMaskArea.Append(aMask);
   303             iBubblesMaskArea.Append(aMask);
   265             iBubblesPos.Append(aPos);
   304             iBubblesPos.Append(aPos);
   266             }
   305             }
   267         else
   306         else
   273     else
   312     else
   274         {
   313         {
   275         //remove
   314         //remove
   276         if(idx != KErrNotFound)
   315         if(idx != KErrNotFound)
   277             {
   316             {
       
   317 
       
   318             iBubblesCtrl.Remove( idx );
       
   319 
   278             iBubblesArea.Remove(idx);
   320             iBubblesArea.Remove(idx);
   279             iBubblesMaskArea.Remove(idx);
   321             iBubblesMaskArea.Remove(idx);
   280             iBubblesPos.Remove(idx);            
   322             iBubblesPos.Remove(idx);            
   281             }        
   323             }        
   282         }
   324         }
   286     {
   328     {
   287     iICFBmp = const_cast<CFbsBitmap*>(aBmp);
   329     iICFBmp = const_cast<CFbsBitmap*>(aBmp);
   288     iIcfPos = aPos;
   330     iIcfPos = aPos;
   289     Invalidate(Rect(), ETrue);   
   331     Invalidate(Rect(), ETrue);   
   290     }
   332     }
   291 void CPenUiWndCtrl::UpdateChangedArea(const CFbsBitmap* aBmp,const TRect& aPos,TBool aFlag)
   333 
   292     {
   334 
   293     UpdateBubble(aBmp,0,aPos,aFlag);
   335 // ---------------------------------------------------------------------------
   294     return;
   336 // CPenUiWndCtrl::UpdateChangedArea
   295 
   337 // ---------------------------------------------------------------------------
   296     
   338 //
   297     }
   339 void CPenUiWndCtrl::UpdateChangedArea( const TUint32 aCtrl, 
       
   340 		const CFbsBitmap* aBmp,const TRect& aPos,TBool aFlag)
       
   341     {
       
   342     UpdateBubble( aCtrl, aBmp, 0, aPos, aFlag );
       
   343     return;    
       
   344     }
       
   345 
       
   346 
   298 void CPenUiWndCtrl::SetPopupArea(const TRect& aRect, TBool aFlag)
   347 void CPenUiWndCtrl::SetPopupArea(const TRect& aRect, TBool aFlag)
   299     {
   348     {
   300     if(aFlag) //add pop area
   349     if(aFlag) //add pop area
   301         {
   350         {
   302         iPopRegion.AddRect(aRect);
   351         iPopRegion.AddRect(aRect);
   692             break;
   741             break;
   693         case ESignalUpdateBubble:
   742         case ESignalUpdateBubble:
   694             {
   743             {
   695             struct SData
   744             struct SData
   696                 {
   745                 {
       
   746             	TUint32 ctrl;
   697                 TBool flag;
   747                 TBool flag;
   698                 TRect pos;
   748                 TRect pos;
   699                 CFbsBitmap* bmp;
   749                 CFbsBitmap* bmp;
   700                 CFbsBitmap* mask;
   750                 CFbsBitmap* mask;
   701                 } data;
   751                 } data;
   702             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   752             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   703             UpdateBubble(data.bmp,data.mask,data.pos,data.flag);
   753             UpdateBubble( data.ctrl, data.bmp, data.mask, data.pos, data.flag );
   704             }
   754             }
   705             break;
   755             break;
   706         case ESignalUpdateChangedArea:
   756         case ESignalUpdateChangedArea:
   707             {
   757             {
   708             struct SData
   758             struct SData
   709                 {
   759                 {
       
   760             	TUint32 ctrl;
   710                 TBool flag;
   761                 TBool flag;
   711                 CFbsBitmap* bmp;
   762                 CFbsBitmap* bmp;
   712                 TRect pos;
   763                 TRect pos;
   713                 } data;
   764                 } data;
   714             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   765             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   715             UpdateChangedArea(data.bmp,data.pos,data.flag);
   766             UpdateChangedArea( data.ctrl, data.bmp, data.pos, data.flag );
   716             }
   767             }
   717             break;
   768             break;
   718         case ESignalRegisterBkControl:
   769         case ESignalRegisterBkControl:
   719             {
   770             {
   720             
   771