Adds transition effect
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / transition / transition-lifecycle-controller.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TRANSITION_PLAYLIST_H
2 #define DALI_TOOLKIT_INTERNAL_TRANSITION_PLAYLIST_H
3
4 /*
5  * Copyright (c) 2021 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 <cstdio>
23 #include <memory>
24 #include <mutex>
25 #include <vector>
26
27 // INTERNAL INCLUDES
28 #include <dali-toolkit/public-api/transition/transition-set.h>
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal
35 {
36 class TransitionLifecycleController;
37
38 namespace
39 {
40 std::unique_ptr<TransitionLifecycleController> instance = nullptr;
41 std::once_flag                                 onceFlag;
42 } // namespace
43
44 class TransitionLifecycleController : public ConnectionTracker
45 {
46 public:
47   static TransitionLifecycleController& GetInstance()
48   {
49     std::call_once(onceFlag, []() {
50       instance.reset(new TransitionLifecycleController);
51     });
52     return *(instance.get());
53   }
54
55   void AddTransitions(Dali::Toolkit::TransitionSet transitions);
56
57 private:
58
59   void RemoveTransitions(Dali::Toolkit::TransitionSet &transitions);
60
61   /**
62    * Construct a new TransitionLifecycleController.
63    */
64   TransitionLifecycleController() = default;
65
66   // Undefined
67   TransitionLifecycleController(const TransitionLifecycleController&) = delete;
68
69   // Undefined
70   TransitionLifecycleController& operator=(const TransitionLifecycleController& rhs) = delete;
71
72 private:
73   std::vector<Dali::Toolkit::TransitionSet> mTransitionList;
74 };
75
76 } // namespace Internal
77
78 } // namespace Toolkit
79
80 } // namespace Dali
81
82 #endif // DALI_TOOLKIT_INTERNAL_TRANSITION_PLAYLIST_H
83 ;