From b2e0875240ab94aeafce0f5a7d05f84a562184b7 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Wed, 8 Jul 2020 17:59:21 +0100 Subject: [PATCH] Support weak handle for BaseHandle Change-Id: Id351d09ba06d9dee380db4f760fc4ee98536da44 --- automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp | 5 ++++- .../internal/controls/scroll-bar/scroll-bar-impl.cpp | 14 +++++++------- .../internal/controls/scroll-bar/scroll-bar-impl.h | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp index 1d32e33..609621a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -19,6 +19,7 @@ #include #include #include +#include "dali-toolkit-test-utils/toolkit-timer.h" #include #include #include @@ -116,6 +117,8 @@ static Vector2 PerformGestureSwipe(ToolkitTestApplication& application, Vector2 for(int i = 0; i < frames; i++) { + Test::EmitGlobalTimerSignal(); + pos += direction; // Move in this direction time += RENDER_FRAME_INTERVAL; TestMovePan( application, pos, time); 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 711f323..7056b0c 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -186,7 +186,7 @@ ScrollBar::ScrollBar(Toolkit::ScrollBar::Direction direction) : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mIndicatorShowAlpha(1.0f), mDirection(direction), - mScrollableObject(WeakHandleBase()), + mScrollableObject(WeakHandle()), mPropertyScrollPosition(Property::INVALID_INDEX), mPropertyMinScrollPosition(Property::INVALID_INDEX), mPropertyMaxScrollPosition(Property::INVALID_INDEX), @@ -225,7 +225,7 @@ void ScrollBar::SetScrollPropertySource( Handle handle, Property::Index property && propertyMaxScrollPosition != Property::INVALID_INDEX && propertyScrollContentSize != Property::INVALID_INDEX ) { - mScrollableObject = WeakHandleBase(handle); + mScrollableObject = WeakHandle(handle); mPropertyScrollPosition = propertyScrollPosition; mPropertyMinScrollPosition = propertyMinScrollPosition; mPropertyMaxScrollPosition = propertyMaxScrollPosition; @@ -294,7 +294,7 @@ Actor ScrollBar::GetScrollIndicator() void ScrollBar::ApplyConstraints() { - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { @@ -337,7 +337,7 @@ void ScrollBar::SetScrollPositionIntervals( const Dali::Vector& positions { mScrollPositionIntervals = positions; - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { @@ -359,7 +359,7 @@ Dali::Vector ScrollBar::GetScrollPositionIntervals() const 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 ) ); @@ -442,7 +442,7 @@ void ScrollBar::ShowTransientIndicator() bool ScrollBar::OnPanGestureProcessTick() { // Update the scroll position property. - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if( scrollableHandle ) { scrollableHandle.SetProperty(mPropertyScrollPosition, mCurrentScrollPosition); @@ -453,7 +453,7 @@ bool ScrollBar::OnPanGestureProcessTick() void ScrollBar::OnPan( const PanGesture& gesture ) { - Handle scrollableHandle = mScrollableObject.GetBaseHandle(); + Handle scrollableHandle = mScrollableObject.GetHandle(); if(scrollableHandle) { diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h index e808d83..f56b9a0 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_SCROLL_BAR_H /* - * Copyright (c) 2019 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. @@ -283,7 +283,7 @@ private: Toolkit::ScrollBar::Direction mDirection; ///< The direction of scroll bar (vertical or horizontal) - WeakHandleBase mScrollableObject; ///< Object to be scrolled + WeakHandle mScrollableObject; ///< Object to be scrolled Property::Index mPropertyScrollPosition; ///< Index of scroll position property owned by the object to be scrolled Property::Index mPropertyMinScrollPosition; ///< Index of minimum scroll position property owned by the object to be scrolled -- 2.7.4