Merge "DALi Version 1.0.4" into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / actors / layer.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/actors/layer.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/actors/layer-impl.h>
23 #include <dali/internal/event/images/frame-buffer-image-impl.h>
24
25 namespace Dali
26 {
27
28 using Dali::Layer;
29
30 const char* const Layer::ACTION_RAISE = "raise";
31 const char* const Layer::ACTION_LOWER = "lower";
32 const char* const Layer::ACTION_RAISE_TO_TOP = "raise-to-top";
33 const char* const Layer::ACTION_LOWER_TO_BOTTOM = "lower-to-bottom";
34
35
36 Layer::Layer()
37 {
38 }
39
40 Layer Layer::New()
41 {
42   Internal::LayerPtr internal = Internal::Layer::New();
43
44   return Layer(internal.Get());
45 }
46
47 Layer Layer::DownCast( BaseHandle handle )
48 {
49   return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
50 }
51
52 Layer::~Layer()
53 {
54 }
55
56 Layer::Layer(const Layer& copy)
57 : Actor(copy)
58 {
59 }
60
61 Layer& Layer::operator=(const Layer& rhs)
62 {
63   BaseHandle::operator=(rhs);
64   return *this;
65 }
66
67 Layer& Layer::operator=(BaseHandle::NullType* rhs)
68 {
69   DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
70   Reset();
71   return *this;
72 }
73
74 unsigned int Layer::GetDepth() const
75 {
76   return GetImplementation(*this).GetDepth();
77 }
78
79 void Layer::Raise()
80 {
81   GetImplementation(*this).Raise();
82 }
83
84 void Layer::Lower()
85 {
86   GetImplementation(*this).Lower();
87 }
88
89 void Layer::RaiseAbove( Layer target )
90 {
91   GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
92 }
93
94 void Layer::LowerBelow( Layer target )
95 {
96   GetImplementation(*this).LowerBelow( GetImplementation( target ) );
97 }
98
99 void Layer::RaiseToTop()
100 {
101   GetImplementation(*this).RaiseToTop();
102 }
103
104 void Layer::LowerToBottom()
105 {
106   GetImplementation(*this).LowerToBottom();
107 }
108
109 void Layer::MoveAbove( Layer target )
110 {
111   GetImplementation(*this).MoveAbove( GetImplementation( target ) );
112 }
113
114 void Layer::MoveBelow( Layer target )
115 {
116   GetImplementation(*this).MoveBelow( GetImplementation( target ) );
117 }
118
119 void Layer::SetClipping(bool enabled)
120 {
121   GetImplementation(*this).SetClipping(enabled);
122 }
123
124 bool Layer::IsClipping() const
125 {
126   return GetImplementation(*this).IsClipping();
127 }
128
129 void Layer::SetClippingBox(int x, int y, int width, int height)
130 {
131   GetImplementation(*this).SetClippingBox(x, y, width, height);
132 }
133
134 void Layer::SetClippingBox(ClippingBox box)
135 {
136   GetImplementation(*this).SetClippingBox(box.x, box.y, box.width, box.height);
137 }
138
139 ClippingBox Layer::GetClippingBox() const
140 {
141   return GetImplementation(*this).GetClippingBox();
142 }
143
144 void Layer::SetDepthTestDisabled( bool disable )
145 {
146   GetImplementation(*this).SetDepthTestDisabled( disable );
147 }
148
149 bool Layer::IsDepthTestDisabled() const
150 {
151   return GetImplementation(*this).IsDepthTestDisabled();
152 }
153
154 float Layer::ZValue(const Vector3& position, float sortModifier)
155 {
156   return Internal::Layer::ZValue( position, sortModifier );
157 }
158
159 void Layer::SetSortFunction(SortFunctionType function)
160 {
161   GetImplementation(*this).SetSortFunction(function);
162 }
163
164 void Layer::SetTouchConsumed( bool consume )
165 {
166   GetImplementation( *this ).SetTouchConsumed( consume );
167 }
168
169 bool Layer::IsTouchConsumed() const
170 {
171   return GetImplementation( *this ).IsTouchConsumed();
172 }
173
174 Layer::Layer(Internal::Layer* internal)
175 : Actor(internal)
176 {
177 }
178
179 } // namespace Dali
180