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