textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp
branchRCL_3
changeset 9 e6a39382bb9c
parent 7 6defe5d1bd39
child 12 5e18d8c489d6
equal deleted inserted replaced
8:4eb1ae11334f 9:e6a39382bb9c
    28 
    28 
    29 #include <e32property.h>
    29 #include <e32property.h>
    30 #include <avkondomainpskeys.h>
    30 #include <avkondomainpskeys.h>
    31 #endif
    31 #endif
    32 
    32 
       
    33 #ifndef FIX_FOR_NGA
       
    34 #define FIX_FOR_NGA
       
    35 #endif
    33 
    36 
    34 const TInt KAknCapServerUid = 0x10207218;
    37 const TInt KAknCapServerUid = 0x10207218;
    35 const TInt KAknNotifySrvUid = 0x10281EF2;  
    38 const TInt KAknNotifySrvUid = 0x10281EF2;  
    36     
    39 
       
    40 const TInt KAutoRefreshTimer = 10; //ms
       
    41 const TInt KAutoRefreshLongTimer = 1000; //ms
       
    42 
       
    43 TInt AutoRefreshTimerCallback( TAny* aObject )
       
    44     {
       
    45     CPenUiWndCtrl* wnd = static_cast<CPenUiWndCtrl*>( aObject );
       
    46     wnd->RefreshUI();
       
    47 
       
    48     return 0;
       
    49     }
       
    50 
    37 CPenUiWndCtrl::CPenUiWndCtrl(RWindowGroup& aWndGroup,CFbsBitmap * aBitmap)
    51 CPenUiWndCtrl::CPenUiWndCtrl(RWindowGroup& aWndGroup,CFbsBitmap * aBitmap)
    38     :iWndGroup(aWndGroup),
    52     :iWndGroup(aWndGroup),
    39      iBitmap(aBitmap),
    53      iBitmap(aBitmap),
    40      iAknUiSrv(CAknSgcClient::AknSrv())
    54      iAknUiSrv(CAknSgcClient::AknSrv())
    41 {
    55 {
    52         {
    66         {
    53         // abort component effects (possibly appear effect) 
    67         // abort component effects (possibly appear effect) 
    54         // if aknnote gets destroyed without user interaction or timers
    68         // if aknnote gets destroyed without user interaction or timers
    55         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort );
    69         GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort );
    56         GfxTransEffect::Deregister(this); //Always deregister in destructor.
    70         GfxTransEffect::Deregister(this); //Always deregister in destructor.
    57         }
    71         }    
    58 #endif    	
    72 #endif   
       
    73     if ( iAutoRefreshTimer && iAutoRefreshTimer->IsActive() )
       
    74         {
       
    75         iAutoRefreshTimer->Cancel();
       
    76         }
       
    77     delete iAutoRefreshTimer;    
    59 }
    78 }
    60 
    79 
    61 void CPenUiWndCtrl::ConstructL()
    80 void CPenUiWndCtrl::ConstructL()
    62 {
    81 {
    63     CreateWindowL(iWndGroup);
    82     CreateWindowL(iWndGroup);
    73         GfxTransEffect::Register( this, TUid::Uid( 0x2000B477 ));
    92         GfxTransEffect::Register( this, TUid::Uid( 0x2000B477 ));
    74         }
    93         }
    75 #endif    
    94 #endif    
    76   //  ActivateL();
    95   //  ActivateL();
    77     iPopupWnd = CPenUiPopWnd::NewL(iWndGroup,iBitmap,this);
    96     iPopupWnd = CPenUiPopWnd::NewL(iWndGroup,iBitmap,this);
       
    97     
       
    98     iAutoRefreshTimer = CPeriodic::NewL( CActive::EPriorityStandard );
    78 }
    99 }
    79 
   100 
    80 
   101 
    81 void CPenUiWndCtrl::Draw(const TRect& aRect) const
   102 void CPenUiWndCtrl::Draw(const TRect& aRect) const
    82     {
   103     {
    91         gc.BitBlt( pos, iBitmap, rect );
   112         gc.BitBlt( pos, iBitmap, rect );
    92         return;
   113         return;
    93         }
   114         }
    94     
   115     
    95     gc.BitBlt(aRect.iTl,iBitmap,aRect);
   116     gc.BitBlt(aRect.iTl,iBitmap,aRect);
       
   117     }
       
   118 
       
   119 void CPenUiWndCtrl::RefreshUI()
       
   120     {
       
   121     StopRefreshTimer();
       
   122     
       
   123     if ( iShowPopup )
       
   124         {
       
   125         iPopupWnd->DrawNow();
       
   126         }
       
   127     else
       
   128         {
       
   129         DrawNow();
       
   130         }
       
   131     CCoeEnv::Static()->WsSession().Flush();
       
   132     CCoeEnv::Static()->WsSession().Finish();
       
   133     
    96     }
   134     }
    97 
   135 
    98 TInt CPenUiWndCtrl::WndPriority()
   136 TInt CPenUiWndCtrl::WndPriority()
    99     {
   137     {
   100     return iPriority;
   138     return iPriority;
   278         {        
   316         {        
   279         iPopupWnd->MakeVisible(EFalse);//This is a temproary fix due to pop up UI not updated.
   317         iPopupWnd->MakeVisible(EFalse);//This is a temproary fix due to pop up UI not updated.
   280         iPopupWnd->Invalidate(aRect);
   318         iPopupWnd->Invalidate(aRect);
   281         iPopupWnd->MakeVisible(ETrue);//This is a temproary fix due to pop up UI not updated.
   319         iPopupWnd->MakeVisible(ETrue);//This is a temproary fix due to pop up UI not updated.
   282         iPopupWnd->Invalidate(aRect);
   320         iPopupWnd->Invalidate(aRect);
   283         iPopupWnd->DrawNow();
       
   284         }
   321         }
   285     else
   322     else
   286         //DrawNow(aRect);
       
   287         {
   323         {
   288         iInvalidateRect = aRect;
   324         iInvalidateRect = aRect;
   289         Window().Invalidate(aRect);
   325         Window().Invalidate(aRect);
   290         DrawNow(aRect);
   326         }
   291         }
   327 #ifdef FIX_FOR_NGA
   292     CCoeEnv::Static()->WsSession().Flush();
   328     RestartRefreshTimer();
   293     CCoeEnv::Static()->WsSession().Finish(); 
   329 #endif
   294     }
   330     }
   295 
   331 
   296 void CPenUiWndCtrl::OnActivate(EditorType aType)
   332 void CPenUiWndCtrl::OnActivate(EditorType aType)
   297     {
   333     {
   298     //TBool dim = IsDimmed();
   334     //TBool dim = IsDimmed();
   427 void CPenUiWndCtrl::SetResourceChange(TBool aResourceChange)
   463 void CPenUiWndCtrl::SetResourceChange(TBool aResourceChange)
   428     {
   464     {
   429     iResourceChange = aResourceChange;
   465     iResourceChange = aResourceChange;
   430     }
   466     }
   431     
   467     
       
   468 
       
   469 void CPenUiWndCtrl::RestartRefreshTimer()
       
   470     {
       
   471     StopRefreshTimer();
       
   472 
       
   473     TTimeIntervalMicroSeconds32 t1 = KAutoRefreshTimer * 1000;
       
   474     TTimeIntervalMicroSeconds32 t2 = KAutoRefreshLongTimer * 1000;
       
   475     iAutoRefreshTimer->Start( t1, t2, TCallBack(AutoRefreshTimerCallback, this) );
       
   476     }
       
   477 
       
   478 void CPenUiWndCtrl::StopRefreshTimer()
       
   479     {
       
   480     if ( iAutoRefreshTimer->IsActive() )
       
   481         {
       
   482         iAutoRefreshTimer->Cancel();
       
   483         }
       
   484     }
       
   485 
   432 //End Of File
   486 //End Of File
   433 // class CInternalBkCtrl
   487 // class CInternalBkCtrl
   434 CInternalBkCtrl::CInternalBkCtrl(RWindowGroup& aWndGroup)    
   488 CInternalBkCtrl::CInternalBkCtrl(RWindowGroup& aWndGroup)    
   435             :iWndGroup(aWndGroup)
   489             :iWndGroup(aWndGroup)
   436     {
   490     {