[NUI] Add Window Creation API for setting name (#998)
[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="isTranslucent">Whether Window is translucent.</param>
75         /// <returns>A new Window.</returns>
76         /// <since_tizen> 6 </since_tizen>
77         [EditorBrowsable(EditorBrowsableState.Never)]
78         public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
79         {
80             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81         }
82
83         /// <summary>
84         /// Creates a new Window.<br />
85         /// This creates an extra window in addition to the default main window<br />
86         /// </summary>
87         /// <param name="name">The name for extra window. </param>
88         /// <param name="windowPosition">The position and size of the Window.</param>
89         /// <param name="isTranslucent">Whether Window is translucent.</param>
90         /// <returns>A new Window.</returns>
91         /// <since_tizen> 6 </since_tizen>
92         [EditorBrowsable(EditorBrowsableState.Never)]
93         public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
94         {
95             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96         }
97
98         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
99         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
100         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
101         private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
102         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
103         private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
104         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
105         private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
106         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
107         private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
108
109         /// <summary>
110         /// FocusChanged event.
111         /// </summary>
112         /// <since_tizen> 3 </since_tizen>
113         public event EventHandler<FocusChangedEventArgs> FocusChanged
114         {
115             add
116             {
117                 if (_windowFocusChangedEventHandler == null)
118                 {
119                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
120                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
121                 }
122
123                 _windowFocusChangedEventHandler += value;
124             }
125             remove
126             {
127                 _windowFocusChangedEventHandler -= value;
128
129                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
130                 {
131                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
132                 }
133             }
134         }
135
136         /// <summary>
137         /// This event is emitted when the screen is touched and when the touch ends.<br />
138         /// If there are multiple touch points, then this will be emitted when the first touch occurs and
139         /// then when the last finger is lifted.<br />
140         /// An interrupted event will also be emitted (if it occurs).<br />
141         /// </summary>
142         /// <since_tizen> 3 </since_tizen>
143         public event EventHandler<TouchEventArgs> TouchEvent
144         {
145             add
146             {
147                 if (_rootLayerTouchDataEventHandler == null)
148                 {
149                     _rootLayerTouchDataCallback = OnWindowTouch;
150                     this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
151                 }
152                 _rootLayerTouchDataEventHandler += value;
153             }
154             remove
155             {
156                 _rootLayerTouchDataEventHandler -= value;
157                 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
158                 {
159                     this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
160                 }
161             }
162         }
163
164         /// <summary>
165         /// This event is emitted when the wheel event is received.
166         /// </summary>
167         /// <since_tizen> 3 </since_tizen>
168         public event EventHandler<WheelEventArgs> WheelEvent
169         {
170             add
171             {
172                 if (_stageWheelHandler == null)
173                 {
174                     _wheelEventCallback = OnStageWheel;
175                     this.StageWheelEventSignal().Connect(_wheelEventCallback);
176                 }
177                 _stageWheelHandler += value;
178             }
179             remove
180             {
181                 _stageWheelHandler -= value;
182                 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
183                 {
184                     this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
185                 }
186             }
187         }
188
189         /// <summary>
190         /// This event is emitted when the key event is received.
191         /// </summary>
192         /// <since_tizen> 3 </since_tizen>
193         public event EventHandler<KeyEventArgs> KeyEvent
194         {
195             add
196             {
197                 if (_stageKeyHandler == null)
198                 {
199                     _stageKeyCallbackDelegate = OnStageKey;
200                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
201                 }
202                 _stageKeyHandler += value;
203             }
204             remove
205             {
206                 _stageKeyHandler -= value;
207                 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
208                 {
209                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
210                 }
211             }
212         }
213
214         /// <summary>
215         /// This event is emitted when the window resized.
216         /// </summary>
217         /// <since_tizen> 3 </since_tizen>
218         public event EventHandler<ResizedEventArgs> Resized
219         {
220             add
221             {
222                 if (_windowResizedEventHandler == null)
223                 {
224                     _windowResizedEventCallback = OnResized;
225                     ResizedSignal().Connect(_windowResizedEventCallback);
226                 }
227
228                 _windowResizedEventHandler += value;
229             }
230             remove
231             {
232                 _windowResizedEventHandler -= value;
233
234                 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
235                 {
236                     ResizedSignal().Disconnect(_windowResizedEventCallback);
237                 }
238             }
239         }
240
241         /// <summary>
242         /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
243         /// </summary>
244         /// <since_tizen> 3 </since_tizen>
245         /// Please do not use! this will be deprecated!
246         /// Instead please use FocusChanged.
247         [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
248             "Like: " +
249             "Window.Instance.FocusChanged = OnFocusChanged; " +
250             "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
251         [EditorBrowsable(EditorBrowsableState.Never)]
252         public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
253         {
254             add
255             {
256                 if (_windowFocusChangedEventHandler2 == null)
257                 {
258                     _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
259                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
260                 }
261
262                 _windowFocusChangedEventHandler2 += value;
263             }
264             remove
265             {
266                 _windowFocusChangedEventHandler2 -= value;
267
268                 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
269                 {
270                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
271                 }
272             }
273         }
274
275         /// <summary>
276         /// ViewAdded will be triggered when the view added on Window
277         /// </summary>
278         /// <since_tizen> 6 </since_tizen>
279         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
280         [EditorBrowsable(EditorBrowsableState.Never)]
281         public event EventHandler ViewAdded;
282
283         internal void SendViewAdded(View view)
284         {
285             ViewAdded?.Invoke(view, EventArgs.Empty);
286         }
287
288         internal event EventHandler EventProcessingFinished
289         {
290             add
291             {
292                 if (_stageEventProcessingFinishedEventHandler == null)
293                 {
294                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
295                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
296                 }
297                 _stageEventProcessingFinishedEventHandler += value;
298
299             }
300             remove
301             {
302                 _stageEventProcessingFinishedEventHandler -= value;
303                 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
304                 {
305                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
306                 }
307             }
308         }
309
310         internal event EventHandler ContextLost
311         {
312             add
313             {
314                 if (_stageContextLostEventHandler == null)
315                 {
316                     _stageContextLostEventCallbackDelegate = OnContextLost;
317                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
318                 }
319                 _stageContextLostEventHandler += value;
320             }
321             remove
322             {
323                 _stageContextLostEventHandler -= value;
324                 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
325                 {
326                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
327                 }
328             }
329         }
330
331         internal event EventHandler ContextRegained
332         {
333             add
334             {
335                 if (_stageContextRegainedEventHandler == null)
336                 {
337                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
338                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
339                 }
340                 _stageContextRegainedEventHandler += value;
341             }
342             remove
343             {
344                 _stageContextRegainedEventHandler -= value;
345                 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
346                 {
347                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
348                 }
349             }
350         }
351
352         internal event EventHandler SceneCreated
353         {
354             add
355             {
356                 if (_stageSceneCreatedEventHandler == null)
357                 {
358                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
359                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
360                 }
361                 _stageSceneCreatedEventHandler += value;
362             }
363             remove
364             {
365                 _stageSceneCreatedEventHandler -= value;
366                 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
367                 {
368                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
369                 }
370             }
371         }
372
373         private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
374         private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
375         private event EventHandler<WheelEventArgs> _stageWheelHandler;
376         private event EventHandler<KeyEventArgs> _stageKeyHandler;
377         private event EventHandler _stageEventProcessingFinishedEventHandler;
378         private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
379         private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
380
381         /// <summary>
382         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
383         /// </summary>
384         /// <since_tizen> 3 </since_tizen>
385         public enum WindowOrientation
386         {
387             /// <summary>
388             /// Portrait orientation. The height of the display area is greater than the width.
389             /// </summary>
390             /// <since_tizen> 3 </since_tizen>
391             Portrait = 0,
392             /// <summary>
393             /// Landscape orientation. A wide view area is needed.
394             /// </summary>
395             /// <since_tizen> 3 </since_tizen>
396             Landscape = 90,
397             /// <summary>
398             /// Portrait inverse orientation.
399             /// </summary>
400             /// <since_tizen> 3 </since_tizen>
401             PortraitInverse = 180,
402             /// <summary>
403             /// Landscape inverse orientation.
404             /// </summary>
405             /// <since_tizen> 3 </since_tizen>
406             LandscapeInverse = 270
407         }
408
409         /// <summary>
410         /// Enumeration for the key grab mode for platform-level APIs.
411         /// </summary>
412         /// <since_tizen> 3 </since_tizen>
413         public enum KeyGrabMode
414         {
415             /// <summary>
416             /// Grabs a key only when on the top of the grabbing-window stack mode.
417             /// </summary>
418             Topmost = 0,
419             /// <summary>
420             /// Grabs a key together with the other client window(s) mode.
421             /// </summary>
422             Shared,
423             /// <summary>
424             /// 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.
425             /// </summary>
426             OverrideExclusive,
427             /// <summary>
428             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
429             /// </summary>
430             Exclusive
431         };
432
433         /// <summary>
434         /// Enumeration for opacity of the indicator.
435         /// </summary>
436         internal enum IndicatorBackgroundOpacity
437         {
438             Opaque = 100,
439             Translucent = 50,
440             Transparent = 0
441         }
442
443         /// <summary>
444         /// Enumeration for visible mode of the indicator.
445         /// </summary>
446         internal enum IndicatorVisibleMode
447         {
448             Invisible = 0,
449             Visible = 1,
450             Auto = 2
451         }
452
453         /// <summary>
454         /// The stage instance property (read-only).<br />
455         /// Gets the current window.<br />
456         /// </summary>
457         /// <since_tizen> 3 </since_tizen>
458         public static Window Instance
459         {
460             get
461             {
462                 return instance;
463             }
464         }
465
466         /// <summary>
467         /// Gets or sets a window type.
468         /// </summary>
469         /// <since_tizen> 3 </since_tizen>
470         public WindowType Type
471         {
472             get
473             {
474                 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
475                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476                 return ret;
477             }
478             set
479             {
480                 Interop.Window.SetType(swigCPtr, (int)value);
481                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
482             }
483         }
484
485         /// <summary>
486         /// Gets/Sets a window title.
487         /// </summary>
488         /// <since_tizen> 4 </since_tizen>
489         public string Title
490         {
491             get
492             {
493                 return _windowTitle;
494             }
495             set
496             {
497                 _windowTitle = value;
498                 SetClass(_windowTitle, "");
499             }
500         }
501
502         /// <summary>
503         /// The rendering behavior of a Window.
504         /// </summary>
505         /// <since_tizen> 5 </since_tizen>
506         public RenderingBehaviorType RenderingBehavior
507         {
508             get
509             {
510                 return GetRenderingBehavior();
511             }
512             set
513             {
514                 SetRenderingBehavior(value);
515             }
516         }
517
518         /// <summary>
519         /// The window size property (read-only).
520         /// </summary>
521         /// <since_tizen> 3 </since_tizen>
522         public Size2D Size
523         {
524             get
525             {
526                 Size2D ret = GetSize();
527                 return ret;
528             }
529         }
530
531         /// <summary>
532         /// The background color property.
533         /// </summary>
534         /// <since_tizen> 3 </since_tizen>
535         public Color BackgroundColor
536         {
537             set
538             {
539                 SetBackgroundColor(value);
540             }
541             get
542             {
543                 Color ret = GetBackgroundColor();
544                 return ret;
545             }
546         }
547
548         /// <summary>
549         /// The DPI property (read-only).<br />
550         /// Retrieves the DPI of the display device to which the Window is connected.<br />
551         /// </summary>
552         /// <since_tizen> 3 </since_tizen>
553         public Vector2 Dpi
554         {
555             get
556             {
557                 return GetDpi();
558             }
559         }
560
561         /// <summary>
562         /// The layer count property (read-only).<br />
563         /// Queries the number of on-Window layers.<br />
564         /// </summary>
565         /// <since_tizen> 3 </since_tizen>
566         public uint LayerCount
567         {
568             get
569             {
570                 return GetLayerCount();
571             }
572         }
573
574         /// <summary>
575         /// Gets or sets a size of the window.
576         /// </summary>
577         /// <since_tizen> 4 </since_tizen>
578         public Size2D WindowSize
579         {
580             get
581             {
582                 return GetWindowSize();
583             }
584             set
585             {
586                 SetWindowSize(value);
587             }
588         }
589
590         /// <summary>
591         /// Gets or sets a position of the window.
592         /// </summary>
593         /// <since_tizen> 4 </since_tizen>
594         public Position2D WindowPosition
595         {
596             get
597             {
598                 return GetPosition();
599             }
600             set
601             {
602                 SetPosition(value);
603             }
604         }
605         internal static Vector4 DEFAULT_BACKGROUND_COLOR
606         {
607             get
608             {
609                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
610                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
611                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612                 return ret;
613             }
614         }
615
616         internal static Vector4 DEBUG_BACKGROUND_COLOR
617         {
618             get
619             {
620                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
621                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
622                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
623                 return ret;
624             }
625         }
626
627         internal List<Layer> LayersChildren
628         {
629             get
630             {
631                 return _childLayers;
632             }
633         }
634
635         internal LayoutController LayoutController
636         {
637             get
638             {
639                 return localController;
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(Layer.getCPtr(GetRootLayer()), 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(Layer.getCPtr(GetRootLayer()), 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         /// Destroy the window immediately.
1016         /// </summary>
1017         [EditorBrowsable(EditorBrowsableState.Never)]
1018         public void Destroy()
1019         {
1020             this.Dispose();
1021         }
1022
1023         /// <summary>
1024         /// Keep rendering for at least the given amount of time.
1025         /// </summary>
1026         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1027         /// <since_tizen> 3 </since_tizen>
1028         public void KeepRendering(float durationSeconds)
1029         {
1030             Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
1031             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1032         }
1033
1034         /// <summary>
1035         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1036         /// This function can be used for following example scenarios: <br />
1037         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1038         /// </summary>
1039         /// <param name="DaliKey">The key code to grab.</param>
1040         /// <returns>True if the grab succeeds.</returns>
1041         /// <since_tizen> 3 </since_tizen>
1042         public bool GrabKeyTopmost(int DaliKey)
1043         {
1044             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1045             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1046             return ret;
1047         }
1048
1049         /// <summary>
1050         /// Ungrabs the key specified by a key for the window.<br />
1051         /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.<br />
1052         /// </summary>
1053         /// <param name="DaliKey">The key code to ungrab.</param>
1054         /// <returns>True if the ungrab succeeds.</returns>
1055         /// <since_tizen> 3 </since_tizen>
1056         public bool UngrabKeyTopmost(int DaliKey)
1057         {
1058             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1059             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1060             return ret;
1061         }
1062
1063         /// <summary>
1064         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
1065         ///  Details: This function can be used for following example scenarios: <br />
1066         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1067         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1068         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1069         /// </summary>
1070         /// <param name="DaliKey">The key code to grab.</param>
1071         /// <param name="GrabMode">The grab mode for the key.</param>
1072         /// <returns>True if the grab succeeds.</returns>
1073         /// <since_tizen> 3 </since_tizen>
1074         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1075         {
1076             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
1077             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1078             return ret;
1079         }
1080
1081         /// <summary>
1082         /// Ungrabs the key specified by a key for a window.<br />
1083         /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event. <br />
1084         /// </summary>
1085         /// <param name="DaliKey">The key code to ungrab.</param>
1086         /// <returns>True if the ungrab succeeds.</returns>
1087         /// <since_tizen> 3 </since_tizen>
1088         public bool UngrabKey(int DaliKey)
1089         {
1090             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
1091             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1092             return ret;
1093         }
1094
1095         /// <summary>
1096         /// Sets the keyboard repeat information.
1097         /// </summary>
1098         /// <param name="rate">The key repeat rate value in seconds.</param>
1099         /// <param name="delay">The key repeat delay value in seconds.</param>
1100         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1101         /// <since_tizen> 5 </since_tizen>
1102         public bool SetKeyboardRepeatInfo(float rate, float delay)
1103         {
1104             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1105             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106             return ret;
1107         }
1108
1109         /// <summary>
1110         /// Gets the keyboard repeat information.
1111         /// </summary>
1112         /// <param name="rate">The key repeat rate value in seconds.</param>
1113         /// <param name="delay">The key repeat delay value in seconds.</param>
1114         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1115         /// <since_tizen> 5 </since_tizen>
1116         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1117         {
1118             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1119             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1120             return ret;
1121         }
1122
1123         /// <summary>
1124         /// Adds a layer to the stage.
1125         /// </summary>
1126         /// <param name="layer">Layer to add.</param>
1127         /// <since_tizen> 3 </since_tizen>
1128         public void AddLayer(Layer layer)
1129         {
1130             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132
1133             LayersChildren?.Add(layer);
1134             layer.SetWindow(this);
1135         }
1136
1137         /// <summary>
1138         /// Removes a layer from the stage.
1139         /// </summary>
1140         /// <param name="layer">Layer to remove.</param>
1141         /// <since_tizen> 3 </since_tizen>
1142         public void RemoveLayer(Layer layer)
1143         {
1144             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146
1147             LayersChildren?.Remove(layer);
1148             layer.SetWindow(null);
1149         }
1150
1151         /// <summary>
1152         /// Feeds a key event into the window.
1153         /// </summary>
1154         /// <param name="keyEvent">The key event to feed.</param>
1155         /// <since_tizen> 5 </since_tizen>
1156         public void FeedKey(Key keyEvent)
1157         {
1158             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1160         }
1161
1162         /// <summary>
1163         /// Allows at least one more render, even when paused.
1164         /// The window should be shown, not minimised.
1165         /// </summary>
1166         /// <since_tizen> 4 </since_tizen>
1167         public void RenderOnce()
1168         {
1169             Interop.Window.Window_RenderOnce(swigCPtr);
1170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1171         }
1172
1173         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1174         {
1175             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1176         }
1177
1178         internal static Window GetCurrent()
1179         {
1180             Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182             return ret;
1183         }
1184
1185         internal static bool IsInstalled()
1186         {
1187             bool ret = Interop.Stage.Stage_IsInstalled();
1188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1189             return ret;
1190         }
1191
1192         internal WindowFocusSignalType WindowFocusChangedSignal()
1193         {
1194             WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196             return ret;
1197         }
1198
1199         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1200         {
1201             Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1203         }
1204
1205         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1206         {
1207             Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1209         }
1210
1211         internal void RotateIndicator(Window.WindowOrientation orientation)
1212         {
1213             Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1214             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1215         }
1216
1217         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
1218         {
1219             Interop.WindowInternal.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1221         }
1222
1223         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1224         {
1225             Interop.WindowInternal.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1226             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227         }
1228
1229         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
1230         {
1231             Interop.WindowInternal.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233         }
1234
1235         internal Window.WindowOrientation GetPreferredOrientation()
1236         {
1237             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.WindowInternal.Window_GetPreferredOrientation(swigCPtr);
1238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239             return ret;
1240         }
1241
1242         internal Any GetNativeHandle()
1243         {
1244             Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246             return ret;
1247         }
1248
1249         internal WindowFocusSignalType FocusChangedSignal()
1250         {
1251             WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1253             return ret;
1254         }
1255
1256         internal void Add(Layer layer)
1257         {
1258             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1259             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1260
1261             LayersChildren?.Add(layer);
1262             layer.SetWindow(this);
1263         }
1264
1265         internal void Remove(Layer layer)
1266         {
1267             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269
1270             LayersChildren?.Remove(layer);
1271             layer.SetWindow(null);
1272         }
1273
1274         internal Vector2 GetSize()
1275         {
1276             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1277             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1278             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1279             return ret;
1280         }
1281
1282         internal RenderTaskList GetRenderTaskList()
1283         {
1284             RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1285             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1286             return ret;
1287         }
1288
1289         /// <summary>
1290         /// Queries the number of on-window layers.
1291         /// </summary>
1292         /// <returns>The number of layers.</returns>
1293         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1294         internal uint GetLayerCount()
1295         {
1296             if (LayersChildren == null || LayersChildren.Count < 0)
1297                 return 0;
1298
1299             return (uint) LayersChildren.Count;
1300         }
1301
1302         internal Layer GetRootLayer()
1303         {
1304             // Window.IsInstalled() is actually true only when called from event thread and
1305             // Core has been initialized, not when Stage is ready.
1306             if (_rootLayer == null && Window.IsInstalled())
1307             {
1308                 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1309                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1310                 LayersChildren?.Add(_rootLayer);
1311                 _rootLayer.SetWindow(this);
1312             }
1313             return _rootLayer;
1314         }
1315
1316         internal void SetBackgroundColor(Vector4 color)
1317         {
1318             Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1319             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1320         }
1321
1322         internal Vector4 GetBackgroundColor()
1323         {
1324             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1325             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1326             return ret;
1327         }
1328
1329         internal Vector2 GetDpi()
1330         {
1331             Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1332             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1333             return ret;
1334         }
1335
1336         internal ObjectRegistry GetObjectRegistry()
1337         {
1338             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1340             return ret;
1341         }
1342
1343         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1344         {
1345             Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1346             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1347         }
1348
1349         internal RenderingBehaviorType GetRenderingBehavior()
1350         {
1351             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1352             if (NDalicPINVOKE.SWIGPendingException.Pending)
1353                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354             return ret;
1355         }
1356
1357         internal KeyEventSignal KeyEventSignal()
1358         {
1359             KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361             return ret;
1362         }
1363
1364         internal VoidSignal EventProcessingFinishedSignal()
1365         {
1366             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368             return ret;
1369         }
1370
1371         internal TouchSignal TouchSignal()
1372         {
1373             TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1374             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1375             return ret;
1376         }
1377
1378         internal TouchDataSignal TouchDataSignal()
1379         {
1380             TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1381             if (NDalicPINVOKE.SWIGPendingException.Pending)
1382                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383             return ret;
1384         }
1385
1386         internal VoidSignal ContextLostSignal()
1387         {
1388             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1389             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1390             return ret;
1391         }
1392
1393         internal VoidSignal ContextRegainedSignal()
1394         {
1395             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1396             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1397             return ret;
1398         }
1399
1400         internal VoidSignal SceneCreatedSignal()
1401         {
1402             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1403             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404             return ret;
1405         }
1406
1407         internal ResizedSignal ResizedSignal()
1408         {
1409             ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1410             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1411             return ret;
1412         }
1413
1414         internal void SetWindowSize(Size2D size)
1415         {
1416             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1417             Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1418
1419             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1420
1421             // Resetting Window size should request a relayout of the tree.
1422         }
1423
1424         internal Size2D GetWindowSize()
1425         {
1426             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1427             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1428
1429             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1430             return ret;
1431         }
1432
1433         internal void SetPosition(Position2D position)
1434         {
1435             var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1436             Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1437
1438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1439
1440             // Setting Position of the window should request a relayout of the tree.
1441
1442         }
1443
1444         internal Position2D GetPosition()
1445         {
1446             var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1447             Position2D ret = new Position2D(val.GetX(), val.GetY());
1448
1449             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1450             return ret;
1451         }
1452
1453         internal void SetPositionSize(Rectangle positionSize)
1454         {
1455             Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1456
1457             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458
1459             // Setting Position of the window should request a relayout of the tree.
1460
1461         }
1462
1463         /// <summary>
1464         /// Sets whether the window is transparent or not.
1465         /// </summary>
1466         /// <param name="transparent">Whether the window is transparent or not.</param>
1467         /// <since_tizen> 5 </since_tizen>
1468         public void SetTransparency(bool transparent) {
1469             Interop.Window.SetTransparency(swigCPtr, transparent);
1470             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471
1472             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1473
1474         }
1475
1476         /// <summary>
1477         /// Sets parent window of the window.
1478         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1479         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1480         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1481         /// </summary>
1482         /// <param name="parent">The parent window.</param>
1483         /// <since_tizen> 6 </since_tizen>
1484         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1485         [EditorBrowsable(EditorBrowsableState.Never)]
1486         public void SetParent(Window parent) {
1487             Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
1488             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1489         }
1490
1491         /// <summary>
1492         /// Unsets parent window of the window.
1493         /// After unsetting, the window is disconnected his parent window.
1494         /// </summary>
1495         /// <since_tizen> 6 </since_tizen>
1496         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1497         [EditorBrowsable(EditorBrowsableState.Never)]
1498         public void Unparent() {
1499             Interop.Window.Unparent(swigCPtr);
1500             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501         }
1502
1503         /// <summary>
1504         /// Gets parent window of the window.
1505         /// </summary>
1506         /// <returns>The parent window of the window.</returns>
1507         /// <since_tizen> 6 </since_tizen>
1508         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1509         [EditorBrowsable(EditorBrowsableState.Never)]
1510         public Window GetParent() {
1511             Window ret = new Window(Interop.Window.GetParent(swigCPtr), true);
1512             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1513             return ret;
1514         }
1515
1516         /// <summary>
1517         /// Dispose for Window
1518         /// </summary>
1519         [EditorBrowsable(EditorBrowsableState.Never)]
1520         protected override void Dispose(DisposeTypes type)
1521         {
1522             if (disposed)
1523             {
1524                 return;
1525             }
1526
1527             if (type == DisposeTypes.Explicit)
1528             {
1529                 //Called by User
1530                 //Release your own managed resources here.
1531                 //You should release all of your own disposable objects here.
1532
1533                 _rootLayer.Dispose();
1534                 localController.Dispose();
1535
1536                 foreach(var layer in _childLayers)
1537                 {
1538                     layer.Dispose();
1539                 }
1540                 _childLayers.Clear();
1541             }
1542
1543             this.DisconnectNativeSignals();
1544
1545             //Release your own unmanaged resources here.
1546             //You should not access any managed member here except static instance.
1547             //because the execution order of Finalizes is non-deterministic.
1548
1549             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1550             {
1551                 if (swigCMemOwn)
1552                 {
1553                     swigCMemOwn = false;
1554                     Interop.Window.delete_Window(swigCPtr);
1555                 }
1556                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1557             }
1558
1559             base.Dispose(type);
1560         }
1561
1562         internal System.IntPtr GetNativeWindowHandler()
1563         {
1564             System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1565             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1566             return ret;
1567         }
1568
1569         private void OnWindowFocusedChanged(bool focusGained)
1570         {
1571             FocusChangedEventArgs e = new FocusChangedEventArgs();
1572
1573             e.FocusGained = focusGained;
1574
1575             if (_windowFocusChangedEventHandler != null)
1576             {
1577                 _windowFocusChangedEventHandler(this, e);
1578             }
1579         }
1580
1581         private StageWheelSignal WheelEventSignal()
1582         {
1583             StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1585             return ret;
1586         }
1587
1588         private WheelSignal StageWheelEventSignal()
1589         {
1590             WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1591             if (NDalicPINVOKE.SWIGPendingException.Pending)
1592                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1593             return ret;
1594         }
1595
1596         private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1597         {
1598             if (touchData == global::System.IntPtr.Zero)
1599             {
1600                 NUILog.Error("touchData should not be null!");
1601                 return false;
1602             }
1603
1604             TouchEventArgs e = new TouchEventArgs();
1605
1606             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1607
1608             if (_rootLayerTouchDataEventHandler != null)
1609             {
1610                 _rootLayerTouchDataEventHandler(this, e);
1611             }
1612             return false;
1613         }
1614
1615         private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1616         {
1617             if (wheelEvent == global::System.IntPtr.Zero)
1618             {
1619                 NUILog.Error("wheelEvent should not be null!");
1620                 return true;
1621             }
1622
1623             WheelEventArgs e = new WheelEventArgs();
1624
1625             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1626
1627             if (_stageWheelHandler != null)
1628             {
1629                 _stageWheelHandler(this, e);
1630             }
1631             return true;
1632         }
1633
1634         // Callback for Stage KeyEventsignal
1635         private void OnStageKey(IntPtr data)
1636         {
1637             KeyEventArgs e = new KeyEventArgs();
1638             e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1639
1640
1641             if (_stageKeyHandler != null)
1642             {
1643                 //here we send all data to user event handlers
1644                 _stageKeyHandler(this, e);
1645             }
1646         }
1647
1648         // Callback for Stage EventProcessingFinishedSignal
1649         private void OnEventProcessingFinished()
1650         {
1651             if (_stageEventProcessingFinishedEventHandler != null)
1652             {
1653                 _stageEventProcessingFinishedEventHandler(this, null);
1654             }
1655         }
1656
1657         // Callback for Stage ContextLostSignal
1658         private void OnContextLost()
1659         {
1660             if (_stageContextLostEventHandler != null)
1661             {
1662                 _stageContextLostEventHandler(this, null);
1663             }
1664         }
1665
1666         // Callback for Stage ContextRegainedSignal
1667         private void OnContextRegained()
1668         {
1669             if (_stageContextRegainedEventHandler != null)
1670             {
1671                 _stageContextRegainedEventHandler(this, null);
1672             }
1673         }
1674
1675         // Callback for Stage SceneCreatedSignal
1676         private void OnSceneCreated()
1677         {
1678             if (_stageSceneCreatedEventHandler != null)
1679             {
1680                 _stageSceneCreatedEventHandler(this, null);
1681             }
1682         }
1683
1684         private void OnResized(IntPtr windowSize)
1685         {
1686             ResizedEventArgs e = new ResizedEventArgs();
1687             var val = new Uint16Pair(windowSize, false);
1688             e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1689             val.Dispose();
1690
1691             if (_windowResizedEventHandler != null)
1692             {
1693                 _windowResizedEventHandler(this, e);
1694             }
1695         }
1696
1697         private void OnWindowFocusedChanged2(bool focusGained)
1698         {
1699             FocusChangedEventArgs e = new FocusChangedEventArgs();
1700
1701             e.FocusGained = focusGained;
1702
1703             if (_windowFocusChangedEventHandler2 != null)
1704             {
1705                 _windowFocusChangedEventHandler2(this, e);
1706             }
1707         }
1708
1709         /// <summary>
1710         /// The focus changed event argument.
1711         /// </summary>
1712         /// <since_tizen> 3 </since_tizen>
1713         public class FocusChangedEventArgs : EventArgs
1714         {
1715             /// <summary>
1716             /// FocusGained flag.
1717             /// </summary>
1718             /// <since_tizen> 3 </since_tizen>
1719             public bool FocusGained
1720             {
1721                 get;
1722                 set;
1723             }
1724         }
1725
1726         /// <summary>
1727         /// The touch event argument.
1728         /// </summary>
1729         /// <since_tizen> 3 </since_tizen>
1730         public class TouchEventArgs : EventArgs
1731         {
1732             private Touch _touch;
1733
1734             /// <summary>
1735             /// Touch.
1736             /// </summary>
1737             /// <since_tizen> 3 </since_tizen>
1738             public Touch Touch
1739             {
1740                 get
1741                 {
1742                     return _touch;
1743                 }
1744                 set
1745                 {
1746                     _touch = value;
1747                 }
1748             }
1749         }
1750
1751         /// <summary>
1752         /// Wheel event arguments.
1753         /// </summary>
1754         /// <since_tizen> 3 </since_tizen>
1755         public class WheelEventArgs : EventArgs
1756         {
1757             private Wheel _wheel;
1758
1759             /// <summary>
1760             /// Wheel.
1761             /// </summary>
1762             /// <since_tizen> 3 </since_tizen>
1763             public Wheel Wheel
1764             {
1765                 get
1766                 {
1767                     return _wheel;
1768                 }
1769                 set
1770                 {
1771                     _wheel = value;
1772                 }
1773             }
1774         }
1775
1776         /// <summary>
1777         /// Key event arguments.
1778         /// </summary>
1779         /// <since_tizen> 3 </since_tizen>
1780         public class KeyEventArgs : EventArgs
1781         {
1782             private Key _key;
1783
1784             /// <summary>
1785             /// Key.
1786             /// </summary>
1787             /// <since_tizen> 3 </since_tizen>
1788             public Key Key
1789             {
1790                 get
1791                 {
1792                     return _key;
1793                 }
1794                 set
1795                 {
1796                     _key = value;
1797                 }
1798             }
1799         }
1800
1801         /// <summary>
1802         /// Sets position and size of the window. This API guarantees that
1803         /// both moving and resizing of window will appear on the screen at once.
1804         /// </summary>
1805         [EditorBrowsable(EditorBrowsableState.Never)]
1806         public Rectangle WindowPositionSize
1807         {
1808             get
1809             {
1810                 Position2D position = GetPosition();
1811                 Size2D size = GetSize();
1812                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1813                 return ret;
1814             }
1815             set
1816             {
1817                 SetPositionSize(value);
1818             }
1819         }
1820
1821         /// <summary>
1822         /// Feeds a key event into the window.
1823         /// This resized event arguments.
1824         /// </summary>
1825         /// <since_tizen> 3 </since_tizen>
1826         public class ResizedEventArgs : EventArgs
1827         {
1828             Size2D _windowSize;
1829
1830             /// <summary>
1831             /// This window size.
1832             /// </summary>
1833             /// <since_tizen> 4 </since_tizen>
1834             public Size2D WindowSize
1835             {
1836                 get
1837                 {
1838                     return _windowSize;
1839                 }
1840                 set
1841                 {
1842                     _windowSize = value;
1843                 }
1844             }
1845         }
1846
1847         /// <summary>
1848         /// Please do not use! this will be deprecated
1849         /// </summary>
1850         /// <since_tizen> 3 </since_tizen>
1851         [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1852             "Like: " +
1853             "Window.Instance.FocusChanged = OnFocusChanged; " +
1854             "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1855         [EditorBrowsable(EditorBrowsableState.Never)]
1856         public class WindowFocusChangedEventArgs : EventArgs
1857         {
1858             /// <summary>
1859             /// Please do not use! this will be deprecated
1860             /// </summary>
1861             /// <since_tizen> 3 </since_tizen>
1862             public bool FocusGained
1863             {
1864                 get;
1865                 set;
1866             }
1867         }
1868
1869         /// <summary>
1870         /// Contains and encapsulates Native Window handle.
1871         /// </summary>
1872         /// <since_tizen> 4 </since_tizen>
1873         public class SafeNativeWindowHandle : SafeHandle
1874         {
1875             /// <summary>
1876             /// Contructor, Native window handle is set to handle.
1877             /// </summary>
1878             /// <since_tizen> 4 </since_tizen>
1879             public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1880             {
1881                 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1882             }
1883             /// <summary>
1884             /// Null check if the handle is valid or not.
1885             /// </summary>
1886             /// <since_tizen> 4 </since_tizen>
1887             public override bool IsInvalid
1888             {
1889                 get
1890                 {
1891                     return this.handle == IntPtr.Zero;
1892                 }
1893             }
1894             /// <summary>
1895             /// Release handle itself.
1896             /// </summary>
1897             /// <returns>true when released successfully.</returns>
1898             /// <since_tizen> 4 </since_tizen>
1899             protected override bool ReleaseHandle()
1900             {
1901                 return true;
1902             }
1903         }
1904
1905         /// <summary>
1906         /// Disconnect all native signals
1907         /// </summary>
1908         /// <since_tizen> 5 </since_tizen>
1909         internal void DisconnectNativeSignals()
1910         {
1911             if( _windowFocusChangedEventCallback != null )
1912             {
1913                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1914             }
1915
1916             if( _rootLayerTouchDataCallback != null )
1917             {
1918                 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1919             }
1920
1921             if( _wheelEventCallback != null )
1922             {
1923                 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1924             }
1925
1926             if( _stageKeyCallbackDelegate != null )
1927             {
1928                 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1929             }
1930
1931             if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1932             {
1933                 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1934             }
1935
1936             if( _stageContextLostEventCallbackDelegate != null )
1937             {
1938                 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1939             }
1940
1941             if( _stageContextRegainedEventCallbackDelegate != null )
1942             {
1943                 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1944             }
1945
1946             if( _stageSceneCreatedEventCallbackDelegate != null )
1947             {
1948                 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1949             }
1950
1951             if( _windowResizedEventCallback != null )
1952             {
1953                 ResizedSignal().Disconnect(_windowResizedEventCallback);
1954             }
1955
1956             if( _windowFocusChangedEventCallback2 != null )
1957             {
1958                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1959             }
1960
1961         }
1962
1963     }
1964 }