63 // Default draw color |
63 // Default draw color |
64 const TInt KAknSliderDefaultDrawColor = 120; |
64 const TInt KAknSliderDefaultDrawColor = 120; |
65 const TInt KScrollRepeatTimeout = 250000; // 0.25 seconds |
65 const TInt KScrollRepeatTimeout = 250000; // 0.25 seconds |
66 const TInt KStableFeedbackIntesity = 100; |
66 const TInt KStableFeedbackIntesity = 100; |
67 const TInt KFeedbackTimeout = 100000; |
67 const TInt KFeedbackTimeout = 100000; |
68 const TInt KNoFeedbackTimeout = 0; |
|
69 const TInt KStepThreshold = 15; |
|
70 // ============================================================================ |
68 // ============================================================================ |
71 // Internal class to hold slider control data, primarily coming from resource. |
69 // Internal class to hold slider control data, primarily coming from resource. |
72 NONSHARABLE_CLASS( CAknSliderData ): public CBase |
70 NONSHARABLE_CLASS( CAknSliderData ): public CBase |
73 { |
71 { |
74 public: |
72 public: |
537 EMbmAvkonQgn_graf_nslider_vertical_tick_major_mask, |
535 EMbmAvkonQgn_graf_nslider_vertical_tick_major_mask, |
538 EMbmAvkonQgn_graf_nslider_marker_mask |
536 EMbmAvkonQgn_graf_nslider_marker_mask |
539 }; |
537 }; |
540 const TAknsItemID iconSkinIDArray[] = |
538 const TAknsItemID iconSkinIDArray[] = |
541 { |
539 { |
542 KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalTop, |
540 KAknsIIDQgnGrafNsliderVerticalTop, //KAknsIIDNone, |
543 KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalBottom, |
541 KAknsIIDQgnGrafNsliderVerticalBottom,//KAknsIIDNone, |
544 KAknsIIDNone,//KAknsIIDQgnGrafNsliderVerticalMiddle, |
542 KAknsIIDQgnGrafNsliderVerticalMiddle,//KAknsIIDNone, |
545 KAknsIIDNone,// KAknsIIDQgnGrafNsliderVerticalMarker, |
543 KAknsIIDQgnGrafNsliderVerticalMarker,//KAknsIIDNone, |
546 KAknsIIDNone,// KAknsIIDQgnGrafNsliderVerticalTIckMajor, |
544 KAknsIIDQgnGrafNsliderVerticalTickMajor,//KAknsIIDNone, |
547 KAknsIIDNone//KAknsIIDQgnGrafNsliderVerticalMarker |
545 KAknsIIDQgnGrafNsliderVerticalMarker//KAknsIIDNone |
548 }; |
546 }; |
549 |
547 |
550 const TInt element[] = |
548 const TInt element[] = |
551 { |
549 { |
552 CAknSlider::EElemEmptyLeftCap, |
550 CAknSlider::EElemEmptyLeftCap, |
1497 EXPORT_C CFbsBitmap* CAknSlider::CreateBitmapL( TInt aValue, TInt aResourceId ) |
1495 EXPORT_C CFbsBitmap* CAknSlider::CreateBitmapL( TInt aValue, TInt aResourceId ) |
1498 { |
1496 { |
1499 TResourceReader reader; |
1497 TResourceReader reader; |
1500 CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); |
1498 CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); |
1501 |
1499 |
1502 reader.ReadInt16(); // ignore layout |
1500 TInt sliderType = reader.ReadInt16(); |
|
1501 if ( sliderType == EAknSliderWithFeedbackStyle ) |
|
1502 { |
|
1503 reader.ReadInt16(); // ignore type |
|
1504 reader.ReadInt16(); // ignore layout |
|
1505 } |
1503 TInt minValue = reader.ReadInt16(); |
1506 TInt minValue = reader.ReadInt16(); |
1504 TInt maxValue = reader.ReadInt16(); |
1507 TInt maxValue = reader.ReadInt16(); |
1505 CleanupStack::PopAndDestroy(); // reader |
1508 CleanupStack::PopAndDestroy(); // reader |
1506 |
1509 |
1507 return CreateBitmapL( aValue, minValue, maxValue ); |
1510 return CreateBitmapL( aValue, minValue, maxValue ); |
1538 TInt aValue, TInt aResourceId ) |
1541 TInt aValue, TInt aResourceId ) |
1539 { |
1542 { |
1540 TResourceReader reader; |
1543 TResourceReader reader; |
1541 CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); |
1544 CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId ); |
1542 |
1545 |
1543 reader.ReadInt16(); // ignore layout |
1546 TInt sliderType = reader.ReadInt16(); |
|
1547 if ( sliderType == EAknSliderWithFeedbackStyle ) |
|
1548 { |
|
1549 reader.ReadInt16(); // ignore type |
|
1550 reader.ReadInt16(); // ignore layout |
|
1551 } |
1544 TInt minValue = reader.ReadInt16(); |
1552 TInt minValue = reader.ReadInt16(); |
1545 TInt maxValue = reader.ReadInt16(); |
1553 TInt maxValue = reader.ReadInt16(); |
1546 CleanupStack::PopAndDestroy(); // reader |
1554 CleanupStack::PopAndDestroy(); // reader |
1547 |
1555 |
1548 return CreateSetStyleListBoxIconL( aValue, minValue, maxValue ); |
1556 return CreateSetStyleListBoxIconL( aValue, minValue, maxValue ); |
3148 { |
3156 { |
3149 case TPointerEvent::EButton1Down: |
3157 case TPointerEvent::EButton1Down: |
3150 { |
3158 { |
3151 if ( touchDownArea.Contains( aEvent.iPosition ) ) |
3159 if ( touchDownArea.Contains( aEvent.iPosition ) ) |
3152 { |
3160 { |
3153 TInt stepCount = SliderData()->Range() / SliderData()->iStepSize; |
|
3154 if ( stepCount <= KStepThreshold ) |
|
3155 { |
|
3156 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
3157 if ( feedback ) |
|
3158 { |
|
3159 feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aEvent ); |
|
3160 } |
|
3161 } |
|
3162 // repeat until thumb reaches the stylus down position |
3161 // repeat until thumb reaches the stylus down position |
3163 iExt->iPenInputPos = aEvent.iPosition; |
3162 iExt->iPenInputPos = aEvent.iPosition; |
3164 |
3163 |
3165 // Click was inside and down slider marker area |
3164 // Click was inside and down slider marker area |
3166 iExt->SetFlag( CAknSliderExtension::EFlagPointerDown ); |
3165 iExt->SetFlag( CAknSliderExtension::EFlagPointerDown ); |
3168 if ( mrect.Contains( aEvent.iPosition ) ) |
3167 if ( mrect.Contains( aEvent.iPosition ) ) |
3169 { |
3168 { |
3170 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
3169 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
3171 if ( feedback ) |
3170 if ( feedback ) |
3172 { |
3171 { |
3173 feedback->InstantFeedback( this, ETouchFeedbackBasicSlider, aEvent ); |
3172 feedback->InstantFeedback( this, ETouchFeedbackSlider, aEvent ); |
3174 } |
3173 } |
3175 iExt->SetFlag( CAknSliderExtension::EFlagDraggingThumb ); |
3174 iExt->SetFlag( CAknSliderExtension::EFlagDraggingThumb ); |
3176 reportDragEvent = EDragMarkerStart; |
3175 reportDragEvent = EDragMarkerStart; |
3177 } |
3176 } |
3178 // Marker icon changes - draw |
3177 // Marker icon changes - draw |
3255 { |
3254 { |
3256 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
3255 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
3257 if ( feedback ) |
3256 if ( feedback ) |
3258 { |
3257 { |
3259 feedback->InstantFeedback( this, |
3258 feedback->InstantFeedback( this, |
3260 ETouchFeedbackBasicSlider, |
3259 ETouchFeedbackSlider, |
3261 ETouchFeedbackVibra, |
3260 ETouchFeedbackVibra, |
3262 aEvent ); |
3261 aEvent ); |
3263 } |
3262 } |
3264 } |
3263 } |
3265 StopFeedback(); |
3264 StopFeedback(); |
3616 |
3615 |
3617 if ( sliderValue != oldSliderValue ) |
3616 if ( sliderValue != oldSliderValue ) |
3618 { |
3617 { |
3619 if( aFeedback ) |
3618 if( aFeedback ) |
3620 { |
3619 { |
3621 TInt stepCount = SliderData()->Range() / SliderData()->iStepSize; |
3620 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
3622 if ( stepCount > KStepThreshold ) |
3621 if ( feedback ) |
3623 { |
3622 { |
3624 if ( iExt->IsFlagSet( CAknSliderExtension::EFlagPlayingContinuousFb )) |
3623 feedback->InstantFeedback( this, ETouchFeedbackSlider ); |
3625 { |
3624 } |
3626 if ( SliderData()->iFeedbackStyle == EAknSliderFbDynamic ) |
|
3627 { |
|
3628 ModifyFeedback(); |
|
3629 } |
|
3630 } |
|
3631 else |
|
3632 { |
|
3633 StartFeedback( NULL, KNoFeedbackTimeout ); |
|
3634 } |
|
3635 } |
|
3636 else |
|
3637 { |
|
3638 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
3639 if ( feedback ) |
|
3640 { |
|
3641 feedback->InstantFeedback( this, ETouchFeedbackBasicSlider ); |
|
3642 } |
|
3643 } |
|
3644 } |
3625 } |
3645 |
3626 |
3646 Window().Invalidate( Rect() ); |
3627 Window().Invalidate( Rect() ); |
3647 } |
3628 } |
3648 } |
3629 } |
4207 TRgb color; |
4188 TRgb color; |
4208 TInt error; |
4189 TInt error; |
4209 if ( Layout() != EAknSettingsItemSliderLayout && |
4190 if ( Layout() != EAknSettingsItemSliderLayout && |
4210 Layout() != EAknSettingsItemSliderLayoutWithGraphics && |
4191 Layout() != EAknSettingsItemSliderLayoutWithGraphics && |
4211 Layout() != EAknSliderLayoutVertical && |
4192 Layout() != EAknSliderLayoutVertical && |
4212 Layout() != EAknSliderLayoutHorizontal ) |
4193 Layout() != EAknSliderLayoutHorizontal && |
|
4194 Layout() != EAknMIDPFormSliderLayout ) |
4213 { |
4195 { |
4214 error = AknsUtils::GetCachedColor( skin, color, |
4196 error = AknsUtils::GetCachedColor( skin, color, |
4215 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 ); |
4197 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG8 ); |
4216 } |
4198 } |
4217 else |
4199 else |
4275 void CAknSlider::StartFeedback( const TPointerEvent* aPointerEvent, TTimeIntervalMicroSeconds32 aTimeout ) |
4257 void CAknSlider::StartFeedback( const TPointerEvent* aPointerEvent, TTimeIntervalMicroSeconds32 aTimeout ) |
4276 { |
4258 { |
4277 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
4259 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
4278 if ( feedback ) |
4260 if ( feedback ) |
4279 { |
4261 { |
|
4262 TTouchContinuousFeedback type = ETouchContinuousSmooth; |
4280 TInt intensity = KStableFeedbackIntesity; |
4263 TInt intensity = KStableFeedbackIntesity; |
|
4264 |
4281 if ( SliderData()->iFeedbackStyle == EAknSliderFbDynamic ) |
4265 if ( SliderData()->iFeedbackStyle == EAknSliderFbDynamic ) |
4282 { |
4266 { |
|
4267 type = ETouchDynamicSlider; |
4283 intensity = FeedbackIntensity(); |
4268 intensity = FeedbackIntensity(); |
4284 } |
4269 } |
4285 feedback->StartFeedback( this, ETouchContinuousSlider, aPointerEvent, intensity, aTimeout ); |
4270 |
|
4271 feedback->StartFeedback( this, type, aPointerEvent, intensity, aTimeout ); |
4286 iExt->SetFlag( CAknSliderExtension::EFlagPlayingContinuousFb ); |
4272 iExt->SetFlag( CAknSliderExtension::EFlagPlayingContinuousFb ); |
4287 } |
4273 } |
4288 } |
4274 } |
4289 |
4275 |
4290 // ---------------------------------------------------------------------------- |
4276 // ---------------------------------------------------------------------------- |