{
if(impl.mTextScroller)
{
- impl.mTextScroller->StopScrolling();
+ impl.mTextScroller->StopScrolling(false);
}
}
// If request is enable (true) then start autoscroll as not already running
}
}
+void TextLabel::OnSceneConnection(int depth)
+{
+ if(mController->IsAutoScrollEnabled() || mLastAutoScrollEnabled)
+ {
+ mController->SetAutoScrollEnabled(true);
+ }
+ Control::OnSceneConnection(depth);
+}
+
+void TextLabel::OnSceneDisconnection()
+{
+ if(mTextScroller)
+ {
+ mLastAutoScrollEnabled = mController->IsAutoScrollEnabled();
+ mTextScroller->StopScrolling(true);
+ }
+ Control::OnSceneDisconnection();
+}
+
void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::OnRelayout\n");
TextLabel::TextLabel()
: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
mRenderingBackend(DEFAULT_RENDERING_BACKEND),
- mTextUpdateNeeded(false)
+ mTextUpdateNeeded(false),
+ mLastAutoScrollEnabled(false)
{
}
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
*/
void OnPropertySet(Property::Index index, const Property::Value& propertyValue) override;
+ /**
+ * @copydoc Control::OnSceneConnection()
+ */
+ void OnSceneConnection(int depth) override;
+
+ /**
+ * @copydoc Control::OnSceneDisconnection()
+ */
+ void OnSceneDisconnection() override;
+
// From ControlInterface
/**
int mRenderingBackend;
bool mTextUpdateNeeded : 1;
+ bool mLastAutoScrollEnabled : 1;
protected:
/**
mStopMode = stopMode;
}
-void TextScroller::StopScrolling()
+void TextScroller::StopScrolling(bool immediate)
{
if(mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING)
{
- switch(mStopMode)
+ if(mStopMode == TextLabel::AutoScrollStopMode::IMMEDIATE || immediate)
{
- case TextLabel::AutoScrollStopMode::IMMEDIATE:
- {
- mScrollAnimation.Stop();
- mScrollerInterface.ScrollingFinished();
- break;
- }
- case TextLabel::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");
- }
+ mScrollAnimation.Stop();
+ mScrollerInterface.ScrollingFinished();
+ }
+ else if(mStopMode == TextLabel::AutoScrollStopMode::FINISH_LOOP)
+ {
+ mScrollAnimation.SetLoopCount(1); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way
+ }
+ else
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n");
}
}
else
/**
* @brief Stop the auto scrolling.
+ * @param[in] immediate Stop scrolling immediately.
*/
- void StopScrolling();
+ void StopScrolling(bool immediate);
/**
* @brief Get the mode of scrolling stop