DALi Version 1.4.20
[platform/core/uifw/dali-core.git] / dali / public-api / signals / signal-slot-observers.h
1 #ifndef __DALI_SIGNAL_SLOT_OBSERVERS_H__
2 #define __DALI_SIGNAL_SLOT_OBSERVERS_H__
3
4 /*
5  * Copyright (c) 2018 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/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26 /**
27  * @addtogroup dali_core_signals
28  * @{
29  */
30
31 class SlotObserver;
32 class CallbackBase;
33
34 /**
35  * @brief Abstract interface used by a signal to inform a slot it is disconnecting.
36  *
37  * This will happen if the object owning the signal is destroyed.
38  * @SINCE_1_0.0
39  */
40 class DALI_CORE_API SignalObserver
41 {
42 public:
43
44   /**
45    * @brief Constructor.
46    * @SINCE_1_0.0
47    */
48   SignalObserver();
49
50   /**
51    * @brief Virtual destructor.
52    * @SINCE_1_0.0
53    */
54   virtual ~SignalObserver();
55
56   /**
57    * @brief This method is called when the signal is disconnecting.
58    *
59    * @SINCE_1_0.0
60    * @param[in] slotObserver The signal that has disconnected
61    * @param[in] callback The callback attached to the signal disconnected
62    */
63   virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback ) = 0;
64 };
65
66 /**
67  * @brief Abstract Interface used by a slot to inform a signal it is disconnecting.
68  *
69  * This is used by the slot if wants to disconnect or is deleted.
70  * @SINCE_1_0.0
71  */
72 class DALI_CORE_API SlotObserver
73 {
74 public:
75
76   /**
77    * @brief Constructor.
78    * @SINCE_1_0.0
79    */
80   SlotObserver();
81
82   /**
83    * @brief Virtual destructor.
84    * @SINCE_1_0.0
85    */
86   virtual ~SlotObserver();
87
88   /**
89    * @brief This method is called when the slot is disconnecting.
90    *
91    * @SINCE_1_0.0
92    * @param[in] callback The callback attached to the signal disconnected
93    */
94   virtual void SlotDisconnected( CallbackBase* callback ) = 0;
95 };
96
97 /**
98  * @}
99  */
100 } // namespace Dali
101
102 #endif // __DALI_SIGNAL_SLOT_OBSERVERS_H__