/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <cstring> // for strcmp
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-registry-helper.h>
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mIndicatorShowAlpha(1.0f),
mDirection(direction),
- mScrollableObject(WeakHandleBase()),
+ mScrollableObject(WeakHandle<Handle>()),
mPropertyScrollPosition(Property::INVALID_INDEX),
mPropertyMinScrollPosition(Property::INVALID_INDEX),
mPropertyMaxScrollPosition(Property::INVALID_INDEX),
void ScrollBar::OnInitialize()
{
CreateDefaultIndicatorActor();
- Self().SetDrawMode(DrawMode::OVERLAY_2D);
+ Self().SetProperty( Actor::Property::DRAW_MODE,DrawMode::OVERLAY_2D);
}
void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize )
&& propertyMaxScrollPosition != Property::INVALID_INDEX
&& propertyScrollContentSize != Property::INVALID_INDEX )
{
- mScrollableObject = WeakHandleBase(handle);
+ mScrollableObject = WeakHandle<Handle>(handle);
mPropertyScrollPosition = propertyScrollPosition;
mPropertyMinScrollPosition = propertyMinScrollPosition;
mPropertyMaxScrollPosition = propertyMaxScrollPosition;
indicator.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
indicator.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
indicator.SetStyleName( "ScrollBarIndicator" );
- indicator.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+ indicator.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
SetScrollIndicator(indicator);
}
void ScrollBar::ApplyConstraints()
{
- Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ Handle scrollableHandle = mScrollableObject.GetHandle();
if( scrollableHandle )
{
// Set indicator height according to the indicator's height policy
if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
{
- mIndicator.SetSize(Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight);
+ mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) );
}
else
{
{
mScrollPositionIntervals = positions;
- Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ Handle scrollableHandle = mScrollableObject.GetHandle();
if( scrollableHandle )
{
void ScrollBar::OnScrollPositionIntervalReached(PropertyNotification& source)
{
// Emit the signal to notify the scroll position crossing
- Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ Handle scrollableHandle = mScrollableObject.GetHandle();
if(scrollableHandle)
{
mScrollPositionIntervalReachedSignal.Emit( scrollableHandle.GetCurrentProperty< float >( mPropertyScrollPosition ) );
}
else
{
- mIndicator.SetProperty( DevelActor::Property::OPACITY,mIndicatorShowAlpha);
+ mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha);
}
}
}
else
{
- mIndicator.SetProperty( DevelActor::Property::OPACITY,0.0f);
+ mIndicator.SetProperty( Actor::Property::OPACITY,0.0f);
}
}
}
else
{
- mIndicator.SetProperty( DevelActor::Property::OPACITY,mIndicatorShowAlpha);
+ mIndicator.SetProperty( Actor::Property::OPACITY,mIndicatorShowAlpha);
}
mAnimation.AnimateTo( Property( mIndicator, Actor::Property::COLOR_ALPHA ),
0.0f, AlphaFunction::EASE_IN, TimePeriod((mIndicatorShowDuration + mTransientIndicatorDuration), mIndicatorHideDuration) );
bool ScrollBar::OnPanGestureProcessTick()
{
// Update the scroll position property.
- Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ Handle scrollableHandle = mScrollableObject.GetHandle();
if( scrollableHandle )
{
scrollableHandle.SetProperty(mPropertyScrollPosition, mCurrentScrollPosition);
void ScrollBar::OnPan( const PanGesture& gesture )
{
- Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ Handle scrollableHandle = mScrollableObject.GetHandle();
if(scrollableHandle)
{
{
if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
{
- mIndicator.SetSize(size.width, mIndicatorFixedHeight);
+ mIndicator.SetProperty( Actor::Property::SIZE, Vector2( size.width, mIndicatorFixedHeight ) );
}
Control::OnSizeSet( size );
if(mIndicatorHeightPolicy == Toolkit::ScrollBar::Fixed)
{
- mIndicator.SetSize(Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight);
+ mIndicator.SetProperty( Actor::Property::SIZE, Vector2( Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, mIndicatorFixedHeight) );
}
}