projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix prevent issues
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
controls
/
scroll-bar
/
scroll-bar-impl.cpp
diff --git
a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
index
998289b
..
d2b699b
100755
(executable)
--- a/
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
+++ b/
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
@@
-153,7
+153,7
@@
const char* INDICATOR_HEIGHT_POLICY_NAME[] = {"Variable", "Fixed"};
ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction)
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mDirection(direction),
ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction)
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mDirection(direction),
- mScrollableObject(
Handl
e()),
+ mScrollableObject(
WeakHandleBas
e()),
mPropertyScrollPosition(Property::INVALID_INDEX),
mPropertyMinScrollPosition(Property::INVALID_INDEX),
mPropertyMaxScrollPosition(Property::INVALID_INDEX),
mPropertyScrollPosition(Property::INVALID_INDEX),
mPropertyMinScrollPosition(Property::INVALID_INDEX),
mPropertyMaxScrollPosition(Property::INVALID_INDEX),
@@
-175,6
+175,7
@@
ScrollBar::~ScrollBar()
void ScrollBar::OnInitialize()
{
CreateDefaultIndicatorActor();
void ScrollBar::OnInitialize()
{
CreateDefaultIndicatorActor();
+ Self().SetDrawMode(DrawMode::OVERLAY_2D);
}
void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize )
}
void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index propertyScrollPosition, Property::Index propertyMinScrollPosition, Property::Index propertyMaxScrollPosition, Property::Index propertyScrollContentSize )
@@
-185,7
+186,7
@@
void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index property
&& propertyMaxScrollPosition != Property::INVALID_INDEX
&& propertyScrollContentSize != Property::INVALID_INDEX )
{
&& propertyMaxScrollPosition != Property::INVALID_INDEX
&& propertyScrollContentSize != Property::INVALID_INDEX )
{
- mScrollableObject =
handle
;
+ mScrollableObject =
WeakHandleBase(handle)
;
mPropertyScrollPosition = propertyScrollPosition;
mPropertyMinScrollPosition = propertyMinScrollPosition;
mPropertyMaxScrollPosition = propertyMaxScrollPosition;
mPropertyScrollPosition = propertyScrollPosition;
mPropertyMinScrollPosition = propertyMinScrollPosition;
mPropertyMaxScrollPosition = propertyMaxScrollPosition;
@@
-217,19
+218,13
@@
void ScrollBar::SetScrollIndicator( Actor indicator )
if( indicator )
{
mIndicator = indicator;
if( indicator )
{
mIndicator = indicator;
+ Self().Add(mIndicator);
- Actor self = Self();
- self.Add(mIndicator);
- self.SetDrawMode(DrawMode::OVERLAY);
+ EnableGestureDetection(Gesture::Type(Gesture::Pan));
- if( !mPanGestureDetector )
- {
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.DetectedSignal().Connect(this, &ScrollBar::OnPan);
- }
-
- mPanGestureDetector.DetachAll();
- mPanGestureDetector.Attach( mIndicator );
+ PanGestureDetector detector( GetPanGestureDetector() );
+ detector.DetachAll();
+ detector.Attach( mIndicator );
unsigned int childCount = mIndicator.GetChildCount();
for ( unsigned int index = 0; index < childCount; index++ )
unsigned int childCount = mIndicator.GetChildCount();
for ( unsigned int index = 0; index < childCount; index++ )
@@
-237,7
+232,7
@@
void ScrollBar::SetScrollIndicator( Actor indicator )
Actor child = mIndicator.GetChildAt( index );
if ( child )
{
Actor child = mIndicator.GetChildAt( index );
if ( child )
{
-
mPanGestureD
etector.Attach( child );
+
d
etector.Attach( child );
}
}
}
}
}
}
@@
-254,7
+249,9
@@
Actor ScrollBar::GetScrollIndicator()
void ScrollBar::ApplyConstraints()
{
void ScrollBar::ApplyConstraints()
{
- if( mScrollableObject )
+ Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+
+ if( scrollableHandle )
{
if(mIndicatorSizeConstraint)
{
{
if(mIndicatorSizeConstraint)
{
@@
-270,7
+267,7
@@
void ScrollBar::ApplyConstraints()
{
mIndicatorSizeConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::SIZE, IndicatorSizeConstraint() );
mIndicatorSizeConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
{
mIndicatorSizeConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::SIZE, IndicatorSizeConstraint() );
mIndicatorSizeConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
- mIndicatorSizeConstraint.AddSource( Source(
mScrollableObject
, mPropertyScrollContentSize ) );
+ mIndicatorSizeConstraint.AddSource( Source(
scrollableHandle
, mPropertyScrollContentSize ) );
mIndicatorSizeConstraint.Apply();
}
mIndicatorSizeConstraint.Apply();
}
@@
-282,9
+279,9
@@
void ScrollBar::ApplyConstraints()
mIndicatorPositionConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::POSITION, IndicatorPositionConstraint() );
mIndicatorPositionConstraint.AddSource( LocalSource( Actor::Property::SIZE ) );
mIndicatorPositionConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
mIndicatorPositionConstraint = Constraint::New<Vector3>( mIndicator, Actor::Property::POSITION, IndicatorPositionConstraint() );
mIndicatorPositionConstraint.AddSource( LocalSource( Actor::Property::SIZE ) );
mIndicatorPositionConstraint.AddSource( ParentSource( Actor::Property::SIZE ) );
- mIndicatorPositionConstraint.AddSource( Source(
mScrollableObject
, mPropertyScrollPosition ) );
- mIndicatorPositionConstraint.AddSource( Source(
mScrollableObject
, mPropertyMinScrollPosition ) );
- mIndicatorPositionConstraint.AddSource( Source(
mScrollableObject
, mPropertyMaxScrollPosition ) );
+ mIndicatorPositionConstraint.AddSource( Source(
scrollableHandle
, mPropertyScrollPosition ) );
+ mIndicatorPositionConstraint.AddSource( Source(
scrollableHandle
, mPropertyMinScrollPosition ) );
+ mIndicatorPositionConstraint.AddSource( Source(
scrollableHandle
, mPropertyMaxScrollPosition ) );
mIndicatorPositionConstraint.Apply();
}
}
mIndicatorPositionConstraint.Apply();
}
}
@@
-293,14
+290,16
@@
void ScrollBar::SetScrollPositionIntervals( const Dali::Vector<float>& positions
{
mScrollPositionIntervals = positions;
{
mScrollPositionIntervals = positions;
- if( mScrollableObject )
+ Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+
+ if( scrollableHandle )
{
if( mPositionNotification )
{
{
if( mPositionNotification )
{
-
mScrollableObject
.RemovePropertyNotification(mPositionNotification);
+
scrollableHandle
.RemovePropertyNotification(mPositionNotification);
}
}
- mPositionNotification =
mScrollableObject
.AddPropertyNotification( mPropertyScrollPosition, VariableStepCondition(mScrollPositionIntervals) );
+ mPositionNotification =
scrollableHandle
.AddPropertyNotification( mPropertyScrollPosition, VariableStepCondition(mScrollPositionIntervals) );
mPositionNotification.NotifySignal().Connect( this, &ScrollBar::OnScrollPositionIntervalReached );
}
}
mPositionNotification.NotifySignal().Connect( this, &ScrollBar::OnScrollPositionIntervalReached );
}
}
@@
-313,9
+312,10
@@
Dali::Vector<float> ScrollBar::GetScrollPositionIntervals() const
void ScrollBar::OnScrollPositionIntervalReached(PropertyNotification& source)
{
// Emit the signal to notify the scroll position crossing
void ScrollBar::OnScrollPositionIntervalReached(PropertyNotification& source)
{
// Emit the signal to notify the scroll position crossing
- if(mScrollableObject)
+ Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ if(scrollableHandle)
{
{
- mScrollPositionIntervalReachedSignal.Emit(
mScrollableObject
.GetProperty<float>(mPropertyScrollPosition));
+ mScrollPositionIntervalReachedSignal.Emit(
scrollableHandle
.GetProperty<float>(mPropertyScrollPosition));
}
}
}
}
@@
-364,19
+364,22
@@
void ScrollBar::HideIndicator()
bool ScrollBar::OnPanGestureProcessTick()
{
// Update the scroll position property.
bool ScrollBar::OnPanGestureProcessTick()
{
// Update the scroll position property.
- if( mScrollableObject )
+ Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+ if( scrollableHandle )
{
{
-
mScrollableObject
.SetProperty(mPropertyScrollPosition, mCurrentScrollPosition);
+
scrollableHandle
.SetProperty(mPropertyScrollPosition, mCurrentScrollPosition);
}
return true;
}
}
return true;
}
-void ScrollBar::OnPan(
Actor source,
const PanGesture& gesture )
+void ScrollBar::OnPan( const PanGesture& gesture )
{
{
- if(mScrollableObject)
+ Handle scrollableHandle = mScrollableObject.GetBaseHandle();
+
+ if(scrollableHandle)
{
{
- Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast(
mScrollableObject
);
+ Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast(
scrollableHandle
);
switch(gesture.state)
{
switch(gesture.state)
{
@@
-391,7
+394,7
@@
void ScrollBar::OnPan( Actor source, const PanGesture& gesture )
}
ShowIndicator();
}
ShowIndicator();
- mScrollStart =
mScrollableObject
.GetProperty<float>(mPropertyScrollPosition);
+ mScrollStart =
scrollableHandle
.GetProperty<float>(mPropertyScrollPosition);
mGestureDisplacement = Vector3::ZERO;
mIsPanning = true;
mGestureDisplacement = Vector3::ZERO;
mIsPanning = true;
@@
-403,8
+406,8
@@
void ScrollBar::OnPan( Actor source, const PanGesture& gesture )
mGestureDisplacement+=delta;
Vector3 span = Self().GetCurrentSize() - mIndicator.GetCurrentSize();
mGestureDisplacement+=delta;
Vector3 span = Self().GetCurrentSize() - mIndicator.GetCurrentSize();
- float minScrollPosition =
mScrollableObject
.GetProperty<float>(mPropertyMinScrollPosition);
- float maxScrollPosition =
mScrollableObject
.GetProperty<float>(mPropertyMaxScrollPosition);
+ float minScrollPosition =
scrollableHandle
.GetProperty<float>(mPropertyMinScrollPosition);
+ float maxScrollPosition =
scrollableHandle
.GetProperty<float>(mPropertyMaxScrollPosition);
float domainSize = maxScrollPosition - minScrollPosition;
mCurrentScrollPosition = mScrollStart - mGestureDisplacement.y * domainSize / span.y;
float domainSize = maxScrollPosition - minScrollPosition;
mCurrentScrollPosition = mScrollStart - mGestureDisplacement.y * domainSize / span.y;
@@
-439,7
+442,7
@@
void ScrollBar::OnPan( Actor source, const PanGesture& gesture )
if(itemView)
{
// Disable automatic refresh in ItemView during fast scrolling
if(itemView)
{
// Disable automatic refresh in ItemView during fast scrolling
- GetImpl(itemView).SetRefreshEnabled(
true);//
!mIsPanning);
+ GetImpl(itemView).SetRefreshEnabled(!mIsPanning);
}
}
}
}
}
}
@@
-661,11
+664,15
@@
Property::Value ScrollBar::GetProperty( BaseObject* object, Property::Index inde
{
Property::Value value( Property::ARRAY );
Property::Array* array = value.GetArray();
{
Property::Value value( Property::ARRAY );
Property::Array* array = value.GetArray();
- Dali::Vector<float> positions = scrollBarImpl.GetScrollPositionIntervals();
- size_t positionCount( array->Count() );
- for( size_t i( 0 ); i != positionCount; ++i )
+
+ if( array )
{
{
- array->PushBack( positions[i] );
+ Dali::Vector<float> positions = scrollBarImpl.GetScrollPositionIntervals();
+ size_t positionCount( array->Count() );
+ for( size_t i( 0 ); i != positionCount; ++i )
+ {
+ array->PushBack( positions[i] );
+ }
}
break;
}
}
break;
}