[4.0] If a RenderTask's exclusive actor is destoryed, then ensure the RenderTaskList...
[platform/core/uifw/dali-core.git] / dali / internal / event / events / actor-observer.h
index 3cc8b19..9e42a19 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/public-api/signals/callback.h>
 #include <dali/internal/event/common/object-impl.h>
 
 namespace Dali
@@ -44,17 +45,50 @@ public:
   ActorObserver();
 
   /**
+   * Constructor with a callback which is called when the observed actor is removed from the scene.
+   *
+   * The callback should have the following signature:
+   * @code
+   * void MyCallback( Actor* actor );
+   * @endcode
+   * Where actor is a pointer to the object that has been removed from the scene.
+   *
+   * @param[in]  callback  The callback to connect to.
+   *
+   * @note Ownership of callback is passed onto this class.
+   */
+  ActorObserver( CallbackBase* callback );
+
+  /**
    * Non virtual destructor
    */
   ~ActorObserver();
 
+  // Movable.
+
+  /**
+   *
+   */
+  ActorObserver( ActorObserver&& other );
+
+  /**
+   *
+   */
+  ActorObserver& operator=( ActorObserver&& other );
+
+  // Not copyable
+
+  ActorObserver( const ActorObserver& ) = delete;   ///< Deleted copy constructor.
+  ActorObserver& operator=( const ActorObserver& ) = delete;   ///< Deleted copy assignment operator.
+
+
   // Methods
 
   /**
    * Return the stored Actor pointer.
    * @return The Actor pointer.
    */
-  Actor* GetActor();
+  Actor* GetActor() const;
 
   /**
    * Assignment operator.
@@ -70,12 +104,6 @@ public:
 
 private:
 
-  // Undefined
-  ActorObserver( const ActorObserver& );
-  ActorObserver& operator=( const ActorObserver& );
-
-private:
-
   /**
    * This will never get called as we do not observe objects that have not been added to the scene.
    * @param[in] object The object object.
@@ -99,8 +127,9 @@ private:
   virtual void ObjectDestroyed(Object& object);
 
 private:
-  Actor* mActor;              ///< Raw pointer to an Actor.
-  bool  mActorDisconnected;   ///< Indicates whether the actor has been disconnected from the scene
+  Actor* mActor;                 ///< Raw pointer to an Actor.
+  bool  mActorDisconnected;      ///< Indicates whether the actor has been disconnected from the scene
+  CallbackBase* mRemoveCallback; ///< Callback to call when the observed actor is removed from the scene
 };
 
 } // namespace Internal