Tizen Native API
Dali::SlotDelegate< Slot > Class Template Reference

SlotDelegates can be used to connect member functions to signals, without inheriting from SlotDelegateInterface. More...

Public Member Functions

 SlotDelegate (Slot *slot)
 Constructor.
 ~SlotDelegate ()
 Non-virtual destructor.
void DisconnectAll ()
 Disconnect all signals from this object.
std::size_t GetConnectionCount () const
Slot * GetSlot ()
 Retrieve the slot object.
ConnectionTrackerGetConnectionTracker ()
 Retrieve the connection tracker component.

Detailed Description

template<typename Slot>
class Dali::SlotDelegate< Slot >

SlotDelegates can be used to connect member functions to signals, without inheriting from SlotDelegateInterface.

Note that the object providing the member function is expected to own the SlotDelegate; therefore when the object is destroyed, the SlotDelegate destructor will automatically disconnect.

 class Example // This does not inherit from SlotDelegateInterface!
 {
 public:

   Example()
   : mSlotDelegate( this )
   {
   }

   ~Example()
   {
     // mSlotDelegate disconnects automatically here
   }

   void Animate()
   {
     Animation animation = Animation::New( 1.0f );
     animation.FinishedSignal().Connect( mSlotDelegate, &Example::OnAnimationFinished );
     animation.Play(); // fire & forget
   }

   void OnAnimationFinished( Animation& animation )
   {
     std::cout << "Animation Finished!" << std::endl;
   }

 private:

  SlotDelegate<Example> mSlotDelegate;

 };
Since :
2.4

Constructor & Destructor Documentation

template<typename Slot >
Dali::SlotDelegate< Slot >::SlotDelegate ( Slot *  slot)

Constructor.

Since :
2.4
Parameters:
[in]slotThe object with a callback.
template<typename Slot >
Dali::SlotDelegate< Slot >::~SlotDelegate ( )

Non-virtual destructor.

Since :
2.4

Member Function Documentation

template<typename Slot >
void Dali::SlotDelegate< Slot >::DisconnectAll ( )

Disconnect all signals from this object.

Since :
2.4
template<typename Slot >
std::size_t Dali::SlotDelegate< Slot >::GetConnectionCount ( ) const

returns the connection count

Since :
2.4
Returns:
the connection count
template<typename Slot >
ConnectionTracker* Dali::SlotDelegate< Slot >::GetConnectionTracker ( )

Retrieve the connection tracker component.

Since :
2.4
Returns:
The connection tracker component.
template<typename Slot >
Slot* Dali::SlotDelegate< Slot >::GetSlot ( )

Retrieve the slot object.

Since :
2.4
Returns:
The object with a callback.