idlehomescreen/xmluirendering/uiengine/src/xnbgcontrol.cpp
changeset 5 c743ef5928ba
parent 2 08c6ee43b396
child 15 ff572dfe6d86
equal deleted inserted replaced
4:4d54b72983ae 5:c743ef5928ba
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
    19 #include <aknappui.h>
    19 #include <aknappui.h>
    20 #include <AknUtils.h>
       
    21 #include <AknsUtils.h>
       
    22 #include <AknsDrawUtils.h>
       
    23 #include <AknsLayeredBackgroundControlContext.h>
       
    24 #include <gdi.h>
       
    25 
    20 
    26 // User includes
    21 // User includes
    27 #include "xnappuiadapter.h"
    22 #include "xnappuiadapter.h"
    28 #include "xnuiengine.h"
    23 #include "xnuiengine.h"
    29 #include "xneditmode.h"
    24 #include "xneditmode.h"
    30 #include "xnviewadapter.h"
       
    31 #include "xnfocuscontrol.h"
       
    32 
    25 
    33 #include "xnbgcontrol.h"
    26 #include "xnbgcontrol.h"
    34 
    27 
    35 // Constants
    28 // Constants
    36 
    29 
    75 // CXnBgControl::CXnBgControl()
    68 // CXnBgControl::CXnBgControl()
    76 // C++ default constructor.
    69 // C++ default constructor.
    77 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    78 //
    71 //
    79 CXnBgControl::CXnBgControl()
    72 CXnBgControl::CXnBgControl()
       
    73     :   iHitpoint( TPoint( -1,-1 ) )
    80     {  
    74     {  
    81     }
    75     }
    82 
    76 
    83 // -----------------------------------------------------------------------------
    77 // -----------------------------------------------------------------------------
    84 // CXnBgControl::ConstructL()
    78 // CXnBgControl::ConstructL()
   104     ActivateL();
    98     ActivateL();
   105 
    99 
   106     MakeVisible( ETrue );
   100     MakeVisible( ETrue );
   107     
   101     
   108     SetComponentsToInheritVisibility( ETrue );
   102     SetComponentsToInheritVisibility( ETrue );
       
   103     
       
   104     static_cast< CXnAppUiAdapter* >( iAvkonAppUi )
       
   105             ->UiStateListener().AddObserver( *this );
       
   106     
   109     }
   107     }
   110 
   108 
   111 // -----------------------------------------------------------------------------
   109 // -----------------------------------------------------------------------------
   112 // CXnBgControl::CountComponentControls()
   110 // CXnBgControl::CountComponentControls()
   113 // 
   111 // 
   176 // 
   174 // 
   177 // -----------------------------------------------------------------------------
   175 // -----------------------------------------------------------------------------
   178 //
   176 //
   179 void CXnBgControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   177 void CXnBgControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
   180     {
   178     {
       
   179     switch( aPointerEvent.iType )
       
   180         {
       
   181         case TPointerEvent::EButton1Down:
       
   182             iHitpoint = aPointerEvent.iPosition;
       
   183             break;
       
   184             
       
   185         case TPointerEvent::EButton1Up:
       
   186             break;
       
   187             
       
   188         default:
       
   189             break;
       
   190         }
       
   191     
   181     CXnAppUiAdapter* appui( static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) );
   192     CXnAppUiAdapter* appui( static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) );
   182     
   193     
   183     appui->UiEngine().DisableRenderUiLC();
   194     appui->UiEngine().DisableRenderUiLC();
   184             
   195             
   185     CCoeControl::HandlePointerEventL( aPointerEvent );
   196     CCoeControl::HandlePointerEventL( aPointerEvent );
   220         }
   231         }
   221     
   232     
   222     iControl = aControl;        
   233     iControl = aControl;        
   223     }
   234     }
   224 
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // CXnBgControl::ResetGrabbingL()
       
   238 // Service for removing grabbing controls
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 void CXnBgControl::ResetGrabbingL()
       
   242     {
       
   243     TPointerEvent event;
       
   244     event.iType = TPointerEvent::EButton1Up;
       
   245     
       
   246     RemoveGrabbingControL( this, event );
       
   247     
       
   248     iHitpoint.SetXY( -1, -1 );
       
   249     }
       
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 // CXnBgControl::PrepareDestroy()
       
   253 // Prepares control for destroying
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 void CXnBgControl::PrepareDestroy()
       
   257     {
       
   258     static_cast< CXnAppUiAdapter* >( iAvkonAppUi )
       
   259             ->UiStateListener().RemoveObserver( *this );
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CXnBgControl::RemoveGrabbingControL()
       
   264 // Removes recursively grabbing controls
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 void CXnBgControl::RemoveGrabbingControL( const CCoeControl* aControl,
       
   268         const TPointerEvent& aEvent ) const
       
   269     {
       
   270     TInt count = aControl->CountComponentControls();
       
   271     
       
   272     for( TInt i = 0; i < count; i++ )
       
   273         {
       
   274         CCoeControl* child = aControl->ComponentControl( i );
       
   275         
       
   276         if( child && child->Rect().Contains( iHitpoint ) )
       
   277             {
       
   278             child->CCoeControl::HandlePointerEventL( aEvent ); 
       
   279             RemoveGrabbingControL( child, aEvent );
       
   280             }
       
   281         }
       
   282     }
       
   283 
       
   284 // -----------------------------------------------------------------------------
       
   285 // CXnBgControl::NotifyForegroundChanged()
       
   286 // Notifies foreground changes.
       
   287 // -----------------------------------------------------------------------------
       
   288 //
       
   289 void CXnBgControl::NotifyForegroundChanged( TForegroundStatus aStatus )
       
   290     {
       
   291     switch( aStatus )
       
   292         {
       
   293         case EForeground:
       
   294             break;
       
   295             
       
   296         case EUnknown:
       
   297         case EBackground:
       
   298         case EPartialForeground:  
       
   299         default:
       
   300             TRAP_IGNORE( ResetGrabbingL(); )
       
   301             break;
       
   302         }
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CXnBgControl::NotifyLightStatusChanged()
       
   307 // Notifies primary display light status is changed.
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 void CXnBgControl::NotifyLightStatusChanged( TBool /*aLightsOn*/ )
       
   311     {
       
   312     
       
   313     }
       
   314 
       
   315 // -----------------------------------------------------------------------------
       
   316 // CXnBgControl::NotifyInCallStateChaged()
       
   317 // Notifies in-call state is changed.
       
   318 // -----------------------------------------------------------------------------
       
   319 //
       
   320 void CXnBgControl::NotifyInCallStateChaged( TBool /*aInCall*/ )
       
   321     {
       
   322     
       
   323     }
       
   324 
   225 // End of file
   325 // End of file
   226 
   326