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