X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Fscrollable%2Fscrollable-impl.cpp;h=27bd3434fd2533d2c2a7e47894d0ef6a5f12f528;hb=refs%2Fchanges%2F26%2F29826%2F6;hp=df782be192925c232bf435866a6450fb7aa8aea5;hpb=9241e64179f1c471bb8f6ef19faebccbae67a5d9;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index df782be..27bd343 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -1,18 +1,22 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES #include @@ -31,11 +35,14 @@ namespace Dali namespace Toolkit { +const Property::Index Scrollable::PROPERTY_OVERSHOOT_EFFECT_COLOR( Toolkit::Internal::Control::CONTROL_PROPERTY_END_INDEX + 1 ); + namespace Internal { namespace { +const Vector4 DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.25f); BaseHandle Create() { @@ -50,22 +57,33 @@ SignalConnectorType s2(mType, Toolkit::Scrollable::SIGNAL_SCROLL_COMPLETED, &Scr SignalConnectorType s3(mType, Toolkit::Scrollable::SIGNAL_SCROLL_UPDATED, &Scrollable::DoConnectSignal); SignalConnectorType s4(mType, Toolkit::Scrollable::SIGNAL_SCROLL_CLAMPED, &Scrollable::DoConnectSignal); +PropertyRegistration property1( mType, + "overshoot-effect-color", + Toolkit::Scrollable::PROPERTY_OVERSHOOT_EFFECT_COLOR, + Property::VECTOR4, + &Scrollable::SetProperty, + &Scrollable::GetProperty ); + } const std::string Scrollable::SCROLLABLE_CAN_SCROLL_VERTICAL( "scrollable-can-scroll-vertical" ); const std::string Scrollable::SCROLLABLE_CAN_SCROLL_HORIZONTAL( "scrollable-can-scroll-horizontal" ); -const Vector4 Scrollable::DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.6f); /////////////////////////////////////////////////////////////////////////////////////////////////// // Scrollable /////////////////////////////////////////////////////////////////////////////////////////////////// +// 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() -: ControlImpl(true/*requires touch*/), +: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | NO_SIZE_NEGOTIATION ) ), + mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ), mPropertyRelativePosition(Property::INVALID_INDEX), mPropertyPositionMin(Property::INVALID_INDEX), mPropertyPositionMax(Property::INVALID_INDEX), mPropertyScrollDirection(Property::INVALID_INDEX), + mPropertyCanScrollVertical(Property::INVALID_INDEX), + mPropertyCanScrollHorizontal(Property::INVALID_INDEX), mOvershootEnabled(false) { } @@ -146,6 +164,11 @@ void Scrollable::DisableScrollComponent(Toolkit::Scrollable::ScrollComponentType } } +Vector4 Scrollable::GetOvershootEffectColor() const +{ + return mOvershootEffectColor; +}; + Toolkit::Scrollable::ScrollStartedSignalV2& Scrollable::ScrollStartedSignal() { return mScrollStartedSignalV2; @@ -198,6 +221,46 @@ bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface return connected; } +void Scrollable::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) +{ + Toolkit::Scrollable scrollable = Toolkit::Scrollable::DownCast( Dali::BaseHandle( object ) ); + + if( scrollable ) + { + Scrollable& scrollableImpl( GetImpl( scrollable ) ); + switch( index ) + { + case Toolkit::Scrollable::PROPERTY_OVERSHOOT_EFFECT_COLOR: + { + scrollableImpl.SetOvershootEffectColor( value.Get() ); + break; + } + } + } +} + +Property::Value Scrollable::GetProperty( BaseObject* object, Property::Index index ) +{ + Property::Value value; + + Toolkit::Scrollable scrollable = Toolkit::Scrollable::DownCast( Dali::BaseHandle( object ) ); + + if( scrollable ) + { + Scrollable& scrollableImpl( GetImpl( scrollable ) ); + switch( index ) + { + case Toolkit::Scrollable::PROPERTY_OVERSHOOT_EFFECT_COLOR: + { + value = scrollableImpl.GetOvershootEffectColor(); + break; + } + } + } + + return value; +} + Toolkit::ScrollComponent Scrollable::NewScrollComponent(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type) { Toolkit::ScrollComponent instance; @@ -214,9 +277,10 @@ Toolkit::ScrollComponent Scrollable::NewScrollComponent(Toolkit::Scrollable& scr instance = static_cast(Toolkit::ScrollBarInternal::New(scrollable, false)); break; } - default: + case Toolkit::Scrollable::OvershootIndicator: { - DALI_ASSERT_ALWAYS(true && "Unrecognized component type"); + DALI_ASSERT_ALWAYS(!"Unrecognized component type"); + break; } }