Release 11.0.0.17809
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window / Window.cs
1 /*
2  * Copyright(c) 2021 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
21 using System;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24 using System.Runtime.InteropServices;
25
26 using Tizen.NUI.BaseComponents;
27
28 namespace Tizen.NUI
29 {
30     /// <summary>
31     /// The window class is used internally for drawing.<br />
32     /// The window has an orientation and indicator properties.<br />
33     /// </summary>
34     /// <since_tizen> 3 </since_tizen>
35     public partial class Window : BaseHandle
36     {
37         private HandleRef stageCPtr;
38         private Layer rootLayer;
39         private Layer overlayLayer;
40         private Layer borderLayer;
41         private string windowTitle;
42         private List<Layer> childLayers = new List<Layer>();
43         private LayoutController localController;
44
45         static internal bool IsSupportedMultiWindow()
46         {
47             bool isSupported = false;
48             try
49             {
50                 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
51             }
52             catch (DllNotFoundException e)
53             {
54                 Tizen.Log.Fatal("NUI", $"{e}\n");
55             }
56             return isSupported;
57         }
58
59         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
60         {
61             if (Interop.Stage.IsInstalled())
62             {
63                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
64
65                 localController = new LayoutController(this);
66                 NUILog.Debug("layoutController id:" + localController.GetId());
67             }
68         }
69
70         /// <summary>
71         /// A helper method to get the current window where the view is added
72         /// </summary>
73         /// <param name="view">The View added to the window</param>
74         /// <returns>A Window.</returns>
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         static public Window Get(View view)
77         {
78             if (view == null)
79             {
80                 NUILog.Error("if there is no view, it can not get a window");
81                 return null;
82             }
83
84             //to fix memory leak issue, match the handle count with native side.
85             Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
86             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87             return ret;
88         }
89
90         /// <summary>
91         /// Creates a new Window.<br />
92         /// This creates an extra window in addition to the default main window<br />
93         /// </summary>
94         /// <param name="windowPosition">The position and size of the Window.</param>
95         /// <param name="isTranslucent">Whether Window is translucent.</param>
96         /// <returns>A new Window.</returns>
97         /// <since_tizen> 6 </since_tizen>
98         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
99         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
100         public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
101         {
102             if (IsSupportedMultiWindow() == false)
103             {
104                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
105             }
106             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107         }
108
109         /// <summary>
110         /// Creates a new Window with a specific name.<br />
111         /// This creates an extra window in addition to the default main window<br />
112         /// </summary>
113         /// <param name="name">The name for extra window. </param>
114         /// <param name="windowPosition">The position and size of the Window.</param>
115         /// <param name="isTranslucent">Whether Window is translucent.</param>
116         /// <returns>A new Window.</returns>
117         /// <since_tizen> 6 </since_tizen>
118         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
119         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
120         public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
121         {
122             if (IsSupportedMultiWindow() == false)
123             {
124                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
125             }
126             this.windowTitle = name;
127             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128         }
129
130         /// <summary>
131         /// Creates a new Window with a specific name.<br />
132         /// This creates an extra window in addition to the default main window<br />
133         /// </summary>
134         /// <param name="name">The name for extra window. </param>
135         /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
136         /// <param name="windowPosition">The position and size of the Window.</param>
137         /// <param name="isTranslucent">Whether Window is translucent.</param>
138         /// <returns>A new Window.</returns>
139         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
140         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
141         [EditorBrowsable(EditorBrowsableState.Never)]
142         public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
143         {
144             if (IsSupportedMultiWindow() == false)
145             {
146                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
147             }
148             this.windowTitle = name;
149             this.EnableBorder(borderInterface);
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151         }
152
153
154         /// <summary>
155         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
156         /// </summary>
157         /// <since_tizen> 3 </since_tizen>
158         public enum WindowOrientation
159         {
160             /// <summary>
161             /// Portrait orientation. The height of the display area is greater than the width.
162             /// </summary>
163             /// <since_tizen> 3 </since_tizen>
164             Portrait = 0,
165             /// <summary>
166             /// Landscape orientation. A wide view area is needed.
167             /// </summary>
168             /// <since_tizen> 3 </since_tizen>
169             Landscape = 90,
170             /// <summary>
171             /// Portrait inverse orientation.
172             /// </summary>
173             /// <since_tizen> 3 </since_tizen>
174             PortraitInverse = 180,
175             /// <summary>
176             /// Landscape inverse orientation.
177             /// </summary>
178             /// <since_tizen> 3 </since_tizen>
179             LandscapeInverse = 270,
180             /// <summary>
181             /// No orientation. It is for the preferred orientation
182             /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
183             /// It is used to unset the preferred orientation with SetPreferredOrientation.
184             /// </summary>
185             [EditorBrowsable(EditorBrowsableState.Never)]
186             NoOrientationPreference = -1
187         }
188
189         /// <summary>
190         /// Enumeration for the key grab mode for platform-level APIs.
191         /// </summary>
192         /// <since_tizen> 3 </since_tizen>
193         public enum KeyGrabMode
194         {
195             /// <summary>
196             /// Grabs a key only when on the top of the grabbing-window stack mode.
197             /// </summary>
198             Topmost = 0,
199             /// <summary>
200             /// Grabs a key together with the other client window(s) mode.
201             /// </summary>
202             Shared,
203             /// <summary>
204             /// 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.
205             /// </summary>
206             OverrideExclusive,
207             /// <summary>
208             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
209             /// </summary>
210             Exclusive
211         };
212
213         /// <summary>
214         /// Enumeration for transition effect's state.
215         /// </summary>
216         [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
217         [EditorBrowsable(EditorBrowsableState.Never)]
218         //  This is already deprecated, so suppress warning here.
219         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
220         public enum EffectStates
221         {
222             /// <summary>
223             /// None state.
224             /// </summary>
225             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
226             [EditorBrowsable(EditorBrowsableState.Never)]
227             None = 0,
228             /// <summary>
229             /// Transition effect is started.
230             /// </summary>
231             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
232             [EditorBrowsable(EditorBrowsableState.Never)]
233             Start,
234             /// <summary>
235             /// Transition effect is ended.
236             /// </summary>
237             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
238             [EditorBrowsable(EditorBrowsableState.Never)]
239             End,
240         }
241
242         /// <summary>
243         /// Enumeration for transition effect's state.
244         /// </summary>
245         [EditorBrowsable(EditorBrowsableState.Never)]
246         public enum EffectState
247         {
248             /// <summary>
249             /// None state.
250             /// </summary>
251             [EditorBrowsable(EditorBrowsableState.Never)]
252             None = 0,
253             /// <summary>
254             /// Transition effect is started.
255             /// </summary>
256             [EditorBrowsable(EditorBrowsableState.Never)]
257             Start,
258             /// <summary>
259             /// Transition effect is ended.
260             /// </summary>
261             [EditorBrowsable(EditorBrowsableState.Never)]
262             End,
263         }
264
265         /// <summary>
266         /// Enumeration for transition effect's type.
267         /// </summary>
268         [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
269         [EditorBrowsable(EditorBrowsableState.Never)]
270         //  This is already deprecated, so suppress warning here.
271         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
272         public enum EffectTypes
273         {
274             /// <summary>
275             /// None type.
276             /// </summary>
277             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
278             [EditorBrowsable(EditorBrowsableState.Never)]
279             None = 0,
280             /// <summary>
281             /// Window show effect.
282             /// </summary>
283             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
284             [EditorBrowsable(EditorBrowsableState.Never)]
285             Show,
286             /// <summary>
287             /// Window hide effect.
288             /// </summary>
289             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
290             [EditorBrowsable(EditorBrowsableState.Never)]
291             Hide,
292         }
293
294         /// <summary>
295         /// Enumeration for transition effect's type.
296         /// </summary>
297         [EditorBrowsable(EditorBrowsableState.Never)]
298         public enum EffectType
299         {
300             /// <summary>
301             /// None type.
302             /// </summary>
303             [EditorBrowsable(EditorBrowsableState.Never)]
304             None = 0,
305             /// <summary>
306             /// Window show effect.
307             /// </summary>
308             [EditorBrowsable(EditorBrowsableState.Never)]
309             Show,
310             /// <summary>
311             /// Window hide effect.
312             /// </summary>
313             [EditorBrowsable(EditorBrowsableState.Never)]
314             Hide,
315         }
316
317         /// <summary>
318         /// Enumeration for result of window operation.
319         /// </summary>
320         internal enum OperationResult
321         {
322             /// <summary>
323             /// Failed for unknown reason
324             /// </summary>
325             UnknownError = 0,
326             /// <summary>
327             /// Succeed
328             /// </summary>
329             Succeed,
330             /// <summary>
331             /// Permission denied
332             /// </summary>
333             PermissionDenied,
334             /// <summary>
335             /// The operation is not supported.
336             /// </summary>
337             NotSupported,
338         }
339
340         /// <summary>
341         /// Enumeration for window resized mode by display server.
342         /// </summary>
343         [EditorBrowsable(EditorBrowsableState.Never)]
344         public enum ResizeDirection
345         {
346             /// <summary>
347             /// None type.
348             /// </summary>
349             [EditorBrowsable(EditorBrowsableState.Never)]
350             None = 0,
351             /// <summary>
352             /// Start resizing window to the top-left edge.
353             /// </summary>
354             [EditorBrowsable(EditorBrowsableState.Never)]
355             TopLeft = 1,
356             /// <summary>
357             /// Start resizing window to the top side.
358             /// </summary>
359             [EditorBrowsable(EditorBrowsableState.Never)]
360             Top = 2,
361             /// <summary>
362             /// Start resizing window to the top-right edge.
363             /// </summary>
364             [EditorBrowsable(EditorBrowsableState.Never)]
365             TopRight = 3,
366             /// <summary>
367             /// Start resizing window to the left side.
368             /// </summary>
369             [EditorBrowsable(EditorBrowsableState.Never)]
370             Left = 4,
371             /// <summary>
372             /// Start resizing window to the right side.
373             /// </summary>
374             [EditorBrowsable(EditorBrowsableState.Never)]
375             Right = 5,
376             /// <summary>
377             /// Start resizing window to the bottom-left edge.
378             /// </summary>
379             [EditorBrowsable(EditorBrowsableState.Never)]
380             BottomLeft = 6,
381             /// <summary>
382             /// Start resizing window to the bottom side.
383             /// </summary>
384             [EditorBrowsable(EditorBrowsableState.Never)]
385             Bottom = 7,
386             /// <summary>
387             /// Start resizing window to the bottom-right edge.
388             /// </summary>
389             [EditorBrowsable(EditorBrowsableState.Never)]
390             BottomRight = 8,
391         }
392
393
394         /// <summary>
395         /// The stage instance property (read-only).<br />
396         /// Gets the current window.<br />
397         /// </summary>
398         /// <since_tizen> 3 </since_tizen>
399         public static Window Instance { get; internal set; }
400
401         /// <summary>
402         /// Gets or sets a window type.
403         /// Most of window type can be set to use WindowType, except for IME type.
404         /// IME type can be set to use one of NUIApplication's constrcutors.
405         /// </summary>
406         /// <since_tizen> 3 </since_tizen>
407         public WindowType Type
408         {
409             get
410             {
411                 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
412                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
413                 return ret;
414             }
415             set
416             {
417                 Interop.Window.SetType(SwigCPtr, (int)value);
418                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419             }
420         }
421
422         /// <summary>
423         /// Gets/Sets a window title.
424         /// </summary>
425         /// <since_tizen> 4 </since_tizen>
426         public string Title
427         {
428             get
429             {
430                 return windowTitle;
431             }
432             set
433             {
434                 windowTitle = value;
435                 SetClass(windowTitle, "");
436             }
437         }
438
439         /// <summary>
440         /// The rendering behavior of a Window.
441         /// </summary>
442         /// <since_tizen> 5 </since_tizen>
443         public RenderingBehaviorType RenderingBehavior
444         {
445             get
446             {
447                 return GetRenderingBehavior();
448             }
449             set
450             {
451                 SetRenderingBehavior(value);
452             }
453         }
454
455         /// <summary>
456         /// The window size property (read-only).
457         /// </summary>
458         /// <since_tizen> 3 </since_tizen>
459         public Size2D Size
460         {
461             get
462             {
463                 Size2D ret = GetSize();
464                 return ret;
465             }
466         }
467
468         /// <summary>
469         /// The background color property.
470         /// </summary>
471         /// <since_tizen> 3 </since_tizen>
472         public Color BackgroundColor
473         {
474             set
475             {
476                 SetBackgroundColor(value);
477             }
478             get
479             {
480                 Color ret = GetBackgroundColor();
481                 return ret;
482             }
483         }
484
485         /// <summary>
486         /// The DPI property (read-only).<br />
487         /// Retrieves the DPI of the display device to which the Window is connected.<br />
488         /// </summary>
489         /// <since_tizen> 3 </since_tizen>
490         public Vector2 Dpi
491         {
492             get
493             {
494                 return GetDpi();
495             }
496         }
497
498         /// <summary>
499         /// The layer count property (read-only).<br />
500         /// Queries the number of on-Window layers.<br />
501         /// </summary>
502         /// <since_tizen> 3 </since_tizen>
503         public uint LayerCount
504         {
505             get
506             {
507                 return GetLayerCount();
508             }
509         }
510
511         /// <summary>
512         /// Gets or sets a size of the window.
513         /// </summary>
514         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
515         /// <since_tizen> 4 </since_tizen>
516         public Size2D WindowSize
517         {
518             get
519             {
520                 return GetWindowSize();
521             }
522             set
523             {
524                 SetWindowSize(value);
525             }
526         }
527
528         /// <summary>
529         /// Gets or sets a position of the window.
530         /// </summary>
531         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
532         /// <since_tizen> 4 </since_tizen>
533         public Position2D WindowPosition
534         {
535             get
536             {
537                 return GetPosition();
538             }
539             set
540             {
541                 SetPosition(value);
542             }
543         }
544
545         /// <summary>
546         /// Sets position and size of the window. This API guarantees that
547         /// both moving and resizing of window will appear on the screen at once.
548         /// </summary>
549         [EditorBrowsable(EditorBrowsableState.Never)]
550         public Rectangle WindowPositionSize
551         {
552             get
553             {
554                 Position2D position = GetPosition();
555                 Size2D size = GetSize();
556                 Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
557                 position.Dispose();
558                 return ret;
559             }
560             set
561             {
562                 SetPositionSize(value);
563             }
564         }
565
566         internal static Vector4 DEFAULT_BACKGROUND_COLOR
567         {
568             get
569             {
570                 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
571                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
572                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
573                 return ret;
574             }
575         }
576
577         internal static Vector4 DEBUG_BACKGROUND_COLOR
578         {
579             get
580             {
581                 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
582                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
583                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584                 return ret;
585             }
586         }
587
588         internal List<Layer> LayersChildren
589         {
590             get
591             {
592                 return childLayers;
593             }
594         }
595
596         /// <summary>
597         ///  Get the LayoutController for this Window.
598         /// </summary>
599         internal LayoutController LayoutController
600         {
601             get
602             {
603                 return localController;
604             }
605         }
606
607         /// <summary>
608         /// Feed a key-event into the window.
609         /// </summary>
610         /// <param name="keyEvent">The key event to feed.</param>
611         /// <since_tizen> 4 </since_tizen>
612         [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
613         public static void FeedKeyEvent(Key keyEvent)
614         {
615             Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
616             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617         }
618
619         /// <summary>
620         /// Sets whether the window accepts a focus or not.
621         /// </summary>
622         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
623         /// <since_tizen> 3 </since_tizen>
624         public void SetAcceptFocus(bool accept)
625         {
626             Interop.Window.SetAcceptFocus(SwigCPtr, accept);
627             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628         }
629
630         /// <summary>
631         /// Returns whether the window accepts a focus or not.
632         /// </summary>
633         /// <returns>True if the window accepts a focus, false otherwise.</returns>
634         /// <since_tizen> 3 </since_tizen>
635         public bool IsFocusAcceptable()
636         {
637             bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
638             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
639
640             return ret;
641         }
642
643         /// <summary>
644         /// Shows the window if it is hidden.
645         /// </summary>
646         /// <since_tizen> 3 </since_tizen>
647         public void Show()
648         {
649             Interop.Window.Show(SwigCPtr);
650             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651         }
652
653         /// <summary>
654         /// Hides the window if it is showing.
655         /// </summary>
656         /// <since_tizen> 3 </since_tizen>
657         public void Hide()
658         {
659             Interop.Window.Hide(SwigCPtr);
660             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
661         }
662
663         /// <summary>
664         /// Retrieves whether the window is visible or not.
665         /// </summary>
666         /// <returns>True if the window is visible.</returns>
667         /// <since_tizen> 3 </since_tizen>
668         public bool IsVisible()
669         {
670             bool temp = Interop.Window.IsVisible(SwigCPtr);
671             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
672             return temp;
673         }
674
675         /// <summary>
676         /// Gets the count of supported auxiliary hints of the window.
677         /// </summary>
678         /// <returns>The number of supported auxiliary hints.</returns>
679         /// <since_tizen> 3 </since_tizen>
680         public uint GetSupportedAuxiliaryHintCount()
681         {
682             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
683             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684             return ret;
685         }
686
687         /// <summary>
688         /// Gets the supported auxiliary hint string of the window.
689         /// </summary>
690         /// <param name="index">The index of the supported auxiliary hint lists.</param>
691         /// <returns>The auxiliary hint string of the index.</returns>
692         /// <since_tizen> 3 </since_tizen>
693         public string GetSupportedAuxiliaryHint(uint index)
694         {
695             string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
696             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697             return ret;
698         }
699
700         /// <summary>
701         /// Creates an auxiliary hint of the window.
702         /// </summary>
703         /// <param name="hint">The auxiliary hint string.</param>
704         /// <param name="value">The value string.</param>
705         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
706         /// <since_tizen> 3 </since_tizen>
707         public uint AddAuxiliaryHint(string hint, string value)
708         {
709             uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
710             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711             return ret;
712         }
713
714         /// <summary>
715         /// Removes an auxiliary hint of the window.
716         /// </summary>
717         /// <param name="id">The ID of the auxiliary hint.</param>
718         /// <returns>True if no error occurred, false otherwise.</returns>
719         /// <since_tizen> 3 </since_tizen>
720         public bool RemoveAuxiliaryHint(uint id)
721         {
722             bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
723             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724             return ret;
725         }
726
727         /// <summary>
728         /// Changes a value of the auxiliary hint.
729         /// </summary>
730         /// <param name="id">The auxiliary hint ID.</param>
731         /// <param name="value">The value string to be set.</param>
732         /// <returns>True if no error occurred, false otherwise.</returns>
733         /// <since_tizen> 3 </since_tizen>
734         public bool SetAuxiliaryHintValue(uint id, string value)
735         {
736             bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
737             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738             return ret;
739         }
740
741         /// <summary>
742         /// Gets a value of the auxiliary hint.
743         /// </summary>
744         /// <param name="id">The auxiliary hint ID.</param>
745         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
746         /// <since_tizen> 3 </since_tizen>
747         public string GetAuxiliaryHintValue(uint id)
748         {
749             string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
750             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751             return ret;
752         }
753
754         /// <summary>
755         /// Gets an ID of the auxiliary hint string.
756         /// </summary>
757         /// <param name="hint">The auxiliary hint string.</param>
758         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
759         /// <since_tizen> 3 </since_tizen>
760         public uint GetAuxiliaryHintId(string hint)
761         {
762             uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
763             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764             return ret;
765         }
766
767         /// <summary>
768         /// Sets a region to accept input events.
769         /// </summary>
770         /// <param name="inputRegion">The region to accept input events.</param>
771         /// <since_tizen> 3 </since_tizen>
772         public void SetInputRegion(Rectangle inputRegion)
773         {
774             Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
775             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776         }
777
778         /// <summary>
779         /// Sets a priority level for the specified notification window.
780         /// </summary>
781         /// <param name="level">The notification window level.</param>
782         /// <returns>True if no error occurred, false otherwise.</returns>
783         /// <since_tizen> 3 </since_tizen>
784         public bool SetNotificationLevel(NotificationLevel level)
785         {
786             var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
787             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788             return ret == OperationResult.Succeed;
789         }
790
791         /// <summary>
792         /// Gets a priority level for the specified notification window.
793         /// </summary>
794         /// <returns>The notification window level.</returns>
795         /// <since_tizen> 3 </since_tizen>
796         public NotificationLevel GetNotificationLevel()
797         {
798             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
799             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800             return ret;
801         }
802
803         /// <summary>
804         /// Sets a transparent window's visual state to opaque. <br />
805         /// If a visual state of a transparent window is opaque, <br />
806         /// then the window manager could handle it as an opaque window when calculating visibility.
807         /// </summary>
808         /// <param name="opaque">Whether the window's visual state is opaque.</param>
809         /// <remarks>This will have no effect on an opaque window. <br />
810         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
811         /// </remarks>
812         /// <since_tizen> 3 </since_tizen>
813         public void SetOpaqueState(bool opaque)
814         {
815             Interop.Window.SetOpaqueState(SwigCPtr, opaque);
816             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817         }
818
819         /// <summary>
820         /// Returns whether a transparent window's visual state is opaque or not.
821         /// </summary>
822         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
823         /// <remarks> The return value has no meaning on an opaque window. </remarks>
824         /// <since_tizen> 3 </since_tizen>
825         public bool IsOpaqueState()
826         {
827             bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
828             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
829             return ret;
830         }
831
832         /// <summary>
833         /// Sets a window's screen off mode.
834         /// </summary>
835         /// <param name="screenOffMode">The screen mode.</param>
836         /// <returns>True if no error occurred, false otherwise.</returns>
837         /// <since_tizen> 4 </since_tizen>
838         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
839         {
840             var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
841             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
842             return ret == OperationResult.Succeed;
843         }
844
845         /// <summary>
846         /// Gets the screen mode of the window.
847         /// </summary>
848         /// <returns>The screen off mode.</returns>
849         /// <since_tizen> 4 </since_tizen>
850         public ScreenOffMode GetScreenOffMode()
851         {
852             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
853             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854             return ret;
855         }
856
857         /// <summary>
858         /// Sets preferred brightness of the window.
859         /// </summary>
860         /// <param name="brightness">The preferred brightness (0 to 100).</param>
861         /// <returns>True if no error occurred, false otherwise.</returns>
862         /// <since_tizen> 3 </since_tizen>
863         public bool SetBrightness(int brightness)
864         {
865             var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
866             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867             return ret == OperationResult.Succeed;
868         }
869
870         /// <summary>
871         /// Gets the preferred brightness of the window.
872         /// </summary>
873         /// <returns>The preferred brightness.</returns>
874         /// <since_tizen> 3 </since_tizen>
875         public int GetBrightness()
876         {
877             int ret = Interop.Window.GetBrightness(SwigCPtr);
878             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879             return ret;
880         }
881
882         /// <summary>
883         /// Sets the window name and the class string.
884         /// </summary>
885         /// <param name="name">The name of the window.</param>
886         /// <param name="klass">The class of the window.</param>
887         /// <since_tizen> 4 </since_tizen>
888         public void SetClass(string name, string klass)
889         {
890             Interop.Window.SetClass(SwigCPtr, name, klass);
891             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
892         }
893
894         /// <summary>
895         /// Raises the window to the top of the window stack.
896         /// </summary>
897         /// <since_tizen> 3 </since_tizen>
898         public void Raise()
899         {
900             Interop.Window.Raise(SwigCPtr);
901             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
902         }
903
904         /// <summary>
905         /// Lowers the window to the bottom of the window stack.
906         /// </summary>
907         /// <since_tizen> 3 </since_tizen>
908         public void Lower()
909         {
910             Interop.Window.Lower(SwigCPtr);
911             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
912         }
913
914         /// <summary>
915         /// Activates the window to the top of the window stack even it is iconified.
916         /// </summary>
917         /// <since_tizen> 3 </since_tizen>
918         public void Activate()
919         {
920             Interop.Window.Activate(SwigCPtr);
921             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
922         }
923
924         /// <summary>
925         /// Gets the default ( root ) layer.
926         /// </summary>
927         /// <returns>The root layer.</returns>
928         /// <since_tizen> 3 </since_tizen>
929         public Layer GetDefaultLayer()
930         {
931             return this.GetRootLayer();
932         }
933
934         /// <summary>
935         /// Gets the overlay layer.
936         /// </summary>
937         /// <returns>The overlay layer.</returns>
938         [EditorBrowsable(EditorBrowsableState.Never)]
939         public Layer GetOverlayLayer()
940         {
941             // Window.IsInstalled() is actually true only when called from event thread and
942             // Core has been initialized, not when Stage is ready.
943             if (overlayLayer == null && Window.IsInstalled())
944             {
945                 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
946                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
947                 LayersChildren?.Add(overlayLayer);
948                 overlayLayer.SetWindow(this);
949             }
950             return overlayLayer;
951         }
952
953         /// <summary>
954         /// Add a child view to window.
955         /// </summary>
956         /// <param name="view">the child should be added to the window.</param>
957         /// <since_tizen> 3 </since_tizen>
958         public void Add(View view)
959         {
960             this.GetRootLayer().Add(view);
961         }
962
963         /// <summary>
964         /// Remove a child view from window.
965         /// </summary>
966         /// <param name="view">the child to be removed.</param>
967         /// <since_tizen> 3 </since_tizen>
968         public void Remove(View view)
969         {
970             this.GetRootLayer().Remove(view);
971         }
972
973         /// <summary>
974         /// Retrieves the layer at a specified depth.
975         /// </summary>
976         /// <param name="depth">The layer's depth index.</param>
977         /// <returns>The layer found at the given depth.</returns>
978         /// <since_tizen> 3 </since_tizen>
979         public Layer GetLayer(uint depth)
980         {
981             if (depth < LayersChildren?.Count)
982             {
983                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
984                 return ret;
985             }
986             else
987             {
988                 return null;
989             }
990         }
991
992         /// <summary>
993         /// Destroy the window immediately.
994         /// </summary>
995         [EditorBrowsable(EditorBrowsableState.Never)]
996         public void Destroy()
997         {
998             this.Dispose();
999         }
1000
1001         /// <summary>
1002         /// Keep rendering for at least the given amount of time.
1003         /// </summary>
1004         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1005         /// <since_tizen> 3 </since_tizen>
1006         public void KeepRendering(float durationSeconds)
1007         {
1008             Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
1009             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1010         }
1011
1012         /// <summary>
1013         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1014         /// This function can be used for following example scenarios: <br />
1015         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1016         /// </summary>
1017         /// <param name="DaliKey">The key code to grab.</param>
1018         /// <returns>True if the grab succeeds.</returns>
1019         /// <since_tizen> 3 </since_tizen>
1020         public bool GrabKeyTopmost(int DaliKey)
1021         {
1022             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1023             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1024             return ret;
1025         }
1026
1027         /// <summary>
1028         /// Ungrabs the key specified by a key for the window.<br />
1029         /// 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 />
1030         /// </summary>
1031         /// <param name="DaliKey">The key code to ungrab.</param>
1032         /// <returns>True if the ungrab succeeds.</returns>
1033         /// <since_tizen> 3 </since_tizen>
1034         public bool UngrabKeyTopmost(int DaliKey)
1035         {
1036             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1037             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1038             return ret;
1039         }
1040
1041         /// <summary>
1042         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
1043         ///  Details: This function can be used for following example scenarios: <br />
1044         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1045         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1046         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1047         /// </summary>
1048         /// <param name="DaliKey">The key code to grab.</param>
1049         /// <param name="GrabMode">The grab mode for the key.</param>
1050         /// <returns>True if the grab succeeds.</returns>
1051         /// <since_tizen> 3 </since_tizen>
1052         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1053         {
1054             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1055             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1056             return ret;
1057         }
1058
1059         /// <summary>
1060         /// Ungrabs the key specified by a key for a window.<br />
1061         /// 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 />
1062         /// </summary>
1063         /// <param name="DaliKey">The key code to ungrab.</param>
1064         /// <returns>True if the ungrab succeeds.</returns>
1065         /// <since_tizen> 3 </since_tizen>
1066         public bool UngrabKey(int DaliKey)
1067         {
1068             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1069             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1070             return ret;
1071         }
1072
1073         /// <summary>
1074         /// Sets the keyboard repeat information.
1075         /// </summary>
1076         /// <param name="rate">The key repeat rate value in seconds.</param>
1077         /// <param name="delay">The key repeat delay value in seconds.</param>
1078         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1079         /// <since_tizen> 5 </since_tizen>
1080         public bool SetKeyboardRepeatInfo(float rate, float delay)
1081         {
1082             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1083             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1084             return ret;
1085         }
1086
1087         /// <summary>
1088         /// Gets the keyboard repeat information.
1089         /// </summary>
1090         /// <param name="rate">The key repeat rate value in seconds.</param>
1091         /// <param name="delay">The key repeat delay value in seconds.</param>
1092         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1093         /// <since_tizen> 5 </since_tizen>
1094         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1095         {
1096             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1097             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1098             return ret;
1099         }
1100
1101         /// <summary>
1102         /// Adds a layer to the stage.
1103         /// </summary>
1104         /// <param name="layer">Layer to add.</param>
1105         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1106         /// <since_tizen> 3 </since_tizen>
1107         public void AddLayer(Layer layer)
1108         {
1109             Add(layer);
1110         }
1111
1112         /// <summary>
1113         /// Removes a layer from the stage.
1114         /// </summary>
1115         /// <param name="layer">Layer to remove.</param>
1116         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1117         /// <since_tizen> 3 </since_tizen>
1118         public void RemoveLayer(Layer layer)
1119         {
1120             Remove(layer);
1121         }
1122
1123         /// <summary>
1124         /// Feeds a key event into the window.
1125         /// </summary>
1126         /// <param name="keyEvent">The key event to feed.</param>
1127         /// <since_tizen> 5 </since_tizen>
1128         public void FeedKey(Key keyEvent)
1129         {
1130             Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132         }
1133
1134         /// <summary>
1135         /// Feeds a touch point into the window.
1136         /// </summary>
1137         /// <param name="touchPoint">The touch point to feed.</param>
1138         /// <param name="timeStamp">The timeStamp.</param>
1139         internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1140         {
1141             Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1142             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143         }
1144
1145         /// <summary>
1146         /// Feeds a wheel event into the window.
1147         /// </summary>
1148         /// <param name="wheelEvent">The wheel event to feed.</param>
1149         internal void FeedWheel(Wheel wheelEvent)
1150         {
1151             Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1153         }
1154
1155         /// <summary>
1156         /// Allows at least one more render, even when paused.
1157         /// The window should be shown, not minimised.
1158         /// </summary>
1159         /// <since_tizen> 4 </since_tizen>
1160         public void RenderOnce()
1161         {
1162             Interop.Window.RenderOnce(SwigCPtr);
1163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1164         }
1165
1166         /// <summary>
1167         /// Sets whether the window is transparent or not.
1168         /// </summary>
1169         /// <param name="transparent">Whether the window is transparent or not.</param>
1170         /// <since_tizen> 5 </since_tizen>
1171         public void SetTransparency(bool transparent)
1172         {
1173             Interop.Window.SetTransparency(SwigCPtr, transparent);
1174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175
1176             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1177         }
1178
1179         /// <summary>
1180         /// Sets parent window of the window.
1181         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1182         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1183         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1184         /// </summary>
1185         /// <param name="parent">The parent window.</param>
1186         /// <since_tizen> 6 </since_tizen>
1187         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1188         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1189         public void SetParent(Window parent)
1190         {
1191             if (IsSupportedMultiWindow() == false)
1192             {
1193                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1194             }
1195             Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1196             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1197         }
1198
1199         /// <summary>
1200         /// Sets parent window of the window.
1201         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1202         /// This function has the additional flag whether the child is located above or below of the parent.
1203         /// </summary>
1204         /// <param name="parent">The parent window.</param>
1205         /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1206         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1207         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1208         [EditorBrowsable(EditorBrowsableState.Never)]
1209         public void SetParent(Window parent, bool belowParent)
1210         {
1211             if (IsSupportedMultiWindow() == false)
1212             {
1213                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1214             }
1215             Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217         }
1218
1219         /// <summary>
1220         /// Unsets parent window of the window.
1221         /// After unsetting, the window is disconnected his parent window.
1222         /// </summary>
1223         /// <since_tizen> 6 </since_tizen>
1224         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1225         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1226         public void Unparent()
1227         {
1228             if (IsSupportedMultiWindow() == false)
1229             {
1230                 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1231             }
1232             Interop.Window.Unparent(SwigCPtr);
1233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1234         }
1235
1236         /// <summary>
1237         /// Gets parent window of the window.
1238         /// </summary>
1239         /// <returns>The parent window of the window.</returns>
1240         /// <since_tizen> 6 </since_tizen>
1241         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1242         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1243         [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1244         public Window GetParent()
1245         {
1246             if (IsSupportedMultiWindow() == false)
1247             {
1248                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1249             }
1250             Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1251             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252             return ret;
1253         }
1254
1255         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1256         [EditorBrowsable(EditorBrowsableState.Never)]
1257         public void ObjectDump()
1258         {
1259             Layer rootLayer = GetRootLayer();
1260             foreach (View view in rootLayer.Children)
1261             {
1262                 view.ObjectDump();
1263             }
1264         }
1265
1266         internal static bool IsInstalled()
1267         {
1268             bool ret = Interop.Stage.IsInstalled();
1269             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270             return ret;
1271         }
1272
1273         /// <summary>
1274         /// Adds an orientation to the list of available orientations.
1275         /// </summary>
1276         /// <param name="orientation">The available orientation to add</param>
1277         /// <since_tizen> 6 </since_tizen>
1278         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1279         {
1280             Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1281             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1282         }
1283
1284         /// <summary>
1285         /// Removes an orientation from the list of available orientations.
1286         /// </summary>
1287         /// <param name="orientation">The available orientation to remove.</param>
1288         /// <since_tizen> 6 </since_tizen>
1289         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1290         {
1291             Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1292             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1293         }
1294
1295         /// <summary>
1296         /// Sets a preferred orientation.
1297         /// </summary>
1298         /// <param name="orientation">The preferred orientation.</param>
1299         /// <since_tizen> 6 </since_tizen>
1300         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1301         {
1302             Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1304         }
1305
1306         /// <summary>
1307         /// Gets the preferred orientation.
1308         /// </summary>
1309         /// <since_tizen> 6 </since_tizen>
1310         /// <returns>The preferred orientation if previously set, or none.</returns>
1311         public Window.WindowOrientation GetPreferredOrientation()
1312         {
1313             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1314             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315             return ret;
1316         }
1317
1318         /// <summary>
1319         /// Gets current orientation of the window.
1320         /// </summary>
1321         /// <since_tizen> 6 </since_tizen>
1322         /// <returns>The current window orientation if previously set, or none.</returns>
1323         [EditorBrowsable(EditorBrowsableState.Never)]
1324         public Window.WindowOrientation GetCurrentOrientation()
1325         {
1326             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1327             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328             return ret;
1329         }
1330
1331         /// <summary>
1332         /// Sets available orientations of the window.
1333         /// This API is for setting several orientations one time.
1334         /// </summary>
1335         /// <param name="orientations">The list of orientations.</param>
1336         /// <since_tizen> 6 </since_tizen>
1337         [EditorBrowsable(EditorBrowsableState.Never)]
1338         public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1339         {
1340             if (null == orientations)
1341             {
1342                 throw new ArgumentNullException(nameof(orientations));
1343             }
1344
1345             PropertyArray orientationArray = new PropertyArray();
1346             for (int i = 0; i < orientations.Count; i++)
1347             {
1348                 PropertyValue value = new PropertyValue((int)orientations[i]);
1349                 orientationArray.PushBack(value);
1350                 value.Dispose();
1351             }
1352
1353             Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1354             orientationArray.Dispose();
1355             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356         }
1357
1358         /// <summary>
1359         /// Get native window ID
1360         /// </summary>
1361         /// <returns>native window ID</returns>
1362         [EditorBrowsable(EditorBrowsableState.Never)]
1363         public int GetNativeId()
1364         {
1365             int ret = Interop.Window.GetNativeId(SwigCPtr);
1366             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1367             return ret;
1368         }
1369
1370         internal Any GetNativeHandle()
1371         {
1372             Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1373             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1374             return ret;
1375         }
1376
1377         internal void Add(Layer layer)
1378         {
1379             if (null == layer)
1380             {
1381                 throw new ArgumentNullException(nameof(layer));
1382             }
1383
1384             if (isBorderWindow)
1385             {
1386                 Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr);
1387                 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1388             }
1389             else
1390             {
1391                 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1392                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393             }
1394
1395             LayersChildren?.Add(layer);
1396             layer.SetWindow(this);
1397         }
1398
1399         internal void Remove(Layer layer)
1400         {
1401             if (null == layer)
1402             {
1403                 throw new ArgumentNullException(nameof(layer));
1404             }
1405             Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1406             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407
1408             LayersChildren?.Remove(layer);
1409             layer.SetWindow(null);
1410         }
1411
1412         internal Vector2 GetSize()
1413         {
1414             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1415
1416             convertRealWindowSizeToBorderWindowSize(val);
1417
1418             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1419             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1420             val.Dispose();
1421             return ret;
1422         }
1423
1424         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1425         [EditorBrowsable(EditorBrowsableState.Never)]
1426         public RenderTaskList GetRenderTaskList()
1427         {
1428             RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1429             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1430             return ret;
1431         }
1432
1433         /// <summary>
1434         /// Queries the number of on-window layers.
1435         /// </summary>
1436         /// <returns>The number of layers.</returns>
1437         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1438         internal uint GetLayerCount()
1439         {
1440             if (LayersChildren == null || LayersChildren.Count < 0)
1441                 return 0;
1442
1443             return (uint)LayersChildren.Count;
1444         }
1445
1446         internal Layer GetRootLayer()
1447         {
1448             if (isBorderWindow)
1449             {
1450                 if (borderLayer == null)
1451                 {
1452                     borderLayer = GetBorderWindowRootLayer();
1453                     LayersChildren?.Add(borderLayer);
1454                     borderLayer.SetWindow(this);
1455                 }
1456                 return borderLayer;
1457             }
1458             else
1459             {
1460                 // Window.IsInstalled() is actually true only when called from event thread and
1461                 // Core has been initialized, not when Stage is ready.
1462                 if (rootLayer == null && Window.IsInstalled())
1463                 {
1464                     rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1465                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466                     LayersChildren?.Add(rootLayer);
1467                     rootLayer.SetWindow(this);
1468                 }
1469                 return rootLayer;
1470             }
1471         }
1472
1473         internal void SetBackgroundColor(Vector4 color)
1474         {
1475             Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1476             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1477         }
1478
1479         internal Vector4 GetBackgroundColor()
1480         {
1481             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1482             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1483             return ret;
1484         }
1485
1486         internal Vector2 GetDpi()
1487         {
1488             Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1489             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1490             return ret;
1491         }
1492
1493         internal ObjectRegistry GetObjectRegistry()
1494         {
1495             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1496             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1497             return ret;
1498         }
1499
1500         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1501         {
1502             Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1503             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1504         }
1505
1506         internal RenderingBehaviorType GetRenderingBehavior()
1507         {
1508             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1509             if (NDalicPINVOKE.SWIGPendingException.Pending)
1510                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1511             return ret;
1512         }
1513
1514         internal void SetWindowSize(Size2D size)
1515         {
1516             if (null == size)
1517             {
1518                 throw new ArgumentNullException(nameof(size));
1519             }
1520             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1521
1522             convertBorderWindowSizeToRealWindowSize(val);
1523
1524             Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1525             val.Dispose();
1526             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1527             // Resetting Window size should request a relayout of the tree.
1528         }
1529
1530         internal Size2D GetWindowSize()
1531         {
1532             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1533
1534             convertRealWindowSizeToBorderWindowSize(val);
1535
1536             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1537             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1538             val.Dispose();
1539             return ret;
1540         }
1541
1542         internal void SetPosition(Position2D position)
1543         {
1544             if (null == position)
1545             {
1546                 throw new ArgumentNullException(nameof(position));
1547             }
1548             var val = new Int32Pair(position.X, position.Y);
1549             Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1550             val.Dispose();
1551             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1552             // Setting Position of the window should request a relayout of the tree.
1553         }
1554
1555         internal Position2D GetPosition()
1556         {
1557             var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1558             Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1559             val.Dispose();
1560             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1561             return ret;
1562         }
1563
1564         internal void SetPositionSize(Rectangle positionSize)
1565         {
1566             if (positionSize == null)
1567             {
1568                 throw new ArgumentNullException(nameof(positionSize));
1569             }
1570             var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1571
1572             convertBorderWindowSizeToRealWindowSize(val);
1573
1574             positionSize.Width = val.GetX();
1575             positionSize.Height = val.GetY();
1576
1577             Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1578             val.Dispose();
1579
1580             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1581
1582             // Setting Position of the window should request a relayout of the tree.
1583         }
1584
1585         /// <summary>
1586         /// Enables the floating mode of window.
1587         /// The floating mode is to support window is moved or resized by display server.
1588         /// For example, if the video-player window sets the floating mode,
1589         /// then display server changes its geometry and handles it like a popup.
1590         /// The way of handling floating mode window is decided by display server.
1591         /// A special display server(as a Tizen display server) supports this mode.
1592         /// </summary>
1593         /// <param name="enable">Enable floating mode or not.</param>
1594         [EditorBrowsable(EditorBrowsableState.Never)]
1595         public void EnableFloatingMode(bool enable)
1596         {
1597             Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1598             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1599         }
1600
1601         /// <summary>
1602         /// Requests to display server for the window is moved by display server.
1603         /// It can be work with setting window floating mode.
1604         /// </summary>
1605         [EditorBrowsable(EditorBrowsableState.Never)]
1606         public void RequestMoveToServer()
1607         {
1608             Interop.Window.RequestMoveToServer(SwigCPtr);
1609             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1610         }
1611
1612         /// <summary>
1613         ///  Requests to display server for the window is resized by display server.
1614         /// It can be work with setting window floating mode.
1615         /// </summary>
1616         /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1617         [EditorBrowsable(EditorBrowsableState.Never)]
1618         public void RequestResizeToServer(ResizeDirection direction)
1619         {
1620             Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1621             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1622         }
1623
1624         /// <summary>
1625         /// Includes input region.
1626         /// This function inlcudes input regions.
1627         /// It can be used multiple times and supports multiple regions.
1628         /// It means input region will be extended.
1629         /// This input is related to mouse and touch event.
1630         /// If device has touch screen, this function is useful.
1631         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1632         /// </summary>
1633         /// <param name="inputRegion">The included region to accept input events.</param>
1634         [EditorBrowsable(EditorBrowsableState.Never)]
1635         public void IncludeInputRegion(Rectangle inputRegion)
1636         {
1637             Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1638             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1639         }
1640
1641         /// <summary>
1642         /// This function excludes input regions.
1643         /// It can be used multiple times and supports multiple regions.
1644         /// It means input region will be reduced.
1645         /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1646         /// This input is related to mouse and touch event.
1647         /// If device has touch screen, this function is useful.
1648         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1649         /// </summary>
1650         /// <param name="inputRegion">The excluded region to except input events.</param>
1651         [EditorBrowsable(EditorBrowsableState.Never)]
1652         public void ExcludeInputRegion(Rectangle inputRegion)
1653         {
1654             Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1655             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1656         }
1657
1658         /// <summary>
1659         /// Maximizes window's size.
1660         /// If this function is called with true, window will be resized with screen size.
1661         /// Otherwise window will be resized with previous size.
1662         /// It is for the window's MAX button in window's border.
1663         /// If window border is supported by display server, it is not necessary.
1664         /// </summary>
1665         /// <param name="max">If window is maximized or unmaximized.</param>
1666         [EditorBrowsable(EditorBrowsableState.Never)]
1667         public void Maximize(bool max)
1668         {
1669             Interop.Window.Maximize(SwigCPtr, max);
1670             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1671         }
1672
1673         /// <summary>
1674         /// Returns whether the window is maximized or not.
1675         /// </summary>
1676         /// <returns>True if the window is maximized, false otherwise.</returns>
1677         [EditorBrowsable(EditorBrowsableState.Never)]
1678         public bool IsMaximized()
1679         {
1680             bool ret = Interop.Window.IsMaximized(SwigCPtr);
1681             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1682             return ret;
1683         }
1684
1685         /// <summary>
1686         /// Sets window's maximum size.
1687         ///
1688         /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1689         /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1690         ///
1691         /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1692         ///
1693         /// </summary>
1694         /// <param name="size">the maximum size.</param>
1695         [EditorBrowsable(EditorBrowsableState.Never)]
1696         public void SetMaximumSize(Size2D size)
1697         {
1698             if (null == size)
1699             {
1700                 throw new ArgumentNullException(nameof(size));
1701             }
1702             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1703
1704             Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1705             val.Dispose();
1706             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707         }
1708
1709         /// <summary>
1710         /// Minimizes window's size.
1711         /// If this function is called with true, window will be iconified.
1712         /// Otherwise window will be activated.
1713         /// It is for the window's MIN button in window border.
1714         /// If window border is supported by display server, it is not necessary.
1715         /// </summary>
1716         /// <param name="min">If window is minimized or unminimized.</param>
1717         [EditorBrowsable(EditorBrowsableState.Never)]
1718         public void Minimize(bool min)
1719         {
1720             Interop.Window.Minimize(SwigCPtr, min);
1721             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1722         }
1723
1724         /// <summary>
1725         /// Returns whether the window is minimized or not.
1726         /// </summary>
1727         /// <returns>True if the window is minimized, false otherwise.</returns>
1728         [EditorBrowsable(EditorBrowsableState.Never)]
1729         public bool IsMinimized()
1730         {
1731             bool ret = Interop.Window.IsMinimized(SwigCPtr);
1732             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1733             return ret;
1734         }
1735
1736         /// <summary>
1737         /// Sets window's minimum size.
1738         /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1739         /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1740         /// </summary>
1741         /// <param name="size">the minimum size.</param>
1742         [EditorBrowsable(EditorBrowsableState.Never)]
1743         public void SetMimimumSize(Size2D size)
1744         {
1745             if (null == size)
1746             {
1747                 throw new ArgumentNullException(nameof(size));
1748             }
1749             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1750
1751             Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1752             val.Dispose();
1753             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1754         }
1755
1756         /// <summary>
1757         /// Sets the layout of the window.
1758         /// </summary>
1759         /// <param name="numCols">The number of columns in the layout.</param>
1760         /// <param name="numRows">The number of rows in the layout.</param>
1761         /// <param name="column">The column number of the window within the layout.</param>
1762         /// <param name="row">The row number of the window within the layout.</param>
1763         /// <param name="colSpan">The number of columns the window should span within the layout.</param>
1764         /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
1765         [EditorBrowsable(EditorBrowsableState.Never)]
1766         public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
1767         {
1768             Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
1769             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1770
1771         }
1772
1773         /// <summary>
1774         /// Sets the layout of the window.
1775         /// </summary>
1776         /// <param name="layoutType">The type of layout to set for the window.</param>
1777         [EditorBrowsable(EditorBrowsableState.Never)]
1778         public void SetLayout(WindowLayoutType layoutType)
1779         {
1780             switch (layoutType)
1781             {
1782                 case WindowLayoutType.LeftHalf:
1783                     Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
1784                     break;
1785                 case WindowLayoutType.RightHalf:
1786                     Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
1787                     break;
1788
1789                 case WindowLayoutType.TopHalf:
1790                     Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
1791                     break;
1792                 case WindowLayoutType.BottomHalf:
1793                     Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
1794                     break;
1795
1796                 case WindowLayoutType.UpperLeftQuarter:
1797                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
1798                     break;
1799                 case WindowLayoutType.UpperRightQuarter:
1800                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
1801                     break;
1802                 case WindowLayoutType.LowerLeftQuarter:
1803                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
1804                     break;
1805                 case WindowLayoutType.LowerRightQuarter:
1806                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
1807                     break;
1808
1809                 case WindowLayoutType.LeftThird:
1810                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
1811                     break;
1812                 case WindowLayoutType.CenterThird:
1813                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
1814                     break;
1815                 case WindowLayoutType.RightThird:
1816                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
1817                     break;
1818
1819                 case WindowLayoutType.TopThird:
1820                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
1821                     break;
1822                 case WindowLayoutType.MiddleThird:
1823                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
1824                     break;
1825                 case WindowLayoutType.BottomThird:
1826                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
1827                     break;
1828             }
1829             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1830
1831         }
1832
1833         /// <summary>
1834         /// Query whether window is rotating or not.
1835         /// </summary>
1836         /// <returns>True if window is rotating, false otherwise.</returns>
1837         [EditorBrowsable(EditorBrowsableState.Never)]
1838         public bool IsWindowRotating()
1839         {
1840             bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1841             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1842             return ret;
1843         }
1844
1845         /// <summary>
1846         /// Gets the last key event the window gets.
1847         /// </summary>
1848         /// <returns>The last key event the window gets.</returns>
1849         [EditorBrowsable(EditorBrowsableState.Never)]
1850         public Key GetLastKeyEvent()
1851         {
1852             Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
1853             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1854             return ret;
1855         }
1856
1857         /// <summary>
1858         /// Gets the last touch event the window gets.
1859         /// </summary>
1860         /// <returns>The last touch event the window gets.</returns>
1861         [EditorBrowsable(EditorBrowsableState.Never)]
1862         public Touch GetLastTouchEvent()
1863         {
1864             Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
1865             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1866             return ret;
1867         }
1868
1869         /// <summary>
1870         /// Sets the necessary for window rotation Acknowledgement.
1871         /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
1872         ///
1873         /// This function is supprot that application has the window rotation acknowledgement's control.
1874         /// It means display server waits when application's rotation work is finished.
1875         /// It is useful application has the other rendering engine which works asynchronous.
1876         /// For instance, GlView.
1877         /// </summary>
1878         /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
1879         [EditorBrowsable(EditorBrowsableState.Never)]
1880         public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
1881         {
1882             Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
1883             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1884         }
1885
1886         /// <summary>
1887         /// send the Acknowledgement to complete window rotation.
1888         /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
1889         /// </summary>
1890         [EditorBrowsable(EditorBrowsableState.Never)]
1891         public void SendRotationCompletedAcknowledgement()
1892         {
1893             Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
1894             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1895         }
1896
1897         /// <summary>
1898         /// Add FrameUpdateCallback
1899         /// </summary>
1900         [EditorBrowsable(EditorBrowsableState.Never)]
1901         public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1902         {
1903             frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1904         }
1905
1906         /// <summary>
1907         /// Remove FrameUpdateCallback
1908         /// </summary>
1909         [EditorBrowsable(EditorBrowsableState.Never)]
1910         public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1911         {
1912             frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1913         }
1914
1915         /// <summary>
1916         /// Dispose for Window
1917         /// </summary>
1918         [EditorBrowsable(EditorBrowsableState.Never)]
1919         protected override void Dispose(DisposeTypes type)
1920         {
1921             if (disposed)
1922             {
1923                 return;
1924             }
1925
1926             this.DisconnectNativeSignals();
1927
1928             if (type == DisposeTypes.Explicit)
1929             {
1930                 //Called by User
1931                 //Release your own managed resources here.
1932                 //You should release all of your own disposable objects here.
1933
1934                 if (IsBorderEnabled)
1935                 {
1936                     DisposeBorder();
1937                 }
1938
1939                 foreach (var layer in childLayers)
1940                 {
1941                     if (layer != null)
1942                     {
1943                         layer.Dispose();
1944                     }
1945                 }
1946
1947                 childLayers.Clear();
1948
1949                 localController?.Dispose();
1950             }
1951
1952
1953             base.Dispose(type);
1954         }
1955
1956         /// This will not be public opened.
1957         [EditorBrowsable(EditorBrowsableState.Never)]
1958         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1959         {
1960             Interop.Window.DeleteWindow(swigCPtr);
1961         }
1962
1963         private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1964
1965         private static readonly object locker = new object();
1966
1967         private static int key = 0;
1968
1969         private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1970
1971         private struct internalHookCallbackType
1972         {
1973             public FrameCallbackType userCallback;
1974             public int frameId;
1975         }
1976
1977         private static void OnInternalHookFrameCallback(int id)
1978         {
1979             lock (locker)
1980             {
1981                 if (frameCallbackList.ContainsKey(id))
1982                 {
1983                     if (frameCallbackList[id].userCallback != null)
1984                     {
1985                         frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1986                         frameCallbackList.Remove(id);
1987                     }
1988                     else
1989                     {
1990                         NUILog.Error($"found userCallback is NULL");
1991                         frameCallbackList.Remove(id);
1992                     }
1993                 }
1994             }
1995         }
1996
1997         private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1998         {
1999             if (null == callback)
2000             {
2001                 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2002             }
2003             var assignedKey = 0;
2004             lock (locker)
2005             {
2006                 key++;
2007                 assignedKey = key;
2008                 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2009                 {
2010                     userCallback = callback,
2011                     frameId = frameId,
2012                 });
2013             }
2014             return assignedKey;
2015         }
2016
2017         /// <summary>
2018         /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2019         /// </summary>
2020         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2021         [EditorBrowsable(EditorBrowsableState.Never)]
2022         public delegate void FrameCallbackType(int frameId);
2023
2024         /// <summary>
2025         /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2026         /// A callback of the following type may be used:
2027         /// <code>
2028         /// void MyFunction( int frameId )
2029         /// </code>
2030         /// This callback will be deleted once it is called.
2031         /// <remarks>
2032         /// Ownership of the callback is passed onto this class
2033         /// </remarks>
2034         /// </summary>
2035         /// <param name="callback">The function to call</param>
2036         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2037         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2038         [EditorBrowsable(EditorBrowsableState.Never)]
2039         public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2040         {
2041             var assignedKey = AddInterHookCallback(callback, frameId);
2042             Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2043
2044             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2045         }
2046
2047         /// <summary>
2048         /// Adds a callback that is called when the frame is displayed on the display.
2049         /// A callback of the following type may be used:
2050         /// <code>
2051         /// void MyFunction( int frameId )
2052         /// </code>
2053         /// This callback will be deleted once it is called.
2054         /// <remarks>
2055         /// Ownership of the callback is passed onto this class
2056         /// </remarks>
2057         /// </summary>
2058         /// <param name="callback">The function to call</param>
2059         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2060         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2061         [EditorBrowsable(EditorBrowsableState.Never)]
2062         public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2063         {
2064             var assignedKey = AddInterHookCallback(callback, frameId);
2065             Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2066
2067             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2068         }
2069
2070         /// <summary>
2071         /// Search through this Window for a Layer with the given unique ID.
2072         /// </summary>
2073         /// <param name="id">The ID of the Layer to find.</param>
2074         /// <remarks>Hidden-API</remarks>
2075         /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2076         [EditorBrowsable(EditorBrowsableState.Never)]
2077         public Layer FindLayerByID(uint id)
2078         {
2079             Layer defaultLayer = this.GetDefaultLayer();
2080             IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2081             Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2082
2083             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2084             return ret;
2085         }
2086
2087         /// <summary>
2088         /// Get Native Window handle.
2089         /// <example>
2090         /// How to get Native Window handle
2091         /// <code>
2092         /// Window window = NUIApplication.GetDefaultWindow();
2093         /// var handle = window.NativeHandle;
2094         /// if(handle.IsInvalid == false)
2095         /// {
2096         ///     IntPtr nativeHandle = handle.DangerousGetHandle();
2097         ///     // do something with nativeHandle
2098         /// }
2099         /// </code>
2100         /// </example>
2101         /// </summary>
2102         /// <since_tizen> 9 </since_tizen>
2103         public SafeHandle NativeHandle
2104         {
2105             get
2106             {
2107                 return new NUI.SafeNativeWindowHandle(this);
2108             }
2109         }
2110     }
2111 }