idlehomescreen/xmluirendering/uiengine/src/xncontroladapterimpl.cpp
branchRCL_3
changeset 34 d05a55b217df
parent 30 b8fae6b8a148
child 47 7be2816dbabd
equal deleted inserted replaced
30:b8fae6b8a148 34:d05a55b217df
    51 #include "xndomnode.h"
    51 #include "xndomnode.h"
    52 #include "xnproperty.h"
    52 #include "xnproperty.h"
    53 #include "xndomlist.h"
    53 #include "xndomlist.h"
    54 #include "xnodt.h"
    54 #include "xnodt.h"
    55 #include "xnresource.h"
    55 #include "xnresource.h"
    56 #include "xnhittest.h"
       
    57 #include "xnplugindata.h"
    56 #include "xnplugindata.h"
    58 #include "xnnode.h"
    57 #include "xnnode.h"
    59 #include "xnpanic.h"
    58 #include "xnpanic.h"
    60 #include "xnviewdata.h"
    59 #include "xnviewdata.h"
    61 #include "xnscrollablecontroladapter.h"
    60 #include "xnscrollablecontroladapter.h"
    62 #include "xnfocuscontrol.h"
    61 #include "xnfocuscontrol.h"
    63 #include "xneditmode.h"
    62 #include "xneditmode.h"
    64 
    63 
    65 _LIT8(KScrollableBoxNodeName, "scrollablebox");
    64 _LIT8(KScrollableBoxNodeName, "scrollablebox");
    66         
       
    67 using namespace XnGestureHelper;
       
    68 #include "xngesture.h"
       
    69 
    65 
    70 // Constants
    66 // Constants
    71 const TInt KSkinGfxInnerRectShrink = 5;
    67 const TInt KSkinGfxInnerRectShrink = 5;
    72 const TInt KFocusGrowValue = 3;
    68 const TInt KFocusGrowValue = 3;
    73 
    69 
    74 const TInt KLongTapStartShortDelay( 150000 ); // 0.15s for Sk
    70 const TInt KLongTapStartShortDelay( 150000 ); // 0.15s for Sk
    75 const TInt KLongTapStartLongDelay( 500000 ); // 0.5s
    71 const TInt KLongTapStartLongDelay( 500000 ); // 0.5s
    76 const TInt KLongTapTimeShortDelay( 600000 ); // 0.6s for SK
    72 const TInt KLongTapTimeShortDelay( 600000 ); // 0.6s for SK
    77 const TInt KLongTapTimeLongDelay( 1500000 ); // 1.5s 
    73 const TInt KLongTapTimeLongDelay( 1500000 ); // 1.5s
       
    74 
       
    75 const TInt KDragThreshold = 20; // pixels
    78 
    76 
    79 // LOCAL FUNCTION PROTOTYPES
    77 // LOCAL FUNCTION PROTOTYPES
    80 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness );
    78 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness );
    81 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation,
    79 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation,
    82     TUint& aLightness );
    80     TUint& aLightness );
  3354     CleanupStack::Pop( aTrgBitmap );
  3352     CleanupStack::Pop( aTrgBitmap );
  3355     }
  3353     }
  3356 
  3354 
  3357 // -----------------------------------------------------------------------------
  3355 // -----------------------------------------------------------------------------
  3358 // SoftkeyNode
  3356 // SoftkeyNode
  3359 // Gets the node of softkey according to index
       
  3360 // -----------------------------------------------------------------------------
       
  3361 //
       
  3362 static CXnNode* SoftkeyNodeL( CXnNode* aMenuBarNode, const TDesC8& aSoftkey )
       
  3363     {
       
  3364     if ( aMenuBarNode )
       
  3365         {
       
  3366         XnMenuInterface::MXnMenuInterface* menuIf( NULL );
       
  3367         XnComponentInterface::MakeInterfaceL( menuIf, aMenuBarNode->AppIfL() );
       
  3368         CXnNodePluginIf* skNode( NULL );
       
  3369         if ( menuIf )
       
  3370             {
       
  3371             if ( aSoftkey == XnPropertyNames::softkey::type::KLeft )
       
  3372                 {
       
  3373                 skNode = menuIf->SoftKeyL(
       
  3374                     XnMenuInterface::MXnMenuInterface::ELeft );
       
  3375                 }
       
  3376             else if ( aSoftkey == XnPropertyNames::softkey::type::KMiddle )
       
  3377                 {
       
  3378                 skNode = menuIf->SoftKeyL(
       
  3379                     XnMenuInterface::MXnMenuInterface::ECenter );
       
  3380                 }
       
  3381             else if ( aSoftkey == XnPropertyNames::softkey::type::KRight )
       
  3382                 {
       
  3383                 skNode = menuIf->SoftKeyL(
       
  3384                     XnMenuInterface::MXnMenuInterface::ERight );
       
  3385                 }
       
  3386             }
       
  3387         if ( skNode )
       
  3388             {
       
  3389             return &skNode->Node();
       
  3390             }
       
  3391         }
       
  3392     return NULL;
       
  3393     }
       
  3394 
       
  3395 // -----------------------------------------------------------------------------
       
  3396 // SoftkeyNode
       
  3397 // Gets the node of softkey according to pointer location
  3357 // Gets the node of softkey according to pointer location
  3398 // -----------------------------------------------------------------------------
  3358 // -----------------------------------------------------------------------------
  3399 //
  3359 //
  3400 static CXnNode* SoftkeyNode( CXnNode* aMenuBarNode, const TPoint aPosition )
  3360 static CXnNode* SoftkeyNode( CXnNode* aMenuBarNode, const TPoint aPosition )
  3401     {
  3361     {
  3652     if ( iAnimation )
  3612     if ( iAnimation )
  3653         {
  3613         {
  3654         iAnimation->Stop();
  3614         iAnimation->Stop();
  3655         delete iAnimation;
  3615         delete iAnimation;
  3656         }
  3616         }
  3657 
  3617     
  3658     if ( iGestureHelper )
  3618     delete iGestureFw;
  3659         {
       
  3660         delete iGestureHelper;
       
  3661         }
       
  3662     }
  3619     }
  3663 
  3620 
  3664 // -----------------------------------------------------------------------------
  3621 // -----------------------------------------------------------------------------
  3665 // CXnControlAdapterImpl::CXnControlAdapterImpl
  3622 // CXnControlAdapterImpl::CXnControlAdapterImpl
  3666 // C++ default constructor. Must not leave.
  3623 // C++ default constructor. Must not leave.
  3720     CXnNode* temp( node );
  3677     CXnNode* temp( node );
  3721 
  3678 
  3722     for ( ; temp; temp = temp->Parent() )
  3679     for ( ; temp; temp = temp->Parent() )
  3723         {
  3680         {
  3724         if ( temp == menuBar )
  3681         if ( temp == menuBar )
  3725             {
  3682             {            
  3726             // This is softkey node
  3683             // This is softkey node        
  3727             const TDesC8* pos( NULL );
  3684             XnMenuInterface::MXnMenuInterface* menuIf( NULL );
  3728             node = NULL;
  3685             XnComponentInterface::MakeInterfaceL( menuIf, menuBar->AppIfL() );
  3729 
  3686         
  3730             if ( aKeyEvent.iScanCode == EStdKeyDevice0 )
  3687             if ( menuIf )
  3731                 {
  3688                 {
  3732                 pos = &XnPropertyNames::softkey::type::KLeft;
  3689                 CXnNodePluginIf* eventNode( menuIf->KeyEventNode() );
       
  3690                 
       
  3691                 if ( eventNode )
       
  3692                     {
       
  3693                     node = &eventNode->Node();
       
  3694                     }
  3733                 }
  3695                 }
  3734             else if ( aKeyEvent.iScanCode == EStdKeyDevice1 )
  3696             
  3735                 {
       
  3736                 pos = &XnPropertyNames::softkey::type::KRight;
       
  3737                 }
       
  3738             else if ( aKeyEvent.iScanCode == EStdKeyDevice3 )
       
  3739                 {
       
  3740                 pos = &XnPropertyNames::softkey::type::KMiddle;
       
  3741                 }
       
  3742 
       
  3743             if ( pos )
       
  3744                 {
       
  3745                 node = SoftkeyNodeL( menuBar, *pos );
       
  3746                 }
       
  3747 
       
  3748             break;
  3697             break;
  3749             }
  3698             }
  3750         }
  3699         }
  3751 
  3700 
  3752     if ( !node )
  3701     if ( !node )
  3757     if ( aKeyEvent.iScanCode == EStdKeyDevice0 || // RSK
  3706     if ( aKeyEvent.iScanCode == EStdKeyDevice0 || // RSK
  3758          aKeyEvent.iScanCode == EStdKeyDevice1 || // LSK
  3707          aKeyEvent.iScanCode == EStdKeyDevice1 || // LSK
  3759          aKeyEvent.iScanCode == EStdKeyDevice3 )  // MSK
  3708          aKeyEvent.iScanCode == EStdKeyDevice3 )  // MSK
  3760         {
  3709         {
  3761         if ( aType == EEventKeyDown )
  3710         if ( aType == EEventKeyDown )
  3762             {
  3711             {            
  3763             iKeyDownNode = node;
       
  3764             iLongtap = EFalse;
  3712             iLongtap = EFalse;
  3765             
  3713             
  3766             if ( aKeyEvent.iScanCode == EStdKeyDevice3 ||
  3714             if ( aKeyEvent.iScanCode == EStdKeyDevice3 ||
  3767                 aKeyEvent.iScanCode == EStdKeyEnter )
  3715                 aKeyEvent.iScanCode == EStdKeyEnter )
  3768                 {
  3716                 {
  3787 
  3735 
  3788             CleanupStack::PopAndDestroy( keydown );                              
  3736             CleanupStack::PopAndDestroy( keydown );                              
  3789             }
  3737             }
  3790         else if( aType == EEventKey )
  3738         else if( aType == EEventKey )
  3791             {
  3739             {
  3792             if( iKeyDownNode != node)
       
  3793             	{
       
  3794                 node = iKeyDownNode;
       
  3795             	}
       
  3796             if ( aKeyEvent.iRepeats == 0 )
  3740             if ( aKeyEvent.iRepeats == 0 )
  3797                 {
  3741                 {
  3798                 if ( !HasHoldTrigger( node->DomNode() ) )
  3742                 if ( !HasHoldTrigger( node->DomNode() ) )
  3799                     {
  3743                     {
  3800                     // If node doesn't define hold trigger, then report activate
  3744                     // If node doesn't define hold trigger, then report activate
  3819                 
  3763                 
  3820         else if ( aType == EEventKeyUp )
  3764         else if ( aType == EEventKeyUp )
  3821             {
  3765             {
  3822             if ( !iLongtap )
  3766             if ( !iLongtap )
  3823                 {
  3767                 {
  3824               if( iKeyDownNode != node)
       
  3825                 {
       
  3826                 node = iKeyDownNode;
       
  3827                 }   
       
  3828                 if ( HasHoldTrigger( node->DomNode() ) )
  3768                 if ( HasHoldTrigger( node->DomNode() ) )
  3829                     {
  3769                     {
  3830                     // Hold trigger defined, report activate event here                   
  3770                     // Hold trigger defined, report activate event here                   
  3831                     node->SetStateL( 
  3771                     node->SetStateL( 
  3832                         XnPropertyNames::style::common::KActive );                     
  3772                         XnPropertyNames::style::common::KActive );                     
  3932             }
  3872             }
  3933         }
  3873         }
  3934     }
  3874     }
  3935 
  3875 
  3936 // -----------------------------------------------------------------------------
  3876 // -----------------------------------------------------------------------------
       
  3877 // CXnControlAdapterImpl::IsDragThresholdExceeded
       
  3878 // Checks if drag threshold is exceeded
       
  3879 // -----------------------------------------------------------------------------
       
  3880 //
       
  3881 TBool CXnControlAdapterImpl::IsDragThresholdExceeded( const TPoint& aPoint )
       
  3882     {
       
  3883     TBool ret = EFalse;
       
  3884     TPoint distance = aPoint - iButtonDownStartPoint;
       
  3885     if ( Abs( distance.iX ) >= KDragThreshold ||
       
  3886          Abs( distance.iY ) >= KDragThreshold )
       
  3887         {
       
  3888         ret = ETrue;
       
  3889         }
       
  3890     return ret;
       
  3891     }
       
  3892 
       
  3893 // -----------------------------------------------------------------------------
  3937 // CXnControlAdapterImpl::HandlePointerEventL
  3894 // CXnControlAdapterImpl::HandlePointerEventL
  3938 // Handle pointer events
  3895 // Handle pointer events
  3939 // -----------------------------------------------------------------------------
  3896 // -----------------------------------------------------------------------------
  3940 //
  3897 //
  3941 TBool CXnControlAdapterImpl::HandlePointerEventL(
  3898 TBool CXnControlAdapterImpl::HandlePointerEventL(
  3943     {
  3900     {
  3944     const TPointerEvent& event( aPointerEvent );
  3901     const TPointerEvent& event( aPointerEvent );
  3945     
  3902     
  3946     CXnNode* node( &iNode.Node() );
  3903     CXnNode* node( &iNode.Node() );
  3947     CXnUiEngine* engine( node->UiEngine() );
  3904     CXnUiEngine* engine( node->UiEngine() );
  3948  
  3905     
  3949     if(!engine->IsPartialInputActive())
  3906     if ( !engine->IsPartialInputActive() )
  3950         {
  3907         {
  3951         // Forward event to gesture helper
  3908         InitializeGestureL( aPointerEvent );
  3952         if( PassEventToGestureHelperL( aPointerEvent ) )
  3909         }
  3953             { 
  3910     else
  3954             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  3911         {
  3955             CXnViewData& data( appui.ViewManager().ActiveViewData() );
  3912         // reset destination
  3956             
  3913         iGestureDestination = NULL;
  3957             CXnViewControlAdapter* control = 
       
  3958                 static_cast< CXnViewControlAdapter* >( data.ViewNode()->Control() );
       
  3959             
       
  3960             control->ResetGrabbing();
       
  3961 
       
  3962             // Swipe took place, consume this event
       
  3963             return ETrue;
       
  3964             }
       
  3965 
       
  3966         }
  3914         }
  3967     
  3915     
  3968     TBool menuBar( node == engine->MenuBarNode() );
  3916     TBool menuBar( node == engine->MenuBarNode() );
  3969 
  3917 
  3970     if ( menuBar )
  3918     if ( menuBar )
  4029             CancelFocusRefusalL( *engine );
  3977             CancelFocusRefusalL( *engine );
  4030             }
  3978             }
  4031                         
  3979                         
  4032         if ( !menuBar && !engine->FocusedNode() )
  3980         if ( !menuBar && !engine->FocusedNode() )
  4033             {
  3981             {
       
  3982             // save starting point
       
  3983             iButtonDownStartPoint = event.iPosition;
  4034             // Require focus to be shown
  3984             // Require focus to be shown
  4035             engine->AppUiAdapter().ShowFocus();                
  3985             engine->AppUiAdapter().ShowFocus();                
  4036             
  3986             
  4037 #ifdef RD_TACTILE_FEEDBACK            
  3987 #ifdef RD_TACTILE_FEEDBACK            
  4038             MTouchFeedback* feedback( MTouchFeedback::Instance() );
  3988             MTouchFeedback* feedback( MTouchFeedback::Instance() );
  4043                 }
  3993                 }
  4044 #endif                           
  3994 #endif                           
  4045             node->SetStateL( 
  3995             node->SetStateL( 
  4046                 XnPropertyNames::style::common::KFocus, 
  3996                 XnPropertyNames::style::common::KFocus, 
  4047                 XnEventSource::EStylus );
  3997                 XnEventSource::EStylus );
  4048             node->SetStateL( 
       
  4049                 XnPropertyNames::style::common::KPressedDown );
       
  4050             }        
  3998             }        
  4051         }
  3999         }
  4052     else if ( event.iType == TPointerEvent::EDrag )
  4000     else if ( event.iType == TPointerEvent::EDrag )
  4053         {        
  4001         {        
  4054         if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
  4002         if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
  4055             {
  4003             {
  4056             if ( !node->MarginRect().Contains( event.iPosition ) )
  4004             if ( IsDragThresholdExceeded( event.iPosition ) ||
  4057                 {
  4005                  !node->MarginRect().Contains( event.iPosition ) )
  4058                 // Remove pressed down
  4006                 {
       
  4007                 // Remove focus
  4059                 node->UnsetStateL(
  4008                 node->UnsetStateL(
  4060                     XnPropertyNames::style::common::KPressedDown );
  4009                     XnPropertyNames::style::common::KFocus );
  4061                 }
       
  4062             if ( node->MarginRect().Contains( event.iPosition ) )
       
  4063                 {
       
  4064                 // Add pressed down
       
  4065                 node->SetStateL(
       
  4066                     XnPropertyNames::style::common::KPressedDown );
       
  4067                 }
  4010                 }
  4068             }
  4011             }
  4069         }
  4012         }
  4070     else if ( event.iType == TPointerEvent::EButton1Up )
  4013     else if ( event.iType == TPointerEvent::EButton1Up )
  4071         {
  4014         {
  4074             if ( menuBar ) 
  4017             if ( menuBar ) 
  4075                 {
  4018                 {
  4076                 node->SetStateL( XnPropertyNames::style::common::KActive );
  4019                 node->SetStateL( XnPropertyNames::style::common::KActive );
  4077                 }          
  4020                 }          
  4078             else if ( ( node->MarginRect().Contains( event.iPosition ) &&
  4021             else if ( ( node->MarginRect().Contains( event.iPosition ) &&
  4079                node->IsStateSet( XnPropertyNames::style::common::KFocus ) &&
  4022                node->IsStateSet( XnPropertyNames::style::common::KFocus ) ) )
  4080                node->IsStateSet( XnPropertyNames::style::common::KPressedDown ) ) )
       
  4081                 {
  4023                 {
  4082 #ifdef RD_TACTILE_FEEDBACK            
  4024 #ifdef RD_TACTILE_FEEDBACK            
  4083                 MTouchFeedback* feedback( MTouchFeedback::Instance() );
  4025                 MTouchFeedback* feedback( MTouchFeedback::Instance() );
  4084                 
  4026                 
  4085                 if ( feedback )
  4027                 if ( feedback )
  5523 
  5465 
  5524     iAdapter = &aAdapter;
  5466     iAdapter = &aAdapter;
  5525 
  5467 
  5526     if ( CreateGestureHelperL( aNode.Node() ) )
  5468     if ( CreateGestureHelperL( aNode.Node() ) )
  5527         {
  5469         {
  5528         iGestureHelper = CXnGestureHelper::NewL( aNode.Node() );
  5470         iGestureFw = CAknTouchGestureFw::NewL( *this, aAdapter );
       
  5471         iGestureFw->SetGestureInterestL( EAknTouchGestureFwGroupFlick );
  5529         }
  5472         }
  5530     }
  5473     }
  5531 
  5474 
  5532 // -----------------------------------------------------------------------------
  5475 // -----------------------------------------------------------------------------
  5533 // CXnControlAdapterImpl::LoadBitmap
  5476 // CXnControlAdapterImpl::LoadBitmap
  5863     CleanupStack::Pop( newBitmap );
  5806     CleanupStack::Pop( newBitmap );
  5864     return newBitmap;
  5807     return newBitmap;
  5865     }
  5808     }
  5866 
  5809 
  5867 // -----------------------------------------------------------------------------
  5810 // -----------------------------------------------------------------------------
  5868 // PassEventToGestureHelperL
  5811 // InitializeGestureL
  5869 // Forwards event to gesturehelper
  5812 // Sets up gesture
  5870 // -----------------------------------------------------------------------------
  5813 // -----------------------------------------------------------------------------
  5871 //
  5814 //
  5872 TBool CXnControlAdapterImpl::PassEventToGestureHelperL(
  5815 void CXnControlAdapterImpl::InitializeGestureL(
  5873     const TPointerEvent& aPointerEvent )
  5816     const TPointerEvent& aPointerEvent )
  5874     {
  5817     {
  5875     TBool ret( EFalse );
  5818     if ( !iGestureFw || aPointerEvent.iType != TPointerEvent::EButton1Down )
       
  5819         {
       
  5820         return;
       
  5821         }
  5876     
  5822     
  5877     CXnNode* node( &iNode.Node() );
  5823     CXnUiEngine* engine( iNode.Node().UiEngine() );                               
  5878     CXnUiEngine* engine( node->UiEngine() );
  5824     // Set default destination                     
  5879 
  5825     iGestureDestination = &iNode.Node();
  5880     if ( iGestureHelper && iGestureHelper->Owner() == node )
  5826     
  5881         {
  5827     RPointerArray< CXnPluginData >& plugins( 
  5882         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  5828         engine->ViewManager()->ActiveViewData().PluginData() );
  5883             {                               
  5829     
  5884             // Set default destination                     
  5830     for ( TInt i = 0; i < plugins.Count(); i++ )
  5885             iGestureHelper->SetDestination( iGestureHelper->Owner() );
  5831         {
       
  5832         CXnPluginData* plugin( plugins[i] );
       
  5833                                    
       
  5834         if ( plugin->Occupied() )
       
  5835             {
       
  5836             CXnNode* widget( plugin->Node()->LayoutNode() );
  5886             
  5837             
  5887             RPointerArray< CXnPluginData >& plugins( 
  5838             if ( widget->MarginRect().Contains( aPointerEvent.iPosition ) )
  5888                 engine->ViewManager()->ActiveViewData().PluginData() );
  5839                 {
  5889             
  5840                 // Resolve swipe destination
  5890             for ( TInt i = 0; i < plugins.Count(); i++ )
  5841                 CXnProperty* prop( widget->GetPropertyL( 
  5891                 {
  5842                     XnPropertyNames::common::KSwipeDestination ) );
  5892                 CXnPluginData* plugin( plugins[i] );
  5843                 
  5893                                            
  5844                 if ( prop )
  5894                 if ( plugin->Occupied() )
       
  5895                     {
  5845                     {
  5896                     CXnNode* widget( plugin->Node()->LayoutNode() );
  5846                     const TDesC8& value( prop->StringValue() );
  5897                     
  5847                         
  5898                     if ( widget->MarginRect().Contains( aPointerEvent.iPosition ) )
  5848                     if( value == XnPropertyNames::KWidget )
  5899                         {
  5849                         {
  5900                         // Resolve swipe destination
  5850                         // Set widget as destination    
  5901                         CXnProperty* prop( widget->GetPropertyL( 
  5851                         iGestureDestination = widget;
  5902                             XnPropertyNames::common::KSwipeDestination ) );
  5852                         }
  5903                         
  5853                     else if( value == XnPropertyNames::KNone )
  5904                         if ( prop )
  5854                         {
  5905                             {
  5855                         // Set no destination    
  5906                             const TDesC8& value( prop->StringValue() );
  5856                         iGestureDestination = NULL;
  5907                                 
       
  5908                             if( value == XnPropertyNames::KWidget )
       
  5909                                 {
       
  5910                                 // Set widget as destination    
       
  5911                                 iGestureHelper->SetDestination( widget );
       
  5912                                 }
       
  5913                             else if( value == XnPropertyNames::KNone )
       
  5914                                 {
       
  5915                                 // Set no destination    
       
  5916                                 iGestureHelper->SetDestination( NULL );
       
  5917                                 }
       
  5918                             }
       
  5919                         
       
  5920                         break;
       
  5921                         }
  5857                         }
  5922                     }
  5858                     }
       
  5859                 break;
  5923                 }
  5860                 }
  5924             }
  5861             }
  5925 
  5862         }
  5926         TXnGestureCode result( iGestureHelper->HandlePointerEventL( aPointerEvent ) );
  5863     }
       
  5864 
       
  5865 // -----------------------------------------------------------------------------
       
  5866 // -----------------------------------------------------------------------------
       
  5867 //
       
  5868 void CXnControlAdapterImpl::RemoveChildAdapters()
       
  5869     {
       
  5870     iChildren.Reset();
       
  5871     }
       
  5872 
       
  5873 // -----------------------------------------------------------------------------
       
  5874 // -----------------------------------------------------------------------------
       
  5875 //
       
  5876 RPointerArray< CXnControlAdapter >& CXnControlAdapterImpl::ChildAdapters()
       
  5877     {
       
  5878     return iChildren;
       
  5879     }
       
  5880 
       
  5881 // -----------------------------------------------------------------------------
       
  5882 // -----------------------------------------------------------------------------
       
  5883 //
       
  5884 RFs& CXnControlAdapterImpl::FsSession()
       
  5885     {
       
  5886     return iAdapter->ControlEnv()->FsSession();
       
  5887     }
       
  5888 
       
  5889 // -----------------------------------------------------------------------------
       
  5890 // -----------------------------------------------------------------------------
       
  5891 //
       
  5892 void CXnControlAdapterImpl::HandleTouchGestureL( MAknTouchGestureFwEvent& aEvent )
       
  5893     {
       
  5894     if ( aEvent.Group() == EAknTouchGestureFwGroupFlick )
       
  5895         {
       
  5896         TAknTouchGestureFwType type = aEvent.Type();
  5927         
  5897         
  5928         const TDesC8* swipe( NULL );
  5898         const TDesC8* swipe( NULL );
  5929     
  5899     
  5930         if ( result == EGestureSwipeLeft )
  5900         if ( type == EAknTouchGestureFwFlickLeft )
  5931             {
  5901             {
  5932             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KLeft;
  5902             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KLeft;
  5933             }
  5903             }
  5934         else if ( result == EGestureSwipeRight )
  5904         else if ( type == EAknTouchGestureFwFlickRight )
  5935             {
  5905             {
  5936             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KRight;
  5906             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KRight;
  5937             }
  5907             }
  5938 
  5908 
  5939         if ( swipe )
  5909         if ( swipe && iGestureDestination )
  5940             {
  5910             {
  5941             CXnNode* destination( iGestureHelper->Destination() );
  5911             CXnUiEngine* engine = iNode.Node().UiEngine();
       
  5912             if ( iGestureDestination == &iNode.Node() )
       
  5913                 {
       
  5914                 CancelFocusRefusalL( *engine );
       
  5915                 }
  5942             
  5916             
  5943             if ( destination )
  5917             // Remove focus
  5944                 {
  5918             engine->AppUiAdapter().HideFocus();
  5945                 if ( destination == iGestureHelper->Owner() )
  5919 
  5946                     {
  5920             CXnNode* trigger( BuildSwipeTriggerNodeLC( *engine, *swipe ) );
  5947                     CancelFocusRefusalL( *engine );
  5921             iGestureDestination->ReportXuikonEventL( *trigger );
  5948                     }
  5922             CleanupStack::PopAndDestroy( trigger );
  5949                 
  5923             
  5950                 // Remove focus
  5924             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  5951                 engine->AppUiAdapter().HideFocus();
  5925             CXnViewData& data( appui.ViewManager().ActiveViewData() );
  5952 
  5926             
  5953                 CXnNode* trigger( BuildSwipeTriggerNodeLC( *engine, *swipe ) );
  5927             CXnViewControlAdapter* control = 
  5954                 destination->ReportXuikonEventL( *trigger );
  5928                 static_cast< CXnViewControlAdapter* >( data.ViewNode()->Control() );
  5955                 CleanupStack::PopAndDestroy( trigger );
  5929             
  5956                        
  5930             control->ResetGrabbing();
  5957                 // If needed we can call here for example HandleSwipeL()
  5931             }
  5958                 
  5932         }
  5959                 // Consume this event
       
  5960                 ret = ETrue;
       
  5961                 }
       
  5962             }
       
  5963         }
       
  5964 
       
  5965     return ret;
       
  5966     }
       
  5967 
       
  5968 // -----------------------------------------------------------------------------
       
  5969 // -----------------------------------------------------------------------------
       
  5970 //
       
  5971 void CXnControlAdapterImpl::RemoveChildAdapters()
       
  5972     {
       
  5973     iChildren.Reset();
       
  5974     }
       
  5975 
       
  5976 // -----------------------------------------------------------------------------
       
  5977 // -----------------------------------------------------------------------------
       
  5978 //
       
  5979 RPointerArray< CXnControlAdapter >& CXnControlAdapterImpl::ChildAdapters()
       
  5980     {
       
  5981     return iChildren;
       
  5982     }
       
  5983 
       
  5984 // -----------------------------------------------------------------------------
       
  5985 // -----------------------------------------------------------------------------
       
  5986 //
       
  5987 RFs& CXnControlAdapterImpl::FsSession()
       
  5988     {
       
  5989     return iAdapter->ControlEnv()->FsSession();
       
  5990     }
  5933     }
  5991 
  5934 
  5992 
  5935 
  5993 // ============================= TIconProvider ===============================
  5936 // ============================= TIconProvider ===============================
  5994 
  5937