Dali 3D User Interface Engine
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
Dali::Internal::ConstraintBase Class Referenceabstract

An abstract base class for active constraints. More...

#include <constraint-base.h>

Inheritance diagram for Dali::Internal::ConstraintBase:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::ConstraintBase:
Collaboration graph
[legend]

Public Types

typedef
Dali::Constraint::RemoveAction 
RemoveAction
 

Public Member Functions

 ConstraintBase (Object &object, Property::Index targetPropertyIndex, SourceContainer &sources)
 Constructor. More...
 
virtual ConstraintBaseClone (Object &object)=0
 Clone this constraint for another object. More...
 
virtual ~ConstraintBase ()
 Virtual destructor. More...
 
void AddSource (Source source)
 Adds a constraint source to the constraint. More...
 
void Apply ()
 Applies this constraint. More...
 
void Remove ()
 Removes this constraint. More...
 
void RemoveInternal ()
 Called when the Constraint is removed. More...
 
ObjectGetParent ()
 Retrieve the parent of the constraint. More...
 
Dali::Handle GetTargetObject ()
 Retrieve the object which this constraint is targeting. More...
 
Property::Index GetTargetProperty ()
 Retrieve the property which this constraint is targeting. More...
 
void SetRemoveAction (RemoveAction action)
 Set the remove action. More...
 
RemoveAction GetRemoveAction () const
 Retrieve the remove action that will happen when the constraint is removed. More...
 
void SetTag (const unsigned int tag)
 Set a tag for the constraint so it can be identified later. More...
 
unsigned int GetTag () const
 Get the tag. More...
 
- Public Member Functions inherited from Dali::BaseObject
template<class T >
bool ConnectSignal (ConnectionTrackerInterface *connectionTracker, const std::string &signalName, const T &functor)
 Connects a void() functor to a specified signal. More...
 
bool DoAction (const std::string &actionName, const Property::Map &attributes)
 Perform action on this object with the given action name and attributes. More...
 
const std::string & GetTypeName () const
 Returns the type name for the Handle. More...
 
bool GetTypeInfo (Dali::TypeInfo &info) const
 Returns the type info for the Handle. More...
 
bool DoConnectSignal (ConnectionTrackerInterface *connectionTracker, const std::string &signalName, FunctorDelegate *functorDelegate)
 Not intended for application developers. More...
 
- Public Member Functions inherited from Dali::RefObject
void Reference ()
 Increment the object's reference count. More...
 
void Unreference ()
 Decrement the object's reference count. More...
 
int ReferenceCount ()
 Retrieve the object's reference count. More...
 

Protected Member Functions

EventThreadServicesGetEventThreadServices ()
 Get the event thread services object - used for sending messages to the scene graph Assert if called from the wrong thread. More...
 
const EventThreadServicesGetEventThreadServices () const
 Get the event thread services object - used for sending messages to the scene graph Assert if called from the wrong thread This is intentionally inline for performance reasons. More...
 
- Protected Member Functions inherited from Dali::BaseObject
 BaseObject ()
 Default constructor. More...
 
virtual ~BaseObject ()
 A reference counted object may only be deleted by calling Unreference(). More...
 
void RegisterObject ()
 Registers the object as created with the Object registry. More...
 
void UnregisterObject ()
 Unregisters the object from Object registry. More...
 
- Protected Member Functions inherited from Dali::RefObject
 RefObject ()
 Default constructor. More...
 
virtual ~RefObject ()
 RefObject is intended as a base class. More...
 
 RefObject (const RefObject &rhs)
 Copy constructor. More...
 
RefObjectoperator= (const RefObject &rhs)
 Assignment operator. More...
 
- Protected Member Functions inherited from Dali::Internal::Object::Observer
virtual ~Observer ()
 Virtual destructor. More...
 

Protected Attributes

EventThreadServicesmEventThreadServices
 
ObjectmTargetObject
 The object owns the constraint. More...
 
const SceneGraph::ConstraintBasemSceneGraphConstraint
 
SourceContainer mSources
 
ObjectContainer mObservedObjects
 
Property::Index mTargetPropertyIndex
 
RemoveAction mRemoveAction
 
unsigned int mTag
 
bool mApplied:1
 Whether the constraint has been applied. More...
 
bool mSourceDestroyed:1
 Is set to true if any of our input source objects are destroyed. More...
 

Private Member Functions

virtual void SceneObjectAdded (Object &object)
 Called immediately after the object has created & passed ownership of a scene-graph object. More...
 
virtual void SceneObjectRemoved (Object &object)
 Called shortly before the object sends a message to remove its scene object. More...
 
virtual void ObjectDestroyed (Object &object)
 Called shortly before the object itself is destroyed; no further callbacks will be received. More...
 
void ObserveObject (Object &object)
 Helper to observe an object, if not already observing it. More...
 
void StopObservation ()
 Helper to stop observing objects. More...
 
virtual void ConnectConstraint ()=0
 Create and connect a constraint for a scene-object. More...
 

Detailed Description

An abstract base class for active constraints.

Definition at line 50 of file constraint-base.h.

Member Typedef Documentation

Definition at line 54 of file constraint-base.h.

Constructor & Destructor Documentation

Dali::Internal::ConstraintBase::ConstraintBase ( Object object,
Property::Index  targetPropertyIndex,
SourceContainer sources 
)

Constructor.

Parameters
[in]objectThe property owning object.
[in]messageControllerUsed to send messages to the update-thread.
[in]targetPropertyIndexThe index of the property being constrained.
[in]sourcesThe sources of the input properties.

Definition at line 39 of file constraint-base.cpp.

References ObserveObject().

Here is the call graph for this function:

Dali::Internal::ConstraintBase::~ConstraintBase ( )
virtual

Virtual destructor.

Definition at line 54 of file constraint-base.cpp.

References RemoveInternal(), and StopObservation().

Here is the call graph for this function:

Member Function Documentation

void Dali::Internal::ConstraintBase::AddSource ( Source  source)

Adds a constraint source to the constraint.

Parameters
[in]sourceThe constraint source input to add

Definition at line 61 of file constraint-base.cpp.

References DALI_LOG_ERROR, mSources, Dali::Internal::Source::object, Dali::OBJECT_PROPERTY, ObserveObject(), and Dali::Internal::Source::sourceType.

Here is the call graph for this function:

void Dali::Internal::ConstraintBase::Apply ( )

Applies this constraint.

.0

Precondition
The constraint must be initialized
The target object must still be alive
The source inputs should not have been destroyed

Definition at line 79 of file constraint-base.cpp.

References Dali::Internal::Object::ApplyConstraint(), ConnectConstraint(), mApplied, mSourceDestroyed, and mTargetObject.

Here is the call graph for this function:

virtual ConstraintBase* Dali::Internal::ConstraintBase::Clone ( Object object)
pure virtual

Clone this constraint for another object.

Parameters
[in]objectThe object to clone this constraint for
Returns
A new constraint.

Implemented in Dali::Internal::Constraint< float >, and Dali::Internal::Constraint< PropertyType >.

virtual void Dali::Internal::ConstraintBase::ConnectConstraint ( )
privatepure virtual

Create and connect a constraint for a scene-object.

Implemented in Dali::Internal::Constraint< float >, and Dali::Internal::Constraint< PropertyType >.

Referenced by Apply(), and SceneObjectAdded().

Here is the caller graph for this function:

EventThreadServices& Dali::Internal::ConstraintBase::GetEventThreadServices ( )
inlineprotected

Get the event thread services object - used for sending messages to the scene graph Assert if called from the wrong thread.

This is intentionally inline for performance reasons.

Returns
The event thread services object

Definition at line 182 of file constraint-base.h.

References DALI_ASSERT_DEBUG, Dali::Internal::EventThreadServices::IsCoreRunning(), and mEventThreadServices.

Referenced by Dali::Internal::Constraint< PropertyType >::ConnectConstraint(), Dali::Internal::Constraint< float >::ConnectConstraint(), RemoveInternal(), and SceneObjectRemoved().

Here is the call graph for this function:

Here is the caller graph for this function:

const EventThreadServices& Dali::Internal::ConstraintBase::GetEventThreadServices ( ) const
inlineprotected

Get the event thread services object - used for sending messages to the scene graph Assert if called from the wrong thread This is intentionally inline for performance reasons.

Returns
The event thread services object

Definition at line 195 of file constraint-base.h.

References DALI_ASSERT_DEBUG, Dali::Internal::EventThreadServices::IsCoreRunning(), and mEventThreadServices.

Here is the call graph for this function:

Object * Dali::Internal::ConstraintBase::GetParent ( )

Retrieve the parent of the constraint.

Returns
The parent object, or NULL.

Definition at line 124 of file constraint-base.cpp.

References mTargetObject.

ConstraintBase::RemoveAction Dali::Internal::ConstraintBase::GetRemoveAction ( ) const

Retrieve the remove action that will happen when the constraint is removed.

.0

Returns
The remove-action.

Definition at line 144 of file constraint-base.cpp.

References mRemoveAction.

unsigned int Dali::Internal::ConstraintBase::GetTag ( ) const

Get the tag.

.0

Returns
The tag

Definition at line 154 of file constraint-base.cpp.

References mTag.

Referenced by Dali::Internal::Object::RemoveConstraints().

Here is the caller graph for this function:

Dali::Handle Dali::Internal::ConstraintBase::GetTargetObject ( )

Retrieve the object which this constraint is targeting.

.0

Returns
The target object.

Definition at line 129 of file constraint-base.cpp.

References mTargetObject.

Property::Index Dali::Internal::ConstraintBase::GetTargetProperty ( )

Retrieve the property which this constraint is targeting.

.0

Returns
The target property.

Definition at line 134 of file constraint-base.cpp.

References mTargetPropertyIndex.

void Dali::Internal::ConstraintBase::ObjectDestroyed ( Object object)
privatevirtual

Called shortly before the object itself is destroyed; no further callbacks will be received.

Parameters
[in]objectThe object object.

Implements Dali::Internal::Object::Observer.

Definition at line 190 of file constraint-base.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), DALI_ASSERT_DEBUG, Dali::Vector< T, IsTrivialType >::End(), Dali::Vector< T, IsTrivialType >::Erase(), mObservedObjects, mSceneGraphConstraint, mSourceDestroyed, mSources, mTargetObject, and StopObservation().

Here is the call graph for this function:

void Dali::Internal::ConstraintBase::ObserveObject ( Object object)
private

Helper to observe an object, if not already observing it.

Definition at line 211 of file constraint-base.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), Dali::Vector< T, IsTrivialType >::End(), mObservedObjects, and Dali::Vector< T, IsTrivialType >::PushBack().

Referenced by AddSource(), and ConstraintBase().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::ConstraintBase::Remove ( )

Removes this constraint.

.0

Definition at line 90 of file constraint-base.cpp.

References mTargetObject, Dali::Internal::Object::RemoveConstraint(), and RemoveInternal().

Here is the call graph for this function:

void Dali::Internal::ConstraintBase::RemoveInternal ( )

Called when the Constraint is removed.

Note
This removes the scene-object as well but then does not call back into the target-object.

Definition at line 100 of file constraint-base.cpp.

References GetEventThreadServices(), Dali::Internal::Object::GetSceneObject(), Dali::Internal::Stage::IsInstalled(), mApplied, mSceneGraphConstraint, mTargetObject, and Dali::Internal::SceneGraph::RemoveConstraintMessage().

Referenced by Remove(), and ~ConstraintBase().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::ConstraintBase::SceneObjectAdded ( Object object)
privatevirtual

Called immediately after the object has created & passed ownership of a scene-graph object.

Parameters
[in]objectThe object object.

Implements Dali::Internal::Object::Observer.

Definition at line 159 of file constraint-base.cpp.

References ConnectConstraint(), mApplied, mSceneGraphConstraint, and mTargetObject.

Here is the call graph for this function:

void Dali::Internal::ConstraintBase::SceneObjectRemoved ( Object object)
privatevirtual

Called shortly before the object sends a message to remove its scene object.

Parameters
[in]objectThe object object.

Implements Dali::Internal::Object::Observer.

Definition at line 169 of file constraint-base.cpp.

References GetEventThreadServices(), Dali::Internal::Object::GetSceneObject(), mSceneGraphConstraint, mTargetObject, and Dali::Internal::SceneGraph::RemoveConstraintMessage().

Here is the call graph for this function:

void Dali::Internal::ConstraintBase::SetRemoveAction ( ConstraintBase::RemoveAction  action)

Set the remove action.

Constraint::Bake will "bake" a value when fully-applied.

In case of Constraint::Discard, the constrained value will be discarded, when the constraint is removed. The default value is Constraint::Bake. .0

Parameters
[in]actionThe remove-action.

Definition at line 139 of file constraint-base.cpp.

References mRemoveAction.

Referenced by Dali::Internal::Constraint< PropertyType >::Clone(), and Dali::Internal::Constraint< float >::Clone().

Here is the caller graph for this function:

void Dali::Internal::ConstraintBase::SetTag ( const unsigned int  tag)

Set a tag for the constraint so it can be identified later.

.0

Parameters
[in]tagAn integer to identify the constraint

Definition at line 149 of file constraint-base.cpp.

References mTag.

void Dali::Internal::ConstraintBase::StopObservation ( )
private

Helper to stop observing objects.

Definition at line 221 of file constraint-base.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), Dali::Vector< T, IsTrivialType >::Clear(), Dali::Vector< T, IsTrivialType >::End(), and mObservedObjects.

Referenced by ObjectDestroyed(), and ~ConstraintBase().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool Dali::Internal::ConstraintBase::mApplied
protected

Whether the constraint has been applied.

Definition at line 210 of file constraint-base.h.

Referenced by Apply(), RemoveInternal(), and SceneObjectAdded().

EventThreadServices& Dali::Internal::ConstraintBase::mEventThreadServices
protected

Definition at line 202 of file constraint-base.h.

Referenced by GetEventThreadServices().

ObjectContainer Dali::Internal::ConstraintBase::mObservedObjects
protected

Definition at line 206 of file constraint-base.h.

Referenced by ObjectDestroyed(), ObserveObject(), and StopObservation().

RemoveAction Dali::Internal::ConstraintBase::mRemoveAction
protected
const SceneGraph::ConstraintBase* Dali::Internal::ConstraintBase::mSceneGraphConstraint
protected
bool Dali::Internal::ConstraintBase::mSourceDestroyed
protected

Is set to true if any of our input source objects are destroyed.

Definition at line 211 of file constraint-base.h.

Referenced by Apply(), Dali::Internal::Constraint< PropertyType >::Clone(), Dali::Internal::Constraint< float >::Clone(), and ObjectDestroyed().

SourceContainer Dali::Internal::ConstraintBase::mSources
protected
unsigned int Dali::Internal::ConstraintBase::mTag
protected
Object* Dali::Internal::ConstraintBase::mTargetObject
protected
Property::Index Dali::Internal::ConstraintBase::mTargetPropertyIndex
protected

Definition at line 207 of file constraint-base.h.

Referenced by GetTargetProperty().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali