Merge remote-tracking branch 'origin/master' into tizen
[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
470                 if (currentIdx > 0 && currentIdx < parentChildren.Count)
471                 {
472                     var low = parentChildren[currentIdx - 1];
473                     LowerBelow(low);
474                 }
475             }
476         }
477
478         /// <summary>
479         /// Raises the layer to the top.
480         /// </summary>
481         /// <since_tizen> 3 </since_tizen>
482         public void RaiseToTop()
483         {
484             var parentChildren = window?.LayersChildren;
485
486             if (parentChildren != null)
487             {
488                 parentChildren.Remove(this);
489                 parentChildren.Add(this);
490
491                 Interop.Layer.RaiseToTop(SwigCPtr);
492                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
493             }
494         }
495
496         /// <summary>
497         /// Lowers the layer to the bottom.
498         /// </summary>
499         /// <since_tizen> 3 </since_tizen>
500         public void LowerToBottom()
501         {
502             var parentChildren = window?.LayersChildren;
503
504             if (parentChildren != null)
505             {
506                 parentChildren.Remove(this);
507                 parentChildren.Insert(0, this);
508
509                 Interop.Layer.LowerToBottom(SwigCPtr);
510                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511             }
512         }
513
514         /// <summary>
515         /// Moves the layer directly above the given layer.<br />
516         /// After the call, this layer's depth will be immediately above target.<br />
517         /// </summary>
518         /// <param name="target">The layer to get on top of.</param>
519         /// <since_tizen> 3 </since_tizen>
520         public void MoveAbove(Layer target)
521         {
522             Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
523             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
524         }
525
526         /// <summary>
527         /// Moves the layer directly below the given layer.<br />
528         /// After the call, this layer's depth will be immediately below target.<br />
529         /// </summary>
530         /// <param name="target">The layer to get below of.</param>
531         /// <since_tizen> 3 </since_tizen>
532         public void MoveBelow(Layer target)
533         {
534             Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
535             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536         }
537
538         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
539         [EditorBrowsable(EditorBrowsableState.Never)]
540         public void SetAnchorPoint(Vector3 anchorPoint)
541         {
542             Interop.Actor.SetAnchorPoint(SwigCPtr, Vector3.getCPtr(anchorPoint));
543             if (NDalicPINVOKE.SWIGPendingException.Pending)
544                 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 SetSize(float width, float height)
550         {
551             Interop.ActorInternal.SetSize(SwigCPtr, width, height);
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 SetParentOrigin(Vector3 parentOrigin)
559         {
560             Interop.ActorInternal.SetParentOrigin(SwigCPtr, Vector3.getCPtr(parentOrigin));
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 SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
568         {
569             Interop.Actor.SetResizePolicy(SwigCPtr, (int)policy, (int)dimension);
570             if (NDalicPINVOKE.SWIGPendingException.Pending)
571                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572         }
573
574         /// <summary>
575         /// Inhouse API.
576         /// This allows the user to specify whether this layer should consume touch (including gestures).
577         /// If set, any layers behind this layer will not be hit-test.
578         /// </summary>
579         /// <param name="consume">Whether the layer should consume touch (including gestures).</param>
580         [EditorBrowsable(EditorBrowsableState.Never)]
581         public void SetTouchConsumed(bool consume)
582         {
583             Interop.Layer.SetTouchConsumed(SwigCPtr, consume);
584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585         }
586
587         /// <summary>
588         /// Inhouse API.
589         /// This allows the user to specify whether this layer should consume hover.
590         /// If set, any layers behind this layer will not be hit-test.
591         /// </summary>
592         /// <param name="consume">Whether the layer should consume hover</param>
593         [EditorBrowsable(EditorBrowsableState.Never)]
594         public void SetHoverConsumed(bool consume)
595         {
596             Interop.Layer.SetHoverConsumed(SwigCPtr, consume);
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598         }
599
600         internal uint GetDepth()
601         {
602             var parentChildren = window?.LayersChildren;
603             if (parentChildren != null)
604             {
605                 int idx = parentChildren.IndexOf(this);
606                 if (idx >= 0)
607                 {
608                     return Convert.ToUInt32(idx); ;
609                 }
610             }
611             return 0u;
612         }
613         internal void RaiseAbove(Layer target)
614         {
615             var parentChildren = window?.LayersChildren;
616             if (parentChildren != null)
617             {
618                 int currentIndex = parentChildren.IndexOf(this);
619                 int targetIndex = parentChildren.IndexOf(target);
620
621                 if (currentIndex < 0 || targetIndex < 0 ||
622                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
623                 {
624                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
625                     return;
626                 }
627
628                 // If the currentIndex is less than the target index and the target has the same parent.
629                 if (currentIndex < targetIndex)
630                 {
631                     parentChildren.Remove(this);
632                     parentChildren.Insert(targetIndex, this);
633
634                     Interop.Layer.MoveAbove(SwigCPtr, Layer.getCPtr(target));
635                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636                 }
637             }
638         }
639
640         internal void LowerBelow(Layer target)
641         {
642             var parentChildren = window?.LayersChildren;
643
644             if (parentChildren != null)
645             {
646                 int currentIndex = parentChildren.IndexOf(this);
647                 int targetIndex = parentChildren.IndexOf(target);
648
649                 if (currentIndex < 0 || targetIndex < 0 ||
650                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
651                 {
652                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
653                     return;
654                 }
655
656                 // If the currentIndex is not already the 0th index and the target has the same parent.
657                 if ((currentIndex != 0) && (targetIndex != -1) &&
658                     (currentIndex > targetIndex))
659                 {
660                     parentChildren.Remove(this);
661                     parentChildren.Insert(targetIndex, this);
662
663                     Interop.Layer.MoveBelow(SwigCPtr, Layer.getCPtr(target));
664                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665                 }
666             }
667         }
668
669         internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
670         {
671             Interop.Layer.SetSortFunction(SwigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
672             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673         }
674
675         internal bool IsTouchConsumed()
676         {
677             bool ret = Interop.Layer.IsTouchConsumed(SwigCPtr);
678             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
679             return ret;
680         }
681         internal bool IsHoverConsumed()
682         {
683             bool ret = Interop.Layer.IsHoverConsumed(SwigCPtr);
684             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685             return ret;
686         }
687
688         internal void AddViewToLayerList(View view)
689         {
690             Children.Add(view);
691         }
692
693         internal void RemoveViewFromLayerList(View view)
694         {
695             Children.Remove(view);
696         }
697
698         internal string GetName()
699         {
700             string ret = Interop.Actor.GetName(SwigCPtr);
701             if (NDalicPINVOKE.SWIGPendingException.Pending)
702                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703             return ret;
704         }
705
706         internal void SetName(string name)
707         {
708             Interop.Actor.SetName(SwigCPtr, name);
709             if (NDalicPINVOKE.SWIGPendingException.Pending)
710                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711         }
712
713         internal void SetWindow(Window win)
714         {
715             if (window == win) return;
716
717             if (window != null)
718             {
719                 window.LayoutController.LayoutCount -= LayoutCount;
720             }
721
722             window = win;
723
724             if (window != null)
725             {
726                 window.LayoutController.LayoutCount += LayoutCount;
727             }
728         }
729
730         internal uint GetId()
731         {
732             uint ret = Interop.Actor.GetId(SwigCPtr);
733             if (NDalicPINVOKE.SWIGPendingException.Pending)
734                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
735             return ret;
736         }
737
738         /// <summary>
739         /// The number of layouts of children views.
740         /// This can be used to set/unset Process callback to calculate Layout.
741         /// </summary>
742         internal int LayoutCount
743         {
744             get
745             {
746                 return layoutCount;
747             }
748
749             set
750             {
751                 if (layoutCount == value) return;
752
753                 if (value < 0) throw new global::System.ArgumentOutOfRangeException(nameof(LayoutCount), "LayoutCount(" + LayoutCount + ") should not be less than zero");
754
755                 int diff = value - layoutCount;
756                 layoutCount = value;
757
758                 if (window != null)
759                 {
760                     window.LayoutController.LayoutCount += diff;
761                 }
762             }
763         }
764
765         /// This will not be public opened.
766         [EditorBrowsable(EditorBrowsableState.Never)]
767         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
768         {
769             Interop.Layer.DeleteLayer(swigCPtr);
770         }
771
772         private void SetBehavior(LayerBehavior behavior)
773         {
774             Interop.Layer.SetBehavior(SwigCPtr, (int)behavior);
775             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776         }
777
778         private LayerBehavior GetBehavior()
779         {
780             Layer.LayerBehavior ret = (Layer.LayerBehavior)Interop.Layer.GetBehavior(SwigCPtr);
781             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782             return ret;
783         }
784
785         internal class Property
786         {
787             internal static readonly int BEHAVIOR = Interop.Layer.BehaviorGet();
788         }
789     }
790 }