#define __DALI_INTERNAL_SCENE_GRAPH_CONSTRAINT_BASE_H__
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
class ConstraintBase : public PropertyOwner::Observer
{
public:
+ /**
+ * Observer to determine when the constraint is no longer present
+ */
+ class LifecycleObserver
+ {
+ public:
+ /**
+ * Called shortly before the constraint is destroyed.
+ */
+ virtual void ObjectDestroyed() = 0;
+
+ protected:
+ /**
+ * Virtual destructor, no deletion through this interface
+ */
+ virtual ~LifecycleObserver() = default;
+ };
+
+public:
typedef Dali::Constraint::RemoveAction RemoveAction;
virtual ~ConstraintBase();
/**
+ * Property resetter observes the lifecycle of this object
+ */
+ void AddLifecycleObserver( LifecycleObserver& observer )
+ {
+ mLifecycleObserver = &observer;
+ }
+
+ /**
+ * Property resetter observers the lifecycle of this object
+ */
+ void RemoveLifecycleObserver( LifecycleObserver& observer )
+ {
+ mLifecycleObserver = nullptr;
+ }
+
+ /**
* Initialize the constraint.
* This should by called by a scene-object, when the constraint is connected.
*/
}
/**
- * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
- */
- virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
-
- /**
* Notify the derived class to disconnect from property owners
*/
virtual void OnDisconnect() = 0;
private:
PropertyOwnerContainer mObservedOwners; ///< A set of pointers to each observed object. Not owned.
+ LifecycleObserver* mLifecycleObserver; ///< Resetter observers this object
#ifdef DEBUG_ENABLED
static unsigned int mCurrentInstanceCount; ///< The current number of Constraint instances in existence.