3a60ec5bc105e28be426b21733373b733378ac4b
[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         /// <summary>
570         /// Gets or sets whether the window will update partial area or full area.
571         /// If this value is true, window will update and render partial area.
572         /// If false, full area updated.
573         /// </summary>
574         [EditorBrowsable(EditorBrowsableState.Never)]
575         public bool PartialUpdate
576         {
577             get
578             {
579                 return IsPartialUpdate();
580             }
581             set
582             {
583                 SetPartialUpdate(value);
584             }
585         }
586
587         internal static Vector4 DEFAULT_BACKGROUND_COLOR
588         {
589             get
590             {
591                 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
592                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
593                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
594                 return ret;
595             }
596         }
597
598         internal static Vector4 DEBUG_BACKGROUND_COLOR
599         {
600             get
601             {
602                 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
603                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
604                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605                 return ret;
606             }
607         }
608
609         internal List<Layer> LayersChildren
610         {
611             get
612             {
613                 return childLayers;
614             }
615         }
616
617         /// <summary>
618         ///  Get the LayoutController for this Window.
619         /// </summary>
620         internal LayoutController LayoutController
621         {
622             get
623             {
624                 return localController;
625             }
626         }
627
628         /// <summary>
629         /// Feed a key-event into the window.
630         /// </summary>
631         /// <param name="keyEvent">The key event to feed.</param>
632         /// <since_tizen> 4 </since_tizen>
633         [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
634         public static void FeedKeyEvent(Key keyEvent)
635         {
636             Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
637             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638         }
639
640         /// <summary>
641         /// Sets whether the window accepts a focus or not.
642         /// </summary>
643         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
644         /// <since_tizen> 3 </since_tizen>
645         public void SetAcceptFocus(bool accept)
646         {
647             Interop.Window.SetAcceptFocus(SwigCPtr, accept);
648             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649         }
650
651         /// <summary>
652         /// Returns whether the window accepts a focus or not.
653         /// </summary>
654         /// <returns>True if the window accepts a focus, false otherwise.</returns>
655         /// <since_tizen> 3 </since_tizen>
656         public bool IsFocusAcceptable()
657         {
658             bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
659             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
660
661             return ret;
662         }
663
664         /// <summary>
665         /// Shows the window if it is hidden.
666         /// </summary>
667         /// <since_tizen> 3 </since_tizen>
668         public void Show()
669         {
670             Interop.Window.Show(SwigCPtr);
671             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
672         }
673
674         /// <summary>
675         /// Hides the window if it is showing.
676         /// </summary>
677         /// <since_tizen> 3 </since_tizen>
678         public void Hide()
679         {
680             Interop.Window.Hide(SwigCPtr);
681             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
682         }
683
684         /// <summary>
685         /// Retrieves whether the window is visible or not.
686         /// </summary>
687         /// <returns>True if the window is visible.</returns>
688         /// <since_tizen> 3 </since_tizen>
689         public bool IsVisible()
690         {
691             bool temp = Interop.Window.IsVisible(SwigCPtr);
692             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
693             return temp;
694         }
695
696         /// <summary>
697         /// Gets the count of supported auxiliary hints of the window.
698         /// </summary>
699         /// <returns>The number of supported auxiliary hints.</returns>
700         /// <since_tizen> 3 </since_tizen>
701         public uint GetSupportedAuxiliaryHintCount()
702         {
703             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
704             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705             return ret;
706         }
707
708         /// <summary>
709         /// Gets the supported auxiliary hint string of the window.
710         /// </summary>
711         /// <param name="index">The index of the supported auxiliary hint lists.</param>
712         /// <returns>The auxiliary hint string of the index.</returns>
713         /// <since_tizen> 3 </since_tizen>
714         public string GetSupportedAuxiliaryHint(uint index)
715         {
716             string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
717             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718             return ret;
719         }
720
721         /// <summary>
722         /// Creates an auxiliary hint of the window.
723         /// </summary>
724         /// <param name="hint">The auxiliary hint string.</param>
725         /// <param name="value">The value string.</param>
726         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
727         /// <since_tizen> 3 </since_tizen>
728         public uint AddAuxiliaryHint(string hint, string value)
729         {
730             uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
731             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732             return ret;
733         }
734
735         /// <summary>
736         /// Removes an auxiliary hint of the window.
737         /// </summary>
738         /// <param name="id">The ID of the auxiliary hint.</param>
739         /// <returns>True if no error occurred, false otherwise.</returns>
740         /// <since_tizen> 3 </since_tizen>
741         public bool RemoveAuxiliaryHint(uint id)
742         {
743             bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
744             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745             return ret;
746         }
747
748         /// <summary>
749         /// Changes a value of the auxiliary hint.
750         /// </summary>
751         /// <param name="id">The auxiliary hint ID.</param>
752         /// <param name="value">The value string to be set.</param>
753         /// <returns>True if no error occurred, false otherwise.</returns>
754         /// <since_tizen> 3 </since_tizen>
755         public bool SetAuxiliaryHintValue(uint id, string value)
756         {
757             bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
758             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759             return ret;
760         }
761
762         /// <summary>
763         /// Gets a value of the auxiliary hint.
764         /// </summary>
765         /// <param name="id">The auxiliary hint ID.</param>
766         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
767         /// <since_tizen> 3 </since_tizen>
768         public string GetAuxiliaryHintValue(uint id)
769         {
770             string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
771             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772             return ret;
773         }
774
775         /// <summary>
776         /// Gets an ID of the auxiliary hint string.
777         /// </summary>
778         /// <param name="hint">The auxiliary hint string.</param>
779         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
780         /// <since_tizen> 3 </since_tizen>
781         public uint GetAuxiliaryHintId(string hint)
782         {
783             uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
784             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785             return ret;
786         }
787
788         /// <summary>
789         /// Sets a region to accept input events.
790         /// </summary>
791         /// <param name="inputRegion">The region to accept input events.</param>
792         /// <since_tizen> 3 </since_tizen>
793         public void SetInputRegion(Rectangle inputRegion)
794         {
795             Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
796             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797         }
798
799         /// <summary>
800         /// Sets a priority level for the specified notification window.
801         /// </summary>
802         /// <param name="level">The notification window level.</param>
803         /// <returns>True if no error occurred, false otherwise.</returns>
804         /// <since_tizen> 3 </since_tizen>
805         public bool SetNotificationLevel(NotificationLevel level)
806         {
807             var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
808             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809             return ret == OperationResult.Succeed;
810         }
811
812         /// <summary>
813         /// Gets a priority level for the specified notification window.
814         /// </summary>
815         /// <returns>The notification window level.</returns>
816         /// <since_tizen> 3 </since_tizen>
817         public NotificationLevel GetNotificationLevel()
818         {
819             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
820             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
821             return ret;
822         }
823
824         /// <summary>
825         /// Sets a transparent window's visual state to opaque. <br />
826         /// If a visual state of a transparent window is opaque, <br />
827         /// then the window manager could handle it as an opaque window when calculating visibility.
828         /// </summary>
829         /// <param name="opaque">Whether the window's visual state is opaque.</param>
830         /// <remarks>This will have no effect on an opaque window. <br />
831         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
832         /// </remarks>
833         /// <since_tizen> 3 </since_tizen>
834         public void SetOpaqueState(bool opaque)
835         {
836             Interop.Window.SetOpaqueState(SwigCPtr, opaque);
837             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838         }
839
840         /// <summary>
841         /// Returns whether a transparent window's visual state is opaque or not.
842         /// </summary>
843         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
844         /// <remarks> The return value has no meaning on an opaque window. </remarks>
845         /// <since_tizen> 3 </since_tizen>
846         public bool IsOpaqueState()
847         {
848             bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
849             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850             return ret;
851         }
852
853         /// <summary>
854         /// Sets a window's screen off mode.
855         /// </summary>
856         /// <param name="screenOffMode">The screen mode.</param>
857         /// <returns>True if no error occurred, false otherwise.</returns>
858         /// <since_tizen> 4 </since_tizen>
859         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
860         {
861             var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
862             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
863             return ret == OperationResult.Succeed;
864         }
865
866         /// <summary>
867         /// Gets the screen mode of the window.
868         /// </summary>
869         /// <returns>The screen off mode.</returns>
870         /// <since_tizen> 4 </since_tizen>
871         public ScreenOffMode GetScreenOffMode()
872         {
873             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
874             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875             return ret;
876         }
877
878         /// <summary>
879         /// Sets preferred brightness of the window.
880         /// </summary>
881         /// <param name="brightness">The preferred brightness (0 to 100).</param>
882         /// <returns>True if no error occurred, false otherwise.</returns>
883         /// <since_tizen> 3 </since_tizen>
884         public bool SetBrightness(int brightness)
885         {
886             var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
887             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888             return ret == OperationResult.Succeed;
889         }
890
891         /// <summary>
892         /// Gets the preferred brightness of the window.
893         /// </summary>
894         /// <returns>The preferred brightness.</returns>
895         /// <since_tizen> 3 </since_tizen>
896         public int GetBrightness()
897         {
898             int ret = Interop.Window.GetBrightness(SwigCPtr);
899             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900             return ret;
901         }
902
903         /// <summary>
904         /// Sets the window name and the class string.
905         /// </summary>
906         /// <param name="name">The name of the window.</param>
907         /// <param name="klass">The class of the window.</param>
908         /// <since_tizen> 4 </since_tizen>
909         public void SetClass(string name, string klass)
910         {
911             Interop.Window.SetClass(SwigCPtr, name, klass);
912             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913         }
914
915         /// <summary>
916         /// Raises the window to the top of the window stack.
917         /// </summary>
918         /// <since_tizen> 3 </since_tizen>
919         public void Raise()
920         {
921             Interop.Window.Raise(SwigCPtr);
922             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
923         }
924
925         /// <summary>
926         /// Lowers the window to the bottom of the window stack.
927         /// </summary>
928         /// <since_tizen> 3 </since_tizen>
929         public void Lower()
930         {
931             Interop.Window.Lower(SwigCPtr);
932             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933         }
934
935         /// <summary>
936         /// Activates the window to the top of the window stack even it is iconified.
937         /// </summary>
938         /// <since_tizen> 3 </since_tizen>
939         public void Activate()
940         {
941             Interop.Window.Activate(SwigCPtr);
942             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
943         }
944
945         /// <summary>
946         /// Gets the default ( root ) layer.
947         /// </summary>
948         /// <returns>The root layer.</returns>
949         /// <since_tizen> 3 </since_tizen>
950         public Layer GetDefaultLayer()
951         {
952             return this.GetRootLayer();
953         }
954
955         /// <summary>
956         /// Gets the overlay layer.
957         /// </summary>
958         /// <returns>The overlay layer.</returns>
959         [EditorBrowsable(EditorBrowsableState.Never)]
960         public Layer GetOverlayLayer()
961         {
962             // Window.IsInstalled() is actually true only when called from event thread and
963             // Core has been initialized, not when Stage is ready.
964             if (overlayLayer == null && Window.IsInstalled())
965             {
966                 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
967                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968                 LayersChildren?.Add(overlayLayer);
969                 overlayLayer.SetWindow(this);
970             }
971             return overlayLayer;
972         }
973
974         /// <summary>
975         /// Add a child view to window.
976         /// </summary>
977         /// <param name="view">the child should be added to the window.</param>
978         /// <since_tizen> 3 </since_tizen>
979         public void Add(View view)
980         {
981             this.GetRootLayer().Add(view);
982         }
983
984         /// <summary>
985         /// Remove a child view from window.
986         /// </summary>
987         /// <param name="view">the child to be removed.</param>
988         /// <since_tizen> 3 </since_tizen>
989         public void Remove(View view)
990         {
991             this.GetRootLayer().Remove(view);
992         }
993
994         /// <summary>
995         /// Retrieves the layer at a specified depth.
996         /// </summary>
997         /// <param name="depth">The layer's depth index.</param>
998         /// <returns>The layer found at the given depth.</returns>
999         /// <since_tizen> 3 </since_tizen>
1000         public Layer GetLayer(uint depth)
1001         {
1002             if (depth < LayersChildren?.Count)
1003             {
1004                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1005                 return ret;
1006             }
1007             else
1008             {
1009                 return null;
1010             }
1011         }
1012
1013         /// <summary>
1014         /// Destroy the window immediately.
1015         /// </summary>
1016         [EditorBrowsable(EditorBrowsableState.Never)]
1017         public void Destroy()
1018         {
1019             this.Dispose();
1020         }
1021
1022         /// <summary>
1023         /// Keep rendering for at least the given amount of time.
1024         /// </summary>
1025         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1026         /// <since_tizen> 3 </since_tizen>
1027         public void KeepRendering(float durationSeconds)
1028         {
1029             Interop.Window.KeepRendering(SwigCPtr, durationSeconds);
1030             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1031         }
1032
1033         /// <summary>
1034         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1035         /// This function can be used for following example scenarios: <br />
1036         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1037         /// </summary>
1038         /// <param name="DaliKey">The key code to grab.</param>
1039         /// <returns>True if the grab succeeds.</returns>
1040         /// <since_tizen> 3 </since_tizen>
1041         public bool GrabKeyTopmost(int DaliKey)
1042         {
1043             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1044             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1045             return ret;
1046         }
1047
1048         /// <summary>
1049         /// Ungrabs the key specified by a key for the window.<br />
1050         /// 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 />
1051         /// </summary>
1052         /// <param name="DaliKey">The key code to ungrab.</param>
1053         /// <returns>True if the ungrab succeeds.</returns>
1054         /// <since_tizen> 3 </since_tizen>
1055         public bool UngrabKeyTopmost(int DaliKey)
1056         {
1057             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1058             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1059             return ret;
1060         }
1061
1062         /// <summary>
1063         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
1064         ///  Details: This function can be used for following example scenarios: <br />
1065         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1066         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1067         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1068         /// </summary>
1069         /// <param name="DaliKey">The key code to grab.</param>
1070         /// <param name="GrabMode">The grab mode for the key.</param>
1071         /// <returns>True if the grab succeeds.</returns>
1072         /// <since_tizen> 3 </since_tizen>
1073         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1074         {
1075             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1076             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1077             return ret;
1078         }
1079
1080         /// <summary>
1081         /// Ungrabs the key specified by a key for a window.<br />
1082         /// 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 />
1083         /// </summary>
1084         /// <param name="DaliKey">The key code to ungrab.</param>
1085         /// <returns>True if the ungrab succeeds.</returns>
1086         /// <since_tizen> 3 </since_tizen>
1087         public bool UngrabKey(int DaliKey)
1088         {
1089             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1090             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091             return ret;
1092         }
1093
1094         /// <summary>
1095         /// Sets the keyboard repeat information.
1096         /// </summary>
1097         /// <param name="rate">The key repeat rate value in seconds.</param>
1098         /// <param name="delay">The key repeat delay value in seconds.</param>
1099         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1100         /// <since_tizen> 5 </since_tizen>
1101         public bool SetKeyboardRepeatInfo(float rate, float delay)
1102         {
1103             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1105             return ret;
1106         }
1107
1108         /// <summary>
1109         /// Gets the keyboard repeat information.
1110         /// </summary>
1111         /// <param name="rate">The key repeat rate value in seconds.</param>
1112         /// <param name="delay">The key repeat delay value in seconds.</param>
1113         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1114         /// <since_tizen> 5 </since_tizen>
1115         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1116         {
1117             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1119             return ret;
1120         }
1121
1122         /// <summary>
1123         /// Sets the keyboard repeat information of horizontal way.
1124         /// </summary>
1125         /// <param name="rate">The key repeat rate value in seconds.</param>
1126         /// <param name="delay">The key repeat delay value in seconds.</param>
1127         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1128         [EditorBrowsable(EditorBrowsableState.Never)]
1129         public bool SetKeyboardHorizentalRepeatInfo(float rate, float delay)
1130         {
1131             bool ret = Interop.Window.SetKeyboardHorizentalRepeatInfo(rate, delay);
1132             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1133             return ret;
1134         }
1135
1136         /// <summary>
1137         /// Gets the keyboard repeat information of horizontal way.
1138         /// </summary>
1139         /// <param name="rate">The key repeat rate value in seconds.</param>
1140         /// <param name="delay">The key repeat delay value in seconds.</param>
1141         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1142         [EditorBrowsable(EditorBrowsableState.Never)]
1143         public bool GetKeyboardHorizentalRepeatInfo(out float rate, out float delay)
1144         {
1145             bool ret = Interop.Window.GetKeyboardHorizentalRepeatInfo(out rate, out delay);
1146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1147             return ret;
1148         }
1149
1150         /// <summary>
1151         /// Sets the keyboard repeat information of vertical way.
1152         /// </summary>
1153         /// <param name="rate">The key repeat rate value in seconds.</param>
1154         /// <param name="delay">The key repeat delay value in seconds.</param>
1155         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1156         [EditorBrowsable(EditorBrowsableState.Never)]
1157         public bool SetKeyboardVerticalRepeatInfo(float rate, float delay)
1158         {
1159             bool ret = Interop.Window.SetKeyboardVerticalRepeatInfo(rate, delay);
1160             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1161             return ret;
1162         }
1163
1164         /// <summary>
1165         /// Gets the keyboard repeat information of vertical way.
1166         /// </summary>
1167         /// <param name="rate">The key repeat rate value in seconds.</param>
1168         /// <param name="delay">The key repeat delay value in seconds.</param>
1169         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1170         [EditorBrowsable(EditorBrowsableState.Never)]
1171         public bool GetKeyboardVerticalRepeatInfo(out float rate, out float delay)
1172         {
1173             bool ret = Interop.Window.GetKeyboardVerticalRepeatInfo(out rate, out delay);
1174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175             return ret;
1176         }
1177
1178         /// <summary>
1179         /// Adds a layer to the stage.
1180         /// </summary>
1181         /// <param name="layer">Layer to add.</param>
1182         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1183         /// <since_tizen> 3 </since_tizen>
1184         public void AddLayer(Layer layer)
1185         {
1186             Add(layer);
1187         }
1188
1189         /// <summary>
1190         /// Removes a layer from the stage.
1191         /// </summary>
1192         /// <param name="layer">Layer to remove.</param>
1193         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1194         /// <since_tizen> 3 </since_tizen>
1195         public void RemoveLayer(Layer layer)
1196         {
1197             Remove(layer);
1198         }
1199
1200         /// <summary>
1201         /// Feeds a key event into the window.
1202         /// </summary>
1203         /// <param name="keyEvent">The key event to feed.</param>
1204         /// <since_tizen> 5 </since_tizen>
1205         public void FeedKey(Key keyEvent)
1206         {
1207             Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1209         }
1210
1211         /// <summary>
1212         /// Feeds a hover event into the window. <br />
1213         /// This is feed after a default time of 48 ms. You can also set this time.
1214         /// </summary>
1215         /// <param name="time">The time of how much later it will be feed (default is 48ms)</param>
1216         /// <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 />
1217         /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover.
1218         /// </remarks>
1219         [EditorBrowsable(EditorBrowsableState.Never)]
1220         public void LazyFeedHover(uint time = 48)
1221         {
1222             if (internalHoverTimer == null)
1223             {
1224                 internalHoverTimer = new Timer(time);
1225                 internalHoverTimer.Tick += (s, e) =>
1226                 {
1227                     FeedHover();
1228                     internalHoverTimer?.Stop();
1229                     internalHoverTimer?.Dispose();
1230                     internalHoverTimer = null;
1231                     return false;
1232                 };
1233                 internalHoverTimer.Start();
1234             }
1235             else
1236             {
1237                 internalHoverTimer.Start();
1238             }
1239         }
1240
1241         /// <summary>
1242         /// Feeds a touch point into the window.
1243         /// </summary>
1244         /// <param name="touchPoint">The touch point to feed.</param>
1245         /// <param name="timeStamp">The timeStamp.</param>
1246         internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1247         {
1248             Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1249             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250         }
1251
1252         /// <summary>
1253         /// Feeds a wheel event into the window.
1254         /// </summary>
1255         /// <param name="wheelEvent">The wheel event to feed.</param>
1256         internal void FeedWheel(Wheel wheelEvent)
1257         {
1258             Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1259             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1260         }
1261
1262         /// <summary>
1263         /// Feeds a hover event into the window.
1264         /// </summary>
1265         /// <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>
1266         [EditorBrowsable(EditorBrowsableState.Never)]
1267         internal void FeedHover(TouchPoint touchPoint = null)
1268         {
1269             if (touchPoint == null)
1270             {
1271                 using Touch touch = GetLastTouchEvent();
1272                 if (touch == null || touch.GetPointCount() < 1)
1273                 {
1274                     return;
1275                 }
1276                 using Vector2 screenPosition = touch.GetScreenPosition(0);
1277                 touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
1278             }
1279             Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
1280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1281         }
1282
1283         /// <summary>
1284         /// Allows at least one more render, even when paused.
1285         /// The window should be shown, not minimised.
1286         /// </summary>
1287         /// <since_tizen> 4 </since_tizen>
1288         public void RenderOnce()
1289         {
1290             Interop.Window.RenderOnce(SwigCPtr);
1291             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1292         }
1293
1294         /// <summary>
1295         /// Sets whether the window is transparent or not.
1296         /// </summary>
1297         /// <param name="transparent">Whether the window is transparent or not.</param>
1298         /// <since_tizen> 5 </since_tizen>
1299         public void SetTransparency(bool transparent)
1300         {
1301             Interop.Window.SetTransparency(SwigCPtr, transparent);
1302             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1303
1304             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1305         }
1306
1307         /// <summary>
1308         /// Sets parent window of the window.
1309         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1310         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1311         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1312         /// </summary>
1313         /// <param name="parent">The parent window.</param>
1314         /// <since_tizen> 6 </since_tizen>
1315         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1316         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1317         public void SetParent(Window parent)
1318         {
1319             if (IsSupportedMultiWindow() == false)
1320             {
1321                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1322             }
1323             Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325         }
1326
1327         /// <summary>
1328         /// Sets parent window of the window.
1329         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1330         /// This function has the additional flag whether the child is located above or below of the parent.
1331         /// </summary>
1332         /// <param name="parent">The parent window.</param>
1333         /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1334         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1335         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1336         [EditorBrowsable(EditorBrowsableState.Never)]
1337         public void SetParent(Window parent, bool belowParent)
1338         {
1339             if (IsSupportedMultiWindow() == false)
1340             {
1341                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1342             }
1343             Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1344             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1345         }
1346
1347         /// <summary>
1348         /// Unsets parent window of the window.
1349         /// After unsetting, the window is disconnected his parent window.
1350         /// </summary>
1351         /// <since_tizen> 6 </since_tizen>
1352         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1353         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1354         public void Unparent()
1355         {
1356             if (IsSupportedMultiWindow() == false)
1357             {
1358                 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1359             }
1360             Interop.Window.Unparent(SwigCPtr);
1361             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1362         }
1363
1364         /// <summary>
1365         /// Gets parent window of the window.
1366         /// </summary>
1367         /// <returns>The parent window of the window.</returns>
1368         /// <since_tizen> 6 </since_tizen>
1369         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1370         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1371         [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1372         public Window GetParent()
1373         {
1374             if (IsSupportedMultiWindow() == false)
1375             {
1376                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1377             }
1378             Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1379             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1380             return ret;
1381         }
1382
1383         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1384         [EditorBrowsable(EditorBrowsableState.Never)]
1385         public void ObjectDump()
1386         {
1387             Layer rootLayer = GetRootLayer();
1388             foreach (View view in rootLayer.Children)
1389             {
1390                 view.ObjectDump();
1391             }
1392         }
1393
1394         internal static bool IsInstalled()
1395         {
1396             bool ret = Interop.Stage.IsInstalled();
1397             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1398             return ret;
1399         }
1400
1401         /// <summary>
1402         /// Adds an orientation to the list of available orientations.
1403         /// </summary>
1404         /// <param name="orientation">The available orientation to add</param>
1405         /// <since_tizen> 6 </since_tizen>
1406         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1407         {
1408             Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1409             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1410         }
1411
1412         /// <summary>
1413         /// Removes an orientation from the list of available orientations.
1414         /// </summary>
1415         /// <param name="orientation">The available orientation to remove.</param>
1416         /// <since_tizen> 6 </since_tizen>
1417         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1418         {
1419             Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1420             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1421         }
1422
1423         /// <summary>
1424         /// Sets a preferred orientation.
1425         /// </summary>
1426         /// <param name="orientation">The preferred orientation.</param>
1427         /// <since_tizen> 6 </since_tizen>
1428         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1429         {
1430             Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1431             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1432         }
1433
1434         /// <summary>
1435         /// Gets the preferred orientation.
1436         /// </summary>
1437         /// <since_tizen> 6 </since_tizen>
1438         /// <returns>The preferred orientation if previously set, or none.</returns>
1439         public Window.WindowOrientation GetPreferredOrientation()
1440         {
1441             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1442             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1443             return ret;
1444         }
1445
1446         /// <summary>
1447         /// Gets current orientation of the window.
1448         /// </summary>
1449         /// <since_tizen> 6 </since_tizen>
1450         /// <returns>The current window orientation if previously set, or none.</returns>
1451         [EditorBrowsable(EditorBrowsableState.Never)]
1452         public Window.WindowOrientation GetCurrentOrientation()
1453         {
1454             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1455             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1456             return ret;
1457         }
1458
1459         /// <summary>
1460         /// Sets available orientations of the window.
1461         /// This API is for setting several orientations one time.
1462         /// </summary>
1463         /// <param name="orientations">The list of orientations.</param>
1464         /// <since_tizen> 6 </since_tizen>
1465         [EditorBrowsable(EditorBrowsableState.Never)]
1466         public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1467         {
1468             if (null == orientations)
1469             {
1470                 throw new ArgumentNullException(nameof(orientations));
1471             }
1472
1473             PropertyArray orientationArray = new PropertyArray();
1474             for (int i = 0; i < orientations.Count; i++)
1475             {
1476                 PropertyValue value = new PropertyValue((int)orientations[i]);
1477                 orientationArray.PushBack(value);
1478                 value.Dispose();
1479             }
1480
1481             Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1482             orientationArray.Dispose();
1483             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484         }
1485
1486         /// <summary>
1487         /// Get native window ID
1488         /// </summary>
1489         /// <returns>native window ID</returns>
1490         [EditorBrowsable(EditorBrowsableState.Never)]
1491         public int GetNativeId()
1492         {
1493             int ret = Interop.Window.GetNativeId(SwigCPtr);
1494             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1495             return ret;
1496         }
1497
1498         internal Any GetNativeHandle()
1499         {
1500             Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1501             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1502             return ret;
1503         }
1504
1505         internal void Add(Layer layer)
1506         {
1507             if (null == layer)
1508             {
1509                 throw new ArgumentNullException(nameof(layer));
1510             }
1511
1512             if (isBorderWindow)
1513             {
1514                 Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr);
1515                 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1516             }
1517             else
1518             {
1519                 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1520                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521             }
1522
1523             LayersChildren?.Add(layer);
1524             layer.SetWindow(this);
1525         }
1526
1527         internal void Remove(Layer layer)
1528         {
1529             if (null == layer)
1530             {
1531                 throw new ArgumentNullException(nameof(layer));
1532             }
1533             Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1534             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1535
1536             LayersChildren?.Remove(layer);
1537             layer.SetWindow(null);
1538         }
1539
1540         internal Vector2 GetSize()
1541         {
1542             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1543
1544             convertRealWindowSizeToBorderWindowSize(val);
1545
1546             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1547             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1548             val.Dispose();
1549             return ret;
1550         }
1551
1552         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1553         [EditorBrowsable(EditorBrowsableState.Never)]
1554         public RenderTaskList GetRenderTaskList()
1555         {
1556             RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1557             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1558             return ret;
1559         }
1560
1561         /// <summary>
1562         /// Queries the number of on-window layers.
1563         /// </summary>
1564         /// <returns>The number of layers.</returns>
1565         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1566         internal uint GetLayerCount()
1567         {
1568             if (LayersChildren == null || LayersChildren.Count < 0)
1569                 return 0;
1570
1571             return (uint)LayersChildren.Count;
1572         }
1573
1574         internal Layer GetRootLayer()
1575         {
1576             if (isBorderWindow)
1577             {
1578                 if (borderLayer == null)
1579                 {
1580                     borderLayer = GetBorderWindowRootLayer();
1581                     LayersChildren?.Add(borderLayer);
1582                     borderLayer.SetWindow(this);
1583                 }
1584                 return borderLayer;
1585             }
1586             else
1587             {
1588                 // Window.IsInstalled() is actually true only when called from event thread and
1589                 // Core has been initialized, not when Stage is ready.
1590                 if (rootLayer == null && Window.IsInstalled())
1591                 {
1592                     rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1593                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1594                     LayersChildren?.Add(rootLayer);
1595                     rootLayer.SetWindow(this);
1596                 }
1597                 return rootLayer;
1598             }
1599         }
1600
1601         internal void SetBackgroundColor(Vector4 color)
1602         {
1603             Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1604             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1605         }
1606
1607         internal Vector4 GetBackgroundColor()
1608         {
1609             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1610             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1611             return ret;
1612         }
1613
1614         internal Vector2 GetDpi()
1615         {
1616             Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1617             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1618             return ret;
1619         }
1620
1621         internal ObjectRegistry GetObjectRegistry()
1622         {
1623             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1624             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1625             return ret;
1626         }
1627
1628         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1629         {
1630             Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1631             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1632         }
1633
1634         internal RenderingBehaviorType GetRenderingBehavior()
1635         {
1636             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1637             if (NDalicPINVOKE.SWIGPendingException.Pending)
1638                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1639             return ret;
1640         }
1641
1642         internal void SetWindowSize(Size2D size)
1643         {
1644             if (null == size)
1645             {
1646                 throw new ArgumentNullException(nameof(size));
1647             }
1648             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1649
1650             convertBorderWindowSizeToRealWindowSize(val);
1651
1652             Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1653             val.Dispose();
1654             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1655             // Resetting Window size should request a relayout of the tree.
1656         }
1657
1658         internal Size2D GetWindowSize()
1659         {
1660             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1661
1662             convertRealWindowSizeToBorderWindowSize(val);
1663
1664             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1665             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1666             val.Dispose();
1667             return ret;
1668         }
1669
1670         internal void SetPosition(Position2D position)
1671         {
1672             if (null == position)
1673             {
1674                 throw new ArgumentNullException(nameof(position));
1675             }
1676             var val = new Int32Pair(position.X, position.Y);
1677             Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1678             val.Dispose();
1679             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1680             // Setting Position of the window should request a relayout of the tree.
1681         }
1682
1683         internal Position2D GetPosition()
1684         {
1685             var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1686             Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1687             val.Dispose();
1688             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1689             return ret;
1690         }
1691
1692         internal void SetPositionSize(Rectangle positionSize)
1693         {
1694             if (positionSize == null)
1695             {
1696                 throw new ArgumentNullException(nameof(positionSize));
1697             }
1698             var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1699
1700             convertBorderWindowSizeToRealWindowSize(val);
1701
1702             positionSize.Width = val.GetX();
1703             positionSize.Height = val.GetY();
1704
1705             Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1706             val.Dispose();
1707
1708             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1709
1710             // Setting Position of the window should request a relayout of the tree.
1711         }
1712
1713         /// <summary>
1714         /// Set the window use partial update or not.
1715         /// </summary>
1716         /// <param name="enabled">If window enable partial update or disable.</param>
1717         internal void SetPartialUpdate(bool enabled)
1718         {
1719             Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled);
1720             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1721         }
1722
1723         /// <summary>
1724         /// Returns whether the window is enabled partial update or not.
1725         /// </summary>
1726         /// <returns>True if the window is enabled partial update, false otherwise.</returns>
1727         internal bool IsPartialUpdate()
1728         {
1729             bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr);
1730             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1731             return ret;
1732         }
1733
1734         /// <summary>
1735         /// Enables the floating mode of window.
1736         /// The floating mode is to support window is moved or resized by display server.
1737         /// For example, if the video-player window sets the floating mode,
1738         /// then display server changes its geometry and handles it like a popup.
1739         /// The way of handling floating mode window is decided by display server.
1740         /// A special display server(as a Tizen display server) supports this mode.
1741         /// </summary>
1742         /// <param name="enable">Enable floating mode or not.</param>
1743         [EditorBrowsable(EditorBrowsableState.Never)]
1744         public void EnableFloatingMode(bool enable)
1745         {
1746             Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1747             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1748         }
1749
1750         /// <summary>
1751         /// Returns whether the window is floating mode or not.
1752         /// </summary>
1753         /// <returns>True if the window is enabled floating mode, false otherwise.</returns>
1754         [EditorBrowsable(EditorBrowsableState.Never)]
1755         public bool IsFloatingModeEnabled()
1756         {
1757             bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
1758             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1759             return ret;
1760         }
1761
1762         /// <summary>
1763         /// Requests to display server for the window is moved by display server.
1764         /// It can be work with setting window floating mode.
1765         /// </summary>
1766         [EditorBrowsable(EditorBrowsableState.Never)]
1767         public void RequestMoveToServer()
1768         {
1769             Interop.Window.RequestMoveToServer(SwigCPtr);
1770             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1771         }
1772
1773         /// <summary>
1774         ///  Requests to display server for the window is resized by display server.
1775         /// It can be work with setting window floating mode.
1776         /// </summary>
1777         /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1778         [EditorBrowsable(EditorBrowsableState.Never)]
1779         public void RequestResizeToServer(ResizeDirection direction)
1780         {
1781             Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1782             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1783         }
1784
1785         /// <summary>
1786         /// Includes input region.
1787         /// This function inlcudes input regions.
1788         /// It can be used multiple times and supports multiple regions.
1789         /// It means input region will be extended.
1790         /// This input is related to mouse and touch event.
1791         /// If device has touch screen, this function is useful.
1792         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1793         /// </summary>
1794         /// <param name="inputRegion">The included region to accept input events.</param>
1795         [EditorBrowsable(EditorBrowsableState.Never)]
1796         public void IncludeInputRegion(Rectangle inputRegion)
1797         {
1798             Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1799             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1800         }
1801
1802         /// <summary>
1803         /// This function excludes input regions.
1804         /// It can be used multiple times and supports multiple regions.
1805         /// It means input region will be reduced.
1806         /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1807         /// This input is related to mouse and touch event.
1808         /// If device has touch screen, this function is useful.
1809         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1810         /// </summary>
1811         /// <param name="inputRegion">The excluded region to except input events.</param>
1812         [EditorBrowsable(EditorBrowsableState.Never)]
1813         public void ExcludeInputRegion(Rectangle inputRegion)
1814         {
1815             Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1816             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1817         }
1818
1819         /// <summary>
1820         /// Sets the pointer constraints lock.
1821         /// </summary>
1822         /// <returns>True if PointerConstraintsLock succeeds.</returns>
1823         [EditorBrowsable(EditorBrowsableState.Never)]
1824         public bool PointerConstraintsLock()
1825         {
1826             bool ret = Interop.Window.PointerConstraintsLock(SwigCPtr);
1827             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1828             return ret;
1829         }
1830
1831         /// <summary>
1832         /// Sets the pointer constraints unlock.
1833         /// </summary>
1834         /// <returns>True if PointerConstraintsUnlock succeeds.</returns>
1835         [EditorBrowsable(EditorBrowsableState.Never)]
1836         public bool PointerConstraintsUnlock()
1837         {
1838             bool ret = Interop.Window.PointerConstraintsUnlock(SwigCPtr);
1839             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1840             return ret;
1841         }
1842
1843         /// <summary>
1844         /// Sets the locked pointer region.
1845         /// </summary>
1846         /// <param name="x">The x position.</param>
1847         /// <param name="y">The y position.</param>
1848         /// <param name="width">The width.</param>
1849         /// <param name="height">The height.</param>
1850         [EditorBrowsable(EditorBrowsableState.Never)]
1851         public void LockedPointerRegionSet(int x, int y, int width, int height)
1852         {
1853             Interop.Window.LockedPointerRegionSet(SwigCPtr, x, y, width, height);
1854             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1855         }
1856
1857         /// <summary>
1858         /// Sets the locked pointer cursor position hintset
1859         /// </summary>
1860         /// <param name="x">The x position.</param>
1861         /// <param name="y">The y position.</param>
1862         [EditorBrowsable(EditorBrowsableState.Never)]
1863         public void LockedPointerCursorPositionHintSet(int x, int y)
1864         {
1865             Interop.Window.LockedPointerCursorPositionHintSet(SwigCPtr, x, y);
1866             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1867         }
1868
1869         /// <summary>
1870         /// Sets the pointer warp. The pointer moves to the set coordinates.
1871         /// </summary>
1872         /// <param name="x">The x position.</param>
1873         /// <param name="y">The y position.</param>
1874         /// <returns>True if PointerWarp succeeds.</returns>
1875         [EditorBrowsable(EditorBrowsableState.Never)]
1876         public bool PointerWarp(int x, int y)
1877         {
1878             bool ret = Interop.Window.PointerWarp(SwigCPtr, x, y);
1879             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1880             return ret;
1881         }
1882
1883         /// <summary>
1884         /// Sets visibility on/off of cursor
1885         /// </summary>
1886         /// <param name="visible">The visibility of cursor.</param>
1887         [EditorBrowsable(EditorBrowsableState.Never)]
1888         public void CursorVisibleSet(bool visible)
1889         {
1890             Interop.Window.CursorVisibleSet(SwigCPtr, visible);
1891             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1892         }
1893
1894
1895         /// <summary>
1896         /// Maximizes window's size.
1897         /// If this function is called with true, window will be resized with screen size.
1898         /// Otherwise window will be resized with previous size.
1899         /// It is for the window's MAX button in window's border.
1900         /// If window border is supported by display server, it is not necessary.
1901         /// </summary>
1902         /// <param name="max">If window is maximized or unmaximized.</param>
1903         [EditorBrowsable(EditorBrowsableState.Never)]
1904         public void Maximize(bool max)
1905         {
1906             Interop.Window.Maximize(SwigCPtr, max);
1907             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1908         }
1909
1910         /// <summary>
1911         /// Returns whether the window is maximized or not.
1912         /// </summary>
1913         /// <returns>True if the window is maximized, false otherwise.</returns>
1914         [EditorBrowsable(EditorBrowsableState.Never)]
1915         public bool IsMaximized()
1916         {
1917             bool ret = Interop.Window.IsMaximized(SwigCPtr);
1918             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1919             return ret;
1920         }
1921
1922         /// <summary>
1923         /// Sets window's maximum size.
1924         ///
1925         /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1926         /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1927         ///
1928         /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1929         ///
1930         /// </summary>
1931         /// <param name="size">the maximum size.</param>
1932         [EditorBrowsable(EditorBrowsableState.Never)]
1933         public void SetMaximumSize(Size2D size)
1934         {
1935             if (null == size)
1936             {
1937                 throw new ArgumentNullException(nameof(size));
1938             }
1939             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1940
1941             Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1942             val.Dispose();
1943             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1944         }
1945
1946         /// <summary>
1947         /// Minimizes window's size.
1948         /// If this function is called with true, window will be iconified.
1949         /// Otherwise window will be activated.
1950         /// It is for the window's MIN button in window border.
1951         /// If window border is supported by display server, it is not necessary.
1952         /// </summary>
1953         /// <param name="min">If window is minimized or unminimized.</param>
1954         [EditorBrowsable(EditorBrowsableState.Never)]
1955         public void Minimize(bool min)
1956         {
1957             Interop.Window.Minimize(SwigCPtr, min);
1958             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1959         }
1960
1961         /// <summary>
1962         /// Returns whether the window is minimized or not.
1963         /// </summary>
1964         /// <returns>True if the window is minimized, false otherwise.</returns>
1965         [EditorBrowsable(EditorBrowsableState.Never)]
1966         public bool IsMinimized()
1967         {
1968             bool ret = Interop.Window.IsMinimized(SwigCPtr);
1969             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1970             return ret;
1971         }
1972
1973         /// <summary>
1974         /// Sets window's minimum size.
1975         /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1976         /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1977         /// </summary>
1978         /// <param name="size">the minimum size.</param>
1979         [EditorBrowsable(EditorBrowsableState.Never)]
1980         public void SetMimimumSize(Size2D size)
1981         {
1982             if (null == size)
1983             {
1984                 throw new ArgumentNullException(nameof(size));
1985             }
1986             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1987
1988             Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1989             val.Dispose();
1990             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1991         }
1992
1993         /// <summary>
1994         /// Sets the layout of the window.
1995         /// </summary>
1996         /// <param name="numCols">The number of columns in the layout.</param>
1997         /// <param name="numRows">The number of rows in the layout.</param>
1998         /// <param name="column">The column number of the window within the layout.</param>
1999         /// <param name="row">The row number of the window within the layout.</param>
2000         /// <param name="colSpan">The number of columns the window should span within the layout.</param>
2001         /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
2002         [EditorBrowsable(EditorBrowsableState.Never)]
2003         public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
2004         {
2005             Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
2006             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2007
2008         }
2009
2010         /// <summary>
2011         /// Sets the layout of the window.
2012         /// </summary>
2013         /// <param name="layoutType">The type of layout to set for the window.</param>
2014         [EditorBrowsable(EditorBrowsableState.Never)]
2015         public void SetLayout(WindowLayoutType layoutType)
2016         {
2017             switch (layoutType)
2018             {
2019                 case WindowLayoutType.LeftHalf:
2020                     Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
2021                     break;
2022                 case WindowLayoutType.RightHalf:
2023                     Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
2024                     break;
2025
2026                 case WindowLayoutType.TopHalf:
2027                     Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
2028                     break;
2029                 case WindowLayoutType.BottomHalf:
2030                     Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
2031                     break;
2032
2033                 case WindowLayoutType.UpperLeftQuarter:
2034                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
2035                     break;
2036                 case WindowLayoutType.UpperRightQuarter:
2037                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
2038                     break;
2039                 case WindowLayoutType.LowerLeftQuarter:
2040                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
2041                     break;
2042                 case WindowLayoutType.LowerRightQuarter:
2043                     Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
2044                     break;
2045
2046                 case WindowLayoutType.LeftThird:
2047                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
2048                     break;
2049                 case WindowLayoutType.CenterThird:
2050                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
2051                     break;
2052                 case WindowLayoutType.RightThird:
2053                     Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
2054                     break;
2055
2056                 case WindowLayoutType.TopThird:
2057                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
2058                     break;
2059                 case WindowLayoutType.MiddleThird:
2060                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
2061                     break;
2062                 case WindowLayoutType.BottomThird:
2063                     Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
2064                     break;
2065             }
2066             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2067
2068         }
2069
2070         /// <summary>
2071         /// Query whether window is rotating or not.
2072         /// </summary>
2073         /// <returns>True if window is rotating, false otherwise.</returns>
2074         [EditorBrowsable(EditorBrowsableState.Never)]
2075         public bool IsWindowRotating()
2076         {
2077             bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
2078             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2079             return ret;
2080         }
2081
2082         /// <summary>
2083         /// Gets the last key event the window gets.
2084         /// </summary>
2085         /// <returns>The last key event the window gets.</returns>
2086         [EditorBrowsable(EditorBrowsableState.Never)]
2087         public Key GetLastKeyEvent()
2088         {
2089             if(internalLastKeyEvent == null)
2090             {
2091                 internalLastKeyEvent = new Key();
2092             }
2093             Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr);
2094             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2095             return internalLastKeyEvent;
2096         }
2097
2098         /// <summary>
2099         /// Gets the last touch event the window gets.
2100         /// </summary>
2101         /// <returns>The last touch event the window gets.</returns>
2102         [EditorBrowsable(EditorBrowsableState.Never)]
2103         public Touch GetLastTouchEvent()
2104         {
2105             if(internalLastTouchEvent == null)
2106             {
2107                 internalLastTouchEvent = new Touch();
2108             }
2109             Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr);
2110             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2111             return internalLastTouchEvent;
2112         }
2113
2114         /// <summary>
2115         /// Sets the necessary for window rotation Acknowledgement.
2116         /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
2117         ///
2118         /// This function is supprot that application has the window rotation acknowledgement's control.
2119         /// It means display server waits when application's rotation work is finished.
2120         /// It is useful application has the other rendering engine which works asynchronous.
2121         /// For instance, GlView.
2122         /// </summary>
2123         /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
2124         [EditorBrowsable(EditorBrowsableState.Never)]
2125         public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
2126         {
2127             Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
2128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2129         }
2130
2131         /// <summary>
2132         /// send the Acknowledgement to complete window rotation.
2133         /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
2134         /// </summary>
2135         [EditorBrowsable(EditorBrowsableState.Never)]
2136         public void SendRotationCompletedAcknowledgement()
2137         {
2138             Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
2139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2140         }
2141
2142         /// <summary>
2143         /// Add FrameUpdateCallback
2144         /// </summary>
2145         [EditorBrowsable(EditorBrowsableState.Never)]
2146         public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2147         {
2148             frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
2149         }
2150
2151         /// <summary>
2152         /// Remove FrameUpdateCallback
2153         /// </summary>
2154         [EditorBrowsable(EditorBrowsableState.Never)]
2155         public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2156         {
2157             frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
2158         }
2159
2160         /// <summary>
2161         /// Dispose for Window
2162         /// </summary>
2163         [EditorBrowsable(EditorBrowsableState.Never)]
2164         protected override void Dispose(DisposeTypes type)
2165         {
2166             if (disposed)
2167             {
2168                 return;
2169             }
2170
2171             this.DisconnectNativeSignals();
2172
2173             if (type == DisposeTypes.Explicit)
2174             {
2175                 //Called by User
2176                 //Release your own managed resources here.
2177                 //You should release all of your own disposable objects here.
2178
2179                 if (IsBorderEnabled)
2180                 {
2181                     DisposeBorder();
2182                 }
2183
2184                 foreach (var layer in childLayers)
2185                 {
2186                     if (layer != null)
2187                     {
2188                         layer.Dispose();
2189                     }
2190                 }
2191
2192                 childLayers.Clear();
2193
2194                 localController?.Dispose();
2195
2196                 internalLastKeyEvent?.Dispose();
2197                 internalLastKeyEvent = null;
2198                 internalLastTouchEvent?.Dispose();
2199                 internalLastTouchEvent = null;
2200
2201                 internalHoverTimer?.Stop();
2202                 internalHoverTimer?.Dispose();
2203                 internalHoverTimer = null;
2204             }
2205
2206
2207             base.Dispose(type);
2208         }
2209
2210         /// This will not be public opened.
2211         [EditorBrowsable(EditorBrowsableState.Never)]
2212         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2213         {
2214             Interop.Window.DeleteWindow(swigCPtr);
2215         }
2216
2217         private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
2218
2219         private static readonly object locker = new object();
2220
2221         private static int key = 0;
2222
2223         private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
2224
2225         private struct internalHookCallbackType
2226         {
2227             public FrameCallbackType userCallback;
2228             public int frameId;
2229         }
2230
2231         private static void OnInternalHookFrameCallback(int id)
2232         {
2233             lock (locker)
2234             {
2235                 if (frameCallbackList.ContainsKey(id))
2236                 {
2237                     if (frameCallbackList[id].userCallback != null)
2238                     {
2239                         frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
2240                         frameCallbackList.Remove(id);
2241                     }
2242                     else
2243                     {
2244                         NUILog.Error($"found userCallback is NULL");
2245                         frameCallbackList.Remove(id);
2246                     }
2247                 }
2248             }
2249         }
2250
2251         private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2252         {
2253             if (null == callback)
2254             {
2255                 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2256             }
2257             var assignedKey = 0;
2258             lock (locker)
2259             {
2260                 key++;
2261                 assignedKey = key;
2262                 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2263                 {
2264                     userCallback = callback,
2265                     frameId = frameId,
2266                 });
2267             }
2268             return assignedKey;
2269         }
2270
2271         /// <summary>
2272         /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2273         /// </summary>
2274         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2275         [EditorBrowsable(EditorBrowsableState.Never)]
2276         public delegate void FrameCallbackType(int frameId);
2277
2278         /// <summary>
2279         /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2280         /// A callback of the following type may be used:
2281         /// <code>
2282         /// void MyFunction( int frameId )
2283         /// </code>
2284         /// This callback will be deleted once it is called.
2285         /// <remarks>
2286         /// Ownership of the callback is passed onto this class
2287         /// </remarks>
2288         /// </summary>
2289         /// <param name="callback">The function to call</param>
2290         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2291         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2292         [EditorBrowsable(EditorBrowsableState.Never)]
2293         public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2294         {
2295             var assignedKey = AddInterHookCallback(callback, frameId);
2296             Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2297
2298             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2299         }
2300
2301         /// <summary>
2302         /// Adds a callback that is called when the frame is displayed on the display.
2303         /// A callback of the following type may be used:
2304         /// <code>
2305         /// void MyFunction( int frameId )
2306         /// </code>
2307         /// This callback will be deleted once it is called.
2308         /// <remarks>
2309         /// Ownership of the callback is passed onto this class
2310         /// </remarks>
2311         /// </summary>
2312         /// <param name="callback">The function to call</param>
2313         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2314         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2315         [EditorBrowsable(EditorBrowsableState.Never)]
2316         public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2317         {
2318             var assignedKey = AddInterHookCallback(callback, frameId);
2319             Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2320
2321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2322         }
2323
2324         /// <summary>
2325         /// Search through this Window for a Layer with the given unique ID.
2326         /// </summary>
2327         /// <param name="id">The ID of the Layer to find.</param>
2328         /// <remarks>Hidden-API</remarks>
2329         /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2330         [EditorBrowsable(EditorBrowsableState.Never)]
2331         public Layer FindLayerByID(uint id)
2332         {
2333             Layer defaultLayer = this.GetDefaultLayer();
2334             IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2335             Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2336
2337             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2338             return ret;
2339         }
2340
2341         /// <summary>
2342         /// Get Native Window handle.
2343         /// <example>
2344         /// How to get Native Window handle
2345         /// <code>
2346         /// Window window = NUIApplication.GetDefaultWindow();
2347         /// var handle = window.NativeHandle;
2348         /// if(handle.IsInvalid == false)
2349         /// {
2350         ///     IntPtr nativeHandle = handle.DangerousGetHandle();
2351         ///     // do something with nativeHandle
2352         /// }
2353         /// </code>
2354         /// </example>
2355         /// </summary>
2356         /// <since_tizen> 9 </since_tizen>
2357         public SafeHandle NativeHandle
2358         {
2359             get
2360             {
2361                 return new NUI.SafeNativeWindowHandle(this);
2362             }
2363         }
2364     }
2365 }