Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / animation-playlist.h
1 #ifndef __DALI_INTERNAL_ANIMATION_PLAYLIST_H__
2 #define __DALI_INTERNAL_ANIMATION_PLAYLIST_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/common/set-wrapper.h>
23 #include <dali/internal/common/message.h>
24 #include <dali/internal/event/animation/animation-finished-notifier.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class Animation;
33
34 /**
35  * AnimationPlaylist provides notifications to applications when animations are finished.
36  * It reference-counts playing animations, to allow "fire and forget" behaviour.
37  */
38 class AnimationPlaylist : public AnimationFinishedNotifier
39 {
40 public:
41
42   /**
43    * Create an AnimationPlaylist.
44    * @return A newly allocated animation playlist.
45    */
46   static AnimationPlaylist* New();
47
48   /**
49    * Virtual destructor.
50    */
51   virtual ~AnimationPlaylist();
52
53   /**
54    * Called when an animation is constructed.
55    */
56   void AnimationCreated( Animation& animation );
57
58   /**
59    * Called when an animation is destroyed.
60    */
61   void AnimationDestroyed( Animation& animation );
62
63   /**
64    * Called when an animation is playing.
65    * @post The animation will be referenced by AnimationPlaylist, until the "Finished" signal is emitted.
66    */
67   void OnPlay( Animation& animation );
68
69   /**
70    * Called when an animation is cleared.
71    * @post The animation will no longer be referenced by AnimationPlaylist.
72    */
73   void OnClear( Animation& animation );
74
75   /**
76    * From AnimationFinishedNotifier; emit "Finished" signal on any animations that have finished.
77    * This method should be called in the event-thread; the update-thread must use AnimationFinishedMessage.
78    * @post The "Finished" animations will no longer be referenced by AnimationPlaylist.
79    */
80   void NotifyFinishedAnimations();
81
82 private:
83
84   /**
85    * Create an AnimationPlaylist.
86    */
87   AnimationPlaylist();
88
89   // Undefined
90   AnimationPlaylist(const AnimationPlaylist&);
91
92   // Undefined
93   AnimationPlaylist& operator=(const AnimationPlaylist& rhs);
94
95 private:
96
97   std::set< Animation* > mAnimations; ///< All existing animations (not referenced)
98
99   std::set< Dali::Animation > mPlaylist; ///< The currently playing animations (reference counted)
100 };
101
102 } // namespace Internal
103
104 } // namespace Dali
105
106 #endif // __DALI_INTERNAL_NOTIFICATION_MANAGER_H__
107