+ void SetScrollThreshold( float threshold )
+ {
+ mScrollThreshold = threshold;
+ }
+
+ float GetScrollThreshold() const
+ {
+ return mScrollThreshold;
+ }
+
+ void SetScrollSpeed( float speed )
+ {
+ mScrollSpeed = speed;
+ mScrollDistance = speed * SCROLL_TICK_INTERVAL * TO_SECONDS;
+ }
+
+ float GetScrollSpeed() const
+ {
+ return mScrollSpeed;
+ }
+
+ /**
+ * Creates and starts a timer to scroll the text when handles are close to the edges of the text.
+ *
+ * It only starts the timer if it's already created.
+ */
+ void StartScrollTimer()
+ {
+ if( !mScrollTimer )
+ {
+ mScrollTimer = Timer::New( SCROLL_TICK_INTERVAL );
+ mScrollTimer.TickSignal().Connect( this, &Decorator::Impl::OnScrollTimerTick );
+ }
+
+ if( !mScrollTimer.IsRunning() )
+ {
+ mScrollTimer.Start();
+ }
+ }
+
+ /**
+ * Stops the timer used to scroll the text.
+ */
+ void StopScrollTimer()
+ {
+ if( mScrollTimer )
+ {
+ mScrollTimer.Stop();
+ }
+ }
+
+ /**
+ * Callback called by the timer used to scroll the text.
+ *
+ * It calculates and sets a new scroll position.
+ */
+ bool OnScrollTimerTick()
+ {
+ if( HANDLE_TYPE_COUNT != mHandleScrolling )
+ {
+ mController.DecorationEvent( mHandleScrolling,
+ HANDLE_SCROLLING,
+ mScrollDirection == SCROLL_RIGHT ? mScrollDistance : -mScrollDistance,
+ 0.f );
+ }
+
+ return true;
+ }
+
+ ControllerInterface& mController;