2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/actors/layer.h>
22 #include <dali/internal/event/actors/layer-impl.h>
23 #include <dali/internal/event/images/frame-buffer-image-impl.h>
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";
42 Internal::LayerPtr internal = Internal::Layer::New();
44 return Layer(internal.Get());
47 Layer Layer::DownCast( BaseHandle handle )
49 return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
56 Layer::Layer(const Layer& copy)
61 Layer& Layer::operator=(const Layer& rhs)
63 BaseHandle::operator=(rhs);
67 Layer& Layer::operator=(BaseHandle::NullType* rhs)
69 DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
74 unsigned int Layer::GetDepth() const
76 return GetImplementation(*this).GetDepth();
81 GetImplementation(*this).Raise();
86 GetImplementation(*this).Lower();
89 void Layer::RaiseAbove( Layer target )
91 GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
94 void Layer::LowerBelow( Layer target )
96 GetImplementation(*this).LowerBelow( GetImplementation( target ) );
99 void Layer::RaiseToTop()
101 GetImplementation(*this).RaiseToTop();
104 void Layer::LowerToBottom()
106 GetImplementation(*this).LowerToBottom();
109 void Layer::MoveAbove( Layer target )
111 GetImplementation(*this).MoveAbove( GetImplementation( target ) );
114 void Layer::MoveBelow( Layer target )
116 GetImplementation(*this).MoveBelow( GetImplementation( target ) );
119 void Layer::SetClipping(bool enabled)
121 GetImplementation(*this).SetClipping(enabled);
124 bool Layer::IsClipping() const
126 return GetImplementation(*this).IsClipping();
129 void Layer::SetClippingBox(int x, int y, int width, int height)
131 GetImplementation(*this).SetClippingBox(x, y, width, height);
134 void Layer::SetClippingBox(ClippingBox box)
136 GetImplementation(*this).SetClippingBox(box.x, box.y, box.width, box.height);
139 ClippingBox Layer::GetClippingBox() const
141 return GetImplementation(*this).GetClippingBox();
144 void Layer::SetDepthTestDisabled( bool disable )
146 GetImplementation(*this).SetDepthTestDisabled( disable );
149 bool Layer::IsDepthTestDisabled() const
151 return GetImplementation(*this).IsDepthTestDisabled();
154 float Layer::ZValue(const Vector3& position, float sortModifier)
156 return Internal::Layer::ZValue( position, sortModifier );
159 void Layer::SetSortFunction(SortFunctionType function)
161 GetImplementation(*this).SetSortFunction(function);
164 void Layer::SetTouchConsumed( bool consume )
166 GetImplementation( *this ).SetTouchConsumed( consume );
169 bool Layer::IsTouchConsumed() const
171 return GetImplementation( *this ).IsTouchConsumed();
174 Layer::Layer(Internal::Layer* internal)