idlehomescreen/xmluirendering/uiengine/src/xncontroladapterimpl.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 17 b8fae6b8a148
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    19 // System includes
    19 // System includes
    20 #include <utf.h>
    20 #include <utf.h>
    21 #include <SVGEngineInterfaceImpl.h>
    21 #include <SVGEngineInterfaceImpl.h>
    22 #include <s32file.h>
    22 #include <s32file.h>
    23 #include <mifconvdefs.h>
    23 #include <mifconvdefs.h>
    24 //skinning support
       
    25 #include <AknsFrameBackgroundControlContext.h>
    24 #include <AknsFrameBackgroundControlContext.h>
    26 #include <AknsDrawUtils.h>
    25 #include <AknsDrawUtils.h>
    27 #include <aknconsts.h>
    26 #include <aknconsts.h>
    28 #include <AknUtils.h>
    27 #include <AknUtils.h>
    29 #include <AknsListBoxBackgroundControlContext.h>
    28 #include <AknsListBoxBackgroundControlContext.h>
    37 #include "xnviewadapter.h"
    36 #include "xnviewadapter.h"
    38 #include "xnviewmanager.h"
    37 #include "xnviewmanager.h"
    39 #include "xncontroladapterimpl.h"
    38 #include "xncontroladapterimpl.h"
    40 #include "xncontroladapter.h"
    39 #include "xncontroladapter.h"
    41 #include "xnmenuadapter.h"
    40 #include "xnmenuadapter.h"
       
    41 #include "xnviewcontroladapter.h"
    42 #include "xncomponentnodeimpl.h"
    42 #include "xncomponentnodeimpl.h"
    43 #include "xntype.h"
    43 #include "xntype.h"
    44 #include "xnnodepluginif.h"
    44 #include "xnnodepluginif.h"
    45 #include "xnuiengine.h"
    45 #include "xnuiengine.h"
    46 #include "xnviewnodeimpl.h"
    46 #include "xnviewnodeimpl.h"
    58 #include "xnpanic.h"
    58 #include "xnpanic.h"
    59 #include "xnviewdata.h"
    59 #include "xnviewdata.h"
    60 #include "xnscrollablecontroladapter.h"
    60 #include "xnscrollablecontroladapter.h"
    61 #include "xnfocuscontrol.h"
    61 #include "xnfocuscontrol.h"
    62 #include "xneditmode.h"
    62 #include "xneditmode.h"
    63 #include "xnbgcontrol.h"
       
    64 
    63 
    65 _LIT8(KScrollableBoxNodeName, "scrollablebox");
    64 _LIT8(KScrollableBoxNodeName, "scrollablebox");
    66         
    65         
    67 using namespace XnGestureHelper;
    66 using namespace XnGestureHelper;
    68 #include "xngesture.h"
    67 #include "xngesture.h"
  3519         {
  3518         {
  3520         CXnControlAdapter* control( focused->Control() );
  3519         CXnControlAdapter* control( focused->Control() );
  3521         
  3520         
  3522         if ( control && control->RefusesFocusLoss() )
  3521         if ( control && control->RefusesFocusLoss() )
  3523             {
  3522             {
       
  3523             focused->HideTooltipsL();
       
  3524             
  3524             // It is now time to give up holding focus
  3525             // It is now time to give up holding focus
  3525             focused->UnsetStateL( 
  3526             focused->UnsetStateL( 
  3526                 XnPropertyNames::style::common::KFocus );
  3527                 XnPropertyNames::style::common::KFocus );
  3527             }
  3528             }
  3528         }    
  3529         }    
  3895             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  3896             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  3896 
  3897 
  3897             CancelFocusRefusalL( *engine );
  3898             CancelFocusRefusalL( *engine );
  3898             
  3899             
  3899             appui.HideFocus();
  3900             appui.HideFocus();
  3900                                    
  3901 
  3901             CCoeControl& bg( appui.ViewAdapter().BgControl() );
  3902             if ( !menuBar )
       
  3903                 {
       
  3904                 CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(
       
  3905                     appui.ViewManager().ActiveViewData().ViewNode()->Control() );
       
  3906                 
       
  3907                 control->IgnoreEventsUntilNextPointerUp();
       
  3908                 control->ResetGrabbing();                      
       
  3909                 }
  3902             
  3910             
  3903             // Ignore events
  3911             // Indicate long tap has taken plave
  3904             bg.IgnoreEventsUntilNextPointerUp();
       
  3905             static_cast<CXnBgControl*>(&bg)->ResetGrabbingL();
       
  3906 
       
  3907           // Indicate long tap has taken plave
       
  3908             iLongtap = ETrue;
  3912             iLongtap = ETrue;
  3909             
  3913             
  3910             CXnNode* hold = BuildTriggerNodeL( *engine,
  3914             CXnNode* hold = BuildTriggerNodeL( *engine,
  3911                 XnPropertyNames::action::trigger::name::KHold );
  3915                 XnPropertyNames::action::trigger::name::KHold );
  3912 
  3916 
  3936         {
  3940         {
  3937         // Forward event to gesture helper
  3941         // Forward event to gesture helper
  3938         if( PassEventToGestureHelperL( aPointerEvent ) )
  3942         if( PassEventToGestureHelperL( aPointerEvent ) )
  3939             { 
  3943             { 
  3940             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  3944             CXnAppUiAdapter& appui( engine->AppUiAdapter() );
  3941             CCoeControl& bg( appui.ViewAdapter().BgControl() );
  3945             CXnViewData& data( appui.ViewManager().ActiveViewData() );
  3942             static_cast<CXnBgControl*>(&bg)->ResetGrabbingL();
       
  3943             
  3946             
       
  3947             CXnViewControlAdapter* control = 
       
  3948                 static_cast< CXnViewControlAdapter* >( data.ViewNode()->Control() );
       
  3949             
       
  3950             control->ResetGrabbing();
       
  3951 
  3944             // Swipe took place, consume this event
  3952             // Swipe took place, consume this event
  3945             return ETrue;
  3953             return ETrue;
  3946             }
  3954             }
  3947         }
  3955         }
  3948     
  3956     
  3960             }
  3968             }
  3961         }
  3969         }
  3962     
  3970     
  3963     CAknLongTapDetector* detector( iAdapter->LongTapDetector() );
  3971     CAknLongTapDetector* detector( iAdapter->LongTapDetector() );
  3964     
  3972     
  3965     if ( detector && !engine->IsPartialInputActive())
  3973     if ( ( detector && ( !engine->IsPartialInputActive() || 
       
  3974         event.iType == TPointerEvent::EButton1Up ) ) ) 
  3966         {
  3975         {
  3967         if ( menuBar )
  3976         if ( menuBar )
  3968             {
  3977             {
  3969             // CXnMenuAdapter owns the longtap detector, but only
  3978             // CXnMenuAdapter owns the longtap detector, but only
  3970             // softkey nodes can have longtap functionality, so
  3979             // softkey nodes can have longtap functionality, so
  4023 #endif                           
  4032 #endif                           
  4024             node->SetStateL( 
  4033             node->SetStateL( 
  4025                 XnPropertyNames::style::common::KFocus, 
  4034                 XnPropertyNames::style::common::KFocus, 
  4026                 XnEventSource::EStylus );
  4035                 XnEventSource::EStylus );
  4027             node->SetStateL( 
  4036             node->SetStateL( 
  4028                 XnPropertyNames::style::common::KPressedDown );                            
  4037                 XnPropertyNames::style::common::KPressedDown );
  4029             }        
  4038             }        
  4030         }
  4039         }
  4031     else if ( event.iType == TPointerEvent::EDrag )
  4040     else if ( event.iType == TPointerEvent::EDrag )
  4032         {        
  4041         {        
  4033         if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
  4042         if ( node->IsStateSet( XnPropertyNames::style::common::KFocus ) )
  4034             {
  4043             {
  4035             if ( !node->MarginRect().Contains( event.iPosition ) )
  4044             if ( !node->MarginRect().Contains( event.iPosition ) )
  4036                 {
  4045                 {
  4037                 // Remove pressed down
  4046                 // Remove pressed down
  4038                 node->UnsetStateL( XnPropertyNames::style::common::KPressedDown );
  4047                 node->UnsetStateL(
  4039                 }            
  4048                     XnPropertyNames::style::common::KPressedDown );
       
  4049                 }
       
  4050             if ( node->MarginRect().Contains( event.iPosition ) )
       
  4051                 {
       
  4052                 // Add pressed down
       
  4053                 node->SetStateL(
       
  4054                     XnPropertyNames::style::common::KPressedDown );
       
  4055                 }
  4040             }
  4056             }
  4041         }
  4057         }
  4042     else if ( event.iType == TPointerEvent::EButton1Up )
  4058     else if ( event.iType == TPointerEvent::EButton1Up )
  4043         {
  4059         {
  4044         if ( !iLongtap )
  4060         if ( !iLongtap )
  5893                         }
  5909                         }
  5894                     }
  5910                     }
  5895                 }
  5911                 }
  5896             }
  5912             }
  5897 
  5913 
  5898         TSwipeResult result( iGestureHelper->HandlePointerEventL( aPointerEvent ) );
  5914         TXnGestureCode result( iGestureHelper->HandlePointerEventL( aPointerEvent ) );
  5899         
  5915         
  5900         const TDesC8* swipe( NULL );
  5916         const TDesC8* swipe( NULL );
  5901     
  5917     
  5902         if ( result == ESwipeLeft )
  5918         if ( result == EGestureSwipeLeft )
  5903             {
  5919             {
  5904             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KLeft;
  5920             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KLeft;
  5905             }
  5921             }
  5906         else if ( result == ESwipeRight )
  5922         else if ( result == EGestureSwipeRight )
  5907             {
  5923             {
  5908             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KRight;
  5924             swipe = &XnPropertyNames::action::trigger::name::swipe::direction::KRight;
  5909             }
  5925             }
  5910 
  5926 
  5911         if ( swipe )
  5927         if ( swipe )