fa78077db7ce3ca08f031e7096e851c0291947e7
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / Layer.cs
1 /*
2  * Copyright(c) 2022 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 using System;
18 using Tizen.NUI.BaseComponents;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// Layers provide a mechanism for overlaying groups of actors on top of each other.
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     public class Layer : Container
28     {
29         private Window window;
30         private int layoutCount = 0;
31
32         /// <summary>
33         /// Creates a Layer object.
34         /// </summary>
35         /// <since_tizen> 3 </since_tizen>
36         public Layer() : this(Interop.Layer.New(), true)
37         {
38             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
39             this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft);
40             this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions);
41         }
42
43         internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
44         {
45         }
46
47         /// <summary>
48         /// Dispose Explicit or Implicit
49         /// </summary>
50         [EditorBrowsable(EditorBrowsableState.Never)]
51         protected override void Dispose(DisposeTypes type)
52         {
53             if (Disposed)
54             {
55                 return;
56             }
57
58             LayoutCount = 0;
59
60             base.Dispose(type);
61         }
62
63         /// <summary>
64         /// Enumeration for the behavior of the layer.
65         /// </summary>
66         /// <since_tizen> 3 </since_tizen>
67         public enum LayerBehavior
68         {
69             /// <summary>
70             /// UI control rendering mode (default mode).
71             /// This mode is designed for UI controls that can overlap. In this
72             /// mode renderer order will be respective to the tree hierarchy of
73             /// Actors.<br />
74             /// The rendering order is depth first, so for the following actor tree,
75             /// A will be drawn first, then B, D, E, then C, F.  This ensures that
76             /// overlapping actors are drawn as expected (whereas, with breadth first
77             /// traversal, the actors would interleave).<br />
78             /// </summary>
79             /// <since_tizen> 3 </since_tizen>
80             LayerUI,
81
82             /// <summary>
83             /// Layer will use depth test.
84             /// This mode is designed for a 3 dimensional scene where actors in front
85             /// of other actors will obscure them, i.e. the actors are sorted by the
86             /// distance from the camera.<br />
87             /// When using this mode, a depth test will be used. A depth clear will
88             /// happen for each layer, which means actors in a layer "above" other
89             /// layers will be rendered in front of actors in those layers regardless
90             /// of their Z positions (see Layer::Raise() and Layer::Lower()).<br />
91             /// Opaque renderers are drawn first and write to the depth buffer.  Then
92             /// transparent renderers are drawn with depth test enabled but depth
93             /// write switched off.  Transparent renderers are drawn based on their
94             /// distance from the camera.  A renderer's DEPTH_INDEX property is used to
95             /// offset the distance to the camera when ordering transparent renderers.
96             /// This is useful if you want to define the draw order of two or more
97             /// transparent renderers that are equal distance from the camera.  Unlike
98             /// LAYER_UI, parent-child relationship does not affect rendering order at
99             /// all.
100             /// </summary>
101             /// <since_tizen> 3 </since_tizen>
102             Layer3D
103         }
104
105         internal enum TreeDepthMultiplier
106         {
107             TREE_DEPTH_MULTIPLIER = 10000
108         }
109
110         /// <summary>
111         /// Layer behavior, type String (Layer.LayerBehavior).
112         /// </summary>
113         /// <since_tizen> 3 </since_tizen>
114         public Layer.LayerBehavior Behavior
115         {
116             get
117             {
118                 return GetBehavior();
119             }
120             set
121             {
122                 SetBehavior(value);
123             }
124         }
125
126         /// <summary>
127         /// Sets the viewport (in window coordinates), type rectangle.
128         /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
129         /// </summary>
130         /// <since_tizen> 4 </since_tizen>
131         public Rectangle Viewport
132         {
133             get
134             {
135                 if (ClippingEnabled)
136                 {
137                     Rectangle ret = new Rectangle(Interop.Layer.GetClippingBox(SwigCPtr), true);
138                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
139                     return ret;
140                 }
141                 else
142                 {
143                     // Clipping not enabled so return the window size
144                     Size2D windowSize = window?.Size;
145                     Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height);
146                     return ret;
147                 }
148             }
149             set
150             {
151                 Interop.Layer.SetClippingBox(SwigCPtr, Rectangle.getCPtr(value));
152                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153                 ClippingEnabled = true;
154             }
155         }
156
157         /// <summary>
158         /// Retrieves and sets the layer's opacity.<br />
159         /// </summary>
160         /// <since_tizen> 3 </since_tizen>
161         public float Opacity
162         {
163             get
164             {
165                 float temp = 0.0f;
166                 var pValue = GetProperty(View.Property.OPACITY);
167                 pValue.Get(out temp);
168                 pValue.Dispose();
169                 return temp;
170             }
171             set
172             {
173                 var temp = new Tizen.NUI.PropertyValue(value);
174                 SetProperty(View.Property.OPACITY, temp);
175                 temp.Dispose();
176             }
177         }
178
179         /// <summary>
180         /// Retrieves and sets the layer's visibility.
181         /// </summary>
182         /// <since_tizen> 3 </since_tizen>
183         public bool Visibility
184         {
185             get
186             {
187                 bool temp = false;
188                 var pValue = GetProperty(View.Property.VISIBLE);
189                 pValue.Get(out temp);
190                 pValue.Dispose();
191                 return temp;
192             }
193             set
194             {
195                 var temp = new Tizen.NUI.PropertyValue(value);
196                 SetProperty(View.Property.VISIBLE, temp);
197                 temp.Dispose();
198             }
199         }
200
201         /// <summary>
202         /// Get the number of children held by the layer.
203         /// </summary>
204         /// <since_tizen> 3 </since_tizen>
205         public new uint ChildCount
206         {
207             get
208             {
209                 return Convert.ToUInt32(Children.Count);
210             }
211         }
212
213         /// <summary>
214         /// Gets or sets the layer's name.
215         /// </summary>
216         /// <since_tizen> 3 </since_tizen>
217         public string Name
218         {
219             get
220             {
221                 return GetName();
222             }
223             set
224             {
225                 SetName(value);
226             }
227         }
228
229         /// <summary>
230         /// Queries the depth of the layer.<br />
231         /// 0 is the bottommost layer, higher number is on the top.<br />
232         /// </summary>
233         /// <since_tizen> 3 </since_tizen>
234         public uint Depth
235         {
236             get
237             {
238                 return GetDepth();
239             }
240         }
241
242         /// <summary>
243         /// Internal only property to enable or disable clipping, type boolean.
244         /// By default, this is false, i.e., the viewport of the layer is the entire window.
245         /// </summary>
246         internal bool ClippingEnabled
247         {
248             get
249             {
250                 bool ret = Interop.Layer.IsClipping(SwigCPtr);
251                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252                 return ret;
253             }
254             set
255             {
256                 Interop.Layer.SetClipping(SwigCPtr, value);
257                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258             }
259         }
260
261         /// <summary>
262         /// Gets the Layer's ID
263         /// Readonly
264         /// </summary>
265         /// <remarks>Hidden-API</remarks>
266         [EditorBrowsable(EditorBrowsableState.Never)]
267         public uint ID
268         {
269             get
270             {
271                 return GetId();
272             }
273         }
274
275
276         /// From the Container base class.
277
278         /// <summary>
279         /// Adds a child view to this layer.
280         /// </summary>
281         /// <seealso cref="Container.Add">
282         /// </seealso>
283         /// <exception cref="ArgumentNullException"> Thrown when child is null. </exception>
284         /// <since_tizen> 4 </since_tizen>
285         public override void Add(View child)
286         {
287             if (null == child)
288             {
289                 throw new ArgumentNullException(nameof(child));
290             }
291
292             Container oldParent = child.GetParent();
293
294             if (oldParent != this)
295             {
296                 if (oldParent != null)
297                 {
298                     oldParent.Remove(child);
299                 }
300                 else
301                 {
302                     child.InternalParent = this;
303                 }
304
305                 LayoutCount += child.LayoutCount;
306
307                 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
308                 if (NDalicPINVOKE.SWIGPendingException.Pending)
309                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310                 Children.Add(child);
311                 OnChildAdded(child);
312             }
313         }
314
315         /// <summary>
316         /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op.
317         /// </summary>
318         /// <seealso cref="Container.Remove">
319         /// </seealso>
320         /// <exception cref="ArgumentNullException"> Thrown when child is null. </exception>
321         /// <since_tizen> 4 </since_tizen>
322         public override void Remove(View child)
323         {
324             if (null == child)
325             {
326                 throw new ArgumentNullException(nameof(child));
327             }
328             if (child.GetParent() == null) // Early out if child parent is null.
329                 return;
330
331             if (child.GetParent() != this)
332             {
333                 //throw new System.InvalidOperationException("You have deleted a view that is not a child of this layer.");
334                 Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this layer.");
335                 return;
336             }
337             Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
338             if (NDalicPINVOKE.SWIGPendingException.Pending)
339                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340
341             Children.Remove(child);
342             child.InternalParent = null;
343             OnChildRemoved(child);
344             LayoutCount -= child.LayoutCount;
345         }
346
347         /// <summary>
348         /// Retrieves a child view by the index.
349         /// </summary>
350         /// <pre>The view has been initialized.</pre>
351         /// <param name="index">The index of the child to retrieve.</param>
352         /// <returns>The view for the given index or empty handle if children not initialized.</returns>
353         /// <since_tizen> 4 </since_tizen>
354         public override View GetChildAt(uint index)
355         {
356             if (index < Children.Count)
357             {
358                 return Children[Convert.ToInt32(index)];
359             }
360             else
361             {
362                 return null;
363             }
364         }
365
366         /// <summary>
367         /// Get parent of the layer.
368         /// </summary>
369         /// <returns>The view's container</returns>
370         /// <since_tizen> 4 </since_tizen>
371         public override Container GetParent()
372         {
373             return null;
374         }
375
376         /// <summary>
377         /// Get the child count of the layer.
378         /// </summary>
379         /// <returns>The child count of the layer.</returns>
380         /// <since_tizen> 4 </since_tizen>
381         [Obsolete("Deprecated in API9, will be removed in API11. Please use ChildCount property instead!")]
382         public override uint GetChildCount()
383         {
384             return Convert.ToUInt32(Children.Count);
385         }
386
387         /// <summary>
388         /// Downcasts a handle to layer handle.
389         /// </summary>
390         /// <exception cref="ArgumentNullException"> Thrown when handle is null. </exception>
391         /// <since_tizen> 3 </since_tizen>
392         /// Please do not use! this will be deprecated!
393         /// Instead please use as keyword.
394         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
395         [EditorBrowsable(EditorBrowsableState.Never)]
396         public static Layer DownCast(BaseHandle handle)
397         {
398             if (null == handle)
399             {
400                 throw new ArgumentNullException(nameof(handle));
401             }
402             Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer;
403             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404             return ret;
405         }
406
407         /// <summary>
408         /// Search through this layer's hierarchy for a view with the given unique ID.
409         /// </summary>
410         /// <pre>This layer (the parent) has been initialized.</pre>
411         /// <remarks>The actor itself is also considered in the search.</remarks>
412         /// <param name="id">The id of the child to find</param>
413         /// <returns> A handle to the view if found, or an empty handle if not. </returns>
414         /// <since_tizen> 3 </since_tizen>
415         public View FindChildById(uint id)
416         {
417             //to fix memory leak issue, match the handle count with native side.
418             IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
419             View ret = this.GetInstanceSafely<View>(cPtr);
420             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421             return ret;
422         }
423
424         internal override View FindCurrentChildById(uint id)
425         {
426             return FindChildById(id);
427         }
428
429         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
430         [EditorBrowsable(EditorBrowsableState.Never)]
431         public View FindChildByName(string viewName)
432         {
433             //to fix memory leak issue, match the handle count with native side.
434             IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
435             View ret = this.GetInstanceSafely<View>(cPtr);
436             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
437             return ret;
438         }
439
440         /// <summary>
441         /// Increments the depth of the layer.
442         /// </summary>
443         /// <since_tizen> 3 </since_tizen>
444         public void Raise()
445         {
446             var parentChildren = window?.LayersChildren;
447             if (parentChildren != null)
448             {
449                 int currentIdx = parentChildren.IndexOf(this);
450
451                 if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1)
452                 {
453                     var upper = parentChildren[currentIdx + 1];
454                     RaiseAbove(upper);
455                 }
456             }
457         }
458
459         /// <summary>
460         /// Decrements the depth of the layer.
461         /// </summary>
462         /// <since_tizen> 3 </since_tizen>
463         public void Lower()
464         {
465             var parentChildren = window?.LayersChildren;
466             if (parentChildren != null)
467             {
468                 int currentIdx = parentChildren.IndexOf(this);
469                 int idx = window.IsBorderEnabled ? 1 : 0;
470
471                 if (currentIdx > idx && currentIdx < parentChildren.Count)
472                 {
473                     var low = parentChildren[currentIdx - 1];
474                     LowerBelow(low);
475                 }
476             }
477         }
478
479         /// <summary>
480         /// Raises the layer to the top.
481         /// </summary>
482         /// <since_tizen> 3 </since_tizen>
483         public void RaiseToTop()
484         {
485             var parentChildren = window?.LayersChildren;
486
487             if (parentChildren != null)
488             {
489                 parentChildren.Remove(this);
490                 parentChildren.Add(this);
491
492                 Interop.Layer.RaiseToTop(SwigCPtr);
493                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494             }
495         }
496
497         /// <summary>
498         /// Lowers the layer to the bottom.
499         /// </summary>
500         /// <since_tizen> 3 </since_tizen>
501         public void LowerToBottom()
502         {
503             var parentChildren = window?.LayersChildren;
504
505             if (parentChildren != null)
506             {
507                 parentChildren.Remove(this);
508                 parentChildren.Insert(0, this);
509
510                 Interop.Layer.LowerToBottom(SwigCPtr);
511
512                 if (window.IsBorderEnabled)
513                 {
514                     Layer bottomLayer = window.GetBorderWindowBottomLayer();
515                     parentChildren.Remove(bottomLayer);
516                     parentChildren.Insert(0, bottomLayer);
517                     Interop.Layer.LowerToBottom(Layer.getCPtr(bottomLayer));
518                 }
519                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520             }
521         }
522
523         /// <summary>
524         /// Moves the layer directly above the given layer.<br />
525         /// After the call, this layer's depth will be immediately above target.<br />
526         /// </summary>
527         /// <param name="target">The layer to get on top of.</param>
528         /// <since_tizen> 3 </since_tizen>
529         public void MoveAbove(Layer target)
530         {
531             Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
532             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533         }
534
535         /// <summary>
536         /// Moves the layer directly below the given layer.<br />
537         /// After the call, this layer's depth will be immediately below target.<br />
538         /// </summary>
539         /// <param name="target">The layer to get below of.</param>
540         /// <since_tizen> 3 </since_tizen>
541         public void MoveBelow(Layer target)
542         {
543             Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
544             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545         }
546
547         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
548         [EditorBrowsable(EditorBrowsableState.Never)]
549         public void SetAnchorPoint(Vector3 anchorPoint)
550         {
551             Interop.Actor.SetAnchorPoint(SwigCPtr, Vector3.getCPtr(anchorPoint));
552             if (NDalicPINVOKE.SWIGPendingException.Pending)
553                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554         }
555
556         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
557         [EditorBrowsable(EditorBrowsableState.Never)]
558         public void SetSize(float width, float height)
559         {
560             Interop.ActorInternal.SetSize(SwigCPtr, width, height);
561             if (NDalicPINVOKE.SWIGPendingException.Pending)
562                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
563         }
564
565         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
566         [EditorBrowsable(EditorBrowsableState.Never)]
567         public void SetParentOrigin(Vector3 parentOrigin)
568         {
569             Interop.ActorInternal.SetParentOrigin(SwigCPtr, Vector3.getCPtr(parentOrigin));
570             if (NDalicPINVOKE.SWIGPendingException.Pending)
571                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572         }
573
574         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
575         [EditorBrowsable(EditorBrowsableState.Never)]
576         public void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
577         {
578             Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
579             if (NDalicPINVOKE.SWIGPendingException.Pending)
580                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
581         }
582
583         /// <summary>
584         /// Inhouse API.
585         /// This allows the user to specify whether this layer should consume touch (including gestures).
586         /// If set, any layers behind this layer will not be hit-test.
587         /// </summary>
588         /// <param name="consume">Whether the layer should consume touch (including gestures).</param>
589         [EditorBrowsable(EditorBrowsableState.Never)]
590         public void SetTouchConsumed(bool consume)
591         {
592             Interop.Layer.SetTouchConsumed(SwigCPtr, consume);
593             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
594         }
595
596         /// <summary>
597         /// Inhouse API.
598         /// This allows the user to specify whether this layer should consume hover.
599         /// If set, any layers behind this layer will not be hit-test.
600         /// </summary>
601         /// <param name="consume">Whether the layer should consume hover</param>
602         [EditorBrowsable(EditorBrowsableState.Never)]
603         public void SetHoverConsumed(bool consume)
604         {
605             Interop.Layer.SetHoverConsumed(SwigCPtr, consume);
606             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607         }
608
609         internal uint GetDepth()
610         {
611             var parentChildren = window?.LayersChildren;
612             if (parentChildren != null)
613             {
614                 int idx = parentChildren.IndexOf(this);
615                 if (idx >= 0)
616                 {
617                     return Convert.ToUInt32(idx); ;
618                 }
619             }
620             return 0u;
621         }
622         internal void RaiseAbove(Layer target)
623         {
624             var parentChildren = window?.LayersChildren;
625             if (parentChildren != null)
626             {
627                 int currentIndex = parentChildren.IndexOf(this);
628                 int targetIndex = parentChildren.IndexOf(target);
629
630                 if (currentIndex < 0 || targetIndex < 0 ||
631                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
632                 {
633                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
634                     return;
635                 }
636
637                 // If the currentIndex is less than the target index and the target has the same parent.
638                 if (currentIndex < targetIndex)
639                 {
640                     parentChildren.Remove(this);
641                     parentChildren.Insert(targetIndex, this);
642
643                     Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
644                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645                 }
646             }
647         }
648
649         internal void LowerBelow(Layer target)
650         {
651             var parentChildren = window?.LayersChildren;
652
653             if (parentChildren != null)
654             {
655                 int currentIndex = parentChildren.IndexOf(this);
656                 int targetIndex = parentChildren.IndexOf(target);
657
658                 if (currentIndex < 0 || targetIndex < 0 ||
659                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
660                 {
661                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
662                     return;
663                 }
664
665                 // If the currentIndex is not already the 0th index and the target has the same parent.
666                 if ((currentIndex != 0) && (targetIndex != -1) &&
667                     (currentIndex > targetIndex))
668                 {
669                     parentChildren.Remove(this);
670                     parentChildren.Insert(targetIndex, this);
671
672                     Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
673                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
674                 }
675             }
676         }
677
678         internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
679         {
680             Interop.Layer.SetSortFunction(SwigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
681             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
682         }
683
684         internal bool IsTouchConsumed()
685         {
686             bool ret = Interop.Layer.IsTouchConsumed(SwigCPtr);
687             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688             return ret;
689         }
690         internal bool IsHoverConsumed()
691         {
692             bool ret = Interop.Layer.IsHoverConsumed(SwigCPtr);
693             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
694             return ret;
695         }
696
697         internal void AddViewToLayerList(View view)
698         {
699             Children.Add(view);
700         }
701
702         internal void RemoveViewFromLayerList(View view)
703         {
704             Children.Remove(view);
705         }
706
707         internal string GetName()
708         {
709             string ret = Interop.Actor.GetName(SwigCPtr);
710             if (NDalicPINVOKE.SWIGPendingException.Pending)
711                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712             return ret;
713         }
714
715         internal void SetName(string name)
716         {
717             Interop.Actor.SetName(SwigCPtr, name);
718             if (NDalicPINVOKE.SWIGPendingException.Pending)
719                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
720         }
721
722         internal void SetWindow(Window win)
723         {
724             if (window == win) return;
725
726             if (window != null)
727             {
728                 window.LayoutController.LayoutCount -= LayoutCount;
729             }
730
731             window = win;
732
733             if (window != null)
734             {
735                 window.LayoutController.LayoutCount += LayoutCount;
736             }
737         }
738
739         internal uint GetId()
740         {
741             uint ret = Interop.Actor.GetId(SwigCPtr);
742             if (NDalicPINVOKE.SWIGPendingException.Pending)
743                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744             return ret;
745         }
746
747         /// <summary>
748         /// The number of layouts of children views.
749         /// This can be used to set/unset Process callback to calculate Layout.
750         /// </summary>
751         internal int LayoutCount
752         {
753             get
754             {
755                 return layoutCount;
756             }
757
758             set
759             {
760                 if (layoutCount == value) return;
761
762                 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
763
764                 if (window != null)
765                 {
766                     if (value == 0)
767                     {
768                         window.LayoutController.LayoutCount = 0;
769                     }
770                     else
771                     {
772                         int diff = value - layoutCount;
773                         window.LayoutController.LayoutCount += diff;
774                     }
775                 }
776                 layoutCount = value;
777             }
778         }
779
780         /// This will not be public opened.
781         [EditorBrowsable(EditorBrowsableState.Never)]
782         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
783         {
784             Interop.Layer.DeleteLayer(swigCPtr);
785         }
786
787         private void SetBehavior(LayerBehavior behavior)
788         {
789             Interop.Layer.SetBehavior(SwigCPtr, (int)behavior);
790             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791         }
792
793         private LayerBehavior GetBehavior()
794         {
795             Layer.LayerBehavior ret = (Layer.LayerBehavior)Interop.Layer.GetBehavior(SwigCPtr);
796             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797             return ret;
798         }
799
800         internal class Property
801         {
802             internal static readonly int BEHAVIOR = Interop.Layer.BehaviorGet();
803         }
804     }
805 }