Revert "[Tizen] Not execute the remove callback"
[platform/core/uifw/dali-core.git] / dali / internal / event / update / frame-callback-interface-impl.h
1 #ifndef DALI_FRAME_CALLBACK_INTERFACE_IMPL_H
2 #define DALI_FRAME_CALLBACK_INTERFACE_IMPL_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 // INTERNAL INCLUDES
22 #include <dali/devel-api/update/frame-callback-interface.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace SceneGraph
29 {
30 class FrameCallback;
31 }
32 } // namespace Internal
33
34 /**
35  * The Implementation of the FrameCallbackInterface
36  * @see FrameCallbackInterface
37  */
38 class FrameCallbackInterface::Impl final
39 {
40 public:
41   Impl()  = default; ///< Default constructor.
42   ~Impl() = default; ///< Default non-virtual destructor.
43
44   /**
45    * Retrieve the Impl of a FrameCallbackInterface.
46    * @param[in]  frameCallback  The frame-callb
47    */
48   static inline Impl& Get(FrameCallbackInterface& frameCallback)
49   {
50     return *frameCallback.mImpl;
51   }
52
53   /**
54    * Links this FrameCallback to the given scene-graph-frame-callback.
55    * @param[in]  sceneGraphObject  The scene-graph-frame-callback to link this with.
56    */
57   void ConnectToSceneGraphObject(Internal::SceneGraph::FrameCallback& sceneGraphObject)
58   {
59     mSceneGraphFrameCallback = &sceneGraphObject;
60   }
61
62   /**
63    * Disconnects this FrameCallback from the scene-graph-frame-callback.
64    */
65   void DisconnectFromSceneGraphObject()
66   {
67     mSceneGraphFrameCallback = nullptr;
68   }
69
70   /**
71    * Checks whether we are connected to a scene-graph-frame-callback.
72    * @return True if connected, false otherwise.
73    */
74   bool IsConnectedToSceneGraph() const
75   {
76     return mSceneGraphFrameCallback;
77   }
78
79   /**
80    * Invalidates this FrameCallback and linked SceneGraph::FrameCallback.
81    */
82   void Invalidate()
83   {
84     if(mSceneGraphFrameCallback)
85     {
86       mSceneGraphFrameCallback->Invalidate();
87     }
88   }
89
90 private:
91   Internal::SceneGraph::FrameCallback* mSceneGraphFrameCallback{nullptr}; ///< Pointer to the scene-graph object, not owned.
92 };
93
94 } // namespace Dali
95
96 #endif // DALI_FRAME_CALLBACK_INTERFACE_IMPL_H