Merge "Changed STEREO_HORIZONTAL view mode to work with landscape orientation" into...
[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/object/property-conditions.h>
23 #include <dali/public-api/object/property-notification.h>
24 #include <dali/internal/event/common/object-impl.h>
25 #include <dali/integration-api/debug.h>
26
27 namespace Dali
28 {
29
30 Handle::Handle(Dali::Internal::Object* handle)
31   : BaseHandle(handle)
32 {
33 }
34
35 Handle::Handle()
36 {
37 }
38
39 Handle::~Handle()
40 {
41 }
42
43 Handle::Handle(const Handle& handle)
44   : BaseHandle(handle)
45 {
46 }
47
48 Handle& Handle::operator=(const Handle& rhs)
49 {
50   if( this != &rhs )
51   {
52     BaseHandle::operator=(rhs);
53   }
54
55   return *this;
56 }
57
58 Handle& Handle::operator=(BaseHandle::NullType* rhs)
59 {
60   DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
61   Reset();
62   return *this;
63 }
64
65 Handle Handle::DownCast( BaseHandle handle )
66 {
67   return Handle( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
68 }
69
70
71 bool Handle::Supports(Capability capability) const
72 {
73   return GetImplementation(*this).Supports( capability );
74 }
75
76 unsigned int Handle::GetPropertyCount() const
77 {
78   return GetImplementation(*this).GetPropertyCount();
79 }
80
81 const std::string& Handle::GetPropertyName(Property::Index index) const
82 {
83   return GetImplementation(*this).GetPropertyName( index );
84 }
85
86 Property::Index Handle::GetPropertyIndex(std::string name) const
87 {
88   return GetImplementation(*this).GetPropertyIndex( name );
89 }
90
91 bool Handle::IsPropertyWritable(Property::Index index) const
92 {
93   return GetImplementation(*this).IsPropertyWritable( index );
94 }
95
96 bool Handle::IsPropertyAnimatable(Property::Index index) const
97 {
98   return GetImplementation(*this).IsPropertyAnimatable( index );
99 }
100
101 bool Handle::IsPropertyAConstraintInput(Property::Index index) const
102 {
103   return GetImplementation(*this).IsPropertyAConstraintInput( index );
104 }
105
106 Property::Type Handle::GetPropertyType(Property::Index index) const
107 {
108   return GetImplementation(*this).GetPropertyType( index );
109 }
110
111 void Handle::SetProperty(Property::Index index, Property::Value propertyValue)
112 {
113   GetImplementation(*this).SetProperty( index, propertyValue );
114 }
115
116 Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue)
117 {
118   return GetImplementation(*this).RegisterProperty( name, propertyValue );
119 }
120
121 Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
122 {
123   return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
124 }
125
126 Property::Value Handle::GetProperty(Property::Index index) const
127 {
128   return GetImplementation(*this).GetProperty( index );
129 }
130
131 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
132 {
133   GetImplementation(*this).GetPropertyIndices( indices );
134 }
135
136 Dali::PropertyNotification Handle::AddPropertyNotification(Property::Index index,
137                                                            const PropertyCondition& condition)
138 {
139   return GetImplementation(*this).AddPropertyNotification( index, -1, condition );
140 }
141
142 Dali::PropertyNotification Handle::AddPropertyNotification(Property::Index index,
143                                                            int componentIndex,
144                                                            const PropertyCondition& condition)
145 {
146   return GetImplementation(*this).AddPropertyNotification( index, componentIndex, condition );
147 }
148
149 void Handle::RemovePropertyNotification(Dali::PropertyNotification propertyNotification)
150 {
151   GetImplementation(*this).RemovePropertyNotification( propertyNotification );
152 }
153
154 void Handle::RemovePropertyNotifications()
155 {
156   GetImplementation(*this).RemovePropertyNotifications();
157 }
158
159 } // namespace Dali