(ItemLayout) Remove redundant GetResizeAnimation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / transition-effects / cube-transition-effect.h
1 #ifndef __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
2 #define __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/actors/image-actor.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33
34 /**
35  * CubeTransitionEffect implementation class
36  */
37 class CubeTransitionEffect;
38
39 } // namespace Internal
40
41 /**
42  * CubeTransitionEffect is a base class of custom transition effect on Image actors
43  * The two images are partitioned into tiles and serves as two perpendicular faces of cubes
44  * By rotating these cubes to transit from one image to another
45  *
46  * Usage example:
47  *
48  * @code
49  *
50  * //create a new CubeTransitionEffect
51  * //use the New funtion of subclass ( CubeTransitionWaveEffect or CubeTransitionCrossEffect )
52  * CubeTransitionEffect cubeEffect = CubeTransitionWaveEffect::New(numRows, numColumns, viewAreaSize);
53  *
54  * //set the duration of transition animation
55  * cubeEffect.SetTransitionDuration( animationDuration );
56  *
57  * //set the displacement of bouncing movement during cube's rotation
58  * cubeEffect.SetCubeDisplacement( cubeDisplacement  );
59  *
60  * // Add to stage
61  * stage.Add( cubeEffect.GetRoot() );
62  *
63  * // Set the current image,
64  * // only need to set at beginning or when the current image was transited to with no effect or other effect
65  * cubeEffect.SetCurrentImage( firstImageActor );
66  *
67  * // Set target image, paired with startTransition. These two steps would be repeated as needed
68  * cubeEffect.SetTargetimage( secondImageActor );
69  * // Activate the effect
70  * //   no param / param ture: default horizontally left panGesture
71  * //   or param false:  default horizontally right panGesture
72  * //   or params position & displacement: specified the panGesture
73  * cubeEffect.StartTransition( );
74  *
75  * @endcode
76  *
77  * Signals
78  * | %Signal Name         | Method                           |
79  * |----------------------|----------------------------------|
80  * | transition-completed | @ref TransitionCompletedSignal() |
81  */
82 class DALI_IMPORT_API CubeTransitionEffect : public BaseHandle
83 {
84 public:
85
86   /**
87    * Create an uninitialized CubeTransitionEffect;
88    * this can be initialized by New function of its subclass
89    */
90   CubeTransitionEffect();
91
92   /**
93    * Destructor
94    */
95   ~CubeTransitionEffect();
96
97   /**
98    * @brief Downcast an Object handle to a CubeTransitionEffect handle.
99    *
100    * If handle points to a CubeTransitionEffect object the downcast produces
101    * a valid handle. If not the returned handle is left uninitialized.
102    *
103    * @param[in] handle A handle to an object
104    * @return A handle to a CubeTransitionEffect object or an uninitialized handle
105    */
106   static CubeTransitionEffect DownCast( BaseHandle handle );
107
108   /**
109    * Set the duration of transition animation
110    * @param[in] duration The duration of transition animation
111    */
112   void SetTransitionDuration( float duration );
113
114   /**
115    * Get the duration of transition animation
116    * @return duration The duration of transition animation
117    */
118   float GetTransitionDuration() const;
119
120   /**
121    * Set the displacement of bouncing animation during cube's rotation
122    * @param[in] displacement The displacement of bouncing animation
123    */
124   void SetCubeDisplacement( float displacement );
125
126   /**
127    * Getet the displacement of bouncing animation during cube's rotation
128    * @return displacement The displacement of bouncing animation
129    */
130   float GetCubeDisplacement() const;
131
132   /**
133    * Return the transition effect root actor, should then be added to stage
134    * @return The transition effect root actor
135    */
136   Actor GetRoot();
137
138   /**
139    * Return the transition status
140    * @return True if the transition is under processing; false if finished
141    */
142   bool IsTransiting();
143
144   /**
145    * Set the current image to transite from
146    * if using this same effect continuely, only need to set once
147    * @param[in] imageActor The current imageActor
148    */
149   void SetCurrentImage(ImageActor imageActor);
150
151   /**
152    * Set the target image to transit to
153    * @param[in] imageActor The new imageActor showing on stage
154    */
155   void SetTargetImage(ImageActor imageActor);
156
157   /**
158    * Activate the transition animation with horizontally left/right panGesture
159    * @pre target image is set
160    * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
161    */
162   void StartTransition( bool toNextImage = true );
163
164   /**
165    * Activate the transition animation with specified panGesture
166    * @pre target image is set
167    * @param[in] panPosition The press down position of panGesture
168    * @param[in] panDisplacement The displacement vector of panGesture
169    */
170   void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
171
172   /**
173    * Pause the transition animation.
174    * It does nothing if the animation is not running.
175    */
176   void PauseTransition();
177
178   /**
179    * Re-Activate the transition animation after it is paused by calling PauseTransition().
180    * It does nothing in other cases.
181    */
182   void ResumeTransition();
183
184   /**
185    * Inactivate the transition animation if it is running.
186    * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
187    * It does nothing if the animation is not running.
188    */
189   void StopTransition();
190
191 public: //Signal
192
193   //Transition animation completed signal
194   typedef Signal< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalType;
195
196   /**
197    * Signal emitted when the transition has completed animation
198    * A callback of the following type may be connected
199    * @code
200    *   void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
201    * @endcode
202    * @return The Signal to connect to.
203    */
204   TransitionCompletedSignalType& TransitionCompletedSignal();
205
206 public: // Not intended for developer use
207
208   explicit DALI_INTERNAL CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
209
210 }; //class CubeTransitionEffect
211
212 } // namespace Toolkit
213
214 } // namespace Dali
215
216 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */