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