[dali_2.3.27] Merge branch 'devel/master'
[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) 2020 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    * @brief Constructor.
45    * @SINCE_1_0.0
46    */
47   SignalObserver();
48
49   /**
50    * @brief Virtual destructor.
51    * @SINCE_1_0.0
52    */
53   virtual ~SignalObserver();
54
55   /**
56    * @brief This method is called when the signal is disconnecting.
57    *
58    * @SINCE_1_0.0
59    * @param[in] slotObserver The signal that has disconnected
60    * @param[in] callback The callback attached to the signal disconnected
61    */
62   virtual void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback) = 0;
63 };
64
65 /**
66  * @brief Abstract Interface used by a slot to inform a signal it is disconnecting.
67  *
68  * This is used by the slot if wants to disconnect or is deleted.
69  * @SINCE_1_0.0
70  */
71 class DALI_CORE_API SlotObserver
72 {
73 public:
74   /**
75    * @brief Constructor.
76    * @SINCE_1_0.0
77    */
78   SlotObserver();
79
80   /**
81    * @brief Virtual destructor.
82    * @SINCE_1_0.0
83    */
84   virtual ~SlotObserver();
85
86   /**
87    * @brief This method is called when the slot is disconnecting.
88    *
89    * @SINCE_1_0.0
90    * @param[in] callback The callback attached to the signal disconnected
91    */
92   virtual void SlotDisconnected(CallbackBase* callback) = 0;
93 };
94
95 /**
96  * @}
97  */
98 } // namespace Dali
99
100 #endif // DALI_SIGNAL_SLOT_OBSERVERS_H