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