7a25f82f2c74e539649fd8c7974fe169c55a4a38
[platform/core/uifw/dali-core.git] / capi / dali / public-api / animation / active-constraint.h
1 #ifndef __DALI_ACTIVE_CONSTRAINT_H__
2 #define __DALI_ACTIVE_CONSTRAINT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 /**
21  * @addtogroup CAPI_DALI_FRAMEWORK
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/animation/active-constraint-declarations.h>
27 #include <dali/public-api/object/handle.h>
28 #include <dali/public-api/object/property.h>
29
30 namespace Dali DALI_IMPORT_API
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35 class ActiveConstraintBase;
36 }
37
38 /**
39  * A constraint which is being applied to an object.
40  */
41 class DALI_IMPORT_API ActiveConstraint : public Handle
42 {
43 public:
44
45   // Default Properties
46   static const Property::Index WEIGHT; ///< Property 0, name "weight", type FLOAT
47
48   static const float FINAL_WEIGHT;   // 1.0f means the constraint is fully-applied, unless weight is still being animated
49   static const float DEFAULT_WEIGHT; // 1.0f
50
51   //Signal Names
52   static const char* const SIGNAL_APPLIED;
53
54   /**
55    * Create an uninitialized Constraint; this can be initialized with Constraint::New()
56    * Calling member functions with an uninitialized Dali::Object is not allowed.
57    */
58   ActiveConstraint();
59
60   /**
61    * Destructor
62    */
63   virtual ~ActiveConstraint();
64
65   /**
66    * @copydoc Dali::BaseHandle::operator=
67    */
68   using BaseHandle::operator=;
69
70   /**
71    * Retrieve the object which this constraint is targeting.
72    * @return The target object.
73    */
74   Handle GetTargetObject();
75
76   /**
77    * Retrieve the property which this constraint is targeting.
78    * @return The target property.
79    */
80   Property::Index GetTargetProperty();
81
82   /**
83    * Set the weight of the constraint; this is a value clamped between 0.0f and 1.0f. The default is 1.0f.
84    * 0.0f means the constraint has no effect, and 1.0f means the constraint is fully-applied.
85    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentWeight().
86    * @param [in] weight The weight.
87    */
88   void SetWeight( float weight );
89
90   /**
91    * Retrieve the current weight of the constraint.
92    * @return The current weight.
93    */
94   float GetCurrentWeight() const;
95
96   /**
97    * This signal is emitted after the apply-time of the constraint has expired.
98    * @note A non-zero apply-time must have been set using Constraint::SetApplyTime().
99    * @return A signal object to Connect() with.
100    */
101   ActiveConstraintSignalV2& AppliedSignal();
102
103 public: // Not intended for use by Application developers
104
105   /**
106    * This constructor is used by Dali New() methods
107    * @param [in] constraint A pointer to a newly allocated Dali resource
108    */
109   explicit DALI_INTERNAL ActiveConstraint( Internal::ActiveConstraintBase* constraint );
110 };
111
112 } // namespace Dali
113
114 /**
115  * @}
116  */
117 #endif // __DALI_ACTIVE_CONSTRAINT_H__