[NUI] Refactor dispose pattern to reduce duplication (#1112)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.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 System.ComponentModel;
19 using System.Collections.Generic;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22
23 namespace Tizen.NUI
24 {
25     /// <summary>
26     /// The window class is used internally for drawing.<br />
27     /// The window has an orientation and indicator properties.<br />
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public partial class Window : BaseHandle
31     {
32         private static readonly Window instance = Application.Instance?.GetWindow();
33         private global::System.Runtime.InteropServices.HandleRef stageCPtr;
34         private Layer _rootLayer;
35         private string _windowTitle;
36         private List<Layer> _childLayers = new List<Layer>();
37         private LayoutController localController;
38
39         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
40         {
41             if (Interop.Stage.Stage_IsInstalled())
42             {
43                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
44
45                 localController = new LayoutController(this);
46                 NUILog.Debug("layoutController id:" + localController.GetId() );
47             }
48         }
49                 
50         /// <summary>
51         /// Creates a new Window.<br />
52         /// This creates an extra window in addition to the default main window<br />
53         /// </summary>
54         /// <param name="windowPosition">The position and size of the Window.</param>
55         /// <param name="isTranslucent">Whether Window is translucent.</param>
56         /// <returns>A new Window.</returns>
57         /// <since_tizen> 6 </since_tizen>
58         public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
59         {
60             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61         }
62
63         /// <summary>
64         /// Creates a new Window with a specific name.<br />
65         /// This creates an extra window in addition to the default main window<br />
66         /// </summary>
67         /// <param name="name">The name for extra window. </param>
68         /// <param name="windowPosition">The position and size of the Window.</param>
69         /// <param name="isTranslucent">Whether Window is translucent.</param>
70         /// <returns>A new Window.</returns>
71         /// <since_tizen> 6 </since_tizen>
72         public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
73         {
74             this._windowTitle = name;
75             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
76         }
77
78         /// <summary>
79         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
80         /// </summary>
81         /// <since_tizen> 3 </since_tizen>
82         public enum WindowOrientation
83         {
84             /// <summary>
85             /// Portrait orientation. The height of the display area is greater than the width.
86             /// </summary>
87             /// <since_tizen> 3 </since_tizen>
88             Portrait = 0,
89             /// <summary>
90             /// Landscape orientation. A wide view area is needed.
91             /// </summary>
92             /// <since_tizen> 3 </since_tizen>
93             Landscape = 90,
94             /// <summary>
95             /// Portrait inverse orientation.
96             /// </summary>
97             /// <since_tizen> 3 </since_tizen>
98             PortraitInverse = 180,
99             /// <summary>
100             /// Landscape inverse orientation.
101             /// </summary>
102             /// <since_tizen> 3 </since_tizen>
103             LandscapeInverse = 270
104         }
105
106         /// <summary>
107         /// Enumeration for the key grab mode for platform-level APIs.
108         /// </summary>
109         /// <since_tizen> 3 </since_tizen>
110         public enum KeyGrabMode
111         {
112             /// <summary>
113             /// Grabs a key only when on the top of the grabbing-window stack mode.
114             /// </summary>
115             Topmost = 0,
116             /// <summary>
117             /// Grabs a key together with the other client window(s) mode.
118             /// </summary>
119             Shared,
120             /// <summary>
121             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode.
122             /// </summary>
123             OverrideExclusive,
124             /// <summary>
125             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
126             /// </summary>
127             Exclusive
128         };
129
130         /// <summary>
131         /// Enumeration for transition effect's state.
132         /// </summary>
133         [EditorBrowsable(EditorBrowsableState.Never)]
134         public enum EffectStates
135         {
136             /// <summary>
137             /// None state.
138             /// </summary>
139             [EditorBrowsable(EditorBrowsableState.Never)]
140             None = 0,
141             /// <summary>
142             /// Transition effect is started.
143             /// </summary>
144             [EditorBrowsable(EditorBrowsableState.Never)]
145             Start,
146             /// <summary>
147             /// Transition effect is ended.
148             /// </summary>
149             [EditorBrowsable(EditorBrowsableState.Never)]
150             End,
151         }
152
153         /// <summary>
154         /// Enumeration for transition effect's type.
155         /// </summary>
156         [EditorBrowsable(EditorBrowsableState.Never)]
157         public enum EffectTypes
158         {
159             /// <summary>
160             /// None type.
161             /// </summary>
162             [EditorBrowsable(EditorBrowsableState.Never)]
163             None = 0,
164             /// <summary>
165             /// Window show effect.
166             /// </summary>
167             [EditorBrowsable(EditorBrowsableState.Never)]
168             Show,
169             /// <summary>
170             /// Window hide effect.
171             /// </summary>
172             [EditorBrowsable(EditorBrowsableState.Never)]
173             Hide,
174         }
175
176         /// <summary>
177         /// Enumeration for opacity of the indicator.
178         /// </summary>
179         internal enum IndicatorBackgroundOpacity
180         {
181             Opaque = 100,
182             Translucent = 50,
183             Transparent = 0
184         }
185
186         /// <summary>
187         /// Enumeration for visible mode of the indicator.
188         /// </summary>
189         internal enum IndicatorVisibleMode
190         {
191             Invisible = 0,
192             Visible = 1,
193             Auto = 2
194         }
195
196         /// <summary>
197         /// The stage instance property (read-only).<br />
198         /// Gets the current window.<br />
199         /// </summary>
200         /// <since_tizen> 3 </since_tizen>
201         public static Window Instance
202         {
203             get
204             {
205                 return instance;
206             }
207         }
208
209         /// <summary>
210         /// Gets or sets a window type.
211         /// </summary>
212         /// <since_tizen> 3 </since_tizen>
213         public WindowType Type
214         {
215             get
216             {
217                 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
218                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219                 return ret;
220             }
221             set
222             {
223                 Interop.Window.SetType(swigCPtr, (int)value);
224                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225             }
226         }
227
228         /// <summary>
229         /// Gets/Sets a window title.
230         /// </summary>
231         /// <since_tizen> 4 </since_tizen>
232         public string Title
233         {
234             get
235             {
236                 return _windowTitle;
237             }
238             set
239             {
240                 _windowTitle = value;
241                 SetClass(_windowTitle, "");
242             }
243         }
244
245         /// <summary>
246         /// The rendering behavior of a Window.
247         /// </summary>
248         /// <since_tizen> 5 </since_tizen>
249         public RenderingBehaviorType RenderingBehavior
250         {
251             get
252             {
253                 return GetRenderingBehavior();
254             }
255             set
256             {
257                 SetRenderingBehavior(value);
258             }
259         }
260
261         /// <summary>
262         /// The window size property (read-only).
263         /// </summary>
264         /// <since_tizen> 3 </since_tizen>
265         public Size2D Size
266         {
267             get
268             {
269                 Size2D ret = GetSize();
270                 return ret;
271             }
272         }
273
274         /// <summary>
275         /// The background color property.
276         /// </summary>
277         /// <since_tizen> 3 </since_tizen>
278         public Color BackgroundColor
279         {
280             set
281             {
282                 SetBackgroundColor(value);
283             }
284             get
285             {
286                 Color ret = GetBackgroundColor();
287                 return ret;
288             }
289         }
290
291         /// <summary>
292         /// The DPI property (read-only).<br />
293         /// Retrieves the DPI of the display device to which the Window is connected.<br />
294         /// </summary>
295         /// <since_tizen> 3 </since_tizen>
296         public Vector2 Dpi
297         {
298             get
299             {
300                 return GetDpi();
301             }
302         }
303
304         /// <summary>
305         /// The layer count property (read-only).<br />
306         /// Queries the number of on-Window layers.<br />
307         /// </summary>
308         /// <since_tizen> 3 </since_tizen>
309         public uint LayerCount
310         {
311             get
312             {
313                 return GetLayerCount();
314             }
315         }
316
317         /// <summary>
318         /// Gets or sets a size of the window.
319         /// </summary>
320         /// <since_tizen> 4 </since_tizen>
321         public Size2D WindowSize
322         {
323             get
324             {
325                 return GetWindowSize();
326             }
327             set
328             {
329                 SetWindowSize(value);
330             }
331         }
332
333         /// <summary>
334         /// Gets or sets a position of the window.
335         /// </summary>
336         /// <since_tizen> 4 </since_tizen>
337         public Position2D WindowPosition
338         {
339             get
340             {
341                 return GetPosition();
342             }
343             set
344             {
345                 SetPosition(value);
346             }
347         }
348
349         /// <summary>
350         /// Sets position and size of the window. This API guarantees that
351         /// both moving and resizing of window will appear on the screen at once.
352         /// </summary>
353         [EditorBrowsable(EditorBrowsableState.Never)]
354         public Rectangle WindowPositionSize
355         {
356             get
357             {
358                 Position2D position = GetPosition();
359                 Size2D size = GetSize();
360                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
361                 return ret;
362             }
363             set
364             {
365                 SetPositionSize(value);
366             }
367         }
368
369         internal static Vector4 DEFAULT_BACKGROUND_COLOR
370         {
371             get
372             {
373                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
374                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
375                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
376                 return ret;
377             }
378         }
379
380         internal static Vector4 DEBUG_BACKGROUND_COLOR
381         {
382             get
383             {
384                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
385                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
386                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387                 return ret;
388             }
389         }
390
391         internal List<Layer> LayersChildren
392         {
393             get
394             {
395                 return _childLayers;
396             }
397         }
398
399         /// <summary>
400         ///  Get the LayoutController for this Window.
401         /// </summary>
402         internal LayoutController LayoutController
403         {
404             get
405             {
406                 return localController;
407             }
408         }
409
410         /// <summary>
411         /// Feed a key-event into the window.
412         /// </summary>
413         /// <param name="keyEvent">The key event to feed.</param>
414         /// <since_tizen> 4 </since_tizen>
415         [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
416         public static void FeedKeyEvent(Key keyEvent)
417         {
418             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
419             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420         }
421
422         /// <summary>
423         /// Sets whether the window accepts a focus or not.
424         /// </summary>
425         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
426         /// <since_tizen> 3 </since_tizen>
427         public void SetAcceptFocus(bool accept)
428         {
429             Interop.Window.SetAcceptFocus(swigCPtr, accept);
430             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
431         }
432
433         /// <summary>
434         /// Returns whether the window accepts a focus or not.
435         /// </summary>
436         /// <returns>True if the window accepts a focus, false otherwise.</returns>
437         /// <since_tizen> 3 </since_tizen>
438         public bool IsFocusAcceptable()
439         {
440             bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
441             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442
443             return ret;
444         }
445
446         /// <summary>
447         /// Shows the window if it is hidden.
448         /// </summary>
449         /// <since_tizen> 3 </since_tizen>
450         public void Show()
451         {
452             Interop.Window.Show(swigCPtr);
453             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454         }
455
456         /// <summary>
457         /// Hides the window if it is showing.
458         /// </summary>
459         /// <since_tizen> 3 </since_tizen>
460         public void Hide()
461         {
462             Interop.Window.Hide(swigCPtr);
463             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464         }
465
466         /// <summary>
467         /// Retrieves whether the window is visible or not.
468         /// </summary>
469         /// <returns>True if the window is visible.</returns>
470         /// <since_tizen> 3 </since_tizen>
471         public bool IsVisible()
472         {
473             bool temp = Interop.Window.IsVisible(swigCPtr);
474             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
475             return temp;
476         }
477
478         /// <summary>
479         /// Gets the count of supported auxiliary hints of the window.
480         /// </summary>
481         /// <returns>The number of supported auxiliary hints.</returns>
482         /// <since_tizen> 3 </since_tizen>
483         public uint GetSupportedAuxiliaryHintCount()
484         {
485             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
486             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487             return ret;
488         }
489
490         /// <summary>
491         /// Gets the supported auxiliary hint string of the window.
492         /// </summary>
493         /// <param name="index">The index of the supported auxiliary hint lists.</param>
494         /// <returns>The auxiliary hint string of the index.</returns>
495         /// <since_tizen> 3 </since_tizen>
496         public string GetSupportedAuxiliaryHint(uint index)
497         {
498             string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
499             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
500             return ret;
501         }
502
503         /// <summary>
504         /// Creates an auxiliary hint of the window.
505         /// </summary>
506         /// <param name="hint">The auxiliary hint string.</param>
507         /// <param name="value">The value string.</param>
508         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
509         /// <since_tizen> 3 </since_tizen>
510         public uint AddAuxiliaryHint(string hint, string value)
511         {
512             uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
513             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514             return ret;
515         }
516
517         /// <summary>
518         /// Removes an auxiliary hint of the window.
519         /// </summary>
520         /// <param name="id">The ID of the auxiliary hint.</param>
521         /// <returns>True if no error occurred, false otherwise.</returns>
522         /// <since_tizen> 3 </since_tizen>
523         public bool RemoveAuxiliaryHint(uint id)
524         {
525             bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
526             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527             return ret;
528         }
529
530         /// <summary>
531         /// Changes a value of the auxiliary hint.
532         /// </summary>
533         /// <param name="id">The auxiliary hint ID.</param>
534         /// <param name="value">The value string to be set.</param>
535         /// <returns>True if no error occurred, false otherwise.</returns>
536         /// <since_tizen> 3 </since_tizen>
537         public bool SetAuxiliaryHintValue(uint id, string value)
538         {
539             bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
540             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541             return ret;
542         }
543
544         /// <summary>
545         /// Gets a value of the auxiliary hint.
546         /// </summary>
547         /// <param name="id">The auxiliary hint ID.</param>
548         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
549         /// <since_tizen> 3 </since_tizen>
550         public string GetAuxiliaryHintValue(uint id)
551         {
552             string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
553             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554             return ret;
555         }
556
557         /// <summary>
558         /// Gets an ID of the auxiliary hint string.
559         /// </summary>
560         /// <param name="hint">The auxiliary hint string.</param>
561         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
562         /// <since_tizen> 3 </since_tizen>
563         public uint GetAuxiliaryHintId(string hint)
564         {
565             uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
566             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
567             return ret;
568         }
569
570         /// <summary>
571         /// Sets a region to accept input events.
572         /// </summary>
573         /// <param name="inputRegion">The region to accept input events.</param>
574         /// <since_tizen> 3 </since_tizen>
575         public void SetInputRegion(Rectangle inputRegion)
576         {
577             Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
578             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579         }
580
581         /// <summary>
582         /// Sets a priority level for the specified notification window.
583         /// </summary>
584         /// <param name="level">The notification window level.</param>
585         /// <returns>True if no error occurred, false otherwise.</returns>
586         /// <since_tizen> 3 </since_tizen>
587         public bool SetNotificationLevel(NotificationLevel level)
588         {
589             bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
590             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
591             return ret;
592         }
593
594         /// <summary>
595         /// Gets a priority level for the specified notification window.
596         /// </summary>
597         /// <returns>The notification window level.</returns>
598         /// <since_tizen> 3 </since_tizen>
599         public NotificationLevel GetNotificationLevel()
600         {
601             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
602             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603             return ret;
604         }
605
606         /// <summary>
607         /// Sets a transparent window's visual state to opaque. <br />
608         /// If a visual state of a transparent window is opaque, <br />
609         /// then the window manager could handle it as an opaque window when calculating visibility.
610         /// </summary>
611         /// <param name="opaque">Whether the window's visual state is opaque.</param>
612         /// <remarks>This will have no effect on an opaque window. <br />
613         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
614         /// </remarks>
615         /// <since_tizen> 3 </since_tizen>
616         public void SetOpaqueState(bool opaque)
617         {
618             Interop.Window.SetOpaqueState(swigCPtr, opaque);
619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620         }
621
622         /// <summary>
623         /// Returns whether a transparent window's visual state is opaque or not.
624         /// </summary>
625         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
626         /// <remarks> The return value has no meaning on an opaque window. </remarks>
627         /// <since_tizen> 3 </since_tizen>
628         public bool IsOpaqueState()
629         {
630             bool ret = Interop.Window.IsOpaqueState(swigCPtr);
631             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632             return ret;
633         }
634
635         /// <summary>
636         /// Sets a window's screen off mode.
637         /// </summary>
638         /// <param name="screenOffMode">The screen mode.</param>
639         /// <returns>True if no error occurred, false otherwise.</returns>
640         /// <since_tizen> 4 </since_tizen>
641         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
642         {
643             bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
644             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645             return ret;
646         }
647
648         /// <summary>
649         /// Gets the screen mode of the window.
650         /// </summary>
651         /// <returns>The screen off mode.</returns>
652         /// <since_tizen> 4 </since_tizen>
653         public ScreenOffMode GetScreenOffMode()
654         {
655             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
656             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
657             return ret;
658         }
659
660         /// <summary>
661         /// Sets preferred brightness of the window.
662         /// </summary>
663         /// <param name="brightness">The preferred brightness (0 to 100).</param>
664         /// <returns>True if no error occurred, false otherwise.</returns>
665         /// <since_tizen> 3 </since_tizen>
666         public bool SetBrightness(int brightness)
667         {
668             bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
669             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670             return ret;
671         }
672
673         /// <summary>
674         /// Gets the preferred brightness of the window.
675         /// </summary>
676         /// <returns>The preferred brightness.</returns>
677         /// <since_tizen> 3 </since_tizen>
678         public int GetBrightness()
679         {
680             int ret = Interop.Window.GetBrightness(swigCPtr);
681             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
682             return ret;
683         }
684
685         /// <summary>
686         /// Sets the window name and the class string.
687         /// </summary>
688         /// <param name="name">The name of the window.</param>
689         /// <param name="klass">The class of the window.</param>
690         /// <since_tizen> 4 </since_tizen>
691         public void SetClass(string name, string klass)
692         {
693             Interop.Window.Window_SetClass(swigCPtr, name, klass);
694             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
695         }
696
697         /// <summary>
698         /// Raises the window to the top of the window stack.
699         /// </summary>
700         /// <since_tizen> 3 </since_tizen>
701         public void Raise()
702         {
703             Interop.Window.Window_Raise(swigCPtr);
704             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705         }
706
707         /// <summary>
708         /// Lowers the window to the bottom of the window stack.
709         /// </summary>
710         /// <since_tizen> 3 </since_tizen>
711         public void Lower()
712         {
713             Interop.Window.Window_Lower(swigCPtr);
714             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715         }
716
717         /// <summary>
718         /// Activates the window to the top of the window stack even it is iconified.
719         /// </summary>
720         /// <since_tizen> 3 </since_tizen>
721         public void Activate()
722         {
723             Interop.Window.Window_Activate(swigCPtr);
724             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725         }
726
727         /// <summary>
728         /// Gets the default ( root ) layer.
729         /// </summary>
730         /// <returns>The root layer.</returns>
731         /// <since_tizen> 3 </since_tizen>
732         public Layer GetDefaultLayer()
733         {
734             return this.GetRootLayer();
735         }
736
737         /// <summary>
738         /// Add a child view to window.
739         /// </summary>
740         /// <param name="view">the child should be added to the window.</param>
741         /// <since_tizen> 3 </since_tizen>
742         public void Add(View view)
743         {
744             Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
745             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746             this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
747             view.InternalParent = this.GetRootLayer();
748         }
749
750         /// <summary>
751         /// Remove a child view from window.
752         /// </summary>
753         /// <param name="view">the child to be removed.</param>
754         /// <since_tizen> 3 </since_tizen>
755         public void Remove(View view)
756         {
757             Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
758             this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
759             view.InternalParent = null;
760         }
761
762         /// <summary>
763         /// Retrieves the layer at a specified depth.
764         /// </summary>
765         /// <param name="depth">The layer's depth index.</param>
766         /// <returns>The layer found at the given depth.</returns>
767         /// <since_tizen> 3 </since_tizen>
768         public Layer GetLayer(uint depth)
769         {
770             if (depth < LayersChildren?.Count)
771             {
772                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
773                 return ret;
774             }
775             else
776             {
777                 return null;
778             }
779         }
780
781         /// <summary>
782         /// Destroy the window immediately.
783         /// </summary>
784         [EditorBrowsable(EditorBrowsableState.Never)]
785         public void Destroy()
786         {
787             this.Dispose();
788         }
789
790         /// <summary>
791         /// Keep rendering for at least the given amount of time.
792         /// </summary>
793         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
794         /// <since_tizen> 3 </since_tizen>
795         public void KeepRendering(float durationSeconds)
796         {
797             Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
798             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799         }
800
801         /// <summary>
802         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
803         /// This function can be used for following example scenarios: <br />
804         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
805         /// </summary>
806         /// <param name="DaliKey">The key code to grab.</param>
807         /// <returns>True if the grab succeeds.</returns>
808         /// <since_tizen> 3 </since_tizen>
809         public bool GrabKeyTopmost(int DaliKey)
810         {
811             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
812             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
813             return ret;
814         }
815
816         /// <summary>
817         /// Ungrabs the key specified by a key for the window.<br />
818         /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.<br />
819         /// </summary>
820         /// <param name="DaliKey">The key code to ungrab.</param>
821         /// <returns>True if the ungrab succeeds.</returns>
822         /// <since_tizen> 3 </since_tizen>
823         public bool UngrabKeyTopmost(int DaliKey)
824         {
825             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
826             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
827             return ret;
828         }
829
830         /// <summary>
831         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
832         ///  Details: This function can be used for following example scenarios: <br />
833         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
834         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
835         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
836         /// </summary>
837         /// <param name="DaliKey">The key code to grab.</param>
838         /// <param name="GrabMode">The grab mode for the key.</param>
839         /// <returns>True if the grab succeeds.</returns>
840         /// <since_tizen> 3 </since_tizen>
841         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
842         {
843             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
844             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845             return ret;
846         }
847
848         /// <summary>
849         /// Ungrabs the key specified by a key for a window.<br />
850         /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event. <br />
851         /// </summary>
852         /// <param name="DaliKey">The key code to ungrab.</param>
853         /// <returns>True if the ungrab succeeds.</returns>
854         /// <since_tizen> 3 </since_tizen>
855         public bool UngrabKey(int DaliKey)
856         {
857             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
858             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859             return ret;
860         }
861
862         /// <summary>
863         /// Sets the keyboard repeat information.
864         /// </summary>
865         /// <param name="rate">The key repeat rate value in seconds.</param>
866         /// <param name="delay">The key repeat delay value in seconds.</param>
867         /// <returns>True if setting the keyboard repeat succeeds.</returns>
868         /// <since_tizen> 5 </since_tizen>
869         public bool SetKeyboardRepeatInfo(float rate, float delay)
870         {
871             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
872             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873             return ret;
874         }
875
876         /// <summary>
877         /// Gets the keyboard repeat information.
878         /// </summary>
879         /// <param name="rate">The key repeat rate value in seconds.</param>
880         /// <param name="delay">The key repeat delay value in seconds.</param>
881         /// <returns>True if setting the keyboard repeat succeeds.</returns>
882         /// <since_tizen> 5 </since_tizen>
883         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
884         {
885             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
886             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
887             return ret;
888         }
889
890         /// <summary>
891         /// Adds a layer to the stage.
892         /// </summary>
893         /// <param name="layer">Layer to add.</param>
894         /// <since_tizen> 3 </since_tizen>
895         public void AddLayer(Layer layer)
896         {
897             Add(layer);
898         }
899
900         /// <summary>
901         /// Removes a layer from the stage.
902         /// </summary>
903         /// <param name="layer">Layer to remove.</param>
904         /// <since_tizen> 3 </since_tizen>
905         public void RemoveLayer(Layer layer)
906         {
907             Remove(layer);
908         }
909
910         /// <summary>
911         /// Feeds a key event into the window.
912         /// </summary>
913         /// <param name="keyEvent">The key event to feed.</param>
914         /// <since_tizen> 5 </since_tizen>
915         public void FeedKey(Key keyEvent)
916         {
917             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
918             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919         }
920
921         /// <summary>
922         /// Allows at least one more render, even when paused.
923         /// The window should be shown, not minimised.
924         /// </summary>
925         /// <since_tizen> 4 </since_tizen>
926         public void RenderOnce()
927         {
928             Interop.Window.Window_RenderOnce(swigCPtr);
929             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
930         }
931
932         /// <summary>
933         /// Sets whether the window is transparent or not.
934         /// </summary>
935         /// <param name="transparent">Whether the window is transparent or not.</param>
936         /// <since_tizen> 5 </since_tizen>
937         public void SetTransparency(bool transparent)
938         {
939             Interop.Window.SetTransparency(swigCPtr, transparent);
940             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941
942             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
943         }
944
945         /// <summary>
946         /// Sets parent window of the window.
947         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
948         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
949         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
950         /// </summary>
951         /// <param name="parent">The parent window.</param>
952         /// <since_tizen> 6 </since_tizen>
953         public void SetParent(Window parent)
954         {
955             Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
956             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
957         }
958
959         /// <summary>
960         /// Unsets parent window of the window.
961         /// After unsetting, the window is disconnected his parent window.
962         /// </summary>
963         /// <since_tizen> 6 </since_tizen>
964         public void Unparent()
965         {
966             Interop.Window.Unparent(swigCPtr);
967             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968         }
969
970         /// <summary>
971         /// Gets parent window of the window.
972         /// </summary>
973         /// <returns>The parent window of the window.</returns>
974         /// <since_tizen> 6 </since_tizen>
975         public Window GetParent()
976         {
977             Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(swigCPtr)) as Window;
978             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979             return ret;
980         }
981
982         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
983         {
984             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
985         }
986
987         internal static Window GetCurrent()
988         {
989             Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
990             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991             return ret;
992         }
993
994         internal static bool IsInstalled()
995         {
996             bool ret = Interop.Stage.Stage_IsInstalled();
997             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
998             return ret;
999         }
1000
1001         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1002         {
1003             Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1004             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1005         }
1006
1007         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1008         {
1009             Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1010             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011         }
1012
1013         internal void RotateIndicator(Window.WindowOrientation orientation)
1014         {
1015             Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1016             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1017         }
1018
1019         /// <summary>
1020         /// Adds an orientation to the list of available orientations.
1021         /// </summary>
1022         /// <param name="orientation">The available orientation to add</param>
1023         /// <since_tizen> 6 </since_tizen>
1024         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1025         {
1026             Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1027             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028         }
1029
1030         /// <summary>
1031         /// Removes an orientation from the list of available orientations.
1032         /// </summary>
1033         /// <param name="orientation">The available orientation to remove.</param>
1034         /// <since_tizen> 6 </since_tizen>
1035         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1036         {
1037             Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1038             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1039         }
1040
1041         /// <summary>
1042         /// Sets a preferred orientation.
1043         /// </summary>
1044         /// <param name="orientation">The preferred orientation.</param>
1045         /// <since_tizen> 6 </since_tizen>
1046         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1047         {
1048             Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1049             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1050         }
1051
1052         /// <summary>
1053         /// Gets the preferred orientation.
1054         /// </summary>
1055         /// <since_tizen> 6 </since_tizen>
1056         /// <returns>The preferred orientation if previously set, or none.</returns>
1057         public Window.WindowOrientation GetPreferredOrientation()
1058         {
1059             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
1060             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1061             return ret;
1062         }
1063
1064         internal Any GetNativeHandle()
1065         {
1066             Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1067             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068             return ret;
1069         }
1070
1071         internal void Add(Layer layer)
1072         {
1073             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1074             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1075
1076             LayersChildren?.Add(layer);
1077             layer.SetWindow(this);
1078         }
1079
1080         internal void Remove(Layer layer)
1081         {
1082             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1083             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1084
1085             LayersChildren?.Remove(layer);
1086             layer.SetWindow(null);
1087         }
1088
1089         internal Vector2 GetSize()
1090         {
1091             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1092             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1093             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1094             return ret;
1095         }
1096
1097         internal RenderTaskList GetRenderTaskList()
1098         {
1099             RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1100             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1101             return ret;
1102         }
1103
1104         /// <summary>
1105         /// Queries the number of on-window layers.
1106         /// </summary>
1107         /// <returns>The number of layers.</returns>
1108         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1109         internal uint GetLayerCount()
1110         {
1111             if (LayersChildren == null || LayersChildren.Count < 0)
1112                 return 0;
1113
1114             return (uint) LayersChildren.Count;
1115         }
1116
1117         internal Layer GetRootLayer()
1118         {
1119             // Window.IsInstalled() is actually true only when called from event thread and
1120             // Core has been initialized, not when Stage is ready.
1121             if (_rootLayer == null && Window.IsInstalled())
1122             {
1123                 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1124                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1125                 LayersChildren?.Add(_rootLayer);
1126                 _rootLayer.SetWindow(this);
1127             }
1128             return _rootLayer;
1129         }
1130
1131         internal void SetBackgroundColor(Vector4 color)
1132         {
1133             Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1134             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1135         }
1136
1137         internal Vector4 GetBackgroundColor()
1138         {
1139             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1141             return ret;
1142         }
1143
1144         internal Vector2 GetDpi()
1145         {
1146             Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1147             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1148             return ret;
1149         }
1150
1151         internal ObjectRegistry GetObjectRegistry()
1152         {
1153             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1154             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155             return ret;
1156         }
1157
1158         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1159         {
1160             Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1162         }
1163
1164         internal RenderingBehaviorType GetRenderingBehavior()
1165         {
1166             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1167             if (NDalicPINVOKE.SWIGPendingException.Pending)
1168                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169             return ret;
1170         }
1171
1172         internal void SetWindowSize(Size2D size)
1173         {
1174             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1175             Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1176
1177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1178
1179             // Resetting Window size should request a relayout of the tree.
1180         }
1181
1182         internal Size2D GetWindowSize()
1183         {
1184             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1185             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1186
1187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188             return ret;
1189         }
1190
1191         internal void SetPosition(Position2D position)
1192         {
1193             var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1194             Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1195
1196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1197             // Setting Position of the window should request a relayout of the tree.
1198         }
1199
1200         internal Position2D GetPosition()
1201         {
1202             var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1203             Position2D ret = new Position2D(val.GetX(), val.GetY());
1204
1205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206             return ret;
1207         }
1208
1209         internal void SetPositionSize(Rectangle positionSize)
1210         {
1211             Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1212
1213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214
1215             // Setting Position of the window should request a relayout of the tree.
1216         }
1217
1218         /// <summary>
1219         /// Dispose for Window
1220         /// </summary>
1221         [EditorBrowsable(EditorBrowsableState.Never)]
1222         protected override void Dispose(DisposeTypes type)
1223         {
1224             if (disposed)
1225             {
1226                 return;
1227             }
1228
1229             if (type == DisposeTypes.Explicit)
1230             {
1231                 //Called by User
1232                 //Release your own managed resources here.
1233                 //You should release all of your own disposable objects here.
1234
1235                 _rootLayer.Dispose();
1236                 localController.Dispose();
1237
1238                 foreach(var layer in _childLayers)
1239                 {
1240                     layer.Dispose();
1241                 }
1242                 _childLayers.Clear();
1243             }
1244
1245             this.DisconnectNativeSignals();
1246
1247             base.Dispose(type);
1248         }
1249
1250         /// This will not be public opened.
1251         [EditorBrowsable(EditorBrowsableState.Never)]
1252         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1253         {
1254             Interop.Window.delete_Window(swigCPtr);
1255         }
1256     }
1257 }