DALi signals refactor to remove V2 naming
[platform/core/uifw/dali-core.git] / 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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/active-constraint-declarations.h>
23 #include <dali/public-api/object/any.h>
24 #include <dali/public-api/object/handle.h>
25 #include <dali/public-api/object/property.h>
26
27 namespace Dali
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class ActiveConstraintBase;
33 }
34
35 /**
36  * @brief A constraint which is being applied to an object.
37  */
38 class DALI_IMPORT_API ActiveConstraint : public Handle
39 {
40 public:
41
42   // Default Properties
43   static const Property::Index WEIGHT; ///< Property 0, name "weight", type FLOAT
44
45   static const float FINAL_WEIGHT;   ///< 1.0f means the constraint is fully-applied, unless weight is still being animated
46   static const float DEFAULT_WEIGHT; ///< 1.0f
47
48   //Signal Names
49   static const char* const SIGNAL_APPLIED; ///< name "applied"
50
51   /**
52    * @brief Create an uninitialized Constraint; this can be initialized with Constraint::New().
53    *
54    * Calling member functions with an uninitialized Dali::Object is not allowed.
55    */
56   ActiveConstraint();
57
58   /**
59    * @brief Dali::ActiveConstraint is intended as a base class
60    *
61    * This is non-virtual since derived Handle types must not contain data or virtual methods.
62    */
63   ~ActiveConstraint();
64
65   /**
66    * @brief This copy constructor is required for (smart) pointer semantics.
67    *
68    * @param [in] handle A reference to the copied handle
69    */
70   ActiveConstraint(const ActiveConstraint& handle);
71
72   /**
73    * @brief This assignment operator is required for (smart) pointer semantics.
74    *
75    * @param [in] rhs  A reference to the copied handle
76    * @return A reference to this
77    */
78   ActiveConstraint& operator=(const ActiveConstraint& rhs);
79
80   /**
81    * @brief Retrieve the object which this constraint is targeting.
82    *
83    * @return The target object.
84    */
85   Handle GetTargetObject();
86
87   /**
88    * @brief Retrieve the property which this constraint is targeting.
89    *
90    * @return The target property.
91    */
92   Property::Index GetTargetProperty();
93
94   /**
95    * @brief Set the weight of the constraint; this is a value clamped between 0.
96    * 0f and 1.0f.
97    * The default is 1.0f.
98    * 0.0f means the constraint has no effect, and 1.0f means the constraint is fully-applied.
99    * @note This is an asynchronous method; the value written may not match a value subsequently read with GetCurrentWeight().
100    * @param [in] weight The weight.
101    */
102   void SetWeight( float weight );
103
104   /**
105    * @brief Retrieve the current weight of the constraint.
106    *
107    * @return The current weight.
108    */
109   float GetCurrentWeight() const;
110
111   /**
112    * @brief This signal is emitted after the apply-time of the constraint has expired.
113    *
114    * @note A non-zero apply-time must have been set using Constraint::SetApplyTime().
115    * @return A signal object to Connect() with.
116    */
117   ActiveConstraintSignalType& AppliedSignal();
118
119 public: // Not intended for use by Application developers
120
121   /**
122    * @brief This constructor is used by Dali New() methods.
123    *
124    * @param [in] constraint A pointer to a newly allocated Dali resource
125    */
126   explicit DALI_INTERNAL ActiveConstraint( Internal::ActiveConstraintBase* constraint );
127 };
128
129 } // namespace Dali
130
131 #endif // __DALI_ACTIVE_CONSTRAINT_H__