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