Dali 3D User Interface Engine
layer-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_LAYER_H__
2 #define __DALI_INTERNAL_LAYER_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // INTERNAL INCLUDES
25 
26 namespace Dali
27 {
28 
29 namespace Internal
30 {
31 
32 class LayerList;
33 
34 namespace SceneGraph
35 {
36 class UpdateManager;
37 class Layer;
38 }
39 
41 
42 class Layer : public Actor
43 {
44 public:
45 
57  static float ZValue(const Vector3& position)
58  {
59  // inlined so we avoid a function call when sorting renderers
60  return position.z;
61  }
62 
67  static LayerPtr New();
68 
76  static LayerPtr NewRoot( LayerList& layerList, SceneGraph::UpdateManager& manager, bool systemLevel );
77 
81  void OnInitialize();
82 
86  unsigned int GetDepth() const;
87 
91  void Raise();
92 
96  void Lower();
97 
101  void RaiseAbove( const Internal::Layer& target );
102 
106  void LowerBelow( const Internal::Layer& target );
107 
111  void RaiseToTop();
112 
116  void LowerToBottom();
117 
121  void MoveAbove( const Internal::Layer& target );
122 
126  void MoveBelow( const Internal::Layer& target );
127 
131  void SetClipping(bool enabled);
132 
136  bool IsClipping() const
137  {
138  return mIsClipping; // Actor-side has most up-to-date value
139  }
140 
144  void SetClippingBox(int x, int y, int width, int height);
145 
150  {
151  return mClippingBox; // Actor-side has most up-to-date value
152  }
153 
157  void SetBehavior( Dali::Layer::Behavior behavior );
158 
163  {
164  return mBehavior;
165  }
166 
170  void SetDepthTestDisabled( bool disable );
171 
175  bool IsDepthTestDisabled() const;
176 
181 
185  void SetTouchConsumed( bool consume );
186 
190  bool IsTouchConsumed() const;
191 
195  void SetHoverConsumed( bool consume );
196 
200  bool IsHoverConsumed() const;
201 
208 
212  static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
213 
214 public: // Default property extensions from Object
218  virtual unsigned int GetDefaultPropertyCount() const;
219 
223  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
224 
228  virtual const char* GetDefaultPropertyName(Property::Index index) const;
229 
233  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
234 
238  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
239 
243  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
244 
248  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
249 
254 
258  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
259 
263  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
264 
265 protected:
266 
271  Layer( Actor::DerivedType type );
272 
276  virtual ~Layer();
277 
278 private: // From Actor
279 
284  virtual SceneGraph::Node* CreateNode() const;
285 
289  virtual void OnStageConnectionInternal();
290 
294  virtual void OnStageDisconnectionInternal();
295 
296 private:
297 
299 
300  // These properties not animatable; the actor side has the most up-to-date values
303 
305 
306  bool mIsClipping:1;
308  bool mTouchConsumed:1;
309  bool mHoverConsumed:1;
310 
311 };
312 
313 } // namespace Internal
314 
315 // Helpers for public-api forwarding methods
316 
318 {
319  DALI_ASSERT_ALWAYS(layer && "Layer handle is empty");
320 
321  BaseObject& handle = layer.GetBaseObject();
322 
323  return static_cast<Internal::Layer&>(handle);
324 }
325 
326 inline const Internal::Layer& GetImplementation(const Dali::Layer& layer)
327 {
328  DALI_ASSERT_ALWAYS(layer && "Layer handle is empty");
329 
330  const BaseObject& handle = layer.GetBaseObject();
331 
332  return static_cast<const Internal::Layer&>(handle);
333 }
334 
335 } // namespace Dali
336 
337 
338 #endif //__DALI_INTERNAL_LAYER_H__
Dali Docs Home
Read more about Dali