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