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