Tizen(Headed) Native API  6.5
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 ()
 Disconnects all signals from this object.
std::size_t GetConnectionCount () const
Slot * GetSlot ()
 Retrieves the slot object.
ConnectionTrackerGetConnectionTracker ()
 Retrieves 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, DALi version 1.0.0

Constructor & Destructor Documentation

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

Constructor.

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

Non-virtual destructor.

Since:
2.4, DALi version 1.0.0

Member Function Documentation

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

Disconnects all signals from this object.

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

Returns the connection count.

Since:
2.4, DALi version 1.0.0
Returns:
The connection count
template<typename Slot >
ConnectionTracker* Dali::SlotDelegate< Slot >::GetConnectionTracker ( )

Retrieves the connection tracker component.

Since:
2.4, DALi version 1.0.0
Returns:
The connection tracker component
template<typename Slot >
Slot* Dali::SlotDelegate< Slot >::GetSlot ( )

Retrieves the slot object.

Since:
2.4, DALi version 1.0.0
Returns:
The object with a callback