1 #ifndef DALI_INTERNAL_ANIMATION_PLAYLIST_H
2 #define DALI_INTERNAL_ANIMATION_PLAYLIST_H
5 * Copyright (c) 2019 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 <dali/public-api/animation/animation.h>
23 #include <dali/public-api/common/dali-vector.h>
24 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali/internal/common/message.h>
26 #include <dali/internal/event/common/complete-notification-interface.h>
27 #include <dali/internal/update/animation/scene-graph-animation.h>
38 * AnimationPlaylist provides notifications to applications when animations are finished.
39 * It reference-counts playing animations, to allow "fire and forget" behaviour.
41 class AnimationPlaylist : public CompleteNotificationInterface
46 * Create an AnimationPlaylist.
47 * @return A newly allocated animation playlist.
49 static AnimationPlaylist* New();
54 virtual ~AnimationPlaylist();
57 * Called when an animation is constructed.
59 void AnimationCreated( Animation& animation );
62 * Called when an animation is destroyed.
64 void AnimationDestroyed( Animation& animation );
67 * Called when an animation is playing.
68 * @post The animation will be referenced by AnimationPlaylist, until the "Finished" signal is emitted.
70 void OnPlay( Animation& animation );
73 * Called when an animation is cleared.
74 * @post The animation will no longer be referenced by AnimationPlaylist.
76 void OnClear( Animation& animation );
79 * @brief Notify that an animation has reached a progress marker
80 * @param[in] sceneGraphAnimation scene graph animation that has reached progress
82 void NotifyProgressReached( const SceneGraph::Animation* sceneGraphAnimation );
87 * Create an AnimationPlaylist.
92 AnimationPlaylist(const AnimationPlaylist&);
95 AnimationPlaylist& operator=(const AnimationPlaylist& rhs);
97 private: // from CompleteNotificationInterface
100 * @copydoc CompleteNotificationInterface::NotifyCompleted()
102 virtual void NotifyCompleted();
106 Dali::Vector< Animation* > mAnimations; ///< All existing animations (not owned)
107 std::vector< Dali::Animation > mPlaylist; ///< The currently playing animations (owned through handle)
112 * Called when an animation reaches a progress marker
114 * Note animationPlaylist is of type CompleteNotificationInterface because of updateManager only knowing about the interface not actual playlist
116 inline MessageBase* NotifyProgressReachedMessage( CompleteNotificationInterface& animationPlaylist, const SceneGraph::Animation* animation )
118 return new MessageValue1< AnimationPlaylist, const SceneGraph::Animation* >( static_cast<AnimationPlaylist*>(&animationPlaylist), &AnimationPlaylist::NotifyProgressReached, animation );
121 } // namespace Internal
125 #endif // DALI_INTERNAL_ANIMATION_PLAYLIST_H