Add 'ExclusiveArch: armv7l' limit build to arm architecture
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-wobble-effect-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_EFFECT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/animation/animation.h>
22 #include <dali/public-api/animation/alpha-functions.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/public-api/object/ref-object.h>
25 #include <dali/public-api/actors/custom-actor.h>
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-wobble-effect.h>
29
30 namespace Dali
31 {
32
33 class Animation;
34
35 namespace Toolkit
36 {
37
38 class ScrollView;
39
40 namespace Internal
41 {
42
43 class ScrollViewEffect;
44
45 /**
46  * @copydoc Toolkit::ScrollViewWobbleEffect
47  */
48 class ScrollViewWobbleEffect : public ScrollViewEffect
49 {
50
51 public:
52
53   /**
54    * Constructor
55    */
56   ScrollViewWobbleEffect();
57
58   /**
59    * Increases the Stable Count (when this reaches mStableTotal)
60    * Then all constraints are stable, and the animation can stop.
61    */
62   void IncrementStableCount();
63
64   /**
65    * Returns animation cycle id. Every time a new animation starts
66    * this cycle id is increased.
67    *
68    * @return The Animation Cycle id is returned.
69    */
70   unsigned int GetAnimationCycleId() const;
71
72 public:
73
74   /**
75    * @copydoc ScrollViewEffect::OnAttach
76    */
77   virtual void OnAttach(Toolkit::ScrollView& scrollView);
78
79   /**
80    * @copydoc ScrollViewEffect::OnDetach
81    */
82   virtual void OnDetach(Toolkit::ScrollView& scrollView);
83
84 protected:
85
86   /**
87    * A reference counted object may only be deleted by calling Unreference()
88    */
89   virtual ~ScrollViewWobbleEffect();
90
91 private:
92
93   /**
94    * Signal handler, called when the ScrollView starts to move
95    *
96    * @param[in] position The current scroll position
97    */
98   void OnScrollStart( const Vector3& position );
99
100   /**
101    * Signal handler, called when the ScrollView is moving
102    *
103    * @param[in] position The current scroll position
104    */
105   void OnScrollUpdate( const Vector3& position );
106
107   /**
108    * Signal handler, called when the ScrollView has completed movement
109    *
110    * @param[in] position The current scroll position
111    */
112   void OnScrollComplete( const Vector3& position );
113
114   /**
115    * Signal handler, called when the Wobble Effect animation has completed.
116    *
117    * @param[in] animation The animation.
118    */
119   void OnAnimationFinished( Animation& animation );
120
121   /**
122    * Attaches effect to Scroll Actor (ScrollView)
123    *
124    * Applies the same wobble effect to each Scroll Actor.
125    *
126    * @param[in] actor The attached Actor
127    */
128   void AttachActor(Actor actor);
129
130   /**
131    * Detaches effect from Scroll Actor (ScrollView)
132    *
133    * @param[in] actor The attached Actor
134    */
135   void DetachActor(Actor actor);
136
137   /**
138    * Continues Animation to time reaches endTime
139    *
140    * @param[in] endTime the target time to reach.
141    */
142   void ContinueAnimation(float endTime);
143
144 private:
145
146   Animation mAnimation;                         ///< Animation Timer to drive the wobble effect constraint.
147   Property::Index mPropertyTime;                ///< Time property used by wobble effect constraint to calculate timePassed.
148
149   int mStableCurrent;                           ///< Stability current - how many wobble constraints are not wobbling (or have neglible wobble).
150   unsigned int mAnimationCycleId;               ///< The start of each new animation cycle is a unique number.
151
152 };
153
154 } // namespace Internal
155
156 } // namespace Toolkit
157
158 } // namespace Dali
159
160 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_WOBBLE_EFFECT_H__