[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-vector-image / vector-animation-manager.h
1 #ifndef DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
2 #define DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H
3
4 /*
5  * Copyright (c) 2024 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 <dali/integration-api/ordered-set.h>
23 #include <dali/integration-api/processor-interface.h>
24 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali/public-api/signals/callback.h>
26 #include <memory>
27
28 // INTERNAL INCLUDES
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal
35 {
36 class VectorAnimationThread;
37
38 /**
39  * @brief Vector animation manager
40  */
41 class VectorAnimationManager : public Integration::Processor
42 {
43 public:
44   /**
45    * @brief Constructor.
46    */
47   VectorAnimationManager();
48
49   /**
50    * @brief Destructor.
51    */
52   ~VectorAnimationManager() override;
53
54   /**
55    * Get the vector animation thread.
56    * @return A raw pointer pointing to the vector animation thread.
57    */
58   VectorAnimationThread& GetVectorAnimationThread();
59
60   /**
61    * @brief Register a callback.
62    *
63    * @param callback The callback to register
64    * @note Ownership of the callback is passed onto this class.
65    */
66   void RegisterEventCallback(CallbackBase* callback);
67
68   /**
69    * @brief Unregister a previously registered callback
70    *
71    * @param callback The callback to unregister
72    */
73   void UnregisterEventCallback(CallbackBase* callback);
74
75 protected: // Implementation of Processor
76   /**
77    * @copydoc Dali::Integration::Processor::Process()
78    */
79   void Process(bool postProcessor) override;
80
81   /**
82    * @copydoc Dali::Integration::Processor::GetProcessorName()
83    */
84   std::string_view GetProcessorName() const override
85   {
86     return "VectorAnimationManager";
87   }
88
89 private:
90   // Undefined
91   VectorAnimationManager(const VectorAnimationManager& manager) = delete;
92
93   // Undefined
94   VectorAnimationManager& operator=(const VectorAnimationManager& manager) = delete;
95
96 private:
97   Dali::Integration::OrderedSet<CallbackBase> mEventCallbacks; ///< Event triggered callback lists (owned)
98
99   std::unique_ptr<VectorAnimationThread> mVectorAnimationThread;
100   bool                                   mProcessorRegistered : 1;
101 };
102
103 } // namespace Internal
104
105 } // namespace Toolkit
106
107 } // namespace Dali
108
109 #endif // DALI_TOOLKIT_INTERNAL_VECTOR_ANIMATION_MANAGER_H