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