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