remove (dead) ImageView UI control
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-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) 2014 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 class DALI_IMPORT_API CubeTransitionEffect : public BaseHandle
78 {
79 public:
80
81   /**
82    * Create an uninitialized CubeTransitionEffect;
83    * this can be initialized by New function of its subclass
84    */
85   CubeTransitionEffect();
86
87   /**
88    * Destructor
89    */
90   ~CubeTransitionEffect();
91
92   /**
93    * Set the duration of transition animation
94    * @param[in] duration The duration of transition animation
95    */
96   void SetTransitionDuration( float duration );
97
98   /**
99    * Get the duration of transition animation
100    * @return duration The duration of transition animation
101    */
102   float GetTransitionDuration() const;
103
104   /**
105    * Set the displacement of bouncing animation during cube's rotation
106    * @param[in] displacement The displacement of bouncing animation
107    */
108   void SetCubeDisplacement( float displacement );
109
110   /**
111    * Getet the displacement of bouncing animation during cube's rotation
112    * @return displacement The displacement of bouncing animation
113    */
114   float GetCubeDisplacement() const;
115
116   /**
117    * Return the transition effect root actor, should then be added to stage
118    * @return The transition effect root actor
119    */
120   Actor GetRoot();
121
122   /**
123    * Return the transition status
124    * @return True if the transition is under processing; false if finished
125    */
126   bool IsTransiting();
127
128   /**
129    * Set the current image to transite from
130    * if using this same effect continuely, only need to set once
131    * @param[in] imageActor The current imageActor
132    */
133   void SetCurrentImage(ImageActor imageActor);
134
135   /**
136    * Set the target image to transit to
137    * @param[in] imageActor The new imageActor showing on stage
138    */
139   void SetTargetImage(ImageActor imageActor);
140
141   /**
142    * Activate the transition animation with horizontally left/right panGesture
143    * @pre target image is set
144    * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
145    */
146   void StartTransition( bool toNextImage = true );
147
148   /**
149    * Activate the transition animation with specified panGesture
150    * @pre target image is set
151    * @param[in] panPosition The press down position of panGesture
152    * @param[in] panDisplacement The displacement vector of panGesture
153    */
154   void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
155
156   /**
157    * Pause the transition animation.
158    * It does nothing if the animation is not running.
159    */
160   void PauseTransition();
161
162   /**
163    * Re-Activate the transition animation after it is paused by calling PauseTransition().
164    * It does nothing in other cases.
165    */
166   void ResumeTransition();
167
168   /**
169    * Inactivate the transition animation if it is running.
170    * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
171    * It does nothing if the animation is not running.
172    */
173   void StopTransition();
174
175 public: //Signal
176
177   //signal name
178   static const char* const SIGNAL_TRANSITION_COMPLETED;
179
180   //Transition animation completed signal
181   typedef Signal< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalType;
182
183   /**
184    * Signal emitted when the transition has completed animation
185    * A callback of the following type may be connected
186    * @code
187    *   void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
188    * @endcode
189    * @return The Signal to connect to.
190    */
191   TransitionCompletedSignalType& TransitionCompletedSignal();
192
193 public: // Not intended for developer use
194
195   explicit DALI_INTERNAL CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
196
197 }; //class CubeTransitionEffect
198
199 } // namespace Toolkit
200
201 } // namespace Dali
202
203 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */