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