1 #ifndef __DALI_TOOLKIT_TEXT_SCROLLER_H__
2 #define __DALI_TOOLKIT_TEXT_SCROLLER_H__
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/actors/camera-actor.h>
23 #include <dali/public-api/animation/animation.h>
24 #include <dali/public-api/render-tasks/render-task.h>
27 #include <dali-toolkit/internal/text/text-definitions.h>
39 class ScrollerInterface;
42 typedef IntrusivePtr<TextScroller> TextScrollerPtr;
45 * @brief A helper class for scrolling text
47 class TextScroller : public RefObject, public ConnectionTracker
51 * @brief Text Scrolling helper, used to automatically scroll text, SetParameters should be called before scrolling is needed.
52 * CleanUp removes the Scrolling actors from stage whilst keeping the Scroller object alive and preserving Speed, Gap and Loop count.
54 * @param[in] scrollerInterface scroller interface
56 static TextScrollerPtr New( ScrollerInterface& scrollerInterface );
59 * @brief Starts the text scrolling.
61 * @param[in] sourceActor source actor to be scrolled
62 * @param[in] data Parameters needed to set up the text scrolling.
65 void StartScrolling( Actor sourceActor,
66 const ScrollerData& data );
69 * @brief Stops the text scrolling.
74 * @brief Get the camera used to look at source, should be added to the parent of target actor.
75 * @return camera Actor
77 Actor GetSourceCamera() const;
80 * @brief Get the resulting scrolling text actor, add to target actor which will show scrolling text
83 Actor GetScrollingText() const;
85 private: // Implementation
90 TextScroller( ScrollerInterface& scrollerInterface );
98 TextScroller( const TextScroller& handle );
101 TextScroller& operator=( const TextScroller& handle );
104 * @brief Callback for end of animation
105 * @param[in] animation Animation handle
107 void AutoScrollAnimationFinished( Dali::Animation& animation );
110 * @brief When scrolling ended, the actors are cleaned up so no longer staged.
116 RenderTask mRenderTask; // Renders full text to a FrameBuffer which is then scrolled.
117 CameraActor mOffscreenCameraActor; // Camera used by render task
118 Actor mScrollingTextActor; // Actor used to show scrolling text
119 ScrollerInterface& mScrollerInterface; // Interface implemented by control that requires scrolling
120 Property::Index mScrollDeltaIndex; // Property used by shader to represent distance to scroll
121 Animation mScrollAnimation; // Animation used to update the mScrollDeltaIndex
123 }; // TextScroller class
127 } // namespace Toolkit
131 #endif // __DALI_TOOLKIT_TEXT_SCROLLER_H__