X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Ftext%2Ftext-scroller.cpp;h=4afd76586a833913d80dd96c6ee49a0c652d59ab;hb=df8aa451cddeafb67f08cce86b07206d07ca9bc3;hp=ac2af53f9a7fb6a4b0758b4649d5239b53f37748;hpb=3d0003ca2eba6287c2ea16eef196a74b097f4190;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index ac2af53..4afd765 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -224,19 +224,11 @@ int TextScroller::GetSpeed() const void TextScroller::SetLoopCount( int loopCount ) { - if ( loopCount > 0 ) + if ( loopCount >= 0 ) { mLoopCount = loopCount; } - if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) - { - if ( loopCount == 0 ) // Request to stop looping - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" ); - mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way - } - } DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount [%d] Status[%s]\n", mLoopCount, (loopCount)?"looping":"stop" ); } @@ -255,6 +247,41 @@ float TextScroller::GetLoopDelay() const return mLoopDelay; } +void TextScroller::SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode ) +{ + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetAutoScrollStopMode [%s]\n",(stopMode == DevelTextLabel::AutoScrollStopMode::IMMEDIATE)?"IMMEDIATE":"FINISH_LOOP" ); + mStopMode = stopMode; +} + +void TextScroller::StopScrolling() +{ + if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) + { + switch( mStopMode ) + { + case DevelTextLabel::AutoScrollStopMode::IMMEDIATE: + { + mScrollAnimation.Stop(); + break; + } + case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP: + { + mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way + break; + } + default: + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" ); + } + } + } +} + +DevelTextLabel::AutoScrollStopMode::Type TextScroller::GetStopMode() const +{ + return mStopMode; +} + Actor TextScroller::GetSourceCamera() const { return mOffscreenCameraActor; @@ -270,7 +297,8 @@ TextScroller::TextScroller( ScrollerInterface& scrollerInterface ) : mScrollerIn mScrollSpeed( MINIMUM_SCROLL_SPEED ), mLoopCount( 1 ), mLoopDelay( 0.0f ), - mWrapGap( 0.0f ) + mWrapGap( 0.0f ), + mStopMode( DevelTextLabel::AutoScrollStopMode::FINISH_LOOP ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller Default Constructor\n" ); }