1 #ifndef DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
2 #define DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
5 * Copyright (c) 2021 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/actor.h>
23 #include <dali/public-api/animation/animation.h>
33 class TextVerticalScroller;
35 typedef IntrusivePtr<TextVerticalScroller> TextVerticalScrollerPtr;
38 * @brief A helper class for scrolling text vertically
40 class TextVerticalScroller : public RefObject, public ConnectionTracker
44 * @brief Text Scrolling helper, used to automatically scroll text, StartScroll should be called when scrolling is needed.
47 static TextVerticalScrollerPtr New();
50 * @brief variables required to set up scrolling animation
51 * @param[in] sourceActor actor to be animated
52 * @param[in] x The new x position
53 * @param[in] y The new y position
54 * @param[in] scrollAmount The distance to destination y position for actor to be animated
56 void CheckStartAnimation(Actor& sourceActor, float x, float y, float scrollAmount);
59 * @brief Set duration the text should scroll
60 * @param[in] duration The duration in seconds
62 void SetDuration(float duration);
64 private: // Implementation
68 TextVerticalScroller();
71 * @brief Virtual Destructor.
73 virtual ~TextVerticalScroller();
76 Animation mScrollAnimation; // Animation used to update the actor's position
77 Actor mScrollingActor; // The actor being animated
78 float mDuration; // The duration of text scrolling
79 float mScrollTo; // The destination y position
80 }; // TextVerticalScroller class
84 } // namespace Toolkit
88 #endif // DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H