idlehomescreen/xmluirendering/uiengine/src/xncontroladapterimpl.cpp
branchRCL_3
changeset 11 ff572dfe6d86
parent 9 f966699dea19
child 12 9674c1a575e9
equal deleted inserted replaced
9:f966699dea19 11:ff572dfe6d86
    73 
    73 
    74 const TInt KLongTapStartShortDelay( 150000 ); // 0.15s for Sk
    74 const TInt KLongTapStartShortDelay( 150000 ); // 0.15s for Sk
    75 const TInt KLongTapStartLongDelay( 500000 ); // 0.5s
    75 const TInt KLongTapStartLongDelay( 500000 ); // 0.5s
    76 const TInt KLongTapTimeShortDelay( 600000 ); // 0.6s for SK
    76 const TInt KLongTapTimeShortDelay( 600000 ); // 0.6s for SK
    77 const TInt KLongTapTimeLongDelay( 1500000 ); // 1.5s 
    77 const TInt KLongTapTimeLongDelay( 1500000 ); // 1.5s 
    78 _LIT( KWidgetBg, "SKIN(268458534 9916)" );
       
    79 
    78 
    80 // LOCAL FUNCTION PROTOTYPES
    79 // LOCAL FUNCTION PROTOTYPES
    81 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness );
    80 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness );
    82 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation,
    81 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation,
    83     TUint& aLightness );
    82     TUint& aLightness );
  4035             {
  4034             {
  4036             if ( !node->MarginRect().Contains( event.iPosition ) )
  4035             if ( !node->MarginRect().Contains( event.iPosition ) )
  4037                 {
  4036                 {
  4038                 // Remove pressed down
  4037                 // Remove pressed down
  4039                 node->UnsetStateL( XnPropertyNames::style::common::KPressedDown );
  4038                 node->UnsetStateL( XnPropertyNames::style::common::KPressedDown );
  4040                 node->HideTooltipsL();            
       
  4041                 }            
  4039                 }            
  4042             }
  4040             }
  4043         }
  4041         }
  4044     else if ( event.iType == TPointerEvent::EButton1Up )
  4042     else if ( event.iType == TPointerEvent::EButton1Up )
  4045         {
  4043         {
  4056 #ifdef RD_TACTILE_FEEDBACK            
  4054 #ifdef RD_TACTILE_FEEDBACK            
  4057                 MTouchFeedback* feedback( MTouchFeedback::Instance() );
  4055                 MTouchFeedback* feedback( MTouchFeedback::Instance() );
  4058                 
  4056                 
  4059                 if ( feedback )
  4057                 if ( feedback )
  4060                     {
  4058                     {
  4061                     feedback->InstantFeedback( ETouchFeedbackBasic );
  4059                     feedback->InstantFeedback( iAdapter, ETouchFeedbackBasic, 
       
  4060                 		                       ETouchFeedbackVibra,
       
  4061                 		                       aPointerEvent );
  4062                     }
  4062                     }
  4063 #endif
  4063 #endif
  4064                 node->SetStateL( XnPropertyNames::style::common::KActive );
  4064                 node->SetStateL( XnPropertyNames::style::common::KActive );
  4065                 }                      
  4065                 }                      
  4066             }
  4066             }
  4088     if ( iAdapter->IsFocused() )
  4088     if ( iAdapter->IsFocused() )
  4089         {
  4089         {
  4090         DrawFocusAppearance( node, aGc );
  4090         DrawFocusAppearance( node, aGc );
  4091         }
  4091         }
  4092     
  4092     
       
  4093     // Draw plus sign for empty plugins in edit mode.
       
  4094     if( node.UiEngine()->EditMode()->EditState() )
       
  4095         {
       
  4096         const_cast< CXnControlAdapterImpl* >( this )->DrawPlusSign( node, aGc );
       
  4097         }
       
  4098     
  4093     if ( iAnimation )
  4099     if ( iAnimation )
  4094         {
  4100         {
  4095         TRect rect = iComponent->Node()->Rect();
  4101         TRect rect = iComponent->Node()->Rect();
  4096         iAnimation->Render( aGc, rect );
  4102         iAnimation->Render( aGc, rect );
  4097         }
  4103         }
  4115 void CXnControlAdapterImpl::DrawBackgroundDataL(
  4121 void CXnControlAdapterImpl::DrawBackgroundDataL(
  4116     const TRect& aRect,
  4122     const TRect& aRect,
  4117     CXnNode& aNode,
  4123     CXnNode& aNode,
  4118     CWindowGc& aGc )
  4124     CWindowGc& aGc )
  4119     {
  4125     {
  4120     // For widgets and plugins, drawing is handled differently in edit mode
       
  4121     const TDesC8& widgetType = aNode.DomNode()->Name();
       
  4122     if( aNode.UiEngine()->EditMode()->EditState() )
  4126     if( aNode.UiEngine()->EditMode()->EditState() )
  4123         {
  4127         {
  4124         DrawEditModeBgData( aNode, aGc );
  4128         DrawEditModeBgData( aNode, aGc );
  4125         return;
  4129         return;
  4126         }
  4130         }
  4174     const TDesC8& widgetType = aNode.DomNode()->Name();
  4178     const TDesC8& widgetType = aNode.DomNode()->Name();
  4175     if( widgetType == XnPropertyNames::KPlugin )
  4179     if( widgetType == XnPropertyNames::KPlugin )
  4176         {
  4180         {
  4177         TRect rect = aNode.PaddingRect();
  4181         TRect rect = aNode.PaddingRect();
  4178         DrawBackgroundSkin( KAknsIIDQgnHomeEditBgWidget, aGc, rect );
  4182         DrawBackgroundSkin( KAknsIIDQgnHomeEditBgWidget, aGc, rect );
  4179 
  4183         }    
  4180         CXnPluginData& data( aNode.UiEngine()->ViewManager()->ActiveViewData().Plugin( &aNode ) );
  4184     }
  4181         if( !data.Occupied() ) // Empty widget
  4185 
       
  4186 // -----------------------------------------------------------------------------
       
  4187 // CXnControlAdapterImpl::DrawPlusSign
       
  4188 // 
       
  4189 // -----------------------------------------------------------------------------
       
  4190 //
       
  4191 void CXnControlAdapterImpl::DrawPlusSign( CXnNode& aNode, CWindowGc& aGc )
       
  4192     {
       
  4193     const TDesC8& widgetType = aNode.DomNode()->Name();
       
  4194     if( widgetType == XnPropertyNames::KPlugin )
       
  4195         {
       
  4196         CXnPluginData* data( aNode.UiEngine()->ViewManager()->ActiveViewData().Plugin( &aNode ) );
       
  4197         if( data && !data->Occupied() ) // Empty widget
  4182             {
  4198             {
  4183             // Draw + -icon
  4199             // Draw + -icon
  4184             // Make rect as 50% of the widget's height.
  4200             // Make rect as 50% of the widget's height.
  4185             // It needs to be square in order to keep aspect ratio.
  4201             // It needs to be square in order to keep aspect ratio.
       
  4202             TRect rect = aNode.PaddingRect();
  4186             TInt w = rect.Width();
  4203             TInt w = rect.Width();
  4187             TInt h = rect.Height();
  4204             TInt h = rect.Height();
  4188             rect.Shrink( ( w - h * 0.5 ) * 0.5, h * 0.25 );            
  4205             rect.Shrink( ( w - h * 0.5 ) * 0.5, h * 0.25 );            
  4189             DrawBackgroundSkin( KAknsIIDQgnHomeAdd, aGc, rect );
  4206             DrawBackgroundSkin( KAknsIIDQgnHomeAdd, aGc, rect );
  4190             }
  4207             }
  4285     if( aRect == TRect::EUninitialized )
  4302     if( aRect == TRect::EUninitialized )
  4286         {
  4303         {
  4287         aRect = aNode.PaddingRect();
  4304         aRect = aNode.PaddingRect();
  4288         }
  4305         }
  4289     
  4306     
  4290     //CXnProperty* colorProperty( aNode.BackgroundColorL() );
       
  4291     CXnProperty* colorProperty( aBgColor );
  4307     CXnProperty* colorProperty( aBgColor );
  4292     if ( colorProperty )
  4308     if ( colorProperty )
  4293         {
  4309         {
  4294         HBufC* skinID = colorProperty->StringValueL();
  4310         HBufC* skinID = colorProperty->StringValueL();
  4295         CleanupStack::PushL( skinID );
  4311         CleanupStack::PushL( skinID );
  4296 
       
  4297         // Widget background should not be drawn in edit mode
       
  4298         if( aNode.UiEngine()->EditMode()->EditState() && 
       
  4299                 skinID->Des() == KWidgetBg )
       
  4300             {
       
  4301             CleanupStack::PopAndDestroy( skinID );
       
  4302             return;
       
  4303             }
       
  4304 
  4312 
  4305         if ( skinID->Length() != 0 )
  4313         if ( skinID->Length() != 0 )
  4306             {
  4314             {
  4307             TAknsItemID itemID;
  4315             TAknsItemID itemID;
  4308             StripQuotes( skinID );
  4316             StripQuotes( skinID );