X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscrollable-impl.cpp;h=6cd2e67131f4427e16d424104aa8abd0e20a6559;hp=384d45cb2adf756083fc35caf0a3e9e333078e91;hb=b1e8521ad77e7b4e62b59613b2edef64429130e9;hpb=df89f9f230cadaac7be4007d1b1a7cf7dc893011 diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index 384d45c..6cd2e67 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -46,27 +46,31 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Scrollable, Toolkit::Control, Create ); -DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshoot-effect-color", VECTOR4, OVERSHOOT_EFFECT_COLOR ) -DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshoot-animation-speed", FLOAT, OVERSHOOT_ANIMATION_SPEED ) - -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scroll-relative-position", VECTOR2, SCROLL_RELATIVE_POSITION) -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scroll-position-min", VECTOR2, SCROLL_POSITION_MIN) -DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scroll-position-min-x", SCROLL_POSITION_MIN_X, SCROLL_POSITION_MIN, 0) -DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scroll-position-min-y", SCROLL_POSITION_MIN_Y, SCROLL_POSITION_MIN, 1) -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scroll-position-max", VECTOR2, SCROLL_POSITION_MAX) -DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scroll-position-max-x", SCROLL_POSITION_MAX_X, SCROLL_POSITION_MAX, 0) -DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scroll-position-max-y", SCROLL_POSITION_MAX_Y, SCROLL_POSITION_MAX, 1) -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "can-scroll-vertical", BOOLEAN, CAN_SCROLL_VERTICAL) -DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "can-scroll-horizontal", BOOLEAN, CAN_SCROLL_HORIZONTAL) - -DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scroll-started", SIGNAL_SCROLL_STARTED ) -DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scroll-completed", SIGNAL_SCROLL_COMPLETED ) -DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scroll-updated", SIGNAL_SCROLL_UPDATED ) +DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootEffectColor", VECTOR4, OVERSHOOT_EFFECT_COLOR ) +DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootAnimationSpeed", FLOAT, OVERSHOOT_ANIMATION_SPEED ) +DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootEnabled", BOOLEAN, OVERSHOOT_ENABLED ) +DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootSize", VECTOR2, OVERSHOOT_SIZE ) +DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollToAlphaFunction", INTEGER, SCROLL_TO_ALPHA_FUNCTION ) + +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollRelativePosition", VECTOR2, SCROLL_RELATIVE_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollPositionMin", VECTOR2, SCROLL_POSITION_MIN) +DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scrollPositionMinX", SCROLL_POSITION_MIN_X, SCROLL_POSITION_MIN, 0) +DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scrollPositionMinY", SCROLL_POSITION_MIN_Y, SCROLL_POSITION_MIN, 1) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollPositionMax", VECTOR2, SCROLL_POSITION_MAX) +DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scrollPositionMaxX", SCROLL_POSITION_MAX_X, SCROLL_POSITION_MAX, 0) +DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, Scrollable, "scrollPositionMaxY", SCROLL_POSITION_MAX_Y, SCROLL_POSITION_MAX, 1) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "canScrollVertical", BOOLEAN, CAN_SCROLL_VERTICAL) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "canScrollHorizontal", BOOLEAN, CAN_SCROLL_HORIZONTAL) + +DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scrollStarted", SIGNAL_SCROLL_STARTED ) +DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scrollCompleted", SIGNAL_SCROLL_COMPLETED ) +DALI_SIGNAL_REGISTRATION( Toolkit, Scrollable, "scrollUpdated", SIGNAL_SCROLL_UPDATED ) DALI_TYPE_REGISTRATION_END() const Vector4 DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.25f); const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second +const Vector2 OVERSHOOT_DEFAULT_SIZE( 720.0f, 42.0f ); } @@ -77,18 +81,28 @@ const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second // Scrollable controls are not layout containers so they dont need size negotiation.. // we dont want size negotiation while scrolling if we can avoid it Scrollable::Scrollable() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ), +: Control( ControlBehaviour( DISABLE_SIZE_NEGOTIATION ) ), mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ), mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ), - mOvershootEnabled(false) + mOvershootSize( OVERSHOOT_DEFAULT_SIZE ), + mScrollToAlphaFunction( AlphaFunction::EASE_OUT ), + mScrollStartedSignal(), + mScrollUpdatedSignal(), + mScrollCompletedSignal(), + mOvershootEnabled(true) { } Scrollable::Scrollable( ControlBehaviour behaviourFlags ) -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | behaviourFlags ) ), +: Control( ControlBehaviour( behaviourFlags ) ), mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ), mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ), - mOvershootEnabled(false) + mOvershootSize( OVERSHOOT_DEFAULT_SIZE ), + mScrollToAlphaFunction( AlphaFunction::EASE_OUT ), + mScrollStartedSignal(), + mScrollUpdatedSignal(), + mScrollCompletedSignal(), + mOvershootEnabled(true) { } @@ -122,6 +136,11 @@ float Scrollable::GetOvershootAnimationSpeed() const return mOvershootAnimationSpeed; }; +const Vector2& Scrollable::GetOvershootSize() const +{ + return mOvershootSize; +} + Toolkit::Scrollable::ScrollStartedSignalType& Scrollable::ScrollStartedSignal() { return mScrollStartedSignal; @@ -184,6 +203,27 @@ void Scrollable::SetProperty( BaseObject* object, Property::Index index, const P scrollableImpl.SetOvershootAnimationSpeed( value.Get() ); break; } + case Toolkit::Scrollable::Property::OVERSHOOT_ENABLED: + { + scrollableImpl.SetOvershootEnabled( value.Get() ); + break; + } + case Toolkit::Scrollable::Property::OVERSHOOT_SIZE: + { + scrollableImpl.SetOvershootSize( value.Get() ); + break; + } + case Toolkit::Scrollable::Property::SCROLL_TO_ALPHA_FUNCTION: + { + int alphaFunction = value.Get(); + + if( alphaFunction >= AlphaFunction::DEFAULT && + alphaFunction < AlphaFunction::COUNT ) + { + scrollableImpl.mScrollToAlphaFunction = static_cast< AlphaFunction::BuiltinFunction >( alphaFunction ); + } + break; + } } } } @@ -209,6 +249,21 @@ Property::Value Scrollable::GetProperty( BaseObject* object, Property::Index ind value = scrollableImpl.GetOvershootAnimationSpeed(); break; } + case Toolkit::Scrollable::Property::OVERSHOOT_ENABLED: + { + value = scrollableImpl.IsOvershootEnabled(); + break; + } + case Toolkit::Scrollable::Property::OVERSHOOT_SIZE: + { + value = scrollableImpl.mOvershootSize; + break; + } + case Toolkit::Scrollable::Property::SCROLL_TO_ALPHA_FUNCTION: + { + value = static_cast( scrollableImpl.mScrollToAlphaFunction ); + break; + } } }