1 #ifndef __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
2 #define __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 #include <boost/function.hpp>
24 #include <dali/dali.h>
26 namespace Dali DALI_IMPORT_API
32 namespace Internal DALI_INTERNAL
36 * CubeTransitionEffect implementation class
38 class CubeTransitionEffect;
40 } // namespace Internal
43 * CubeTransitionEffect is a base class of custom transition effect on Image actors
44 * The two images are partitioned into tiles and serves as two perpendicular faces of cubes
45 * By rotating these cubes to transit from one image to another
51 * //create a new CubeTransitionEffect
52 * //use the New funtion of subclass ( CubeTransitionWaveEffect or CubeTransitionCrossEffect )
53 * CubeTransitionEffect cubeEffect = CubeTransitionWaveEffect::New(numRows, numColumns, viewAreaSize);
55 * //set the duration of transition animation
56 * cubeEffect.SetTransitionDuration( animationDuration );
58 * //set the displacement of bouncing movement during cube's rotation
59 * cubeEffect.SetCubeDisplacement( cubeDisplacement );
62 * stage.Add( cubeEffect.GetRoot() );
64 * // Set the current image,
65 * // only need to set at beginning or when the current image was transited to with no effect or other effect
66 * cubeEffect.SetCurrentImage( firstImageActor );
68 * // Set target image, paired with startTransition. These two steps would be repeated as needed
69 * cubeEffect.SetTargetimage( secondImageActor );
70 * // Activate the effect
71 * // no param / param ture: default horizontally left panGesture
72 * // or param false: default horizontally right panGesture
73 * // or params position & displacement: specified the panGesture
74 * cubeEffect.StartTransition( );
78 class CubeTransitionEffect : public BaseHandle
83 * Create an uninitialized CubeTransitionEffect;
84 * this can be initialized by New function of its subclass
86 CubeTransitionEffect();
91 ~CubeTransitionEffect();
94 * Set the duration of transition animation
95 * @param[in] duration The duration of transition animation
97 void SetTransitionDuration( float duration );
100 * Get the duration of transition animation
101 * @return duration The duration of transition animation
103 float GetTransitionDuration() const;
106 * Set the displacement of bouncing animation during cube's rotation
107 * @param[in] displacement The displacement of bouncing animation
109 void SetCubeDisplacement( float displacement );
112 * Getet the displacement of bouncing animation during cube's rotation
113 * @return displacement The displacement of bouncing animation
115 float GetCubeDisplacement() const;
118 * Return the transition effect root actor, should then be added to stage
119 * @return The transition effect root actor
124 * Return the transition status
125 * @return True if the transition is under processing; false if finished
130 * Set the current image to transite from
131 * if using this same effect continuely, only need to set once
132 * @param[in] imageActor The current imageActor
134 void SetCurrentImage(ImageActor imageActor);
137 * Set the target image to transit to
138 * @param[in] imageActor The new imageActor showing on stage
140 void SetTargetImage(ImageActor imageActor);
143 * Activate the transition animation with horizontally left/right panGesture
144 * @pre target image is set
145 * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
147 void StartTransition( bool toNextImage = true );
150 * Activate the transition animation with specified panGesture
151 * @pre target image is set
152 * @param[in] panPosition The press down position of panGesture
153 * @param[in] panDisplacement The displacement vector of panGesture
155 void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
158 * Pause the transition animation.
159 * It does nothing if the animation is not running.
161 void PauseTransition();
164 * Re-Activate the transition animation after it is paused by calling PauseTransition().
165 * It does nothing in other cases.
167 void ResumeTransition();
170 * Inactivate the transition animation if it is running.
171 * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
172 * It does nothing if the animation is not running.
174 void StopTransition();
179 static const char* const SIGNAL_TRANSITION_COMPLETED;
181 //Transition animation completed signal
182 typedef SignalV2< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalV2;
185 * Signal emitted when the transition has completed animation
186 * A callback of the following type may be connected
188 * void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
190 * @return The Signal to connect to.
192 TransitionCompletedSignalV2& TransitionCompletedSignal();
194 public: // Not intended for developer use
196 CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
198 }; //class CubeTransitionEffect
200 } // namespace Toolkit
204 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */