Dali 3D User Interface Engine
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions
Dali::Constraint Class Reference

An abstract base class for Constraints. More...

#include <constraint.h>

Inheritance diagram for Dali::Constraint:
Inheritance graph
[legend]
Collaboration diagram for Dali::Constraint:
Collaboration graph
[legend]

Classes

class  Function
 Template for the Function that is called by the Constraint system. More...
 

Public Types

enum  RemoveAction { Bake, Discard }
 The action that will happen when the constraint is removed. More...
 
- Public Types inherited from Dali::BaseHandle
typedef void(BaseHandle::* BooleanType )() const
 Pointer-to-member type. More...
 

Public Member Functions

 Constraint ()
 Create an uninitialized Constraint; this can be initialized with Constraint::New(). More...
 
Constraint Clone (Handle handle)
 Creates a clones of this constraint for another object. More...
 
 ~Constraint ()
 Destructor. More...
 
 Constraint (const Constraint &constraint)
 This copy constructor is required for (smart) pointer semantics. More...
 
Constraintoperator= (const Constraint &rhs)
 This assignment operator is required for (smart) pointer semantics. More...
 
void AddSource (ConstraintSource source)
 Adds a constraint source to the constraint. More...
 
void Apply ()
 Applies this constraint. More...
 
void Remove ()
 Removes this constraint. More...
 
Handle GetTargetObject ()
 Retrieve the object which this constraint is targeting. More...
 
Dali::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...
 
DALI_INTERNAL Constraint (Internal::ConstraintBase *constraint)
 This constructor is used by Constraint::New() methods .0. More...
 
- Public Member Functions inherited from Dali::BaseHandle
 BaseHandle (Dali::BaseObject *handle)
 This constructor is used by Dali New() methods. More...
 
 BaseHandle ()
 This constructor provides an uninitialized Dali::BaseHandle. More...
 
 ~BaseHandle ()
 Dali::BaseHandle is intended as a base class. More...
 
 BaseHandle (const BaseHandle &handle)
 This copy constructor is required for (smart) pointer semantics. More...
 
BaseHandleoperator= (const BaseHandle &rhs)
 This assignment operator is required for (smart) pointer semantics. More...
 
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...
 
BaseObjectGetBaseObject ()
 Retrieve the internal Dali resource. More...
 
const BaseObjectGetBaseObject () const
 Retrieve the internal Dali resource. More...
 
void Reset ()
 Resets the handle. More...
 
 operator BooleanType () const
 Converts an handle to a BooleanType. More...
 
bool operator== (const BaseHandle &rhs) const
 Equality operator overload. More...
 
bool operator!= (const BaseHandle &rhs) const
 Inequality operator overload. More...
 
Dali::RefObjectGetObjectPtr () const
 Get the reference counted object pointer. More...
 

Static Public Member Functions

template<class P >
static Constraint New (Handle handle, Property::Index targetIndex, void(*function)(P &, const PropertyInputContainer &))
 Create a constraint which targets a property using a function or a static class member. More...
 
template<class P , class T >
static Constraint New (Handle handle, Property::Index targetIndex, const T &object)
 Create a constraint which targets a property using a functor object. More...
 
template<class P , class T >
static Constraint New (Handle handle, Property::Index targetIndex, const T &object, void(T::*memberFunction)(P &, const PropertyInputContainer &))
 Create a constraint which targets a property using an object method. More...
 
static Constraint DownCast (BaseHandle baseHandle)
 Downcast a handle to Constraint handle. More...
 

Static Public Attributes

static const RemoveAction DEFAULT_REMOVE_ACTION = Constraint::Bake
 Bake. More...
 

Static Private Member Functions

static Constraint New (Handle handle, Property::Index targetIndex, Property::Type targetType, CallbackBase *function)
 Construct a new constraint which targets a property. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dali::BaseHandle
void ThisIsSaferThanReturningVoidStar () const
 Used by the safe bool idiom. More...
 

Detailed Description

An abstract base class for Constraints.

This can be used to constrain a property of an object, after animations have been applied. Constraints are applied in the following order:

Create a constraint using one of the New methods depending on the type of callback function used. Try to use a C function unless some data needs to be stored, otherwise functors and class methods are also supported.

A constraint can be applied to an object in the following manner:

Handle handle = CreateMyObject();
Constraint constraint = Constraint::New< Vector3 >( handle, CONSTRAINING_PROPERTY_INDEX, &MyFunction );
constraint.AddSource( LocalSource( INPUT_PROPERTY_INDEX ) );
constraint.Apply();

.0

Definition at line 68 of file constraint.h.

Member Enumeration Documentation

The action that will happen when the constraint is removed.

The final value may be "baked" i.e. saved permanently. Alternatively the constrained value may be discarded when the constraint is removed. .0

Enumerator
Bake 

When the constraint is fully-applied, the constrained value is saved. .0.

Discard 

When the constraint is removed, the constrained value is discarded. .0.

Definition at line 284 of file constraint.h.

Constructor & Destructor Documentation

Dali::Constraint::Constraint ( )

Create an uninitialized Constraint; this can be initialized with Constraint::New().

Calling member functions with an uninitialized Constraint handle is not allowed. .0

Definition at line 43 of file constraint.cpp.

Referenced by Clone(), and DownCast().

Here is the caller graph for this function:

Dali::Constraint::~Constraint ( )

Destructor.

This is non-virtual since derived Handle types must not contain data or virtual methods. .0

Definition at line 52 of file constraint.cpp.

Dali::Constraint::Constraint ( const Constraint constraint)

This copy constructor is required for (smart) pointer semantics.

.0

Parameters
[in]constraintA reference to the copied handle

Definition at line 56 of file constraint.cpp.

Dali::Constraint::Constraint ( Internal::ConstraintBase constraint)
explicit

This constructor is used by Constraint::New() methods .0.

Parameters
[in]constraintA pointer to a newly allocated Dali resource

Definition at line 117 of file constraint.cpp.

Member Function Documentation

void Dali::Constraint::AddSource ( ConstraintSource  source)

Adds a constraint source to the constraint.

.0

Parameters
[in]sourceThe constraint source input to add

Definition at line 72 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by Dali::Internal::PathConstrainer::Apply(), Dali::Internal::LinearConstrainer::Apply(), Dali::Toolkit::Internal::SpiralLayout::ApplyConstraints(), Dali::Toolkit::Internal::DepthLayout::ApplyConstraints(), Dali::Toolkit::Internal::ScrollBar::ApplyConstraints(), Dali::Toolkit::Internal::GridLayout::ApplyConstraints(), Dali::Toolkit::CreateSoftButtonEffect(), Dali::Toolkit::Internal::ItemView::EnableScrollOvershoot(), Dali::Toolkit::Internal::Magnifier::Initialize(), Dali::Toolkit::Internal::Model3dView::OnStageConnection(), Dali::Toolkit::Internal::SuperBlurView::OnStageConnection(), Dali::Toolkit::Internal::PageTurnApplyInternalConstraint(), Dali::Toolkit::Internal::PageTurnView::PanContinuing(), Dali::Toolkit::Internal::Magnifier::SetFrameVisibility(), Dali::Toolkit::Internal::ScrollView::SetInternalConstraints(), Dali::Toolkit::SetMotionBlurProperties(), Dali::Toolkit::SetMotionStretchProperties(), Dali::Toolkit::Internal::ScrollView::SetOvershootConstraintsEnabled(), anonymous_namespace{utc-Dali-ScrollViewEffect.cpp}::SetupTestScrollView(), Dali::Toolkit::Internal::ScrollView::UpdateMainInternalConstraint(), Dali::Toolkit::Internal::Model3dView::UpdateShaderUniforms(), UtcDaliActorConstrainedToWorldMatrix(), UtcDaliCameraActorAnimatedProperties(), UtcDaliCameraActorCheckLookAtAndFreeLookViews01(), UtcDaliCameraActorCheckLookAtAndFreeLookViews02(), UtcDaliCameraActorReadProjectionMatrix(), UtcDaliConstraintAddSourceN(), UtcDaliConstraintAddSourceP(), UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliPanGestureNoPredictionNoSmoothing(), UtcDaliPanGestureNoPredictionSmoothing(), UtcDaliPanGesturePredictionNoSmoothing(), UtcDaliPanGesturePredictionSmoothing(), UtcDaliPanGestureSetProperties(), UtcDaliPanGestureSetPropertiesAlreadyPanning(), UtcDaliScrollViewPagePathEffectTest(), UtcDaliShaderEffectMethodApplyConstraintFromActor(), UtcDaliShaderEffectMethodApplyConstraintFromActor2(), UtcDaliToolkitScrollViewBind(), UtcDaliToolkitScrollViewConstraints(), UtcDaliToolkitScrollViewConstraintsMove(), and UtcDaliToolkitScrollViewConstraintsWrap().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Constraint::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 77 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by Dali::Internal::PathConstrainer::Apply(), Dali::Internal::LinearConstrainer::Apply(), Dali::Toolkit::Internal::ScrollBase::ActorInfo::ApplyConstraint(), Dali::Toolkit::Internal::SpiralLayout::ApplyConstraints(), Dali::Toolkit::Internal::DepthLayout::ApplyConstraints(), Dali::Toolkit::Internal::ScrollBar::ApplyConstraints(), Dali::Toolkit::Internal::GridLayout::ApplyConstraints(), Dali::Toolkit::CreateSoftButtonEffect(), Dali::Toolkit::Internal::ItemView::EnableScrollOvershoot(), TestPropertyTypes::Execute(), Dali::Toolkit::Internal::Magnifier::Initialize(), Dali::Toolkit::Internal::Model3dView::OnStageConnection(), Dali::Toolkit::Internal::SuperBlurView::OnStageConnection(), Dali::Toolkit::Internal::PageTurnApplyInternalConstraint(), Dali::Toolkit::Internal::PageTurnView::PanContinuing(), Dali::Toolkit::Internal::Magnifier::SetFrameVisibility(), Dali::Toolkit::SetMotionBlurProperties(), Dali::Toolkit::SetMotionStretchProperties(), Dali::Toolkit::Internal::ScrollView::SetOvershootConstraintsEnabled(), anonymous_namespace{utc-Dali-ScrollViewEffect.cpp}::SetupTestScrollView(), Dali::Toolkit::Internal::ScrollView::UpdateMainInternalConstraint(), Dali::Toolkit::Internal::Model3dView::UpdateShaderUniforms(), UtcDaliActorConstrainedToWorldMatrix(), UtcDaliActorRemoveConstraints(), UtcDaliActorRemoveConstraintTag(), UtcDaliAnimationUpdateManagerP(), UtcDaliCameraActorAnimatedProperties(), UtcDaliCameraActorCheckLookAtAndFreeLookViews01(), UtcDaliCameraActorCheckLookAtAndFreeLookViews02(), UtcDaliCameraActorReadProjectionMatrix(), UtcDaliConstraintAddSourceP(), UtcDaliConstraintApplyActorStagedUnstaged(), UtcDaliConstraintApplyAndRemoveBeforeAddedToStage(), UtcDaliConstraintApplyBeforeAddedToStage(), UtcDaliConstraintApplyRemove(), UtcDaliConstraintApplySeveralTimes(), UtcDaliConstraintChaining(), UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliConstraintCloneP(), UtcDaliConstraintNewFunctionP(), UtcDaliConstraintNewFunctorMemberP(), UtcDaliConstraintNewFunctorP(), UtcDaliGeometryConstraint(), UtcDaliGeometryConstraint02(), UtcDaliMaterialConstraint(), UtcDaliMaterialConstraint02(), UtcDaliPanGestureNoPredictionNoSmoothing(), UtcDaliPanGestureNoPredictionSmoothing(), UtcDaliPanGesturePredictionNoSmoothing(), UtcDaliPanGesturePredictionSmoothing(), UtcDaliPanGestureSetProperties(), UtcDaliPanGestureSetPropertiesAlreadyPanning(), UtcDaliRendererConstraint01(), UtcDaliRendererConstraint02(), UtcDaliScrollViewPagePathEffectTest(), UtcDaliShaderConstraint01(), UtcDaliShaderConstraint02(), UtcDaliShaderEffectMethodApplyConstraint(), UtcDaliShaderEffectMethodApplyConstraintFromActor(), UtcDaliShaderEffectMethodApplyConstraintFromActor2(), UtcDaliShaderEffectMethodApplyConstraintOffStage(), UtcDaliShaderEffectMethodRemoveConstraints(), and UtcDaliShaderEffectMethodRemoveConstraints2().

Here is the call graph for this function:

Constraint Dali::Constraint::Clone ( Handle  handle)

Creates a clones of this constraint for another object.

.0

Parameters
[in]handleThe handle to the property-owning object this constraint is to be cloned for.
Returns
The new constraint.

Definition at line 47 of file constraint.cpp.

References Constraint(), and Dali::GetImplementation().

Referenced by Dali::Toolkit::Internal::ScrollBase::ActorInfo::ApplyConstraint(), UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliConstraintCloneN(), and UtcDaliConstraintCloneP().

Here is the call graph for this function:

Here is the caller graph for this function:

Constraint Dali::Constraint::DownCast ( BaseHandle  baseHandle)
static

Downcast a handle to Constraint handle.

If handle points to a Constraint object the downcast produces valid handle. If not the returned handle is left uninitialized. .0

Parameters
[in]baseHandleBaseHandle to an object
Returns
Handle to a Constraint object or an uninitialized handle

Definition at line 67 of file constraint.cpp.

References Constraint(), and Dali::BaseHandle::GetObjectPtr().

Referenced by UtcDaliConstraintDownCast().

Here is the call graph for this function:

Here is the caller graph for this function:

Constraint::RemoveAction Dali::Constraint::GetRemoveAction ( ) const

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

.0

Returns
The remove-action.

Definition at line 102 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliConstraintGetRemoveActionN(), and UtcDaliConstraintRemoveActionP().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Dali::Constraint::GetTag ( ) const

Get the tag.

.0

Returns
The tag

Definition at line 112 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliConstraintGetTagN(), and UtcDaliConstraintTagP().

Here is the call graph for this function:

Here is the caller graph for this function:

Handle Dali::Constraint::GetTargetObject ( )

Retrieve the object which this constraint is targeting.

.0

Returns
The target object.

Definition at line 87 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by UtcDaliConstraintGetTargetObjectN(), and UtcDaliConstraintGetTargetObjectP().

Here is the call graph for this function:

Here is the caller graph for this function:

Property::Index Dali::Constraint::GetTargetProperty ( )

Retrieve the property which this constraint is targeting.

.0

Returns
The target property.

Definition at line 92 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by UtcDaliConstraintGetTargetPropertyN(), and UtcDaliConstraintGetTargetPropertyP().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class P >
static Constraint Dali::Constraint::New ( Handle  handle,
Property::Index  targetIndex,
void(*)(P &, const PropertyInputContainer &)  function 
)
inlinestatic

Create a constraint which targets a property using a function or a static class member.

The expected signature, for a Vector3 type for example, of the function is:

void MyFunction( Vector3&, const PropertyInputContainer& );

Create the constraint with this function as follows:

Constraint constraint = Constraint::New< Vector3 >( handle, CONSTRAINING_PROPERTY_INDEX, &MyFunction );

.0

Parameters
[in]handleThe handle to the property-owning object.
[in]targetIndexThe index of the property to constrain.
[in]functionThe function to call to set the constrained property value.
Returns
The new constraint.
Template Parameters
PThe type of the property to constrain.

Definition at line 323 of file constraint.h.

References Dali::WeightObject::New().

Here is the call graph for this function:

template<class P , class T >
static Constraint Dali::Constraint::New ( Handle  handle,
Property::Index  targetIndex,
const T &  object 
)
inlinestatic

Create a constraint which targets a property using a functor object.

The expected structure, for a Vector3 type for example, of the functor object is:

struct MyObject
{
void operator() ( Vector3&, const PropertyInputContainer& );
};

Create the constraint with this object as follows:

Constraint constraint = Constraint::New< Vector3 >( handle, CONSTRAINING_PROPERTY_INDEX, MyObject() );

.0

Parameters
[in]handleThe handle to the property-owning object.
[in]targetIndexThe index of the property to constrain.
[in]objectThe functor object whose functor is called to set the constrained property value.
Returns
The new constraint.
Template Parameters
PThe type of the property to constrain.
TThe type of the object.

Definition at line 356 of file constraint.h.

References Dali::WeightObject::New().

Here is the call graph for this function:

template<class P , class T >
static Constraint Dali::Constraint::New ( Handle  handle,
Property::Index  targetIndex,
const T &  object,
void(T::*)(P &, const PropertyInputContainer &)  memberFunction 
)
inlinestatic

Create a constraint which targets a property using an object method.

The expected structure, for a Vector3 type for example, of the object is:

struct MyObject
{
void MyMethod( Vector3&, const PropertyInputContainer& );
};

Create the constraint with this object as follows:

Constraint constraint = Constraint::New< Vector3 >( handle, CONSTRAINING_PROPERTY_INDEX, MyObject(), &MyObject::MyMethod );

.0

Parameters
[in]handleThe handle to the property-owning object.
[in]targetIndexThe index of the property to constrain.
[in]objectThe object whose member function is called to set the constrained property value.
[in]memberFunctionThe member function to call to set the constrained property value.
Returns
The new constraint.
Template Parameters
PThe type of the property to constrain.
TThe type of the object.

Definition at line 390 of file constraint.h.

References Dali::WeightObject::New().

Here is the call graph for this function:

Constraint Dali::Constraint::New ( Handle  handle,
Property::Index  targetIndex,
Property::Type  targetType,
CallbackBase function 
)
staticprivate

Construct a new constraint which targets a property.

.0

Parameters
[in]handleThe handle to the property-owning object.
[in]targetIndexThe index of the property to constrain.
[in]targetTypeType The type of the constrained property.
[in]functionThe constraint function.
Returns
The new constraint.

Definition at line 122 of file constraint.cpp.

References Dali::Property::BOOLEAN, DALI_ASSERT_ALWAYS, Dali::Property::FLOAT, Dali::GetImplementation(), Dali::Property::INTEGER, Dali::Property::MATRIX, Dali::Property::MATRIX3, Dali::Property::ROTATION, Dali::Property::VECTOR2, Dali::Property::VECTOR3, and Dali::Property::VECTOR4.

Here is the call graph for this function:

Constraint & Dali::Constraint::operator= ( const Constraint rhs)

This assignment operator is required for (smart) pointer semantics.

.0

Parameters
[in]rhsA reference to the copied handle
Returns
A reference to this

Definition at line 61 of file constraint.cpp.

References Dali::BaseHandle::operator=().

Here is the call graph for this function:

void Dali::Constraint::Remove ( )
void Dali::Constraint::SetRemoveAction ( Constraint::RemoveAction  action)
void Dali::Constraint::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 107 of file constraint.cpp.

References Dali::GetImplementation().

Referenced by Dali::Internal::PathConstrainer::Apply(), Dali::Internal::LinearConstrainer::Apply(), UtcDaliActorRemoveConstraintTag(), UtcDaliConstraintCloneCheckSourcesAndSetters(), UtcDaliConstraintSetTagN(), and UtcDaliConstraintTagP().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

const Constraint::RemoveAction Dali::Constraint::DEFAULT_REMOVE_ACTION = Constraint::Bake
static

Bake.

Definition at line 290 of file constraint.h.

Referenced by UtcDaliConstraintRemoveActionP().


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