idlehomescreen/xmluirendering/uiengine/src/xnwidgetextensionadapter.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 23 7be2816dbabd
child 28 d721605b30d0
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    20 #include <coemain.h>
    20 #include <coemain.h>
    21 #include <AknUtils.h>
    21 #include <AknUtils.h>
    22 #include <gfxtranseffect/gfxtranseffect.h>
    22 #include <gfxtranseffect/gfxtranseffect.h>
    23 #include <akntransitionutils.h>
    23 #include <akntransitionutils.h>
    24 #include <AknPriv.hrh>
    24 #include <AknPriv.hrh>
       
    25 #ifdef RD_TACTILE_FEEDBACK
       
    26 #include <touchfeedback.h>
       
    27 #endif // RD_TACTILE_FEEDBACK
    25 
    28 
    26 // User includes
    29 // User includes
    27 #include "xnwidgetextensionadapter.h"
    30 #include "xnwidgetextensionadapter.h"
    28 #include "xncontroladapter.h"
    31 #include "xncontroladapter.h"
    29 #include "xncomponentnodeimpl.h"
    32 #include "xncomponentnodeimpl.h"
   145             XnPropertyNames::popup::popuptype::KPermanent )
   148             XnPropertyNames::popup::popuptype::KPermanent )
   146             {
   149             {
   147             iPermanent = ETrue;
   150             iPermanent = ETrue;
   148             }        
   151             }        
   149         }
   152         }
   150     else
   153      
   151         {
   154     if ( Window().SetTransparencyAlphaChannel() == KErrNone )
   152         if ( Window().SetTransparencyAlphaChannel() == KErrNone )
   155         {
   153             {
   156         Window().SetBackgroundColor( ~0 );
   154             Window().SetBackgroundColor( ~0 );
   157         }                     
   155             }                     
   158        
   156         }
       
   157     
       
   158     iUiEngine = iNode.Node().UiEngine();
   159     iUiEngine = iNode.Node().UiEngine();
   159     CXnControlAdapter::ConstructL( iNode );
   160     CXnControlAdapter::ConstructL( iNode );
   160     
   161     
   161     EnableDragEvents();
   162     EnableDragEvents();
   162     
   163     
   251     // it will be closed after tapping outside of the
   252     // it will be closed after tapping outside of the
   252     // area of itself and its parent
   253     // area of itself and its parent
   253     if ( iPopup )
   254     if ( iPopup )
   254         {        
   255         {        
   255         // check if the tap was inside of popup
   256         // check if the tap was inside of popup
   256         TRect popupRect = this->Rect();
   257         TRect popupRect( Rect() );
   257         popupRect.Move(this->Position() );
   258         popupRect.Move( Position() );
   258         TBool isInPopupWindow = popupRect.Contains(
   259         
   259                 aPointerEvent.iParentPosition );
   260         TBool isInPopupWindow( popupRect.Contains(
       
   261                 aPointerEvent.iParentPosition ) );
   260 
   262 
   261         if ( !isInPopupWindow )
   263         if ( !isInPopupWindow )
   262             {            
   264             {            
   263             // if tap was outside of window, check if tap was 
   265             // if tap was outside of window, check if tap was 
   264             // inside of the parrent
   266             // inside of the parrent
   265             CXnProperty* parentIdProp( iNode.Node().GetPropertyL(
   267             CXnProperty* parentIdProp( iNode.Node().GetPropertyL(
   266                     KParentIdName ) );
   268                     KParentIdName ) );
   267             
   269             
   268             if ( parentIdProp )
   270             if ( parentIdProp )
   269                 {                
   271                 {                
   270                 const TDesC8& parentIdVal = parentIdProp->StringValue();
   272                 const TDesC8& id( parentIdProp->StringValue() );
   271                 CXnNode* parentN(iUiEngine->FindNodeByIdL( parentIdVal,
       
   272                         iNode.Node().Namespace() ) );
       
   273                 
   273                 
   274                 if ( parentN )
   274                 CXnNode* parent( 
       
   275                     iUiEngine->FindNodeByIdL( id, iNode.Node().Namespace() ) );
       
   276                         
       
   277                 
       
   278                 if ( parent )
   275                     {
   279                     {
   276                     TRect clientRect =
   280                     TRect clientRect( iAppUiAdapter->ClientRect() );
   277                             static_cast<CEikAppUi&> ( *iAppUiAdapter ).ClientRect();
   281                             
   278                     TRect parentRect = parentN->Rect();
   282                     TRect parentRect( parent->Rect() );
   279                     parentRect.Move( clientRect.iTl );
   283                     parentRect.Move( clientRect.iTl );
   280                     
   284                     
   281                     if ( !parentRect.Contains( aPointerEvent.iParentPosition ) )
   285                     if ( !parentRect.Contains( aPointerEvent.iParentPosition ) )
   282                         {
   286                         {
   283                         // tap was neither in popup nor in its parent -
   287                         // tap was neither in popup nor in its parent -
   284                         // we can close it
   288                         // we can close it
   285                         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   289                         if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
   286                             {
   290                             {
       
   291 #ifdef RD_TACTILE_FEEDBACK                    
       
   292                             MTouchFeedback* fb( MTouchFeedback::Instance() );
       
   293     
       
   294                             if ( fb )
       
   295                                 {
       
   296                                 fb->InstantFeedback( ETouchFeedbackBasic );
       
   297                                 }                        
       
   298 #endif                    
   287                             HidePopupL();
   299                             HidePopupL();
   288                             return;
   300                             return;
   289                             }
   301                             }
   290                         }
   302                         }
   291                     else
   303                     else
   292                         {
   304                         {
   293                         // tap was made inside of popup parent
   305                         // tap was made inside of popup parent
   294                         // we pass the event to it after
   306                         // we pass the event to it after
   295                         // recalculating the taping point
   307                         // recalculating the taping point
   296                         TPointerEvent newPointerEvent;
   308                         TPointerEvent newPointerEvent;
       
   309                         
   297                         newPointerEvent.Copy( aPointerEvent );
   310                         newPointerEvent.Copy( aPointerEvent );
       
   311                         
   298                         newPointerEvent.iPosition = TPoint(
   312                         newPointerEvent.iPosition = TPoint(
   299                                  aPointerEvent.iParentPosition - clientRect.iTl );
   313                              aPointerEvent.iParentPosition - clientRect.iTl );
   300                         parentN->Control()->HandlePointerEventL( newPointerEvent );
   314                         
   301                         return;
   315                         parent->Control()->HandlePointerEventL( newPointerEvent );                        
   302                         }
   316                         }
   303                     }
   317                     }
   304                 }
   318                 }
   305             else
   319             else
   306                 {
   320                 {
   307                 HidePopupL();
   321 #ifdef RD_TACTILE_FEEDBACK
       
   322                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
       
   323                     {
       
   324                     MTouchFeedback* fb( MTouchFeedback::Instance() );
       
   325 
       
   326                     if ( fb )
       
   327                         {
       
   328                         fb->InstantFeedback( ETouchFeedbackBasic );
       
   329                         }                        
       
   330 #endif                                
       
   331                     HidePopupL();                    
       
   332                     }
   308                 }
   333                 }
   309             }
   334             }
   310         }
   335         }
   311     
   336     
   312     CXnControlAdapter::HandlePointerEventL( aPointerEvent );    
   337     CXnControlAdapter::HandlePointerEventL( aPointerEvent );    
   707         if ( !DrawableWindow()->IsFaded() )
   732         if ( !DrawableWindow()->IsFaded() )
   708             {
   733             {
   709             DrawableWindow()->FadeBehind( ETrue );
   734             DrawableWindow()->FadeBehind( ETrue );
   710             }
   735             }
   711         }
   736         }
   712     
       
   713     else if( iPopup && aType == KAknSplitInputDisabled )
       
   714         {
       
   715         TRAP_IGNORE( HidePopupL() );
       
   716         }
       
   717     }
   737     }
   718 
   738 
   719 //  End of File  
   739 //  End of File