DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left);
END_TEST;
}
-
-int UtcDaliItemLayoutGetScrollHints(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
-
- // Create a grid layout and add it to ItemView
- GridLayoutPtr gridLayout = GridLayout::New();
- view.AddLayout(*gridLayout);
-
- // Set the orientation of the layout to be horizontal from left to right
- ItemLayoutPtr layout = view.GetLayout(0);
-
- Vector2 axisScrollHint;
-
- layout->SetOrientation(ControlOrientation::Up);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Down);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Left);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
-
- layout->SetOrientation(ControlOrientation::Right);
- layout->GetXAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- layout->GetYAxisScrollHint(axisScrollHint);
- DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION);
- END_TEST;
-}
END_TEST;
}
-int UtcDaliScrollViewTouchesRequired(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliScrollViewTouchesRequired");
-
- // Set up a scrollView...
- ScrollView scrollView = ScrollView::New();
- Stage::GetCurrent().Add( scrollView );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- scrollView.SetSize(stageSize);
- scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
- scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
-
- // Position rulers.
- RulerPtr rulerX = new DefaultRuler();
- RulerPtr rulerY = new DefaultRuler();
- rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
- rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
- scrollView.SetRulerX(rulerX);
- scrollView.SetRulerY(rulerY);
- scrollView.ScrollStartedSignal().Connect( &OnScrollStart );
- scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
- scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete );
- scrollView.SnapStartedSignal().Connect( &OnSnapStart );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // First try touches required being a minimum and maximum of 2.
- scrollView.SetTouchesRequiredForPanning(2, 2, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true);
-
- DALI_TEST_CHECK( !gOnScrollStartCalled );
- DALI_TEST_CHECK( !gOnScrollUpdateCalled );
- DALI_TEST_CHECK( !gOnScrollCompleteCalled );
- DALI_TEST_CHECK( !gOnSnapStartCalled );
-
- scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little.
- Wait(application);
-
- // Second try touches required being a minimum and maximum of 1.
- scrollView.SetTouchesRequiredForPanning(1, 1, true);
- PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT * 0.1f, CLAMP_GESTURE_FRAMES * 0.1f, true);
-
- DALI_TEST_CHECK( gOnScrollStartCalled );
- DALI_TEST_CHECK( gOnScrollUpdateCalled );
- DALI_TEST_CHECK( gOnScrollCompleteCalled );
- DALI_TEST_CHECK( gOnSnapStartCalled );
- END_TEST;
-}
-
int UtcDaliScrollViewAxisAutoLock(void)
{
ToolkitTestApplication application;
mPropertyTime(Property::INVALID_INDEX),
mPropertyPrePosition(Property::INVALID_INDEX),
mPropertyPosition(Property::INVALID_INDEX),
- mPropertyScale(Property::INVALID_INDEX),
mPropertyOvershootX(Property::INVALID_INDEX),
mPropertyOvershootY(Property::INVALID_INDEX),
mPropertyWrap(Property::INVALID_INDEX),
mPropertyOvershootX = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME, 0.0f);
mPropertyOvershootY = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME, 0.0f);
mPropertyFinal = self.RegisterProperty(Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME, Vector3::ZERO);
- mPropertyScale = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCALE_PROPERTY_NAME, Vector3::ONE);
mPropertyWrap = self.RegisterProperty(Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME, false);
mPropertyPanning = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME, false);
mPropertyScrolling = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME, false);
Property::Index mPropertyTime; ///< Scroll Time (0 to animationDuration while animating, otherwise 0)
Property::Index mPropertyPrePosition; ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y]
Property::Index mPropertyPosition; ///< Scroll Position ("scroll-position") [function of scroll-pre-position]
- Property::Index mPropertyScale; ///< Scroll Scale ("scroll-scale")
Property::Index mPropertyOvershootX; ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position]
Property::Index mPropertyOvershootY; ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position]
Property::Index mPropertyWrap; ///< Scroll Wrap ("scroll-wrap")
const char* const SIGNAL_SNAP_STARTED = "snap-started";
-const int DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 50; ///< Refresh rate TODO: Animation should have an update signal (and see item-view-impl)
const Vector2 DEFAULT_MIN_FLICK_DISTANCE(30.0f, 30.0f); ///< minimum distance for pan before flick allowed
const float DEFAULT_MIN_FLICK_SPEED_THRESHOLD(500.0f); ///< Minimum pan speed required for flick in pixels/s
const float FREE_FLICK_SPEED_THRESHOLD = 200.0f; ///< Free-Flick threshold in pixels/ms
const float AUTOLOCK_AXIS_MINIMUM_DISTANCE2 = 100.0f; ///< Auto-lock axis after minimum distance squared.
const float FLICK_ORTHO_ANGLE_RANGE = 75.0f; ///< degrees. (if >45, then supports diagonal flicking)
-const unsigned int MAXIMUM_NUMBER_OF_VALUES = 5; ///< Number of values to use for weighted pan calculation.
const Vector2 DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION = Vector2(0.17f, 0.1f); ///< The step of horizontal scroll distance in the proportion of stage size for each mouse wheel event received.
const unsigned long MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET( 150u );
const float TOUCH_DOWN_TIMER_INTERVAL = 100.0f;
const float DEFAULT_SCROLL_UPDATE_DISTANCE( 30.0f ); ///< Default distance to travel in pixels for scroll update signal
-// predefined effect values
-const Vector3 ANGLE_CAROUSEL_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);
-const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside
-const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen
-const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.5f, Math::PI * 0.5f);
-const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.35f, Math::PI * 0.35f);
-const Vector2 ANGLE_OUTER_CUBE_SWING(Math::PI * 0.5f, Math::PI * 0.5f); ///< outer cube pages swing 90 degrees as they pan offscreen
-
// Helpers ////////////////////////////////////////////////////////////////////////////////////////
/**
mTouchDownTime(0u),
mGestureStackDepth(0),
mScrollStateFlags(0),
- mMinTouchesForPanning(1),
- mMaxTouchesForPanning(1),
mLockAxis(LockPossible),
mScrollUpdateDistance(DEFAULT_SCROLL_UPDATE_DISTANCE),
- mOvershootDelay(1.0f),
mMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT),
mUserMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT),
mSnapOvershootDuration(Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION),
EnableGestureDetection( Gesture::Type( Gesture::Pan ) );
- // For pan, default to only 1 touch required, ignoring touches outside this range.
- SetTouchesRequiredForPanning(1, 1, false);
-
// By default we'll allow the user to freely drag the scroll view,
// while disabling the other rulers.
RulerPtr ruler = new DefaultRuler();
mSnapOvershootDuration = duration;
}
-void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside)
-{
- PanGestureDetector panGesture( GetPanGestureDetector() );
-
- mMinTouchesForPanning = minTouches;
- mMaxTouchesForPanning = maxTouches;
-
- if(endOutside)
- {
- panGesture.SetMinimumTouchesRequired(minTouches);
- panGesture.SetMaximumTouchesRequired(maxTouches);
- }
- else
- {
- panGesture.SetMinimumTouchesRequired(1);
- panGesture.SetMaximumTouchesRequired(UINT_MAX);
- }
-}
-
void ScrollView::SetActorAutoSnap(bool enable)
{
mActorAutoSnapEnabled = enable;
self.RemovePropertyNotification(mScrollXUpdateNotification);
mScrollXUpdateNotification.Reset();
}
- if( enabled )
+ if( enabled && !mScrollUpdatedSignal.Empty())
{
+ // Only set up the notification when the application has connected to the updated signal
mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f));
mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification );
}
self.RemovePropertyNotification(mScrollYUpdateNotification);
mScrollYUpdateNotification.Reset();
}
- if( enabled )
+ if( enabled && !mScrollUpdatedSignal.Empty())
{
+ // Only set up the notification when the application has connected to the updated signal
mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f));
mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification );
}
void ScrollView::ClampPosition(Vector3& position) const
{
- ClampState3 clamped;
+ ClampState3D clamped;
ClampPosition(position, clamped);
}
-void ScrollView::ClampPosition(Vector3& position, ClampState3 &clamped) const
+void ScrollView::ClampPosition(Vector3& position, ClampState3D &clamped) const
{
Vector3 size = Self().GetCurrentSize();
*/
void SetSnapOvershootDuration(float duration);
- /**
- * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
- */
- void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
-
/**
* @copydoc Toolkit::ScrollView::SetActorAutoSnap
*/
* @param[in,out] position The position you wish to clamp
* @param[out] clamped The results of the clamping.
*/
- void ClampPosition(Vector3& position, ClampState3 &clamped) const;
+ void ClampPosition(Vector3& position, ClampState3D &clamped) const;
/**
* Wraps position within the domain set up by X/Y Rulers
Vector3 mMinScroll;
Vector3 mMaxScroll;
- unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
- unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
-
Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
- float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
const char* const SIGNAL_SCROLL_STARTED = "scroll-started";
const char* const SIGNAL_SCROLL_COMPLETED = "scroll-completed";
const char* const SIGNAL_SCROLL_UPDATED = "scroll-updated";
-const char* const SIGNAL_SCROLL_CLAMPED = "scroll-clamped";
BaseHandle Create()
{
SignalConnectorType s1( mType, SIGNAL_SCROLL_STARTED, &Scrollable::DoConnectSignal );
SignalConnectorType s2( mType, SIGNAL_SCROLL_COMPLETED, &Scrollable::DoConnectSignal );
SignalConnectorType s3( mType, SIGNAL_SCROLL_UPDATED, &Scrollable::DoConnectSignal );
-SignalConnectorType s4( mType, SIGNAL_SCROLL_CLAMPED, &Scrollable::DoConnectSignal );
PropertyRegistration property1( mType,
"overshoot-effect-color",
return mScrollCompletedSignal;
}
-Toolkit::Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal()
-{
- return mScrollClampedSignal;
-}
-
bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
Dali::BaseHandle handle( object );
{
scrollable.ScrollCompletedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCROLL_CLAMPED ) )
- {
- scrollable.ScrollClampedSignal().Connect( tracker, functor );
- }
else
{
// signalName does not match any signal
*/
Toolkit::Scrollable::ScrollCompletedSignalType& ScrollCompletedSignal();
- /**
- * @copydoc Dali::Toolkit::Scrollable::ScrollClampedSignal()
- */
- Toolkit::Scrollable::ScrollClampedSignalType& ScrollClampedSignal();
-
/**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal;
- Toolkit::Scrollable::ScrollClampedSignalType mScrollClampedSignal;
private:
return currentLayoutPosition;
}
-void ItemLayout::GetXAxisScrollHint(Vector2& scrollHint) const
-{
- scrollHint = Vector2::ZERO;
- Radian scrollAngle(GetScrollDirection());
- Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
- switch(mOrientation)
- {
- case ControlOrientation::Up:
- {
- if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::XAXIS;
- }
- else
- {
- scrollHint = -Vector2::XAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Down:
- {
- if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::XAXIS;
- }
- else
- {
- scrollHint = Vector2::XAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Left:
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::XAXIS;
- }
- else
- {
- scrollHint = -Vector2::XAXIS;
- }
- break;
- }
- case ControlOrientation::Right:
- {
- // we probably want x scrolling
- if(scrollDirection.x > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::XAXIS;
- }
- else
- {
- scrollHint = Vector2::XAXIS;
- }
- break;
- }
- }
-}
-
-void ItemLayout::GetYAxisScrollHint(Vector2& scrollHint) const
-{
- scrollHint = Vector2::ZERO;
- Radian scrollAngle(GetScrollDirection());
- Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
- switch(mOrientation)
- {
- case ControlOrientation::Up:
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::YAXIS;
- }
- else
- {
- scrollHint = -Vector2::YAXIS;
- }
- break;
- }
- case ControlOrientation::Down:
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::YAXIS;
- }
- else
- {
- scrollHint = Vector2::YAXIS;
- }
- break;
- }
- case ControlOrientation::Left:
- {
- if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = -Vector2::YAXIS;
- }
- else
- {
- scrollHint = Vector2::YAXIS;
- }
- }
- break;
- }
- case ControlOrientation::Right:
- {
- if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
- {
- // we probably want x scrolling
- if(scrollDirection.y > 0.0f)
- {
- // normal positive scrolling
- scrollHint = Vector2::YAXIS;
- }
- else
- {
- scrollHint = -Vector2::YAXIS;
- }
- }
- break;
- }
- }
-}
-
int ItemLayout::GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
{
switch( direction )
*/
virtual Degree GetScrollDirection() const = 0;
- /**
- * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
- *
- * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
- * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
- * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
- * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
- *
- * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
- * layout implementations should provide their own version of this function to ensure proper functionality of
- * internal toolkit systems.
- *
- * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for x-axis scrolling
- */
- DALI_IMPORT_API virtual void GetXAxisScrollHint(Vector2& scrollHint) const;
-
- /**
- * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
- *
- * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
- * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
- * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
- * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
- *
- * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
- * layout implementations should provide their own version of this function to ensure proper functionality of
- * internal toolkit systems.
- *
- * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for y-axis scrolling
- */
- DALI_IMPORT_API virtual void GetYAxisScrollHint(Vector2& scrollHint) const;
-
/**
* @brief Query the scroll speed factor of the layout while dragging.
*
// ScrollView
///////////////////////////////////////////////////////////////////////////////////////////////////
-const std::string ScrollView::SCROLL_PAGE_CURRENT( "scroll-page-current" );
const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" );
const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" );
const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" );
const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" );
const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" );
const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" );
-const std::string ScrollView::SCROLL_SCALE_PROPERTY_NAME( "scroll-scale" );
const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" );
const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" );
const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" );
GetImpl(*this).SetSnapOvershootDuration(duration);
}
-void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside)
-{
- GetImpl(*this).SetTouchesRequiredForPanning(minTouches, maxTouches, endOutside);
-}
-
void ScrollView::SetActorAutoSnap(bool enable)
{
GetImpl(*this).SetActorAutoSnap(enable);
class ScrollView;
}
+/**
+ * @brief How axes/rotation or scale are clamped
+ */
+enum ClampState
+{
+ NotClamped, ///< The quantity isn't clamped
+ ClampedToMin, ///< The quantity is clamped to the min value
+ ClampedToMax ///< The quantity is clamped to the max value
+};
+
+/**
+ * @brief A 3 dimensional clamp
+ */
+struct ClampState3D
+{
+ ClampState x; ///< The clamp state of the x axis
+ ClampState y; ///< The clamp state of the y axis
+ ClampState z; ///< The clamp state of the z axis
+};
+
/**
* @brief The snap type
*/
// Custom properties
- static const std::string SCROLL_PAGE_CURRENT; ///< Property, name "scroll-page-current", type INT
static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type FLOAT
static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type VECTOR3
static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type VECTOR3
static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float
static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float
static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type VECTOR3
- static const std::string SCROLL_SCALE_PROPERTY_NAME; ///< Property, name "scroll-scale", type VECTOR3
static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type BOOLEAN
static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type BOOLEAN
static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type BOOLEAN
static const float DEFAULT_FLICK_SPEED_COEFFICIENT; ///< Default Flick speed coefficient (multiples input touch velocity)
static const float DEFAULT_MAX_FLICK_SPEED; ///< Default Maximum flick speed. (in stage diagonals per second)
- /// Direction of transitions
- enum EDirectionFlag
+public:
+
+ /**
+ * @brief Clamp signal event's data
+ */
+ struct ClampEvent
{
- DirectionFlagLeft = 0x01,
- DirectionFlagRight = 0x02,
- DirectionFlagUp = 0x04,
- DirectionFlagDown = 0x08,
- DirectionFlagTransitionOn = 0x10, ///< doesnt mean a page is moving towards centre, it affects whether the current page is using values for moving onto screen or off screen, if the user changes scroll direction we dont want things to flip over when in view
- DirectionFlagTransitionOff = 0x20,
- DirectionFlagMask_Direction = DirectionFlagLeft | DirectionFlagRight | DirectionFlagUp | DirectionFlagDown,
- DirectionFlagMask_Transition = DirectionFlagTransitionOn | DirectionFlagTransitionOff
+ ClampState3D scale; ///< Clamp information for scale axes
+ ClampState3D position; ///< Clamp information for position axes
+ ClampState rotation; ///< Clamp information for rotation
};
-public:
-
/**
* @brief Snap signal event's data.
*/
*/
void SetSnapOvershootDuration(float duration);
- /**
- * @brief Sets Touches required for pan gestures.
- *
- * Panning requires number of touches to be within (minTouches) and
- * (maxTouches).
- *
- * If (endOutside) is true, then outside this range of touches,
- * the pan gesture will end and thus will snap.
- *
- * If (endOutside) is false, then outside this range of touches,
- * the pan gesture will pause. but will not end until touches = 0.
- *
- * @param[in] minTouches Minimum touches for panning to occur.
- * @param[out] maxTouches Maxiumum touches for panning to occur.
- * @param[in] endOutside Whether to end the panning gesture outside of touch range
- */
- void SetTouchesRequiredForPanning(unsigned int minTouches = 1, unsigned int maxTouches = 1, bool endOutside = true);
-
/**
* @brief Enables or Disables Actor Auto-Snap mode.
*
return GetImpl(*this).ScrollCompletedSignal();
}
-Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal()
-{
- return GetImpl(*this).ScrollClampedSignal();
-}
-
bool Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType indicator) const
{
return GetImpl(*this).IsScrollComponentEnabled(indicator);
class Scrollable;
}
-/**
- * @brief How axes/rotation or scale are clamped
- */
-enum ClampState
-{
- NotClamped, ///< The quantity isn't clamped
- ClampedToMin, ///< The quantity is clamped to the min value
- ClampedToMax ///< The quantity is clamped to the max value
-};
-
-/**
- * @brief A 2 dimensional clamp
- */
-struct ClampState2
-{
- ClampState x; ///< The clamp state of the x axis
- ClampState y; ///< The clamp state of the y axis
-};
-
-/**
- * @brief A 3 dimensional clamp
- */
-struct ClampState3
-{
- ClampState x; ///< The clamp state of the x axis
- ClampState y; ///< The clamp state of the y axis
- ClampState z; ///< The clamp state of the z axis
-};
-
/**
* @brief Base class for derived Scrollables that contains actors that can be scrolled manually
* (via touch) or automatically.
* | scroll-started | @ref ScrollStartedSignal() |
* | scroll-completed | @ref ScrollUpdatedSignal() |
* | scroll-updated | @ref ScrollCompletedSignal() |
- * | scroll-clamped | @ref ScrollClampedSignal() |
*/
class DALI_IMPORT_API Scrollable : public Control
{
public:
- /**
- * @brief Clamp signal event's data
- */
- struct ClampEvent
- {
- ClampState3 scale; ///< Clamp information for scale axes
- ClampState3 position; ///< Clamp information for position axes
- ClampState rotation; ///< Clamp information for rotation
- };
-
/**
* @brief Scroll component types
*/
typedef Signal< void ( const Vector3& ) > ScrollStartedSignalType; ///< ScrollStarted signal type
typedef Signal< void ( const Vector3& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type
typedef Signal< void ( const Vector3& ) > ScrollUpdatedSignalType; ///< Scroll updated signal type
- typedef Signal< void ( const ClampEvent& ) > ScrollClampedSignalType; ///< Scroll clamped signal type
/**
* @brief Signal emitted when the Scrollable has moved (whether by touch or animation).
*/
ScrollCompletedSignalType& ScrollCompletedSignal();
- /**
- * @brief Signal emitted when the Scrollable is pushing against a domain boundary
- * (in either position, scale, or rotation).
- *
- * @return The signal to connect to
- */
- ScrollClampedSignalType& ScrollClampedSignal();
-
public:
/**