[NUI] Change rotation APIs from internal to public (#1013)
[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         /// <summary>
1218         /// Adds an orientation to the list of available orientations.
1219         /// </summary>
1220         /// <param name="orientation">The available orientation to add</param>
1221         /// <since_tizen> 6 </since_tizen>
1222         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1223         [EditorBrowsable(EditorBrowsableState.Never)]
1224         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1225         {
1226             Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1228         }
1229
1230         /// <summary>
1231         /// Removes an orientation from the list of available orientations.
1232         /// </summary>
1233         /// <param name="orientation">The available orientation to remove.</param>
1234         /// <since_tizen> 6 </since_tizen>
1235         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1236         [EditorBrowsable(EditorBrowsableState.Never)]
1237         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1238         {
1239             Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1240             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1241         }
1242
1243         /// <summary>
1244         /// Sets a preferred orientation.
1245         /// </summary>
1246         /// <param name="orientation">The preferred orientation.</param>
1247         /// <since_tizen> 6 </since_tizen>
1248         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1249         [EditorBrowsable(EditorBrowsableState.Never)]
1250         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1251         {
1252             Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1253             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1254         }
1255
1256         /// <summary>
1257         /// Gets the preferred orientation.
1258         /// </summary>
1259         /// <param name="parent">The parent window.</param>
1260         /// <since_tizen> 6 </since_tizen>
1261         /// <returns>The preferred orientation if previously set, or none.</returns>
1262         [EditorBrowsable(EditorBrowsableState.Never)]
1263         public Window.WindowOrientation GetPreferredOrientation()
1264         {
1265             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
1266             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1267             return ret;
1268         }
1269
1270         internal Any GetNativeHandle()
1271         {
1272             Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1273             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1274             return ret;
1275         }
1276
1277         internal WindowFocusSignalType FocusChangedSignal()
1278         {
1279             WindowFocusSignalType ret = new WindowFocusSignalType(Interop.Window.FocusChangedSignal(swigCPtr), false);
1280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1281             return ret;
1282         }
1283
1284         internal void Add(Layer layer)
1285         {
1286             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1288
1289             LayersChildren?.Add(layer);
1290             layer.SetWindow(this);
1291         }
1292
1293         internal void Remove(Layer layer)
1294         {
1295             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1296             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1297
1298             LayersChildren?.Remove(layer);
1299             layer.SetWindow(null);
1300         }
1301
1302         internal Vector2 GetSize()
1303         {
1304             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1305             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1306             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1307             return ret;
1308         }
1309
1310         internal RenderTaskList GetRenderTaskList()
1311         {
1312             RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1313             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1314             return ret;
1315         }
1316
1317         /// <summary>
1318         /// Queries the number of on-window layers.
1319         /// </summary>
1320         /// <returns>The number of layers.</returns>
1321         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1322         internal uint GetLayerCount()
1323         {
1324             if (LayersChildren == null || LayersChildren.Count < 0)
1325                 return 0;
1326
1327             return (uint) LayersChildren.Count;
1328         }
1329
1330         internal Layer GetRootLayer()
1331         {
1332             // Window.IsInstalled() is actually true only when called from event thread and
1333             // Core has been initialized, not when Stage is ready.
1334             if (_rootLayer == null && Window.IsInstalled())
1335             {
1336                 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1337                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338                 LayersChildren?.Add(_rootLayer);
1339                 _rootLayer.SetWindow(this);
1340             }
1341             return _rootLayer;
1342         }
1343
1344         internal void SetBackgroundColor(Vector4 color)
1345         {
1346             Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1347             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348         }
1349
1350         internal Vector4 GetBackgroundColor()
1351         {
1352             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1353             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1354             return ret;
1355         }
1356
1357         internal Vector2 GetDpi()
1358         {
1359             Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361             return ret;
1362         }
1363
1364         internal ObjectRegistry GetObjectRegistry()
1365         {
1366             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368             return ret;
1369         }
1370
1371         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1372         {
1373             Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1374             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1375         }
1376
1377         internal RenderingBehaviorType GetRenderingBehavior()
1378         {
1379             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1380             if (NDalicPINVOKE.SWIGPendingException.Pending)
1381                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382             return ret;
1383         }
1384
1385         internal KeyEventSignal KeyEventSignal()
1386         {
1387             KeyEventSignal ret = new KeyEventSignal(Interop.Window.KeyEventSignal(swigCPtr), false);
1388             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1389             return ret;
1390         }
1391
1392         internal VoidSignal EventProcessingFinishedSignal()
1393         {
1394             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_EventProcessingFinishedSignal(stageCPtr), false);
1395             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1396             return ret;
1397         }
1398
1399         internal TouchSignal TouchSignal()
1400         {
1401             TouchSignal ret = new TouchSignal(Interop.Window.TouchSignal(swigCPtr), false);
1402             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1403             return ret;
1404         }
1405
1406         internal TouchDataSignal TouchDataSignal()
1407         {
1408             TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
1409             if (NDalicPINVOKE.SWIGPendingException.Pending)
1410                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1411             return ret;
1412         }
1413
1414         internal VoidSignal ContextLostSignal()
1415         {
1416             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextLostSignal(stageCPtr), false);
1417             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1418             return ret;
1419         }
1420
1421         internal VoidSignal ContextRegainedSignal()
1422         {
1423             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_ContextRegainedSignal(stageCPtr), false);
1424             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425             return ret;
1426         }
1427
1428         internal VoidSignal SceneCreatedSignal()
1429         {
1430             VoidSignal ret = new VoidSignal(Interop.StageSignal.Stage_SceneCreatedSignal(stageCPtr), false);
1431             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1432             return ret;
1433         }
1434
1435         internal ResizedSignal ResizedSignal()
1436         {
1437             ResizedSignal ret = new ResizedSignal(Interop.Window.Window_ResizedSignal(swigCPtr), false);
1438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1439             return ret;
1440         }
1441
1442         internal void SetWindowSize(Size2D size)
1443         {
1444             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1445             Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1446
1447             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448
1449             // Resetting Window size should request a relayout of the tree.
1450         }
1451
1452         internal Size2D GetWindowSize()
1453         {
1454             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1455             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1456
1457             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458             return ret;
1459         }
1460
1461         internal void SetPosition(Position2D position)
1462         {
1463             var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1464             Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1465
1466             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1467
1468             // Setting Position of the window should request a relayout of the tree.
1469
1470         }
1471
1472         internal Position2D GetPosition()
1473         {
1474             var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1475             Position2D ret = new Position2D(val.GetX(), val.GetY());
1476
1477             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478             return ret;
1479         }
1480
1481         internal void SetPositionSize(Rectangle positionSize)
1482         {
1483             Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1484
1485             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1486
1487             // Setting Position of the window should request a relayout of the tree.
1488
1489         }
1490
1491         /// <summary>
1492         /// Sets whether the window is transparent or not.
1493         /// </summary>
1494         /// <param name="transparent">Whether the window is transparent or not.</param>
1495         /// <since_tizen> 5 </since_tizen>
1496         public void SetTransparency(bool transparent) {
1497             Interop.Window.SetTransparency(swigCPtr, transparent);
1498             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1499
1500             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1501
1502         }
1503
1504         /// <summary>
1505         /// Sets parent window of the window.
1506         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1507         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1508         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1509         /// </summary>
1510         /// <param name="parent">The parent window.</param>
1511         /// <since_tizen> 6 </since_tizen>
1512         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1513         [EditorBrowsable(EditorBrowsableState.Never)]
1514         public void SetParent(Window parent) {
1515             Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
1516             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1517         }
1518
1519         /// <summary>
1520         /// Unsets parent window of the window.
1521         /// After unsetting, the window is disconnected his parent window.
1522         /// </summary>
1523         /// <since_tizen> 6 </since_tizen>
1524         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1525         [EditorBrowsable(EditorBrowsableState.Never)]
1526         public void Unparent() {
1527             Interop.Window.Unparent(swigCPtr);
1528             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1529         }
1530
1531         /// <summary>
1532         /// Gets parent window of the window.
1533         /// </summary>
1534         /// <returns>The parent window of the window.</returns>
1535         /// <since_tizen> 6 </since_tizen>
1536         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1537         [EditorBrowsable(EditorBrowsableState.Never)]
1538         public Window GetParent() {
1539             Window ret = new Window(Interop.Window.GetParent(swigCPtr), true);
1540             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1541             return ret;
1542         }
1543
1544         /// <summary>
1545         /// Dispose for Window
1546         /// </summary>
1547         [EditorBrowsable(EditorBrowsableState.Never)]
1548         protected override void Dispose(DisposeTypes type)
1549         {
1550             if (disposed)
1551             {
1552                 return;
1553             }
1554
1555             if (type == DisposeTypes.Explicit)
1556             {
1557                 //Called by User
1558                 //Release your own managed resources here.
1559                 //You should release all of your own disposable objects here.
1560
1561                 _rootLayer.Dispose();
1562                 localController.Dispose();
1563
1564                 foreach(var layer in _childLayers)
1565                 {
1566                     layer.Dispose();
1567                 }
1568                 _childLayers.Clear();
1569             }
1570
1571             this.DisconnectNativeSignals();
1572
1573             //Release your own unmanaged resources here.
1574             //You should not access any managed member here except static instance.
1575             //because the execution order of Finalizes is non-deterministic.
1576
1577             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1578             {
1579                 if (swigCMemOwn)
1580                 {
1581                     swigCMemOwn = false;
1582                     Interop.Window.delete_Window(swigCPtr);
1583                 }
1584                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1585             }
1586
1587             base.Dispose(type);
1588         }
1589
1590         internal System.IntPtr GetNativeWindowHandler()
1591         {
1592             System.IntPtr ret = Interop.Window.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
1593             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1594             return ret;
1595         }
1596
1597         private void OnWindowFocusedChanged(bool focusGained)
1598         {
1599             FocusChangedEventArgs e = new FocusChangedEventArgs();
1600
1601             e.FocusGained = focusGained;
1602
1603             if (_windowFocusChangedEventHandler != null)
1604             {
1605                 _windowFocusChangedEventHandler(this, e);
1606             }
1607         }
1608
1609         private StageWheelSignal WheelEventSignal()
1610         {
1611             StageWheelSignal ret = new StageWheelSignal(Interop.StageSignal.Stage_WheelEventSignal(stageCPtr), false);
1612             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1613             return ret;
1614         }
1615
1616         private WheelSignal StageWheelEventSignal()
1617         {
1618             WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
1619             if (NDalicPINVOKE.SWIGPendingException.Pending)
1620                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1621             return ret;
1622         }
1623
1624         private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1625         {
1626             if (touchData == global::System.IntPtr.Zero)
1627             {
1628                 NUILog.Error("touchData should not be null!");
1629                 return false;
1630             }
1631
1632             TouchEventArgs e = new TouchEventArgs();
1633
1634             e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1635
1636             if (_rootLayerTouchDataEventHandler != null)
1637             {
1638                 _rootLayerTouchDataEventHandler(this, e);
1639             }
1640             return false;
1641         }
1642
1643         private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1644         {
1645             if (wheelEvent == global::System.IntPtr.Zero)
1646             {
1647                 NUILog.Error("wheelEvent should not be null!");
1648                 return true;
1649             }
1650
1651             WheelEventArgs e = new WheelEventArgs();
1652
1653             e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1654
1655             if (_stageWheelHandler != null)
1656             {
1657                 _stageWheelHandler(this, e);
1658             }
1659             return true;
1660         }
1661
1662         // Callback for Stage KeyEventsignal
1663         private void OnStageKey(IntPtr data)
1664         {
1665             KeyEventArgs e = new KeyEventArgs();
1666             e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1667
1668
1669             if (_stageKeyHandler != null)
1670             {
1671                 //here we send all data to user event handlers
1672                 _stageKeyHandler(this, e);
1673             }
1674         }
1675
1676         // Callback for Stage EventProcessingFinishedSignal
1677         private void OnEventProcessingFinished()
1678         {
1679             if (_stageEventProcessingFinishedEventHandler != null)
1680             {
1681                 _stageEventProcessingFinishedEventHandler(this, null);
1682             }
1683         }
1684
1685         // Callback for Stage ContextLostSignal
1686         private void OnContextLost()
1687         {
1688             if (_stageContextLostEventHandler != null)
1689             {
1690                 _stageContextLostEventHandler(this, null);
1691             }
1692         }
1693
1694         // Callback for Stage ContextRegainedSignal
1695         private void OnContextRegained()
1696         {
1697             if (_stageContextRegainedEventHandler != null)
1698             {
1699                 _stageContextRegainedEventHandler(this, null);
1700             }
1701         }
1702
1703         // Callback for Stage SceneCreatedSignal
1704         private void OnSceneCreated()
1705         {
1706             if (_stageSceneCreatedEventHandler != null)
1707             {
1708                 _stageSceneCreatedEventHandler(this, null);
1709             }
1710         }
1711
1712         private void OnResized(IntPtr windowSize)
1713         {
1714             ResizedEventArgs e = new ResizedEventArgs();
1715             var val = new Uint16Pair(windowSize, false);
1716             e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1717             val.Dispose();
1718
1719             if (_windowResizedEventHandler != null)
1720             {
1721                 _windowResizedEventHandler(this, e);
1722             }
1723         }
1724
1725         private void OnWindowFocusedChanged2(bool focusGained)
1726         {
1727             FocusChangedEventArgs e = new FocusChangedEventArgs();
1728
1729             e.FocusGained = focusGained;
1730
1731             if (_windowFocusChangedEventHandler2 != null)
1732             {
1733                 _windowFocusChangedEventHandler2(this, e);
1734             }
1735         }
1736
1737         /// <summary>
1738         /// The focus changed event argument.
1739         /// </summary>
1740         /// <since_tizen> 3 </since_tizen>
1741         public class FocusChangedEventArgs : EventArgs
1742         {
1743             /// <summary>
1744             /// FocusGained flag.
1745             /// </summary>
1746             /// <since_tizen> 3 </since_tizen>
1747             public bool FocusGained
1748             {
1749                 get;
1750                 set;
1751             }
1752         }
1753
1754         /// <summary>
1755         /// The touch event argument.
1756         /// </summary>
1757         /// <since_tizen> 3 </since_tizen>
1758         public class TouchEventArgs : EventArgs
1759         {
1760             private Touch _touch;
1761
1762             /// <summary>
1763             /// Touch.
1764             /// </summary>
1765             /// <since_tizen> 3 </since_tizen>
1766             public Touch Touch
1767             {
1768                 get
1769                 {
1770                     return _touch;
1771                 }
1772                 set
1773                 {
1774                     _touch = value;
1775                 }
1776             }
1777         }
1778
1779         /// <summary>
1780         /// Wheel event arguments.
1781         /// </summary>
1782         /// <since_tizen> 3 </since_tizen>
1783         public class WheelEventArgs : EventArgs
1784         {
1785             private Wheel _wheel;
1786
1787             /// <summary>
1788             /// Wheel.
1789             /// </summary>
1790             /// <since_tizen> 3 </since_tizen>
1791             public Wheel Wheel
1792             {
1793                 get
1794                 {
1795                     return _wheel;
1796                 }
1797                 set
1798                 {
1799                     _wheel = value;
1800                 }
1801             }
1802         }
1803
1804         /// <summary>
1805         /// Key event arguments.
1806         /// </summary>
1807         /// <since_tizen> 3 </since_tizen>
1808         public class KeyEventArgs : EventArgs
1809         {
1810             private Key _key;
1811
1812             /// <summary>
1813             /// Key.
1814             /// </summary>
1815             /// <since_tizen> 3 </since_tizen>
1816             public Key Key
1817             {
1818                 get
1819                 {
1820                     return _key;
1821                 }
1822                 set
1823                 {
1824                     _key = value;
1825                 }
1826             }
1827         }
1828
1829         /// <summary>
1830         /// Sets position and size of the window. This API guarantees that
1831         /// both moving and resizing of window will appear on the screen at once.
1832         /// </summary>
1833         [EditorBrowsable(EditorBrowsableState.Never)]
1834         public Rectangle WindowPositionSize
1835         {
1836             get
1837             {
1838                 Position2D position = GetPosition();
1839                 Size2D size = GetSize();
1840                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
1841                 return ret;
1842             }
1843             set
1844             {
1845                 SetPositionSize(value);
1846             }
1847         }
1848
1849         /// <summary>
1850         /// Feeds a key event into the window.
1851         /// This resized event arguments.
1852         /// </summary>
1853         /// <since_tizen> 3 </since_tizen>
1854         public class ResizedEventArgs : EventArgs
1855         {
1856             Size2D _windowSize;
1857
1858             /// <summary>
1859             /// This window size.
1860             /// </summary>
1861             /// <since_tizen> 4 </since_tizen>
1862             public Size2D WindowSize
1863             {
1864                 get
1865                 {
1866                     return _windowSize;
1867                 }
1868                 set
1869                 {
1870                     _windowSize = value;
1871                 }
1872             }
1873         }
1874
1875         /// <summary>
1876         /// Please do not use! this will be deprecated
1877         /// </summary>
1878         /// <since_tizen> 3 </since_tizen>
1879         [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1880             "Like: " +
1881             "Window.Instance.FocusChanged = OnFocusChanged; " +
1882             "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1883         [EditorBrowsable(EditorBrowsableState.Never)]
1884         public class WindowFocusChangedEventArgs : EventArgs
1885         {
1886             /// <summary>
1887             /// Please do not use! this will be deprecated
1888             /// </summary>
1889             /// <since_tizen> 3 </since_tizen>
1890             public bool FocusGained
1891             {
1892                 get;
1893                 set;
1894             }
1895         }
1896
1897         /// <summary>
1898         /// Contains and encapsulates Native Window handle.
1899         /// </summary>
1900         /// <since_tizen> 4 </since_tizen>
1901         public class SafeNativeWindowHandle : SafeHandle
1902         {
1903             /// <summary>
1904             /// Contructor, Native window handle is set to handle.
1905             /// </summary>
1906             /// <since_tizen> 4 </since_tizen>
1907             public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1908             {
1909                 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1910             }
1911             /// <summary>
1912             /// Null check if the handle is valid or not.
1913             /// </summary>
1914             /// <since_tizen> 4 </since_tizen>
1915             public override bool IsInvalid
1916             {
1917                 get
1918                 {
1919                     return this.handle == IntPtr.Zero;
1920                 }
1921             }
1922             /// <summary>
1923             /// Release handle itself.
1924             /// </summary>
1925             /// <returns>true when released successfully.</returns>
1926             /// <since_tizen> 4 </since_tizen>
1927             protected override bool ReleaseHandle()
1928             {
1929                 return true;
1930             }
1931         }
1932
1933         /// <summary>
1934         /// Disconnect all native signals
1935         /// </summary>
1936         /// <since_tizen> 5 </since_tizen>
1937         internal void DisconnectNativeSignals()
1938         {
1939             if( _windowFocusChangedEventCallback != null )
1940             {
1941                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
1942             }
1943
1944             if( _rootLayerTouchDataCallback != null )
1945             {
1946                 TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1947             }
1948
1949             if( _wheelEventCallback != null )
1950             {
1951                 StageWheelEventSignal().Disconnect(_wheelEventCallback);
1952             }
1953
1954             if( _stageKeyCallbackDelegate != null )
1955             {
1956                 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1957             }
1958
1959             if( _stageEventProcessingFinishedEventCallbackDelegate != null )
1960             {
1961                 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1962             }
1963
1964             if( _stageContextLostEventCallbackDelegate != null )
1965             {
1966                 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1967             }
1968
1969             if( _stageContextRegainedEventCallbackDelegate != null )
1970             {
1971                 ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1972             }
1973
1974             if( _stageSceneCreatedEventCallbackDelegate != null )
1975             {
1976                 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1977             }
1978
1979             if( _windowResizedEventCallback != null )
1980             {
1981                 ResizedSignal().Disconnect(_windowResizedEventCallback);
1982             }
1983
1984             if( _windowFocusChangedEventCallback2 != null )
1985             {
1986                 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1987             }
1988
1989         }
1990
1991     }
1992 }