Move mItemsDirtyRects from Scene to SceneGraph::Scene
[platform/core/uifw/dali-core.git] / dali / internal / event / common / base-object-impl.h
1 #ifndef DALI_BASE_OBJECT_IMPL_H
2 #define DALI_BASE_OBJECT_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 namespace Dali
25 {
26 /**
27  * @brief Holds the Implementation for the BaseObject class
28  */
29 class BaseObject::Impl
30 {
31 public:
32   /**
33    * @brief Retrieves the implementation of the internal BaseObject class.
34    * @param[in] internalBaseObject A ref to the BaseObject whose internal implementation is required
35    * @return The internal implementation
36    */
37   static BaseObject::Impl& Get(BaseObject& baseObject);
38
39   /**
40    * @copydoc Get( BaseObject& )
41    */
42   static const BaseObject::Impl& Get(const BaseObject& baseObject);
43
44   /**
45    * @brief Constructor.
46    * @param[in] baseObject The base object which owns this implementation
47    */
48   Impl(BaseObject& baseObject);
49
50   /**
51    * @brief Destructor.
52    */
53   ~Impl();
54
55   class Observer
56   {
57   public:
58     /**
59      * Called shortly before the object itself is destroyed; no further callbacks will be received.
60      * @param[in] object The base object.
61      */
62     virtual void ObjectDestroyed(BaseObject& object) = 0;
63
64   protected:
65     /**
66      * Virtual destructor
67      */
68     virtual ~Observer() = default;
69   };
70
71   /**
72    * Add an observer to the object.
73    * @param[in] observer The observer to add.
74    */
75   void AddObserver(Observer& observer);
76
77   /**
78    * Remove an observer from the object
79    * @pre The observer has already been added.
80    * @param[in] observer The observer to remove.
81    */
82   void RemoveObserver(Observer& observer);
83
84 private:
85   BaseObject&             mBaseObject;
86   Dali::Vector<Observer*> mObservers;
87 };
88
89 } // namespace Dali
90
91 #endif // DALI_BASE_OBJECT_IMPL_H