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