[NUI] Add API for NUI Multi WIndow (#875)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.cs
1
2
3 /*
4  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 using System;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24
25 namespace Tizen.NUI
26 {
27     /// <summary>
28     /// The window class is used internally for drawing.<br />
29     /// The window has an orientation and indicator properties.<br />
30     /// </summary>
31     /// <since_tizen> 3 </since_tizen>
32     public class Window : BaseHandle
33     {
34         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35         private global::System.Runtime.InteropServices.HandleRef stageCPtr;
36         private Layer _rootLayer;
37         private string _windowTitle;
38         private List<Layer> _childLayers = new List<Layer>();
39         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
40         private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
41         private WheelEventCallbackType _wheelEventCallback;
42         private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
43         private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
44         private EventHandler _stageContextLostEventHandler;
45         private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
46         private EventHandler _stageContextRegainedEventHandler;
47         private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
48         private EventHandler _stageSceneCreatedEventHandler;
49         private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
50         private WindowResizedEventCallbackType _windowResizedEventCallback;
51         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
52
53         private static readonly Window instance = Application.Instance?.GetWindow();
54
55         private LayoutController localController;
56
57         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
58         {
59             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
60             if (Interop.Stage.Stage_IsInstalled())
61             {
62                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
63
64                 localController = new LayoutController(this);
65                 NUILog.Debug("layoutController id:" + localController.GetId() );
66             }
67         }
68
69         /// <summary>
70         /// Creates a new Window.<br />
71         /// This creates an extra window in addition to the default main window<br />
72         /// </summary>
73         /// <param name="windowPosition">The position and size of the Window.</param>
74         /// <param name="name">The Window title.</param>
75         /// <param name="isTransparent">Whether Window is transparent.</param>
76         /// <returns>A new Window.</returns>
77         /// <since_tizen> 6 </since_tizen>
78         [EditorBrowsable(EditorBrowsableState.Never)]
79         public Window(Rectangle windowPosition, string name, bool isTransparent) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
80         {
81             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82         }
83
84         /// <summary>
85         /// Creates a new Window.<br />
86         /// This creates an extra window in addition to the default main window<br />
87         /// </summary>
88         /// <param name="windowPosition">The position and size of the Window.</param>
89         /// <param name="name">The Window title.</param>
90         /// <returns>A new Window.</returns>
91         /// <since_tizen> 6 </since_tizen>
92         [EditorBrowsable(EditorBrowsableState.Never)]
93         public Window(Rectangle windowPosition, string name) : this(Interop.Window.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
94         {
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96         }
97
98         /// <summary>
99         /// Creates a new Window.<br />
100         /// This creates an extra window in addition to the default main window<br />
101         /// </summary>
102         /// <param name="windowPosition">The position and size of the Window.</param>
103         /// <param name="name">The Window title.</param>
104         /// <param name="className">The Window class name.</param>
105         /// <param name="isTransparent">Whether Window is transparent.</param>
106         /// <returns>A new Window.</returns>
107         /// <since_tizen> 6 </since_tizen>
108         [EditorBrowsable(EditorBrowsableState.Never)]
109         public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(Interop.Window.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
110         {
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112         }
113
114         /// <summary>
115         /// Creates a new Window.<br />
116         /// This creates an extra window in addition to the default main window<br />
117         /// </summary>
118         /// <param name="windowPosition">The position and size of the Window.</param>
119         /// <param name="name">The Window title.</param>
120         /// <param name="className">The Window class name.</param>
121         /// <returns>A new Window.</returns>
122         /// <since_tizen> 6 </since_tizen>
123         [EditorBrowsable(EditorBrowsableState.Never)]
124         public Window(Rectangle windowPosition, string name, string className) : this(Interop.Window.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
125         {
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127         }
128
129         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
130         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
131         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
132         private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
133         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
134         private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
135         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
136         private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
137         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
138         private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
139
140         /// <summary>
141         /// FocusChanged event.
142         /// </summary>
143         /// <since_tizen> 3 </since_tizen>
144         public event EventHandler<FocusChangedEventArgs> FocusChanged
145         {
146             add
147             {
148                 if (_windowFocusChangedEventHandler == null)
149                 {
150                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
151                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
152                 }
153
154                 _windowFocusChangedEventHandler += value;
155             }
156             remove
157             {
158                 _windowFocusChangedEventHandler -= value;
159
160                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
161                 {
162                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
163                 }
164             }
165         }
166
167         /// <summary>
168         /// This event is emitted when the screen is touched and when the touch ends.<br />
169         /// If there are multiple touch points, then this will be emitted when the first touch occurs and
170         /// then when the last finger is lifted.<br />
171         /// An interrupted event will also be emitted (if it occurs).<br />
172         /// </summary>
173         /// <since_tizen> 3 </since_tizen>
174         public event EventHandler<TouchEventArgs> TouchEvent
175         {
176             add
177             {
178                 if (_rootLayerTouchDataEventHandler == null)
179                 {
180                     _rootLayerTouchDataCallback = OnWindowTouch;
181                     this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
182                 }
183                 _rootLayerTouchDataEventHandler += value;
184             }
185             remove
186             {
187                 _rootLayerTouchDataEventHandler -= value;
188                 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
189                 {
190                     this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
191                 }
192             }
193         }
194
195         /// <summary>
196         /// This event is emitted when the wheel event is received.
197         /// </summary>
198         /// <since_tizen> 3 </since_tizen>
199         public event EventHandler<WheelEventArgs> WheelEvent
200         {
201             add
202             {
203                 if (_stageWheelHandler == null)
204                 {
205                     _wheelEventCallback = OnStageWheel;
206                     this.StageWheelEventSignal().Connect(_wheelEventCallback);
207                 }
208                 _stageWheelHandler += value;
209             }
210             remove
211             {
212                 _stageWheelHandler -= value;
213                 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
214                 {
215                     this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
216                 }
217             }
218         }
219
220         /// <summary>
221         /// This event is emitted when the key event is received.
222         /// </summary>
223         /// <since_tizen> 3 </since_tizen>
224         public event EventHandler<KeyEventArgs> KeyEvent
225         {
226             add
227             {
228                 if (_stageKeyHandler == null)
229                 {
230                     _stageKeyCallbackDelegate = OnStageKey;
231                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
232                 }
233                 _stageKeyHandler += value;
234             }
235             remove
236             {
237                 _stageKeyHandler -= value;
238                 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
239                 {
240                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
241                 }
242             }
243         }
244
245         /// <summary>
246         /// This event is emitted when the window resized.
247         /// </summary>
248         /// <since_tizen> 3 </since_tizen>
249         public event EventHandler<ResizedEventArgs> Resized
250         {
251             add
252             {
253                 if (_windowResizedEventHandler == null)
254                 {
255                     _windowResizedEventCallback = OnResized;
256                     ResizedSignal().Connect(_windowResizedEventCallback);
257                 }
258
259                 _windowResizedEventHandler += value;
260             }
261             remove
262             {
263                 _windowResizedEventHandler -= value;
264
265                 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
266                 {
267                     ResizedSignal().Disconnect(_windowResizedEventCallback);
268                 }
269             }
270         }
271
272         /// <summary>
273         /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
274         /// </summary>
275         /// <since_tizen> 3 </since_tizen>
276         /// Please do not use! this will be deprecated!
277         /// Instead please use FocusChanged.
278         [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
279             "Like: " +
280             "Window.Instance.FocusChanged = OnFocusChanged; " +
281             "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
282         [EditorBrowsable(EditorBrowsableState.Never)]
283         public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
284         {
285             add
286             {
287                 if (_windowFocusChangedEventHandler2 == null)
288                 {
289                     _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
290                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
291                 }
292
293                 _windowFocusChangedEventHandler2 += value;
294             }
295             remove
296             {
297                 _windowFocusChangedEventHandler2 -= value;
298
299                 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
300                 {
301                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
302                 }
303             }
304         }
305
306         /// <summary>
307         /// ViewAdded will be triggered when the view added on Window
308         /// </summary>
309         /// <since_tizen> 6 </since_tizen>
310         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
311         [EditorBrowsable(EditorBrowsableState.Never)]
312         public event EventHandler ViewAdded;
313
314         internal void SendViewAdded(View view)
315         {
316             ViewAdded?.Invoke(view, EventArgs.Empty);
317         }
318
319         internal event EventHandler EventProcessingFinished
320         {
321             add
322             {
323                 if (_stageEventProcessingFinishedEventHandler == null)
324                 {
325                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
326                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
327                 }
328                 _stageEventProcessingFinishedEventHandler += value;
329
330             }
331             remove
332             {
333                 _stageEventProcessingFinishedEventHandler -= value;
334                 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
335                 {
336                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
337                 }
338             }
339         }
340
341         internal event EventHandler ContextLost
342         {
343             add
344             {
345                 if (_stageContextLostEventHandler == null)
346                 {
347                     _stageContextLostEventCallbackDelegate = OnContextLost;
348                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
349                 }
350                 _stageContextLostEventHandler += value;
351             }
352             remove
353             {
354                 _stageContextLostEventHandler -= value;
355                 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
356                 {
357                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
358                 }
359             }
360         }
361
362         internal event EventHandler ContextRegained
363         {
364             add
365             {
366                 if (_stageContextRegainedEventHandler == null)
367                 {
368                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
369                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
370                 }
371                 _stageContextRegainedEventHandler += value;
372             }
373             remove
374             {
375                 _stageContextRegainedEventHandler -= value;
376                 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
377                 {
378                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
379                 }
380             }
381         }
382
383         internal event EventHandler SceneCreated
384         {
385             add
386             {
387                 if (_stageSceneCreatedEventHandler == null)
388                 {
389                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
390                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
391                 }
392                 _stageSceneCreatedEventHandler += value;
393             }
394             remove
395             {
396                 _stageSceneCreatedEventHandler -= value;
397                 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
398                 {
399                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
400                 }
401             }
402         }
403
404         private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
405         private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
406         private event EventHandler<WheelEventArgs> _stageWheelHandler;
407         private event EventHandler<KeyEventArgs> _stageKeyHandler;
408         private event EventHandler _stageEventProcessingFinishedEventHandler;
409         private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
410         private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
411
412         /// <summary>
413         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
414         /// </summary>
415         /// <since_tizen> 3 </since_tizen>
416         public enum WindowOrientation
417         {
418             /// <summary>
419             /// Portrait orientation. The height of the display area is greater than the width.
420             /// </summary>
421             /// <since_tizen> 3 </since_tizen>
422             Portrait = 0,
423             /// <summary>
424             /// Landscape orientation. A wide view area is needed.
425             /// </summary>
426             /// <since_tizen> 3 </since_tizen>
427             Landscape = 90,
428             /// <summary>
429             /// Portrait inverse orientation.
430             /// </summary>
431             /// <since_tizen> 3 </since_tizen>
432             PortraitInverse = 180,
433             /// <summary>
434             /// Landscape inverse orientation.
435             /// </summary>
436             /// <since_tizen> 3 </since_tizen>
437             LandscapeInverse = 270
438         }
439
440         /// <summary>
441         /// Enumeration for the key grab mode for platform-level APIs.
442         /// </summary>
443         /// <since_tizen> 3 </since_tizen>
444         public enum KeyGrabMode
445         {
446             /// <summary>
447             /// Grabs a key only when on the top of the grabbing-window stack mode.
448             /// </summary>
449             Topmost = 0,
450             /// <summary>
451             /// Grabs a key together with the other client window(s) mode.
452             /// </summary>
453             Shared,
454             /// <summary>
455             /// 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.
456             /// </summary>
457             OverrideExclusive,
458             /// <summary>
459             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
460             /// </summary>
461             Exclusive
462         };
463
464         /// <summary>
465         /// Enumeration for opacity of the indicator.
466         /// </summary>
467         internal enum IndicatorBackgroundOpacity
468         {
469             Opaque = 100,
470             Translucent = 50,
471             Transparent = 0
472         }
473
474         /// <summary>
475         /// Enumeration for visible mode of the indicator.
476         /// </summary>
477         internal enum IndicatorVisibleMode
478         {
479             Invisible = 0,
480             Visible = 1,
481             Auto = 2
482         }
483
484         /// <summary>
485         /// The stage instance property (read-only).<br />
486         /// Gets the current window.<br />
487         /// </summary>
488         /// <since_tizen> 3 </since_tizen>
489         public static Window Instance
490         {
491             get
492             {
493                 return instance;
494             }
495         }
496
497         /// <summary>
498         /// Gets or sets a window type.
499         /// </summary>
500         /// <since_tizen> 3 </since_tizen>
501         public WindowType Type
502         {
503             get
504             {
505                 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
506                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507                 return ret;
508             }
509             set
510             {
511                 Interop.Window.SetType(swigCPtr, (int)value);
512                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
513             }
514         }
515
516         /// <summary>
517         /// Gets/Sets a window title.
518         /// </summary>
519         /// <since_tizen> 4 </since_tizen>
520         public string Title
521         {
522             get
523             {
524                 return _windowTitle;
525             }
526             set
527             {
528                 _windowTitle = value;
529                 SetClass(_windowTitle, "");
530             }
531         }
532
533         /// <summary>
534         /// The rendering behavior of a Window.
535         /// </summary>
536         /// <since_tizen> 5 </since_tizen>
537         public RenderingBehaviorType RenderingBehavior
538         {
539             get
540             {
541                 return GetRenderingBehavior();
542             }
543             set
544             {
545                 SetRenderingBehavior(value);
546             }
547         }
548
549         /// <summary>
550         /// The window size property (read-only).
551         /// </summary>
552         /// <since_tizen> 3 </since_tizen>
553         public Size2D Size
554         {
555             get
556             {
557                 Size2D ret = GetSize();
558                 return ret;
559             }
560         }
561
562         /// <summary>
563         /// The background color property.
564         /// </summary>
565         /// <since_tizen> 3 </since_tizen>
566         public Color BackgroundColor
567         {
568             set
569             {
570                 SetBackgroundColor(value);
571             }
572             get
573             {
574                 Color ret = GetBackgroundColor();
575                 return ret;
576             }
577         }
578
579         /// <summary>
580         /// The DPI property (read-only).<br />
581         /// Retrieves the DPI of the display device to which the Window is connected.<br />
582         /// </summary>
583         /// <since_tizen> 3 </since_tizen>
584         public Vector2 Dpi
585         {
586             get
587             {
588                 return GetDpi();
589             }
590         }
591
592         /// <summary>
593         /// The layer count property (read-only).<br />
594         /// Queries the number of on-Window layers.<br />
595         /// </summary>
596         /// <since_tizen> 3 </since_tizen>
597         public uint LayerCount
598         {
599             get
600             {
601                 return GetLayerCount();
602             }
603         }
604
605         /// <summary>
606         /// Gets or sets a size of the window.
607         /// </summary>
608         /// <since_tizen> 4 </since_tizen>
609         public Size2D WindowSize
610         {
611             get
612             {
613                 return GetWindowSize();
614             }
615             set
616             {
617                 SetWindowSize(value);
618             }
619         }
620
621         /// <summary>
622         /// Gets or sets a position of the window.
623         /// </summary>
624         /// <since_tizen> 4 </since_tizen>
625         public Position2D WindowPosition
626         {
627             get
628             {
629                 return GetPosition();
630             }
631             set
632             {
633                 SetPosition(value);
634             }
635         }
636         internal static Vector4 DEFAULT_BACKGROUND_COLOR
637         {
638             get
639             {
640                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
641                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
642                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643                 return ret;
644             }
645         }
646
647         internal static Vector4 DEBUG_BACKGROUND_COLOR
648         {
649             get
650             {
651                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
652                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
653                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654                 return ret;
655             }
656         }
657
658         internal List<Layer> LayersChildren
659         {
660             get
661             {
662                 return _childLayers;
663             }
664         }
665
666         internal LayoutController LayoutController
667         {
668             get
669             {
670                 return localController;
671             }
672         }
673
674         /// <summary>
675         /// Feed a key-event into the window.
676         /// </summary>
677         /// <param name="keyEvent">The key event to feed.</param>
678         /// <since_tizen> 4 </since_tizen>
679         [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
680         public static void FeedKeyEvent(Key keyEvent)
681         {
682             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
683             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684         }
685
686         /// <summary>
687         /// Sets whether the window accepts a focus or not.
688         /// </summary>
689         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
690         /// <since_tizen> 3 </since_tizen>
691         public void SetAcceptFocus(bool accept)
692         {
693             Interop.Window.SetAcceptFocus(swigCPtr, accept);
694             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
695         }
696
697         /// <summary>
698         /// Returns whether the window accepts a focus or not.
699         /// </summary>
700         /// <returns>True if the window accepts a focus, false otherwise.</returns>
701         /// <since_tizen> 3 </since_tizen>
702         public bool IsFocusAcceptable()
703         {
704             bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
705             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
706
707             return ret;
708         }
709
710         /// <summary>
711         /// Shows the window if it is hidden.
712         /// </summary>
713         /// <since_tizen> 3 </since_tizen>
714         public void Show()
715         {
716             Interop.Window.Show(swigCPtr);
717             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718         }
719
720         /// <summary>
721         /// Hides the window if it is showing.
722         /// </summary>
723         /// <since_tizen> 3 </since_tizen>
724         public void Hide()
725         {
726             Interop.Window.Hide(swigCPtr);
727             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
728         }
729
730         /// <summary>
731         /// Retrieves whether the window is visible or not.
732         /// </summary>
733         /// <returns>True if the window is visible.</returns>
734         /// <since_tizen> 3 </since_tizen>
735         public bool IsVisible()
736         {
737             bool temp = Interop.Window.IsVisible(swigCPtr);
738             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739             return temp;
740         }
741
742         /// <summary>
743         /// Gets the count of supported auxiliary hints of the window.
744         /// </summary>
745         /// <returns>The number of supported auxiliary hints.</returns>
746         /// <since_tizen> 3 </since_tizen>
747         public uint GetSupportedAuxiliaryHintCount()
748         {
749             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
750             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
751             return ret;
752         }
753
754         /// <summary>
755         /// Gets the supported auxiliary hint string of the window.
756         /// </summary>
757         /// <param name="index">The index of the supported auxiliary hint lists.</param>
758         /// <returns>The auxiliary hint string of the index.</returns>
759         /// <since_tizen> 3 </since_tizen>
760         public string GetSupportedAuxiliaryHint(uint index)
761         {
762             string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
763             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764             return ret;
765         }
766
767         /// <summary>
768         /// Creates an auxiliary hint of the window.
769         /// </summary>
770         /// <param name="hint">The auxiliary hint string.</param>
771         /// <param name="value">The value string.</param>
772         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
773         /// <since_tizen> 3 </since_tizen>
774         public uint AddAuxiliaryHint(string hint, string value)
775         {
776             uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
777             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778             return ret;
779         }
780
781         /// <summary>
782         /// Removes an auxiliary hint of the window.
783         /// </summary>
784         /// <param name="id">The ID of the auxiliary hint.</param>
785         /// <returns>True if no error occurred, false otherwise.</returns>
786         /// <since_tizen> 3 </since_tizen>
787         public bool RemoveAuxiliaryHint(uint id)
788         {
789             bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
790             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791             return ret;
792         }
793
794         /// <summary>
795         /// Changes a value of the auxiliary hint.
796         /// </summary>
797         /// <param name="id">The auxiliary hint ID.</param>
798         /// <param name="value">The value string to be set.</param>
799         /// <returns>True if no error occurred, false otherwise.</returns>
800         /// <since_tizen> 3 </since_tizen>
801         public bool SetAuxiliaryHintValue(uint id, string value)
802         {
803             bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
804             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
805             return ret;
806         }
807
808         /// <summary>
809         /// Gets a value of the auxiliary hint.
810         /// </summary>
811         /// <param name="id">The auxiliary hint ID.</param>
812         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
813         /// <since_tizen> 3 </since_tizen>
814         public string GetAuxiliaryHintValue(uint id)
815         {
816             string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
817             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
818             return ret;
819         }
820
821         /// <summary>
822         /// Gets an ID of the auxiliary hint string.
823         /// </summary>
824         /// <param name="hint">The auxiliary hint string.</param>
825         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
826         /// <since_tizen> 3 </since_tizen>
827         public uint GetAuxiliaryHintId(string hint)
828         {
829             uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
830             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831             return ret;
832         }
833
834         /// <summary>
835         /// Sets a region to accept input events.
836         /// </summary>
837         /// <param name="inputRegion">The region to accept input events.</param>
838         /// <since_tizen> 3 </since_tizen>
839         public void SetInputRegion(Rectangle inputRegion)
840         {
841             Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
842             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
843         }
844
845         /// <summary>
846         /// Sets a priority level for the specified notification window.
847         /// </summary>
848         /// <param name="level">The notification window level.</param>
849         /// <returns>True if no error occurred, false otherwise.</returns>
850         /// <since_tizen> 3 </since_tizen>
851         public bool SetNotificationLevel(NotificationLevel level)
852         {
853             bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
854             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
855             return ret;
856         }
857
858         /// <summary>
859         /// Gets a priority level for the specified notification window.
860         /// </summary>
861         /// <returns>The notification window level.</returns>
862         /// <since_tizen> 3 </since_tizen>
863         public NotificationLevel GetNotificationLevel()
864         {
865             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
866             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867             return ret;
868         }
869
870         /// <summary>
871         /// Sets a transparent window's visual state to opaque. <br />
872         /// If a visual state of a transparent window is opaque, <br />
873         /// then the window manager could handle it as an opaque window when calculating visibility.
874         /// </summary>
875         /// <param name="opaque">Whether the window's visual state is opaque.</param>
876         /// <remarks>This will have no effect on an opaque window. <br />
877         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
878         /// </remarks>
879         /// <since_tizen> 3 </since_tizen>
880         public void SetOpaqueState(bool opaque)
881         {
882             Interop.Window.SetOpaqueState(swigCPtr, opaque);
883             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
884         }
885
886         /// <summary>
887         /// Returns whether a transparent window's visual state is opaque or not.
888         /// </summary>
889         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
890         /// <remarks> The return value has no meaning on an opaque window. </remarks>
891         /// <since_tizen> 3 </since_tizen>
892         public bool IsOpaqueState()
893         {
894             bool ret = Interop.Window.IsOpaqueState(swigCPtr);
895             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
896             return ret;
897         }
898
899         /// <summary>
900         /// Sets a window's screen off mode.
901         /// </summary>
902         /// <param name="screenOffMode">The screen mode.</param>
903         /// <returns>True if no error occurred, false otherwise.</returns>
904         /// <since_tizen> 4 </since_tizen>
905         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
906         {
907             bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
908             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
909             return ret;
910         }
911
912         /// <summary>
913         /// Gets the screen mode of the window.
914         /// </summary>
915         /// <returns>The screen off mode.</returns>
916         /// <since_tizen> 4 </since_tizen>
917         public ScreenOffMode GetScreenOffMode()
918         {
919             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
920             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921             return ret;
922         }
923
924         /// <summary>
925         /// Sets preferred brightness of the window.
926         /// </summary>
927         /// <param name="brightness">The preferred brightness (0 to 100).</param>
928         /// <returns>True if no error occurred, false otherwise.</returns>
929         /// <since_tizen> 3 </since_tizen>
930         public bool SetBrightness(int brightness)
931         {
932             bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
933             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
934             return ret;
935         }
936
937         /// <summary>
938         /// Gets the preferred brightness of the window.
939         /// </summary>
940         /// <returns>The preferred brightness.</returns>
941         /// <since_tizen> 3 </since_tizen>
942         public int GetBrightness()
943         {
944             int ret = Interop.Window.GetBrightness(swigCPtr);
945             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946             return ret;
947         }
948
949         /// <summary>
950         /// Sets the window name and the class string.
951         /// </summary>
952         /// <param name="name">The name of the window.</param>
953         /// <param name="klass">The class of the window.</param>
954         /// <since_tizen> 4 </since_tizen>
955         public void SetClass(string name, string klass)
956         {
957             Interop.Window.Window_SetClass(swigCPtr, name, klass);
958             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959         }
960
961         /// <summary>
962         /// Raises the window to the top of the window stack.
963         /// </summary>
964         /// <since_tizen> 3 </since_tizen>
965         public void Raise()
966         {
967             Interop.Window.Window_Raise(swigCPtr);
968             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969         }
970
971         /// <summary>
972         /// Lowers the window to the bottom of the window stack.
973         /// </summary>
974         /// <since_tizen> 3 </since_tizen>
975         public void Lower()
976         {
977             Interop.Window.Window_Lower(swigCPtr);
978             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
979         }
980
981         /// <summary>
982         /// Activates the window to the top of the window stack even it is iconified.
983         /// </summary>
984         /// <since_tizen> 3 </since_tizen>
985         public void Activate()
986         {
987             Interop.Window.Window_Activate(swigCPtr);
988             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989         }
990
991         /// <summary>
992         /// Gets the default ( root ) layer.
993         /// </summary>
994         /// <returns>The root layer.</returns>
995         /// <since_tizen> 3 </since_tizen>
996         public Layer GetDefaultLayer()
997         {
998             return this.GetRootLayer();
999         }
1000
1001         /// <summary>
1002         /// Add a child view to window.
1003         /// </summary>
1004         /// <param name="view">the child should be added to the window.</param>
1005         /// <since_tizen> 3 </since_tizen>
1006         public void Add(View view)
1007         {
1008             Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
1009             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1010             this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
1011             view.InternalParent = this.GetRootLayer();
1012         }
1013
1014         /// <summary>
1015         /// Remove a child view from window.
1016         /// </summary>
1017         /// <param name="view">the child to be removed.</param>
1018         /// <since_tizen> 3 </since_tizen>
1019         public void Remove(View view)
1020         {
1021             Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
1022             this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
1023             view.InternalParent = null;
1024         }
1025
1026         /// <summary>
1027         /// Retrieves the layer at a specified depth.
1028         /// </summary>
1029         /// <param name="depth">The layer's depth index.</param>
1030         /// <returns>The layer found at the given depth.</returns>
1031         /// <since_tizen> 3 </since_tizen>
1032         public Layer GetLayer(uint depth)
1033         {
1034             if (depth < LayersChildren?.Count)
1035             {
1036                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1037                 return ret;
1038             }
1039             else
1040             {
1041                 return null;
1042             }
1043         }
1044
1045         /// <summary>
1046         /// Keep rendering for at least the given amount of time.
1047         /// </summary>
1048         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1049         /// <since_tizen> 3 </since_tizen>
1050         public void KeepRendering(float durationSeconds)
1051         {
1052             Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1053             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054         }
1055
1056         /// <summary>
1057         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1058         /// This function can be used for following example scenarios: <br />
1059         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1060         /// </summary>
1061         /// <param name="DaliKey">The key code to grab.</param>
1062         /// <returns>True if the grab succeeds.</returns>
1063         /// <since_tizen> 3 </since_tizen>
1064         public bool GrabKeyTopmost(int DaliKey)
1065         {
1066             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1067             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068             return ret;
1069         }
1070
1071         /// <summary>
1072         /// Ungrabs the key specified by a key for the window.<br />
1073         /// 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 />
1074         /// </summary>
1075         /// <param name="DaliKey">The key code to ungrab.</param>
1076         /// <returns>True if the ungrab succeeds.</returns>
1077         /// <since_tizen> 3 </since_tizen>
1078         public bool UngrabKeyTopmost(int DaliKey)
1079         {
1080             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1081             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082             return ret;
1083         }
1084
1085         /// <summary>
1086         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
1087         ///  Details: This function can be used for following example scenarios: <br />
1088         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1089         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1090         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1091         /// </summary>
1092         /// <param name="DaliKey">The key code to grab.</param>
1093         /// <param name="GrabMode">The grab mode for the key.</param>
1094         /// <returns>True if the grab succeeds.</returns>
1095         /// <since_tizen> 3 </since_tizen>
1096         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1097         {
1098             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1099             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1100             return ret;
1101         }
1102
1103         /// <summary>
1104         /// Ungrabs the key specified by a key for a window.<br />
1105         /// 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 />
1106         /// </summary>
1107         /// <param name="DaliKey">The key code to ungrab.</param>
1108         /// <returns>True if the ungrab succeeds.</returns>
1109         /// <since_tizen> 3 </since_tizen>
1110         public bool UngrabKey(int DaliKey)
1111         {
1112             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1114             return ret;
1115         }
1116
1117         /// <summary>
1118         /// Sets the keyboard repeat information.
1119         /// </summary>
1120         /// <param name="rate">The key repeat rate value in seconds.</param>
1121         /// <param name="delay">The key repeat delay value in seconds.</param>
1122         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1123         /// <since_tizen> 5 </since_tizen>
1124         public bool SetKeyboardRepeatInfo(float rate, float delay)
1125         {
1126             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1127             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1128             return ret;
1129         }
1130
1131         /// <summary>
1132         /// Gets the keyboard repeat information.
1133         /// </summary>
1134         /// <param name="rate">The key repeat rate value in seconds.</param>
1135         /// <param name="delay">The key repeat delay value in seconds.</param>
1136         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1137         /// <since_tizen> 5 </since_tizen>
1138         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1139         {
1140             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1142             return ret;
1143         }
1144
1145         /// <summary>
1146         /// Adds a layer to the stage.
1147         /// </summary>
1148         /// <param name="layer">Layer to add.</param>
1149         /// <since_tizen> 3 </since_tizen>
1150         public void AddLayer(Layer layer)
1151         {
1152             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1154
1155             LayersChildren?.Add(layer);
1156             layer.SetWindow(this);
1157         }
1158
1159         /// <summary>
1160         /// Removes a layer from the stage.
1161         /// </summary>
1162         /// <param name="layer">Layer to remove.</param>
1163         /// <since_tizen> 3 </since_tizen>
1164         public void RemoveLayer(Layer layer)
1165         {
1166             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1168
1169             LayersChildren?.Remove(layer);
1170             layer.SetWindow(null);
1171         }
1172
1173         /// <summary>
1174         /// Feeds a key event into the window.
1175         /// </summary>
1176         /// <param name="keyEvent">The key event to feed.</param>
1177         /// <since_tizen> 5 </since_tizen>
1178         public void FeedKey(Key keyEvent)
1179         {
1180             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182         }
1183
1184         /// <summary>
1185         /// Allows at least one more render, even when paused.
1186         /// The window should be shown, not minimised.
1187         /// </summary>
1188         /// <since_tizen> 4 </since_tizen>
1189         public void RenderOnce()
1190         {
1191             Interop.Window.Window_RenderOnce(swigCPtr);
1192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193         }
1194
1195         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1196         {
1197             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1198         }
1199
1200         internal static Window GetCurrent()
1201         {
1202             Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1203             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1204             return ret;
1205         }
1206
1207         internal static bool IsInstalled()
1208         {
1209             bool ret = Interop.Stage.Stage_IsInstalled();
1210             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211             return ret;
1212         }
1213
1214         internal WindowFocusSignalType WindowFocusChangedSignal()
1215         {
1216             WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1217             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218             return ret;
1219         }
1220
1221         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1222         {
1223             Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225         }
1226
1227         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1228         {
1229             Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1230             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231         }
1232
1233         internal void RotateIndicator(Window.WindowOrientation orientation)
1234         {
1235             Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1236             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1237         }
1238
1239         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1240         {
1241             Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243         }
1244
1245         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1246         {
1247             Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1249         }
1250
1251         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1252         {
1253             Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1254             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1255         }
1256
1257         internal Window.WindowOrientation GetPreferredOrientation()
1258         {
1259             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1260             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1261             return ret;
1262         }
1263
1264         internal DragAndDropDetector GetDragAndDropDetector()
1265         {
1266             DragAndDropDetector ret = new DragAndDropDetector(Interop.WindowInternal.Window_GetDragAndDropDetector(swigCPtr), true);
1267             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1268             return ret;
1269         }
1270
1271         internal Any GetNativeHandle()
1272         {
1273             Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1274             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275             return ret;
1276         }
1277
1278         internal WindowFocusSignalType FocusChangedSignal()
1279         {
1280             WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1281             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1282             return ret;
1283         }
1284
1285         internal void Add(Layer layer)
1286         {
1287             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1288             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1289
1290             LayersChildren?.Add(layer);
1291             layer.SetWindow(this);
1292         }
1293
1294         internal void Remove(Layer layer)
1295         {
1296             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1297             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1298
1299             LayersChildren?.Remove(layer);
1300             layer.SetWindow(null);
1301         }
1302
1303         internal Vector2 GetSize()
1304         {
1305             Vector2 ret = new Vector2(Interop.Window.GetSize(swigCPtr), true);
1306             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1307             return ret;
1308         }
1309
1310         internal RenderTaskList GetRenderTaskList()
1311         {
1312             RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1313             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1314             return ret;
1315         }
1316
1317         /// <summary>
1318         /// Queries the number of on-window layers.
1319         /// </summary>
1320         /// <returns>The number of layers.</returns>
1321         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1322         internal uint GetLayerCount()
1323         {
1324             if (LayersChildren == null || LayersChildren.Count < 0)
1325                 return 0;
1326
1327             return (uint) LayersChildren.Count;
1328         }
1329
1330         internal Layer GetRootLayer()
1331         {
1332             // Window.IsInstalled() is actually true only when called from event thread and
1333             // Core has been initialized, not when Stage is ready.
1334             if (_rootLayer == null && Window.IsInstalled())
1335             {
1336                 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1337                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338                 LayersChildren?.Add(_rootLayer);
1339                 _rootLayer.SetWindow(this);
1340             }
1341             return _rootLayer;
1342         }
1343
1344         internal void SetBackgroundColor(Vector4 color)
1345         {
1346             Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1347             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348         }
1349
1350         internal Vector4 GetBackgroundColor()
1351         {
1352             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1353             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354             return ret;
1355         }
1356
1357         internal Vector2 GetDpi()
1358         {
1359             Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361             return ret;
1362         }
1363
1364         internal ObjectRegistry GetObjectRegistry()
1365         {
1366             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368             return ret;
1369         }
1370
1371         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1372         {
1373             Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1374             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1375         }
1376
1377         internal RenderingBehaviorType GetRenderingBehavior()
1378         {
1379             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1380             if (NDalicPINVOKE.SWIGPendingException.Pending)
1381                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382             return ret;
1383         }
1384
1385         internal KeyEventSignal KeyEventSignal()
1386         {
1387             KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1388             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1389             return ret;
1390         }
1391
1392         internal VoidSignal EventProcessingFinishedSignal()
1393         {
1394             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1395             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1396             return ret;
1397         }
1398
1399         internal TouchSignal TouchSignal()
1400         {
1401             TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1402             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1403             return ret;
1404         }
1405
1406         internal TouchDataSignal TouchDataSignal()
1407         {
1408             TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1409             if (NDalicPINVOKE.SWIGPendingException.Pending)
1410                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1411             return ret;
1412         }
1413
1414         internal VoidSignal ContextLostSignal()
1415         {
1416             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1417             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1418             return ret;
1419         }
1420
1421         internal VoidSignal ContextRegainedSignal()
1422         {
1423             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1424             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425             return ret;
1426         }
1427
1428         internal VoidSignal SceneCreatedSignal()
1429         {
1430             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1431             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1432             return ret;
1433         }
1434
1435         internal ResizedSignal ResizedSignal()
1436         {
1437             ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1439             return ret;
1440         }
1441
1442         internal void SetWindowSize(Size2D size)
1443         {
1444             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1445             Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1446
1447             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448
1449             // Resetting Window size should request a relayout of the tree.
1450         }
1451
1452         internal Size2D GetWindowSize()
1453         {
1454             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1455             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1456
1457             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458             return ret;
1459         }
1460
1461         internal void SetPosition(Position2D position)
1462         {
1463             var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1464             Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1465
1466             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1467
1468             // Setting Position of the window should request a relayout of the tree.
1469
1470         }
1471
1472         internal Position2D GetPosition()
1473         {
1474             var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1475             Position2D ret = new Position2D(val.GetX(), val.GetY());
1476
1477             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478             return ret;
1479         }
1480
1481         internal void SetPositionSize(Rectangle positionSize)
1482         {
1483             Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1484
1485             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1486
1487             // Setting Position of the window should request a relayout of the tree.
1488
1489         }
1490
1491         /// <summary>
1492         /// Sets whether the window is transparent or not.
1493         /// </summary>
1494         /// <param name="transparent">Whether the window is transparent or not.</param>
1495         /// <since_tizen> 5 </since_tizen>
1496         public void SetTransparency(bool transparent) {
1497             Interop.Window.SetTransparency(swigCPtr, transparent);
1498             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1499
1500             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1501
1502         }
1503
1504         /// <summary>
1505         /// Dispose for Window
1506         /// </summary>
1507         [EditorBrowsable(EditorBrowsableState.Never)]
1508         protected override void Dispose(DisposeTypes type)
1509         {
1510             if (disposed)
1511             {
1512                 return;
1513             }
1514
1515             if (type == DisposeTypes.Explicit)
1516             {
1517                 //Called by User
1518                 //Release your own managed resources here.
1519                 //You should release all of your own disposable objects here.
1520
1521             }
1522
1523             this.DisconnectNativeSignals();
1524
1525             //Release your own unmanaged resources here.
1526             //You should not access any managed member here except static instance.
1527             //because the execution order of Finalizes is non-deterministic.
1528
1529             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1530             {
1531                 if (swigCMemOwn)
1532                 {
1533                     swigCMemOwn = false;
1534                     Interop.Window.delete_Window(swigCPtr);
1535                 }
1536                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1537             }
1538
1539             base.Dispose(type);
1540         }
1541
1542         internal System.IntPtr GetNativeWindowHandler()
1543         {
1544             System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1545             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1546             return ret;
1547         }
1548
1549         private void OnWindowFocusedChanged(bool focusGained)
1550         {
1551             FocusChangedEventArgs e = new FocusChangedEventArgs();
1552
1553             e.FocusGained = focusGained;
1554
1555             if (_windowFocusChangedEventHandler != null)
1556             {
1557                 _windowFocusChangedEventHandler(this, e);
1558             }
1559         }
1560
1561         private StageWheelSignal WheelEventSignal()
1562         {
1563             StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1564             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1565             return ret;
1566         }
1567
1568         private WheelSignal StageWheelEventSignal()
1569         {
1570             WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1571             if (NDalicPINVOKE.SWIGPendingException.Pending)
1572                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1573             return ret;
1574         }
1575
1576         private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1577         {
1578             if (touchData == global::System.IntPtr.Zero)
1579             {
1580                 NUILog.Error("touchData should not be null!");
1581                 return false;
1582             }
1583
1584             TouchEventArgs e = new TouchEventArgs();
1585
1586             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1587
1588             if (_rootLayerTouchDataEventHandler != null)
1589             {
1590                 _rootLayerTouchDataEventHandler(this, e);
1591             }
1592             return false;
1593         }
1594
1595         private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1596         {
1597             if (wheelEvent == global::System.IntPtr.Zero)
1598             {
1599                 NUILog.Error("wheelEvent should not be null!");
1600                 return true;
1601             }
1602
1603             WheelEventArgs e = new WheelEventArgs();
1604
1605             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1606
1607             if (_stageWheelHandler != null)
1608             {
1609                 _stageWheelHandler(this, e);
1610             }
1611             return true;
1612         }
1613
1614         // Callback for Stage KeyEventsignal
1615         private void OnStageKey(IntPtr data)
1616         {
1617             KeyEventArgs e = new KeyEventArgs();
1618             e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1619
1620
1621             if (_stageKeyHandler != null)
1622             {
1623                 //here we send all data to user event handlers
1624                 _stageKeyHandler(this, e);
1625             }
1626         }
1627
1628         // Callback for Stage EventProcessingFinishedSignal
1629         private void OnEventProcessingFinished()
1630         {
1631             if (_stageEventProcessingFinishedEventHandler != null)
1632             {
1633                 _stageEventProcessingFinishedEventHandler(this, null);
1634             }
1635         }
1636
1637         // Callback for Stage ContextLostSignal
1638         private void OnContextLost()
1639         {
1640             if (_stageContextLostEventHandler != null)
1641             {
1642                 _stageContextLostEventHandler(this, null);
1643             }
1644         }
1645
1646         // Callback for Stage ContextRegainedSignal
1647         private void OnContextRegained()
1648         {
1649             if (_stageContextRegainedEventHandler != null)
1650             {
1651                 _stageContextRegainedEventHandler(this, null);
1652             }
1653         }
1654
1655         // Callback for Stage SceneCreatedSignal
1656         private void OnSceneCreated()
1657         {
1658             if (_stageSceneCreatedEventHandler != null)
1659             {
1660                 _stageSceneCreatedEventHandler(this, null);
1661             }
1662         }
1663
1664         private void OnResized(IntPtr windowSize)
1665         {
1666             ResizedEventArgs e = new ResizedEventArgs();
1667             var val = new Uint16Pair(windowSize, false);
1668             e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1669             val.Dispose();
1670
1671             if (_windowResizedEventHandler != null)
1672             {
1673                 _windowResizedEventHandler(this, e);
1674             }
1675         }
1676
1677         private void OnWindowFocusedChanged2(bool focusGained)
1678         {
1679             FocusChangedEventArgs e = new FocusChangedEventArgs();
1680
1681             e.FocusGained = focusGained;
1682
1683             if (_windowFocusChangedEventHandler2 != null)
1684             {
1685                 _windowFocusChangedEventHandler2(this, e);
1686             }
1687         }
1688
1689         /// <summary>
1690         /// The focus changed event argument.
1691         /// </summary>
1692         /// <since_tizen> 3 </since_tizen>
1693         public class FocusChangedEventArgs : EventArgs
1694         {
1695             /// <summary>
1696             /// FocusGained flag.
1697             /// </summary>
1698             /// <since_tizen> 3 </since_tizen>
1699             public bool FocusGained
1700             {
1701                 get;
1702                 set;
1703             }
1704         }
1705
1706         /// <summary>
1707         /// The touch event argument.
1708         /// </summary>
1709         /// <since_tizen> 3 </since_tizen>
1710         public class TouchEventArgs : EventArgs
1711         {
1712             private Touch _touch;
1713
1714             /// <summary>
1715             /// Touch.
1716             /// </summary>
1717             /// <since_tizen> 3 </since_tizen>
1718             public Touch Touch
1719             {
1720                 get
1721                 {
1722                     return _touch;
1723                 }
1724                 set
1725                 {
1726                     _touch = value;
1727                 }
1728             }
1729         }
1730
1731         /// <summary>
1732         /// Wheel event arguments.
1733         /// </summary>
1734         /// <since_tizen> 3 </since_tizen>
1735         public class WheelEventArgs : EventArgs
1736         {
1737             private Wheel _wheel;
1738
1739             /// <summary>
1740             /// Wheel.
1741             /// </summary>
1742             /// <since_tizen> 3 </since_tizen>
1743             public Wheel Wheel
1744             {
1745                 get
1746                 {
1747                     return _wheel;
1748                 }
1749                 set
1750                 {
1751                     _wheel = value;
1752                 }
1753             }
1754         }
1755
1756         /// <summary>
1757         /// Key event arguments.
1758         /// </summary>
1759         /// <since_tizen> 3 </since_tizen>
1760         public class KeyEventArgs : EventArgs
1761         {
1762             private Key _key;
1763
1764             /// <summary>
1765             /// Key.
1766             /// </summary>
1767             /// <since_tizen> 3 </since_tizen>
1768             public Key Key
1769             {
1770                 get
1771                 {
1772                     return _key;
1773                 }
1774                 set
1775                 {
1776                     _key = value;
1777                 }
1778             }
1779         }
1780
1781         /// <summary>
1782         /// Sets position and size of the window. This API guarantees that
1783         /// both moving and resizing of window will appear on the screen at once.
1784         /// </summary>
1785         [EditorBrowsable(EditorBrowsableState.Never)]
1786         public Rectangle WindowPositionSize
1787         {
1788             get
1789             {
1790                 Position2D position = GetPosition();
1791                 Size2D size = GetSize();
1792                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1793                 return ret;
1794             }
1795             set
1796             {
1797                 SetPositionSize(value);
1798             }
1799         }
1800
1801         /// <summary>
1802         /// Feeds a key event into the window.
1803         /// This resized event arguments.
1804         /// </summary>
1805         /// <since_tizen> 3 </since_tizen>
1806         public class ResizedEventArgs : EventArgs
1807         {
1808             Size2D _windowSize;
1809
1810             /// <summary>
1811             /// This window size.
1812             /// </summary>
1813             /// <since_tizen> 4 </since_tizen>
1814             public Size2D WindowSize
1815             {
1816                 get
1817                 {
1818                     return _windowSize;
1819                 }
1820                 set
1821                 {
1822                     _windowSize = value;
1823                 }
1824             }
1825         }
1826
1827         /// <summary>
1828         /// Please do not use! this will be deprecated
1829         /// </summary>
1830         /// <since_tizen> 3 </since_tizen>
1831         [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1832             "Like: " +
1833             "Window.Instance.FocusChanged = OnFocusChanged; " +
1834             "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1835         [EditorBrowsable(EditorBrowsableState.Never)]
1836         public class WindowFocusChangedEventArgs : EventArgs
1837         {
1838             /// <summary>
1839             /// Please do not use! this will be deprecated
1840             /// </summary>
1841             /// <since_tizen> 3 </since_tizen>
1842             public bool FocusGained
1843             {
1844                 get;
1845                 set;
1846             }
1847         }
1848
1849         /// <summary>
1850         /// Contains and encapsulates Native Window handle.
1851         /// </summary>
1852         /// <since_tizen> 4 </since_tizen>
1853         public class SafeNativeWindowHandle : SafeHandle
1854         {
1855             /// <summary>
1856             /// Contructor, Native window handle is set to handle.
1857             /// </summary>
1858             /// <since_tizen> 4 </since_tizen>
1859             public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1860             {
1861                 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1862             }
1863             /// <summary>
1864             /// Null check if the handle is valid or not.
1865             /// </summary>
1866             /// <since_tizen> 4 </since_tizen>
1867             public override bool IsInvalid
1868             {
1869                 get
1870                 {
1871                     return this.handle == IntPtr.Zero;
1872                 }
1873             }
1874             /// <summary>
1875             /// Release handle itself.
1876             /// </summary>
1877             /// <returns>true when released successfully.</returns>
1878             /// <since_tizen> 4 </since_tizen>
1879             protected override bool ReleaseHandle()
1880             {
1881                 return true;
1882             }
1883         }
1884
1885         /// <summary>
1886         /// Disconnect all native signals
1887         /// </summary>
1888         /// <since_tizen> 5 </since_tizen>
1889         internal void DisconnectNativeSignals()
1890         {
1891             if( _windowFocusChangedEventCallback != null )
1892             {
1893                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1894             }
1895
1896             if( _rootLayerTouchDataCallback != null )
1897             {
1898                 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1899             }
1900
1901             if( _wheelEventCallback != null )
1902             {
1903                 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1904             }
1905
1906             if( _stageKeyCallbackDelegate != null )
1907             {
1908                 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1909             }
1910
1911             if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1912             {
1913                 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1914             }
1915
1916             if( _stageContextLostEventCallbackDelegate != null )
1917             {
1918                 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1919             }
1920
1921             if( _stageContextRegainedEventCallbackDelegate != null )
1922             {
1923                 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1924             }
1925
1926             if( _stageSceneCreatedEventCallbackDelegate != null )
1927             {
1928                 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1929             }
1930
1931             if( _windowResizedEventCallback != null )
1932             {
1933                 ResizedSignal().Disconnect(_windowResizedEventCallback);
1934             }
1935
1936             if( _windowFocusChangedEventCallback2 != null )
1937             {
1938                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1939             }
1940
1941         }
1942
1943     }
1944 }