diff -r 4d54b72983ae -r c743ef5928ba idlehomescreen/xmluirendering/uiengine/src/xnbgcontrol.cpp --- a/idlehomescreen/xmluirendering/uiengine/src/xnbgcontrol.cpp Tue Jan 26 11:48:23 2010 +0200 +++ b/idlehomescreen/xmluirendering/uiengine/src/xnbgcontrol.cpp Tue Feb 02 00:04:13 2010 +0200 @@ -17,18 +17,11 @@ // System includes #include -#include -#include -#include -#include -#include // User includes #include "xnappuiadapter.h" #include "xnuiengine.h" #include "xneditmode.h" -#include "xnviewadapter.h" -#include "xnfocuscontrol.h" #include "xnbgcontrol.h" @@ -77,6 +70,7 @@ // ----------------------------------------------------------------------------- // CXnBgControl::CXnBgControl() + : iHitpoint( TPoint( -1,-1 ) ) { } @@ -106,6 +100,10 @@ MakeVisible( ETrue ); SetComponentsToInheritVisibility( ETrue ); + + static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) + ->UiStateListener().AddObserver( *this ); + } // ----------------------------------------------------------------------------- @@ -178,6 +176,19 @@ // void CXnBgControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) { + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + iHitpoint = aPointerEvent.iPosition; + break; + + case TPointerEvent::EButton1Up: + break; + + default: + break; + } + CXnAppUiAdapter* appui( static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) ); appui->UiEngine().DisableRenderUiLC(); @@ -222,5 +233,94 @@ iControl = aControl; } +// ----------------------------------------------------------------------------- +// CXnBgControl::ResetGrabbingL() +// Service for removing grabbing controls +// ----------------------------------------------------------------------------- +// +void CXnBgControl::ResetGrabbingL() + { + TPointerEvent event; + event.iType = TPointerEvent::EButton1Up; + + RemoveGrabbingControL( this, event ); + + iHitpoint.SetXY( -1, -1 ); + } + +// ----------------------------------------------------------------------------- +// CXnBgControl::PrepareDestroy() +// Prepares control for destroying +// ----------------------------------------------------------------------------- +// +void CXnBgControl::PrepareDestroy() + { + static_cast< CXnAppUiAdapter* >( iAvkonAppUi ) + ->UiStateListener().RemoveObserver( *this ); + } + +// ----------------------------------------------------------------------------- +// CXnBgControl::RemoveGrabbingControL() +// Removes recursively grabbing controls +// ----------------------------------------------------------------------------- +// +void CXnBgControl::RemoveGrabbingControL( const CCoeControl* aControl, + const TPointerEvent& aEvent ) const + { + TInt count = aControl->CountComponentControls(); + + for( TInt i = 0; i < count; i++ ) + { + CCoeControl* child = aControl->ComponentControl( i ); + + if( child && child->Rect().Contains( iHitpoint ) ) + { + child->CCoeControl::HandlePointerEventL( aEvent ); + RemoveGrabbingControL( child, aEvent ); + } + } + } + +// ----------------------------------------------------------------------------- +// CXnBgControl::NotifyForegroundChanged() +// Notifies foreground changes. +// ----------------------------------------------------------------------------- +// +void CXnBgControl::NotifyForegroundChanged( TForegroundStatus aStatus ) + { + switch( aStatus ) + { + case EForeground: + break; + + case EUnknown: + case EBackground: + case EPartialForeground: + default: + TRAP_IGNORE( ResetGrabbingL(); ) + break; + } + } + +// ----------------------------------------------------------------------------- +// CXnBgControl::NotifyLightStatusChanged() +// Notifies primary display light status is changed. +// ----------------------------------------------------------------------------- +// +void CXnBgControl::NotifyLightStatusChanged( TBool /*aLightsOn*/ ) + { + + } + +// ----------------------------------------------------------------------------- +// CXnBgControl::NotifyInCallStateChaged() +// Notifies in-call state is changed. +// ----------------------------------------------------------------------------- +// +void CXnBgControl::NotifyInCallStateChaged( TBool /*aInCall*/ ) + { + + } + // End of file