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 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 <boost/function.hpp>
25 #include <dali/dali.h>
27 namespace Dali DALI_IMPORT_API
33 namespace Internal DALI_INTERNAL
37 * CubeTransitionEffect implementation class
39 class CubeTransitionEffect;
41 } // namespace Internal
44 * CubeTransitionEffect is a base class of custom transition effect on Image actors
45 * The two images are partitioned into tiles and serves as two perpendicular faces of cubes
46 * By rotating these cubes to transit from one image to another
52 * //create a new CubeTransitionEffect
53 * //use the New funtion of subclass ( CubeTransitionWaveEffect or CubeTransitionCrossEffect )
54 * CubeTransitionEffect cubeEffect = CubeTransitionWaveEffect::New(numRows, numColumns, viewAreaSize);
56 * //set the duration of transition animation
57 * cubeEffect.SetTransitionDuration( animationDuration );
59 * //set the displacement of bouncing movement during cube's rotation
60 * cubeEffect.SetCubeDisplacement( cubeDisplacement );
63 * stage.Add( cubeEffect.GetRoot() );
65 * // Set the current image,
66 * // only need to set at beginning or when the current image was transited to with no effect or other effect
67 * cubeEffect.SetCurrentImage( firstImageActor );
69 * // Set target image, paired with startTransition. These two steps would be repeated as needed
70 * cubeEffect.SetTargetimage( secondImageActor );
71 * // Activate the effect
72 * // no param / param ture: default horizontally left panGesture
73 * // or param false: default horizontally right panGesture
74 * // or params position & displacement: specified the panGesture
75 * cubeEffect.StartTransition( );
79 class CubeTransitionEffect : public BaseHandle
84 * Create an uninitialized CubeTransitionEffect;
85 * this can be initialized by New function of its subclass
87 CubeTransitionEffect();
92 ~CubeTransitionEffect();
95 * Set the duration of transition animation
96 * @param[in] duration The duration of transition animation
98 void SetTransitionDuration( float duration );
101 * Get the duration of transition animation
102 * @return duration The duration of transition animation
104 float GetTransitionDuration() const;
107 * Set the displacement of bouncing animation during cube's rotation
108 * @param[in] displacement The displacement of bouncing animation
110 void SetCubeDisplacement( float displacement );
113 * Getet the displacement of bouncing animation during cube's rotation
114 * @return displacement The displacement of bouncing animation
116 float GetCubeDisplacement() const;
119 * Return the transition effect root actor, should then be added to stage
120 * @return The transition effect root actor
125 * Return the transition status
126 * @return True if the transition is under processing; false if finished
131 * Set the current image to transite from
132 * if using this same effect continuely, only need to set once
133 * @param[in] imageActor The current imageActor
135 void SetCurrentImage(ImageActor imageActor);
138 * Set the target image to transit to
139 * @param[in] imageActor The new imageActor showing on stage
141 void SetTargetImage(ImageActor imageActor);
144 * Activate the transition animation with horizontally left/right panGesture
145 * @pre target image is set
146 * @param[in] toNextImage Horizontally left panGesture if ture, horizontally right if false
148 void StartTransition( bool toNextImage = true );
151 * Activate the transition animation with specified panGesture
152 * @pre target image is set
153 * @param[in] panPosition The press down position of panGesture
154 * @param[in] panDisplacement The displacement vector of panGesture
156 void StartTransition( Vector2 panPosition, Vector2 panDisplacement );
159 * Pause the transition animation.
160 * It does nothing if the animation is not running.
162 void PauseTransition();
165 * Re-Activate the transition animation after it is paused by calling PauseTransition().
166 * It does nothing in other cases.
168 void ResumeTransition();
171 * Inactivate the transition animation if it is running.
172 * Also set the rotation and position of cubes, colors of tile to the same as the final state when the animation if finished completely
173 * It does nothing if the animation is not running.
175 void StopTransition();
180 static const char* const SIGNAL_TRANSITION_COMPLETED;
182 //Transition animation completed signal
183 typedef SignalV2< void ( CubeTransitionEffect, ImageActor ) > TransitionCompletedSignalV2;
186 * Signal emitted when the transition has completed animation
187 * A callback of the following type may be connected
189 * void YourCallbackName( CubeTransitionEffect cubeEffect, ImageActor currentImage );
191 * @return The Signal to connect to.
193 TransitionCompletedSignalV2& TransitionCompletedSignal();
195 public: // Not intended for developer use
197 CubeTransitionEffect( Internal::CubeTransitionEffect* impl );
199 }; //class CubeTransitionEffect
201 } // namespace Toolkit
205 #endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */