[SRUK] Initial copy from Tizen 2.2 version
[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 Flora License, Version 1.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://floralicense.org/license/
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 // CLASS HEADER
18 #include <dali/public-api/object/handle.h>
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/object/property-conditions.h>
22 #include <dali/public-api/object/property-notification.h>
23 #include <dali/internal/event/common/object-impl.h>
24 #include <dali/integration-api/debug.h>
25
26 namespace Dali
27 {
28
29 Handle::Handle(Dali::Internal::Object* handle)
30   : BaseHandle(handle)
31 {
32 }
33
34 Handle::Handle()
35 {
36 }
37
38 Handle::~Handle()
39 {
40 }
41
42 Handle::Handle(const Handle& handle)
43   : BaseHandle(handle)
44 {
45 }
46
47 Handle& Handle::operator=(const Handle& rhs)
48 {
49   if( this != &rhs )
50   {
51     BaseHandle::operator=(rhs);
52   }
53
54   return *this;
55 }
56
57 Handle Handle::DownCast( BaseHandle handle )
58 {
59   return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
60 }
61
62
63 bool Handle::Supports(Capability capability) const
64 {
65   return GetImplementation(*this).Supports( capability );
66 }
67
68 unsigned int Handle::GetPropertyCount() const
69 {
70   return GetImplementation(*this).GetPropertyCount();
71 }
72
73 const std::string& Handle::GetPropertyName(Property::Index index) const
74 {
75   return GetImplementation(*this).GetPropertyName( index );
76 }
77
78 Property::Index Handle::GetPropertyIndex(std::string name) const
79 {
80   return GetImplementation(*this).GetPropertyIndex( name );
81 }
82
83 bool Handle::IsPropertyWritable(Property::Index index) const
84 {
85   return GetImplementation(*this).IsPropertyWritable( index );
86 }
87
88 bool Handle::IsPropertyAnimatable(Property::Index index) const
89 {
90   return GetImplementation(*this).IsPropertyAnimatable( index );
91 }
92
93 Property::Type Handle::GetPropertyType(Property::Index index) const
94 {
95   return GetImplementation(*this).GetPropertyType( index );
96 }
97
98 void Handle::SetProperty(Property::Index index, Property::Value propertyValue)
99 {
100   GetImplementation(*this).SetProperty( index, propertyValue );
101 }
102
103 Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue)
104 {
105   return GetImplementation(*this).RegisterProperty( name, propertyValue );
106 }
107
108 Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
109 {
110   return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
111 }
112
113 Property::Value Handle::GetProperty(Property::Index index) const
114 {
115   return GetImplementation(*this).GetProperty( index );
116 }
117
118 Dali::PropertyNotification Handle::AddPropertyNotification(Property::Index index,
119                                                            const PropertyCondition& condition)
120 {
121   return GetImplementation(*this).AddPropertyNotification( index, condition );
122 }
123
124 void Handle::RemovePropertyNotification(Dali::PropertyNotification propertyNotification)
125 {
126   GetImplementation(*this).RemovePropertyNotification( propertyNotification );
127 }
128
129 void Handle::RemovePropertyNotifications()
130 {
131   GetImplementation(*this).RemovePropertyNotifications();
132 }
133
134 } // namespace Dali