X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-scroller.h;h=b93c2d212cb13f1eb0a43ea8bdc6336b3ea3df52;hb=75fe6c4a2f784bd52ccf8eb16049317825338a6e;hp=a40be3f59678b63d6765e49ea82a102ba7a73851;hpb=07bdc775bf08ac2f53c8f6a3a8856077a299959b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-scroller.h b/dali-toolkit/internal/text/text-scroller.h index a40be3f..b93c2d2 100644 --- a/dali-toolkit/internal/text/text-scroller.h +++ b/dali-toolkit/internal/text/text-scroller.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_SCROLLER_H__ -#define __DALI_TOOLKIT_TEXT_SCROLLER_H__ +#ifndef DALI_TOOLKIT_TEXT_SCROLLER_H +#define DALI_TOOLKIT_TEXT_SCROLLER_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -22,22 +22,21 @@ #include #include #include +#include // INTERNAL INCLUDES #include +#include +#include namespace Dali { - namespace Toolkit { - namespace Text { - class TextScroller; class ScrollerInterface; -struct ScrollerData; typedef IntrusivePtr TextScrollerPtr; @@ -53,41 +52,93 @@ public: * * @param[in] scrollerInterface scroller interface */ - static TextScrollerPtr New( ScrollerInterface& scrollerInterface ); + static TextScrollerPtr New(ScrollerInterface& scrollerInterface); /** - * @brief Starts the text scrolling. - * - * @param[in] sourceActor source actor to be scrolled - * @param[in] data Parameters needed to set up the text scrolling. + * @brief Set parameters relating to source required for scrolling * + * @param[in] scrollingTextActor actor containing the text to be scrolled + * @param[in] renderer renderer to render the text + * @param[in] textureSet texture of the text to be scrolled + * @param[in] controlSize size of the control to scroll within + * @param[in] textureSize size of the texture + * @param[in] wrapGap The gap before scrolling wraps + * @param[in] direction text direction true for right to left text + * @param[in] horizontalAlignment horizontal alignment of the text + * @param[in] verticalAlignment vertical alignment of the text */ - void StartScrolling( Actor sourceActor, - const ScrollerData& data ); + void SetParameters(Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textureSize, const float wrapGap, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment); /** - * @brief Stops the text scrolling. + * @brief Set the gap distance to elapse before the text wraps around + * @param[in] gap distance to elapse */ - void StopScrolling(); + void SetGap(int gap); /** - * @brief Get the camera used to look at source, should be added to the parent of target actor. - * @return camera Actor + * @brief Get the distance before scrolling wraps + * @return gap distance to elapse */ - Actor GetSourceCamera() const; + int GetGap() const; /** - * @brief Get the resulting scrolling text actor, add to target actor which will show scrolling text - * @return mesh Actor + * @brief Set speed the text should scroll + * @param[in] scrollSpeed pixels per second */ - Actor GetScrollingText() const; + void SetSpeed(int scrollSpeed); -private: // Implementation + /** + * @brief Get the speed of text scrolling + * @return speed in pixels per second + */ + int GetSpeed() const; + + /** + * @brief Set the number of times the text scrolling should loop, can stop current scrolling by passing in 0; + * @param[in] loopCount number of times the scrolled text should loop, 0 to stop scrolling + */ + void SetLoopCount(int loopCount); + + /** + * @brief Get the number of loops + * @return int number of loops + */ + int GetLoopCount() const; + + /** + * @brief Set the delay time of scroll animation loop + * @param[in] float delay time seconds of loops + */ + void SetLoopDelay(float delay); /** + * @brief Get the delay time of scroll + * @return float delay time seconds of loops + */ + float GetLoopDelay() const; + + /** + * @brief Set the mode of scrolling stop + * @param[in] stopMode type when text scrolling is stoped. + */ + void SetStopMode(TextLabel::AutoScrollStopMode::Type stopMode); + + /** + * @brief Stop the auto scrolling. + */ + void StopScrolling(); + + /** + * @brief Get the mode of scrolling stop + * @return stopMode type when text scrolling is stoped. + */ + TextLabel::AutoScrollStopMode::Type GetStopMode() const; + +private: // Implementation + /** * Constructor */ - TextScroller( ScrollerInterface& scrollerInterface ); + TextScroller(ScrollerInterface& scrollerInterface); /** * Destructor @@ -95,30 +146,39 @@ private: // Implementation ~TextScroller(); // Undefined - TextScroller( const TextScroller& handle ); + TextScroller(const TextScroller& handle); // Undefined - TextScroller& operator=( const TextScroller& handle ); + TextScroller& operator=(const TextScroller& handle); /** * @brief Callback for end of animation * @param[in] animation Animation handle */ - void AutoScrollAnimationFinished( Dali::Animation& animation ); + void AutoScrollAnimationFinished(Dali::Animation& animation); /** - * @brief When scrolling ended, the actors are cleaned up so no longer staged. + * @brief variables required to set up scrolling animation + * @param[in] scrollingTextActor actor that shows scrolling text + * @param[in] scrollAmount distance to animate text for the given duration + * @param[in] scrollDuration duration of aninmation + * @param[in] loopCount number of times to loop the scrolling text */ - void CleanUp(); + void StartScrolling(Actor scrollingTextActor, float scrollAmount, float scrollDuration, int loopCount); private: - - RenderTask mRenderTask; // Renders full text to a FrameBuffer which is then scrolled. - CameraActor mOffscreenCameraActor; // Camera used by render task - Actor mScrollingTextActor; // Actor used to show scrolling text - ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling - Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll - Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex + ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling + Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll + Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex + Dali::Renderer mRenderer; // Renderer used to render the text + Shader mShader; // Shader originally used by the renderer while not scrolling + TextureSet mTextureSet; // Texture originally used by the renderer while not scrolling + + int mScrollSpeed; ///< Speed which text should automatically scroll at + int mLoopCount; ///< Number of time the text should scroll + float mLoopDelay; ///< Time delay of loop start + float mWrapGap; ///< Gap before text wraps around when scrolling + TextLabel::AutoScrollStopMode::Type mStopMode; ///< Stop mode of scrolling text, when loop count is 0. }; // TextScroller class @@ -128,5 +188,4 @@ private: } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_SCROLLER_H__ - +#endif // DALI_TOOLKIT_TEXT_SCROLLER_H