69 |
69 |
70 // Constants |
70 // Constants |
71 const TInt KSkinGfxInnerRectShrink = 5; |
71 const TInt KSkinGfxInnerRectShrink = 5; |
72 const TInt KFocusGrowValue = 3; |
72 const TInt KFocusGrowValue = 3; |
73 |
73 |
|
74 const TInt KLongTapStartShortDelay( 150000 ); // 0.15s for Sk |
|
75 const TInt KLongTapStartLongDelay( 500000 ); // 0.5s |
|
76 const TInt KLongTapTimeShortDelay( 600000 ); // 0.6s for SK |
|
77 const TInt KLongTapTimeLongDelay( 1500000 ); // 1.5s |
|
78 _LIT( KWidgetBg, "SKIN(268458534 9916)" ); |
74 |
79 |
75 // LOCAL FUNCTION PROTOTYPES |
80 // LOCAL FUNCTION PROTOTYPES |
76 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness ); |
81 static TRgb ConvertHslToRgb( TInt aHue, TInt aSaturation, TInt aLightness ); |
77 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation, |
82 static void ConvertRgbToHsl( TRgb aRGB, TUint& aHue, TUint& aSaturation, |
78 TUint& aLightness ); |
83 TUint& aLightness ); |
356 // |
361 // |
357 static void LoadSVGBitmapL( |
362 static void LoadSVGBitmapL( |
358 CXnResource& aResource, |
363 CXnResource& aResource, |
359 CFbsBitmap*& aBitmap, |
364 CFbsBitmap*& aBitmap, |
360 CFbsBitmap*& aBitmapMask, |
365 CFbsBitmap*& aBitmapMask, |
361 TRect /*aRect*/, |
366 TRect aRect, |
362 RFs& aFsSession ) |
367 RFs& aFsSession ) |
363 { |
368 { |
364 RFile file; |
369 RFile file; |
365 |
370 |
366 TInt ret = AccessResourceFileL( aResource, file, aFsSession ); |
371 TInt ret = AccessResourceFileL( aResource, file, aFsSession ); |
369 CleanupClosePushL( file ); |
374 CleanupClosePushL( file ); |
370 |
375 |
371 CFbsBitmap* frameBuffer = new ( ELeave ) CFbsBitmap; |
376 CFbsBitmap* frameBuffer = new ( ELeave ) CFbsBitmap; |
372 CleanupStack::PushL( frameBuffer ); |
377 CleanupStack::PushL( frameBuffer ); |
373 |
378 |
374 frameBuffer->Create( TSize( 0, 0 ), EColor16M ); |
379 TSize contentSize( aRect.Size() ); |
|
380 |
|
381 frameBuffer->Create( contentSize, EColor16M ); |
375 |
382 |
376 TFontSpec fontSpec; |
383 TFontSpec fontSpec; |
377 CSvgEngineInterfaceImpl* svgEngine = |
384 CSvgEngineInterfaceImpl* svgEngine = |
378 CSvgEngineInterfaceImpl::NewL( frameBuffer, NULL, fontSpec ); |
385 CSvgEngineInterfaceImpl::NewL( frameBuffer, NULL, fontSpec ); |
379 |
386 |
380 CleanupStack::PushL( svgEngine ); |
387 CleanupStack::PushL( svgEngine ); |
381 |
388 |
382 svgEngine->Load( file ); |
389 svgEngine->Load( file ); |
383 |
390 |
384 TSize contentSize = svgEngine->ContentDimensions(); |
|
385 |
|
386 TInt domHandle; |
391 TInt domHandle; |
387 svgEngine->PrepareDom( file, domHandle ); |
392 svgEngine->PrepareDom( file, domHandle ); |
388 |
|
389 svgEngine->SetSvgDimensionToFrameBuffer( |
|
390 contentSize.iWidth, contentSize.iHeight ); |
|
391 |
393 |
392 CFbsBitmap* target = new ( ELeave ) CFbsBitmap; |
394 CFbsBitmap* target = new ( ELeave ) CFbsBitmap; |
393 target->Create( contentSize, EColor16M ); |
395 target->Create( contentSize, EColor16M ); |
394 svgEngine->RenderDom( domHandle, target ); |
396 svgEngine->RenderDom( domHandle, target ); |
395 |
397 |
3929 const TPointerEvent& event( aPointerEvent ); |
3931 const TPointerEvent& event( aPointerEvent ); |
3930 |
3932 |
3931 CXnNode* node( &iNode.Node() ); |
3933 CXnNode* node( &iNode.Node() ); |
3932 CXnUiEngine* engine( node->UiEngine() ); |
3934 CXnUiEngine* engine( node->UiEngine() ); |
3933 |
3935 |
|
3936 if(!engine->IsPartialInputActive()) |
|
3937 { |
|
3938 // Forward event to gesture helper |
|
3939 if( PassEventToGestureHelperL( aPointerEvent ) ) |
|
3940 { |
|
3941 CXnAppUiAdapter& appui( engine->AppUiAdapter() ); |
|
3942 CCoeControl& bg( appui.ViewAdapter().BgControl() ); |
|
3943 static_cast<CXnBgControl*>(&bg)->ResetGrabbingL(); |
|
3944 |
|
3945 // Swipe took place, consume this event |
|
3946 return ETrue; |
|
3947 } |
|
3948 } |
3934 |
3949 |
3935 // Forward event to gesture helper |
|
3936 if( PassEventToGestureHelperL( aPointerEvent ) ) |
|
3937 { |
|
3938 CXnAppUiAdapter& appui( engine->AppUiAdapter() ); |
|
3939 CCoeControl& bg( appui.ViewAdapter().BgControl() ); |
|
3940 static_cast<CXnBgControl*>(&bg)->ResetGrabbingL(); |
|
3941 |
|
3942 // Swipe took place, consume this event |
|
3943 return ETrue; |
|
3944 } |
|
3945 |
|
3946 TBool menuBar( node == engine->MenuBarNode() ); |
3950 TBool menuBar( node == engine->MenuBarNode() ); |
3947 |
3951 |
3948 if ( menuBar ) |
3952 if ( menuBar ) |
3949 { |
3953 { |
3950 // Need to update node to match to the real softkey node |
3954 // Need to update node to match to the real softkey node |
3970 CXnProperty* prop( |
3974 CXnProperty* prop( |
3971 node->GetPropertyL( XnPropertyNames::common::KLongTap ) ); |
3975 node->GetPropertyL( XnPropertyNames::common::KLongTap ) ); |
3972 |
3976 |
3973 if ( prop && prop->StringValue() == XnPropertyNames::KTrue ) |
3977 if ( prop && prop->StringValue() == XnPropertyNames::KTrue ) |
3974 { |
3978 { |
|
3979 iAdapter->SetLongTapDelays( KLongTapStartShortDelay, |
|
3980 KLongTapTimeShortDelay ); |
3975 detector->PointerEventL( event ); |
3981 detector->PointerEventL( event ); |
3976 } |
3982 } |
3977 } |
3983 } |
3978 else |
3984 else |
3979 { |
3985 { |
|
3986 iAdapter->SetLongTapDelays( KLongTapStartLongDelay, |
|
3987 KLongTapTimeLongDelay ); |
3980 detector->PointerEventL( event ); |
3988 detector->PointerEventL( event ); |
3981 } |
3989 } |
3982 } |
3990 } |
3983 |
3991 |
3984 CXnProperty* focusable( |
3992 CXnProperty* focusable( |
4109 CXnNode& aNode, |
4117 CXnNode& aNode, |
4110 CWindowGc& aGc ) |
4118 CWindowGc& aGc ) |
4111 { |
4119 { |
4112 // For widgets and plugins, drawing is handled differently in edit mode |
4120 // For widgets and plugins, drawing is handled differently in edit mode |
4113 const TDesC8& widgetType = aNode.DomNode()->Name(); |
4121 const TDesC8& widgetType = aNode.DomNode()->Name(); |
4114 if( ( widgetType == XnPropertyNames::KWidget || |
4122 if( aNode.UiEngine()->EditMode()->EditState() ) |
4115 widgetType == XnPropertyNames::KPlugin ) && |
|
4116 aNode.UiEngine()->EditMode()->EditState() ) |
|
4117 { |
4123 { |
4118 DrawEditModeBgData( aNode, aGc ); |
4124 DrawEditModeBgData( aNode, aGc ); |
4119 return; |
4125 return; |
4120 } |
4126 } |
4121 |
4127 |
4285 CXnProperty* colorProperty( aBgColor ); |
4291 CXnProperty* colorProperty( aBgColor ); |
4286 if ( colorProperty ) |
4292 if ( colorProperty ) |
4287 { |
4293 { |
4288 HBufC* skinID = colorProperty->StringValueL(); |
4294 HBufC* skinID = colorProperty->StringValueL(); |
4289 CleanupStack::PushL( skinID ); |
4295 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 } |
4290 |
4304 |
4291 if ( skinID->Length() != 0 ) |
4305 if ( skinID->Length() != 0 ) |
4292 { |
4306 { |
4293 TAknsItemID itemID; |
4307 TAknsItemID itemID; |
4294 StripQuotes( skinID ); |
4308 StripQuotes( skinID ); |