1 #ifndef __DALI_CONNECTION_TRACKER_INTERFACE_H__
2 #define __DALI_CONNECTION_TRACKER_INTERFACE_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/signals/signal-slot-observers.h>
28 * @addtogroup dali_core_signals
33 * @brief Interface used to track connections between signals and slots.
35 * Performs automatic connection and disconnection when either the slot or signal dies.
38 * class MyApp : public ConnectionTracker
40 * Button.ClickedSignal().Connect( this, &MyApp::OnPress );
44 * std::cout << "hello world" << std::endl;
49 * When MyApp is destroyed, it automatically disconnects from Button.ClickSignal.
50 * It provides a signal observer interface, to observer when signals are destroyed
51 * e.g. if Button object is destroyed while it is still connected.
54 class DALI_CORE_API ConnectionTrackerInterface : public SignalObserver
62 ConnectionTrackerInterface();
65 * @brief Virtual destructor.
68 virtual ~ConnectionTrackerInterface();
71 * @brief Called when a signal is connected.
74 * @param[in] slotObserver The slot observer i.e. a signal. Ownership is not passed
75 * @param[in] callback The call back. Ownership is not passed
77 virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback ) = 0;
81 ConnectionTrackerInterface( const ConnectionTrackerInterface& ); ///< undefined copy constructor @SINCE_1_0.0
82 ConnectionTrackerInterface& operator=( const ConnectionTrackerInterface& ); ///< undefined assignment operator @SINCE_1_0.0
90 #endif // __DALI_CONNECTION_TRACKER_INTERFACE_H__