textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp
branchRCL_3
changeset 56 8152b1f1763a
parent 50 5a1685599b76
equal deleted inserted replaced
50:5a1685599b76 56:8152b1f1763a
    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     
    75 	iPopRegion.Close();
    76 
    76 	iBubblesArea.Close();
    77 	Clean();
    77     iBubblesMaskArea.Close();
    78 
    78 	iBubblesPos.Close();
    79     
    79     
    80 	delete iCursorWnd;   
    80 	delete iCursorWnd;   
    81 }
    81 }
    82 
    82 
    83 void CPenUiWndCtrl::ConstructL()
    83 void CPenUiWndCtrl::ConstructL()
   124         rect.Intersection(iLayoutClipRect);
   124         rect.Intersection(iLayoutClipRect);
   125         TPoint pos = rect.iTl - iLayoutClipRect.iTl;
   125         TPoint pos = rect.iTl - iLayoutClipRect.iTl;
   126         gc.BitBlt(pos, iBitmap, rect);
   126         gc.BitBlt(pos, iBitmap, rect);
   127 #ifdef FIX_FOR_NGA
   127 #ifdef FIX_FOR_NGA
   128         //draw bubble
   128         //draw bubble
   129         for ( TInt i = 0; i < iBubblesCtrl.Count(); ++i )
   129         for (TInt i = 0; i < iBubblesArea.Count(); ++i)
   130             {
   130             {
   131             gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   131             gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   132             }
   132             }
   133 #endif   
   133 #endif   
   134         return;
   134         return;
   136         //gc.SetClippingRect( iLayoutClipRect );
   136         //gc.SetClippingRect( iLayoutClipRect );
   137         }
   137         }
   138 #ifdef FIX_FOR_NGA
   138 #ifdef FIX_FOR_NGA
   139     gc.BitBlt(TPoint(0, 0), iBitmap, Rect());
   139     gc.BitBlt(TPoint(0, 0), iBitmap, Rect());
   140     //draw bubble
   140     //draw bubble
   141     for ( TInt i = 0; i < iBubblesCtrl.Count(); ++i )
   141     for (TInt i = 0; i < iBubblesArea.Count(); ++i)
   142         {
   142         {
   143         gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   143         gc.BitBlt(iBubblesPos[i].iTl, iBubblesArea[i]);
   144         }
   144         }
   145 #else    
   145 #else    
   146     gc.BitBlt(aRect.iTl,iBitmap,aRect);
   146     gc.BitBlt(aRect.iTl,iBitmap,aRect);
   166     }
   166     }
   167 
   167 
   168 void CPenUiWndCtrl::Clean()
   168 void CPenUiWndCtrl::Clean()
   169     {
   169     {
   170     iCursorBmp = NULL;
   170     iCursorBmp = NULL;
   171     iBubblesArea.Close();
   171     iBubblesArea.Reset();
   172     iBubblesCtrl.Close();
   172     iBubblesPos.Reset();
   173     iBubblesPos.Close();
       
   174 	iBubblesMaskArea.Close();
   173 	iBubblesMaskArea.Close();
   175 	iPopRegion.Close();
   174 	iPopRegion.Close();
   176     iChangedBmp= NULL;
   175     iChangedBmp= NULL;
   177     iBackground = EFalse;
   176     iBackground = EFalse;
   178     iNotUpdating = EFalse;
   177     iNotUpdating = EFalse;
   274         iCursorRect = aRect;
   273         iCursorRect = aRect;
   275         iCursorWnd->SetRect(iCursorRect);
   274         iCursorWnd->SetRect(iCursorRect);
   276         }
   275         }
   277     iCursorWnd->SetCursorVisible(aOnFlag);
   276     iCursorWnd->SetCursorVisible(aOnFlag);
   278     }
   277     }
   279 
   278 	
   280 // ---------------------------------------------------------------------------
   279 void CPenUiWndCtrl::UpdateBubble(const CFbsBitmap* aBmp,const CFbsBitmap* aMask,
   281 // CPenUiWndCtrl::UpdateBubble
   280                                                 const TRect& aPos,TBool aFlag)
   282 // ---------------------------------------------------------------------------
   281     {
   283 //
   282     TInt idx = iBubblesArea.Find(aBmp);
   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 
       
   294     
   283     
   295     if(aFlag)
   284     if(aFlag)
   296         {
   285         {
   297         if(KErrNotFound == idx)
   286         if(KErrNotFound == idx)
   298             {
   287             {
   299 
       
   300             iBubblesCtrl.Append( aCtrl );
       
   301 
       
   302             iBubblesArea.Append(aBmp);
   288             iBubblesArea.Append(aBmp);
   303             iBubblesMaskArea.Append(aMask);
   289             iBubblesMaskArea.Append(aMask);
   304             iBubblesPos.Append(aPos);
   290             iBubblesPos.Append(aPos);
   305             }
   291             }
   306         else
   292         else
   312     else
   298     else
   313         {
   299         {
   314         //remove
   300         //remove
   315         if(idx != KErrNotFound)
   301         if(idx != KErrNotFound)
   316             {
   302             {
   317 
       
   318             iBubblesCtrl.Remove( idx );
       
   319 
       
   320             iBubblesArea.Remove(idx);
   303             iBubblesArea.Remove(idx);
   321             iBubblesMaskArea.Remove(idx);
   304             iBubblesMaskArea.Remove(idx);
   322             iBubblesPos.Remove(idx);            
   305             iBubblesPos.Remove(idx);            
   323             }        
   306             }        
   324         }
   307         }
   328     {
   311     {
   329     iICFBmp = const_cast<CFbsBitmap*>(aBmp);
   312     iICFBmp = const_cast<CFbsBitmap*>(aBmp);
   330     iIcfPos = aPos;
   313     iIcfPos = aPos;
   331     Invalidate(Rect(), ETrue);   
   314     Invalidate(Rect(), ETrue);   
   332     }
   315     }
   333 
   316 void CPenUiWndCtrl::UpdateChangedArea(const CFbsBitmap* aBmp,const TRect& aPos,TBool aFlag)
   334 
   317     {
   335 // ---------------------------------------------------------------------------
   318     UpdateBubble(aBmp,0,aPos,aFlag);
   336 // CPenUiWndCtrl::UpdateChangedArea
   319     return;
   337 // ---------------------------------------------------------------------------
   320 
   338 //
   321     
   339 void CPenUiWndCtrl::UpdateChangedArea( const TUint32 aCtrl, 
   322     }
   340 		const CFbsBitmap* aBmp,const TRect& aPos,TBool aFlag)
       
   341     {
       
   342     UpdateBubble( aCtrl, aBmp, 0, aPos, aFlag );
       
   343     return;    
       
   344     }
       
   345 
       
   346 
       
   347 void CPenUiWndCtrl::SetPopupArea(const TRect& aRect, TBool aFlag)
   323 void CPenUiWndCtrl::SetPopupArea(const TRect& aRect, TBool aFlag)
   348     {
   324     {
   349     if(aFlag) //add pop area
   325     if(aFlag) //add pop area
   350         {
   326         {
   351         iPopRegion.AddRect(aRect);
   327         iPopRegion.AddRect(aRect);
   395 void CPenUiWndCtrl::ShowPenUiL(TBool /*aDimmed*/)
   371 void CPenUiWndCtrl::ShowPenUiL(TBool /*aDimmed*/)
   396     {
   372     {
   397     iCursorWnd->SetCursorVisible(EFalse);
   373     iCursorWnd->SetCursorVisible(EFalse);
   398     if (iResourceChange)
   374     if (iResourceChange)
   399         {
   375         {
   400         TInt curPriority = iWndGroup.OrdinalPriority();
       
   401         if ( curPriority == -1 )
       
   402             {
       
   403             // Make sure pen ui must be seen.
       
   404             LiftUpPriority();
       
   405             }
       
   406         ActivateL();
   376         ActivateL();
   407         iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputShow );
   377         iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputShow );
   408         MakeVisible( ETrue );
   378         MakeVisible( ETrue );
   409     	ClaimPointerGrab( ETrue );
   379     	ClaimPointerGrab( ETrue );
   410         return;
   380         return;
   423 	ClaimPointerGrab( ETrue );
   393 	ClaimPointerGrab( ETrue );
   424 	
   394 	
   425 	
   395 	
   426 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS      
   396 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS      
   427 	
   397 	
   428     if ( iEnableGfxTransEffect && GfxTransEffect::IsRegistered( this ) && !IsVisible())
   398     if ( GfxTransEffect::IsRegistered( this ) && !IsVisible())
   429         {
   399         {
   430         iEnableGfxTransEffect = EFalse;
       
   431         this->MakeVisible(EFalse);
   400         this->MakeVisible(EFalse);
   432         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); 
   401         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); 
   433 
   402 
   434         //If still visible, do a transition to invisible state.
   403         //If still visible, do a transition to invisible state.
   435         CAknTransitionUtils::SetAllParents(this);
   404         CAknTransitionUtils::SetAllParents(this);
   468         TRAP_IGNORE(iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputHide ));
   437         TRAP_IGNORE(iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputHide ));
   469         MakeVisible( EFalse );
   438         MakeVisible( EFalse );
   470         return;
   439         return;
   471         }
   440         }
   472 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS           
   441 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS           
   473     if ( iEnableGfxTransEffect && GfxTransEffect::IsRegistered( this ) )
   442     if ( GfxTransEffect::IsRegistered( this ))
   474         {
   443         {
   475         iEnableGfxTransEffect = EFalse;
   444 
   476         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); 
   445         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort ); 
   477 
   446 
   478         //If still visible, do a transition to invisible state.
   447         //If still visible, do a transition to invisible state.
   479         CAknTransitionUtils::SetAllParents(this);
   448         CAknTransitionUtils::SetAllParents(this);
   480         GfxTransEffect::Begin(this, KGfxControlDisappearAction);
   449         GfxTransEffect::Begin(this, KGfxControlDisappearAction);
   752             break;
   721             break;
   753         case ESignalUpdateBubble:
   722         case ESignalUpdateBubble:
   754             {
   723             {
   755             struct SData
   724             struct SData
   756                 {
   725                 {
   757             	TUint32 ctrl;
       
   758                 TBool flag;
   726                 TBool flag;
   759                 TRect pos;
   727                 TRect pos;
   760                 CFbsBitmap* bmp;
   728                 CFbsBitmap* bmp;
   761                 CFbsBitmap* mask;
   729                 CFbsBitmap* mask;
   762                 } data;
   730                 } data;
   763             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   731             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   764             UpdateBubble( data.ctrl, data.bmp, data.mask, data.pos, data.flag );
   732             UpdateBubble(data.bmp,data.mask,data.pos,data.flag);
   765             }
   733             }
   766             break;
   734             break;
   767         case ESignalUpdateChangedArea:
   735         case ESignalUpdateChangedArea:
   768             {
   736             {
   769             struct SData
   737             struct SData
   770                 {
   738                 {
   771             	TUint32 ctrl;
       
   772                 TBool flag;
   739                 TBool flag;
   773                 CFbsBitmap* bmp;
   740                 CFbsBitmap* bmp;
   774                 TRect pos;
   741                 TRect pos;
   775                 } data;
   742                 } data;
   776             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   743             data = * (reinterpret_cast<SData*>( const_cast<TUint16*>( aEventData.Ptr() )));
   777             UpdateChangedArea( data.ctrl, data.bmp, data.pos, data.flag );
   744             UpdateChangedArea(data.bmp,data.pos,data.flag);
   778             }
   745             }
   779             break;
   746             break;
   780         case ESignalRegisterBkControl:
   747         case ESignalRegisterBkControl:
   781             {
   748             {
   782             
   749