Merge "RenderTasks would not finish if source actor was invisible." into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / object / handle.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/object/handle.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/active-constraint.h>
23 #include <dali/public-api/animation/constraint.h>
24 #include <dali/public-api/object/property-conditions.h>
25 #include <dali/public-api/object/property-index.h>
26 #include <dali/public-api/object/property-notification.h>
27 #include <dali/internal/event/animation/constraint-impl.h>
28 #include <dali/internal/event/common/object-impl.h>
29 #include <dali/internal/event/object/custom-object-internal.h>
30 #include <dali/integration-api/debug.h>
31
32 namespace Dali
33 {
34
35 Handle::Handle( Dali::Internal::Object* handle )
36 : BaseHandle(handle)
37 {
38 }
39
40
41 Handle::Handle()
42 {
43 }
44
45 Handle Handle::New()
46 {
47   return Handle( Internal::CustomObject::New() );
48 }
49
50 Handle::~Handle()
51 {
52 }
53
54 Handle::Handle( const Handle& handle )
55 : BaseHandle( handle )
56 {
57 }
58
59 Handle& Handle::operator=( const Handle& rhs )
60 {
61   if( this != &rhs )
62   {
63     BaseHandle::operator=(rhs);
64   }
65
66   return *this;
67 }
68
69 Handle Handle::DownCast( BaseHandle handle )
70 {
71   return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
72 }
73
74
75 bool Handle::Supports( Capability capability ) const
76 {
77   return GetImplementation(*this).Supports( capability );
78 }
79
80 unsigned int Handle::GetPropertyCount() const
81 {
82   return GetImplementation(*this).GetPropertyCount();
83 }
84
85 std::string Handle::GetPropertyName( Property::Index index ) const
86 {
87   return GetImplementation(*this).GetPropertyName( index );
88 }
89
90 Property::Index Handle::GetPropertyIndex( const std::string& name ) const
91 {
92   return GetImplementation(*this).GetPropertyIndex( name );
93 }
94
95 bool Handle::IsPropertyWritable( Property::Index index ) const
96 {
97   return GetImplementation(*this).IsPropertyWritable( index );
98 }
99
100 bool Handle::IsPropertyAnimatable( Property::Index index ) const
101 {
102   return GetImplementation(*this).IsPropertyAnimatable( index );
103 }
104
105 bool Handle::IsPropertyAConstraintInput( Property::Index index ) const
106 {
107   return GetImplementation(*this).IsPropertyAConstraintInput( index );
108 }
109
110 Property::Type Handle::GetPropertyType( Property::Index index ) const
111 {
112   return GetImplementation(*this).GetPropertyType( index );
113 }
114
115 void Handle::SetProperty( Property::Index index, const Property::Value& propertyValue )
116 {
117   GetImplementation(*this).SetProperty( index, propertyValue );
118 }
119
120 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
121 {
122   return GetImplementation(*this).RegisterProperty( name, propertyValue );
123 }
124
125 Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
126 {
127   return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
128 }
129
130 Property::Value Handle::GetProperty( Property::Index index ) const
131 {
132   return GetImplementation(*this).GetProperty( index );
133 }
134
135 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
136 {
137   GetImplementation(*this).GetPropertyIndices( indices );
138 }
139
140 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
141                                                             const PropertyCondition& condition )
142 {
143   return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
144 }
145
146 Dali::PropertyNotification Handle::AddPropertyNotification( Property::Index index,
147                                                             int componentIndex,
148                                                             const PropertyCondition& condition )
149 {
150   return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
151 }
152
153 void Handle::RemovePropertyNotification( Dali::PropertyNotification propertyNotification )
154 {
155   GetImplementation(*this).RemovePropertyNotification( propertyNotification );
156 }
157
158 void Handle::RemovePropertyNotifications()
159 {
160   GetImplementation(*this).RemovePropertyNotifications();
161 }
162
163 ActiveConstraint Handle::ApplyConstraint( Constraint constraint )
164 {
165   return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
166 }
167
168 ActiveConstraint Handle::ApplyConstraint( Constraint constraint, Handle weightObject )
169 {
170   return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
171 }
172
173 void Handle::RemoveConstraint(ActiveConstraint activeConstraint)
174 {
175   GetImplementation(*this).RemoveConstraint( activeConstraint );
176 }
177
178 void Handle::RemoveConstraints()
179 {
180   GetImplementation(*this).RemoveConstraints();
181 }
182
183 void Handle::RemoveConstraints( unsigned int tag )
184 {
185   GetImplementation(*this).RemoveConstraints( tag );
186 }
187
188 namespace WeightObject
189 {
190
191 const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
192
193 Handle New()
194 {
195   Handle handle = Handle::New();
196
197   handle.RegisterProperty( "weight", 0.0f );
198
199   return handle;
200 }
201
202 } // namespace WeightObject
203
204 } // namespace Dali