[NUI] Add NoOrientationPreference (#1221)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using System.Collections.Generic;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.BaseComponents;
22
23 namespace Tizen.NUI
24 {
25     /// <summary>
26     /// The window class is used internally for drawing.<br />
27     /// The window has an orientation and indicator properties.<br />
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public partial class Window : BaseHandle
31     {
32         private static readonly Window instance = Application.Instance?.GetWindow();
33         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34         private global::System.Runtime.InteropServices.HandleRef stageCPtr;
35         private Layer _rootLayer;
36         private string _windowTitle;
37         private List<Layer> _childLayers = new List<Layer>();
38         private LayoutController localController;
39
40         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
41         {
42             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43             if (Interop.Stage.Stage_IsInstalled())
44             {
45                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
46
47                 localController = new LayoutController(this);
48                 NUILog.Debug("layoutController id:" + localController.GetId() );
49             }
50         }
51                 
52         /// <summary>
53         /// Creates a new Window.<br />
54         /// This creates an extra window in addition to the default main window<br />
55         /// </summary>
56         /// <param name="windowPosition">The position and size of the Window.</param>
57         /// <param name="isTranslucent">Whether Window is translucent.</param>
58         /// <returns>A new Window.</returns>
59         /// <since_tizen> 6 </since_tizen>
60         public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
61         {
62             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63         }
64
65         /// <summary>
66         /// Creates a new Window with a specific name.<br />
67         /// This creates an extra window in addition to the default main window<br />
68         /// </summary>
69         /// <param name="name">The name for extra window. </param>
70         /// <param name="windowPosition">The position and size of the Window.</param>
71         /// <param name="isTranslucent">Whether Window is translucent.</param>
72         /// <returns>A new Window.</returns>
73         /// <since_tizen> 6 </since_tizen>
74         public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
75         {
76             this._windowTitle = name;
77             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78         }
79
80         /// <summary>
81         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
82         /// </summary>
83         /// <since_tizen> 3 </since_tizen>
84         public enum WindowOrientation
85         {
86             /// <summary>
87             /// Portrait orientation. The height of the display area is greater than the width.
88             /// </summary>
89             /// <since_tizen> 3 </since_tizen>
90             Portrait = 0,
91             /// <summary>
92             /// Landscape orientation. A wide view area is needed.
93             /// </summary>
94             /// <since_tizen> 3 </since_tizen>
95             Landscape = 90,
96             /// <summary>
97             /// Portrait inverse orientation.
98             /// </summary>
99             /// <since_tizen> 3 </since_tizen>
100             PortraitInverse = 180,
101             /// <summary>
102             /// Landscape inverse orientation.
103             /// </summary>
104             /// <since_tizen> 3 </since_tizen>
105             LandscapeInverse = 270,
106             /// <summary>
107             /// No orientation. It is for the preferred orientation
108             /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
109             /// It is used to unset the preferred orientation with SetPreferredOrientation.
110             /// </summary>
111             [EditorBrowsable(EditorBrowsableState.Never)]
112             NoOrientationPreference = -1
113         }
114
115         /// <summary>
116         /// Enumeration for the key grab mode for platform-level APIs.
117         /// </summary>
118         /// <since_tizen> 3 </since_tizen>
119         public enum KeyGrabMode
120         {
121             /// <summary>
122             /// Grabs a key only when on the top of the grabbing-window stack mode.
123             /// </summary>
124             Topmost = 0,
125             /// <summary>
126             /// Grabs a key together with the other client window(s) mode.
127             /// </summary>
128             Shared,
129             /// <summary>
130             /// 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.
131             /// </summary>
132             OverrideExclusive,
133             /// <summary>
134             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
135             /// </summary>
136             Exclusive
137         };
138
139         /// <summary>
140         /// Enumeration for transition effect's state.
141         /// </summary>
142         [EditorBrowsable(EditorBrowsableState.Never)]
143         public enum EffectStates
144         {
145             /// <summary>
146             /// None state.
147             /// </summary>
148             [EditorBrowsable(EditorBrowsableState.Never)]
149             None = 0,
150             /// <summary>
151             /// Transition effect is started.
152             /// </summary>
153             [EditorBrowsable(EditorBrowsableState.Never)]
154             Start,
155             /// <summary>
156             /// Transition effect is ended.
157             /// </summary>
158             [EditorBrowsable(EditorBrowsableState.Never)]
159             End,
160         }
161
162         /// <summary>
163         /// Enumeration for transition effect's type.
164         /// </summary>
165         [EditorBrowsable(EditorBrowsableState.Never)]
166         public enum EffectTypes
167         {
168             /// <summary>
169             /// None type.
170             /// </summary>
171             [EditorBrowsable(EditorBrowsableState.Never)]
172             None = 0,
173             /// <summary>
174             /// Window show effect.
175             /// </summary>
176             [EditorBrowsable(EditorBrowsableState.Never)]
177             Show,
178             /// <summary>
179             /// Window hide effect.
180             /// </summary>
181             [EditorBrowsable(EditorBrowsableState.Never)]
182             Hide,
183         }
184
185         /// <summary>
186         /// Enumeration for opacity of the indicator.
187         /// </summary>
188         internal enum IndicatorBackgroundOpacity
189         {
190             Opaque = 100,
191             Translucent = 50,
192             Transparent = 0
193         }
194
195         /// <summary>
196         /// Enumeration for visible mode of the indicator.
197         /// </summary>
198         internal enum IndicatorVisibleMode
199         {
200             Invisible = 0,
201             Visible = 1,
202             Auto = 2
203         }
204
205         /// <summary>
206         /// The stage instance property (read-only).<br />
207         /// Gets the current window.<br />
208         /// </summary>
209         /// <since_tizen> 3 </since_tizen>
210         public static Window Instance
211         {
212             get
213             {
214                 return instance;
215             }
216         }
217
218         /// <summary>
219         /// Get Resource ID of window
220         /// </summary>
221         internal int ResourceID
222         {
223             get
224             {
225                 int ret = Interop.Window.GetResouceID(swigCPtr);
226                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227                 return ret;
228             }
229         }
230
231         /// <summary>
232         /// Gets or sets a window type.
233         /// </summary>
234         /// <since_tizen> 3 </since_tizen>
235         public WindowType Type
236         {
237             get
238             {
239                 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
240                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241                 return ret;
242             }
243             set
244             {
245                 Interop.Window.SetType(swigCPtr, (int)value);
246                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247             }
248         }
249
250         /// <summary>
251         /// Gets/Sets a window title.
252         /// </summary>
253         /// <since_tizen> 4 </since_tizen>
254         public string Title
255         {
256             get
257             {
258                 return _windowTitle;
259             }
260             set
261             {
262                 _windowTitle = value;
263                 SetClass(_windowTitle, "");
264             }
265         }
266
267         /// <summary>
268         /// The rendering behavior of a Window.
269         /// </summary>
270         /// <since_tizen> 5 </since_tizen>
271         public RenderingBehaviorType RenderingBehavior
272         {
273             get
274             {
275                 return GetRenderingBehavior();
276             }
277             set
278             {
279                 SetRenderingBehavior(value);
280             }
281         }
282
283         /// <summary>
284         /// The window size property (read-only).
285         /// </summary>
286         /// <since_tizen> 3 </since_tizen>
287         public Size2D Size
288         {
289             get
290             {
291                 Size2D ret = GetSize();
292                 return ret;
293             }
294         }
295
296         /// <summary>
297         /// The background color property.
298         /// </summary>
299         /// <since_tizen> 3 </since_tizen>
300         public Color BackgroundColor
301         {
302             set
303             {
304                 SetBackgroundColor(value);
305             }
306             get
307             {
308                 Color ret = GetBackgroundColor();
309                 return ret;
310             }
311         }
312
313         /// <summary>
314         /// The DPI property (read-only).<br />
315         /// Retrieves the DPI of the display device to which the Window is connected.<br />
316         /// </summary>
317         /// <since_tizen> 3 </since_tizen>
318         public Vector2 Dpi
319         {
320             get
321             {
322                 return GetDpi();
323             }
324         }
325
326         /// <summary>
327         /// The layer count property (read-only).<br />
328         /// Queries the number of on-Window layers.<br />
329         /// </summary>
330         /// <since_tizen> 3 </since_tizen>
331         public uint LayerCount
332         {
333             get
334             {
335                 return GetLayerCount();
336             }
337         }
338
339         /// <summary>
340         /// Gets or sets a size of the window.
341         /// </summary>
342         /// <since_tizen> 4 </since_tizen>
343         public Size2D WindowSize
344         {
345             get
346             {
347                 return GetWindowSize();
348             }
349             set
350             {
351                 SetWindowSize(value);
352             }
353         }
354
355         /// <summary>
356         /// Gets or sets a position of the window.
357         /// </summary>
358         /// <since_tizen> 4 </since_tizen>
359         public Position2D WindowPosition
360         {
361             get
362             {
363                 return GetPosition();
364             }
365             set
366             {
367                 SetPosition(value);
368             }
369         }
370
371         /// <summary>
372         /// Sets position and size of the window. This API guarantees that
373         /// both moving and resizing of window will appear on the screen at once.
374         /// </summary>
375         [EditorBrowsable(EditorBrowsableState.Never)]
376         public Rectangle WindowPositionSize
377         {
378             get
379             {
380                 Position2D position = GetPosition();
381                 Size2D size = GetSize();
382                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
383                 return ret;
384             }
385             set
386             {
387                 SetPositionSize(value);
388             }
389         }
390
391         internal static Vector4 DEFAULT_BACKGROUND_COLOR
392         {
393             get
394             {
395                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
396                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
397                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398                 return ret;
399             }
400         }
401
402         internal static Vector4 DEBUG_BACKGROUND_COLOR
403         {
404             get
405             {
406                 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
407                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
408                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409                 return ret;
410             }
411         }
412
413         internal List<Layer> LayersChildren
414         {
415             get
416             {
417                 return _childLayers;
418             }
419         }
420
421         /// <summary>
422         ///  Get the LayoutController for this Window.
423         /// </summary>
424         internal LayoutController LayoutController
425         {
426             get
427             {
428                 return localController;
429             }
430         }
431
432         /// <summary>
433         /// Feed a key-event into the window.
434         /// </summary>
435         /// <param name="keyEvent">The key event to feed.</param>
436         /// <since_tizen> 4 </since_tizen>
437         [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
438         public static void FeedKeyEvent(Key keyEvent)
439         {
440             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
441             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442         }
443
444         /// <summary>
445         /// Sets whether the window accepts a focus or not.
446         /// </summary>
447         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
448         /// <since_tizen> 3 </since_tizen>
449         public void SetAcceptFocus(bool accept)
450         {
451             Interop.Window.SetAcceptFocus(swigCPtr, accept);
452             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453         }
454
455         /// <summary>
456         /// Returns whether the window accepts a focus or not.
457         /// </summary>
458         /// <returns>True if the window accepts a focus, false otherwise.</returns>
459         /// <since_tizen> 3 </since_tizen>
460         public bool IsFocusAcceptable()
461         {
462             bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
463             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464
465             return ret;
466         }
467
468         /// <summary>
469         /// Shows the window if it is hidden.
470         /// </summary>
471         /// <since_tizen> 3 </since_tizen>
472         public void Show()
473         {
474             Interop.Window.Show(swigCPtr);
475             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476         }
477
478         /// <summary>
479         /// Hides the window if it is showing.
480         /// </summary>
481         /// <since_tizen> 3 </since_tizen>
482         public void Hide()
483         {
484             Interop.Window.Hide(swigCPtr);
485             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486         }
487
488         /// <summary>
489         /// Retrieves whether the window is visible or not.
490         /// </summary>
491         /// <returns>True if the window is visible.</returns>
492         /// <since_tizen> 3 </since_tizen>
493         public bool IsVisible()
494         {
495             bool temp = Interop.Window.IsVisible(swigCPtr);
496             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
497             return temp;
498         }
499
500         /// <summary>
501         /// Gets the count of supported auxiliary hints of the window.
502         /// </summary>
503         /// <returns>The number of supported auxiliary hints.</returns>
504         /// <since_tizen> 3 </since_tizen>
505         public uint GetSupportedAuxiliaryHintCount()
506         {
507             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
508             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509             return ret;
510         }
511
512         /// <summary>
513         /// Gets the supported auxiliary hint string of the window.
514         /// </summary>
515         /// <param name="index">The index of the supported auxiliary hint lists.</param>
516         /// <returns>The auxiliary hint string of the index.</returns>
517         /// <since_tizen> 3 </since_tizen>
518         public string GetSupportedAuxiliaryHint(uint index)
519         {
520             string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
521             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
522             return ret;
523         }
524
525         /// <summary>
526         /// Creates an auxiliary hint of the window.
527         /// </summary>
528         /// <param name="hint">The auxiliary hint string.</param>
529         /// <param name="value">The value string.</param>
530         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
531         /// <since_tizen> 3 </since_tizen>
532         public uint AddAuxiliaryHint(string hint, string value)
533         {
534             uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
535             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536             return ret;
537         }
538
539         /// <summary>
540         /// Removes an auxiliary hint of the window.
541         /// </summary>
542         /// <param name="id">The ID of the auxiliary hint.</param>
543         /// <returns>True if no error occurred, false otherwise.</returns>
544         /// <since_tizen> 3 </since_tizen>
545         public bool RemoveAuxiliaryHint(uint id)
546         {
547             bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
548             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
549             return ret;
550         }
551
552         /// <summary>
553         /// Changes a value of the auxiliary hint.
554         /// </summary>
555         /// <param name="id">The auxiliary hint ID.</param>
556         /// <param name="value">The value string to be set.</param>
557         /// <returns>True if no error occurred, false otherwise.</returns>
558         /// <since_tizen> 3 </since_tizen>
559         public bool SetAuxiliaryHintValue(uint id, string value)
560         {
561             bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
562             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
563             return ret;
564         }
565
566         /// <summary>
567         /// Gets a value of the auxiliary hint.
568         /// </summary>
569         /// <param name="id">The auxiliary hint ID.</param>
570         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
571         /// <since_tizen> 3 </since_tizen>
572         public string GetAuxiliaryHintValue(uint id)
573         {
574             string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
575             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576             return ret;
577         }
578
579         /// <summary>
580         /// Gets an ID of the auxiliary hint string.
581         /// </summary>
582         /// <param name="hint">The auxiliary hint string.</param>
583         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
584         /// <since_tizen> 3 </since_tizen>
585         public uint GetAuxiliaryHintId(string hint)
586         {
587             uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
588             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589             return ret;
590         }
591
592         /// <summary>
593         /// Sets a region to accept input events.
594         /// </summary>
595         /// <param name="inputRegion">The region to accept input events.</param>
596         /// <since_tizen> 3 </since_tizen>
597         public void SetInputRegion(Rectangle inputRegion)
598         {
599             Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
600             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601         }
602
603         /// <summary>
604         /// Sets a priority level for the specified notification window.
605         /// </summary>
606         /// <param name="level">The notification window level.</param>
607         /// <returns>True if no error occurred, false otherwise.</returns>
608         /// <since_tizen> 3 </since_tizen>
609         public bool SetNotificationLevel(NotificationLevel level)
610         {
611             bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
612             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613             return ret;
614         }
615
616         /// <summary>
617         /// Gets a priority level for the specified notification window.
618         /// </summary>
619         /// <returns>The notification window level.</returns>
620         /// <since_tizen> 3 </since_tizen>
621         public NotificationLevel GetNotificationLevel()
622         {
623             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
624             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625             return ret;
626         }
627
628         /// <summary>
629         /// Sets a transparent window's visual state to opaque. <br />
630         /// If a visual state of a transparent window is opaque, <br />
631         /// then the window manager could handle it as an opaque window when calculating visibility.
632         /// </summary>
633         /// <param name="opaque">Whether the window's visual state is opaque.</param>
634         /// <remarks>This will have no effect on an opaque window. <br />
635         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
636         /// </remarks>
637         /// <since_tizen> 3 </since_tizen>
638         public void SetOpaqueState(bool opaque)
639         {
640             Interop.Window.SetOpaqueState(swigCPtr, opaque);
641             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642         }
643
644         /// <summary>
645         /// Returns whether a transparent window's visual state is opaque or not.
646         /// </summary>
647         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
648         /// <remarks> The return value has no meaning on an opaque window. </remarks>
649         /// <since_tizen> 3 </since_tizen>
650         public bool IsOpaqueState()
651         {
652             bool ret = Interop.Window.IsOpaqueState(swigCPtr);
653             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654             return ret;
655         }
656
657         /// <summary>
658         /// Sets a window's screen off mode.
659         /// </summary>
660         /// <param name="screenOffMode">The screen mode.</param>
661         /// <returns>True if no error occurred, false otherwise.</returns>
662         /// <since_tizen> 4 </since_tizen>
663         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
664         {
665             bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
666             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667             return ret;
668         }
669
670         /// <summary>
671         /// Gets the screen mode of the window.
672         /// </summary>
673         /// <returns>The screen off mode.</returns>
674         /// <since_tizen> 4 </since_tizen>
675         public ScreenOffMode GetScreenOffMode()
676         {
677             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
678             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
679             return ret;
680         }
681
682         /// <summary>
683         /// Sets preferred brightness of the window.
684         /// </summary>
685         /// <param name="brightness">The preferred brightness (0 to 100).</param>
686         /// <returns>True if no error occurred, false otherwise.</returns>
687         /// <since_tizen> 3 </since_tizen>
688         public bool SetBrightness(int brightness)
689         {
690             bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
691             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
692             return ret;
693         }
694
695         /// <summary>
696         /// Gets the preferred brightness of the window.
697         /// </summary>
698         /// <returns>The preferred brightness.</returns>
699         /// <since_tizen> 3 </since_tizen>
700         public int GetBrightness()
701         {
702             int ret = Interop.Window.GetBrightness(swigCPtr);
703             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
704             return ret;
705         }
706
707         /// <summary>
708         /// Sets the window name and the class string.
709         /// </summary>
710         /// <param name="name">The name of the window.</param>
711         /// <param name="klass">The class of the window.</param>
712         /// <since_tizen> 4 </since_tizen>
713         public void SetClass(string name, string klass)
714         {
715             Interop.Window.Window_SetClass(swigCPtr, name, klass);
716             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717         }
718
719         /// <summary>
720         /// Raises the window to the top of the window stack.
721         /// </summary>
722         /// <since_tizen> 3 </since_tizen>
723         public void Raise()
724         {
725             Interop.Window.Window_Raise(swigCPtr);
726             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
727         }
728
729         /// <summary>
730         /// Lowers the window to the bottom of the window stack.
731         /// </summary>
732         /// <since_tizen> 3 </since_tizen>
733         public void Lower()
734         {
735             Interop.Window.Window_Lower(swigCPtr);
736             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737         }
738
739         /// <summary>
740         /// Activates the window to the top of the window stack even it is iconified.
741         /// </summary>
742         /// <since_tizen> 3 </since_tizen>
743         public void Activate()
744         {
745             Interop.Window.Window_Activate(swigCPtr);
746             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747         }
748
749         /// <summary>
750         /// Gets the default ( root ) layer.
751         /// </summary>
752         /// <returns>The root layer.</returns>
753         /// <since_tizen> 3 </since_tizen>
754         public Layer GetDefaultLayer()
755         {
756             return this.GetRootLayer();
757         }
758
759         /// <summary>
760         /// Add a child view to window.
761         /// </summary>
762         /// <param name="view">the child should be added to the window.</param>
763         /// <since_tizen> 3 </since_tizen>
764         public void Add(View view)
765         {
766             Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
767             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768             this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
769             view.InternalParent = this.GetRootLayer();
770         }
771
772         /// <summary>
773         /// Remove a child view from window.
774         /// </summary>
775         /// <param name="view">the child to be removed.</param>
776         /// <since_tizen> 3 </since_tizen>
777         public void Remove(View view)
778         {
779             Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
780             this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
781             view.InternalParent = null;
782         }
783
784         /// <summary>
785         /// Retrieves the layer at a specified depth.
786         /// </summary>
787         /// <param name="depth">The layer's depth index.</param>
788         /// <returns>The layer found at the given depth.</returns>
789         /// <since_tizen> 3 </since_tizen>
790         public Layer GetLayer(uint depth)
791         {
792             if (depth < LayersChildren?.Count)
793             {
794                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
795                 return ret;
796             }
797             else
798             {
799                 return null;
800             }
801         }
802
803         /// <summary>
804         /// Destroy the window immediately.
805         /// </summary>
806         [EditorBrowsable(EditorBrowsableState.Never)]
807         public void Destroy()
808         {
809             this.Dispose();
810         }
811
812         /// <summary>
813         /// Keep rendering for at least the given amount of time.
814         /// </summary>
815         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
816         /// <since_tizen> 3 </since_tizen>
817         public void KeepRendering(float durationSeconds)
818         {
819             Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
820             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
821         }
822
823         /// <summary>
824         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
825         /// This function can be used for following example scenarios: <br />
826         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
827         /// </summary>
828         /// <param name="DaliKey">The key code to grab.</param>
829         /// <returns>True if the grab succeeds.</returns>
830         /// <since_tizen> 3 </since_tizen>
831         public bool GrabKeyTopmost(int DaliKey)
832         {
833             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
834             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
835             return ret;
836         }
837
838         /// <summary>
839         /// Ungrabs the key specified by a key for the window.<br />
840         /// 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 />
841         /// </summary>
842         /// <param name="DaliKey">The key code to ungrab.</param>
843         /// <returns>True if the ungrab succeeds.</returns>
844         /// <since_tizen> 3 </since_tizen>
845         public bool UngrabKeyTopmost(int DaliKey)
846         {
847             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
848             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
849             return ret;
850         }
851
852         /// <summary>
853         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
854         ///  Details: This function can be used for following example scenarios: <br />
855         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
856         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
857         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
858         /// </summary>
859         /// <param name="DaliKey">The key code to grab.</param>
860         /// <param name="GrabMode">The grab mode for the key.</param>
861         /// <returns>True if the grab succeeds.</returns>
862         /// <since_tizen> 3 </since_tizen>
863         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
864         {
865             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
866             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867             return ret;
868         }
869
870         /// <summary>
871         /// Ungrabs the key specified by a key for a window.<br />
872         /// 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 />
873         /// </summary>
874         /// <param name="DaliKey">The key code to ungrab.</param>
875         /// <returns>True if the ungrab succeeds.</returns>
876         /// <since_tizen> 3 </since_tizen>
877         public bool UngrabKey(int DaliKey)
878         {
879             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
880             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
881             return ret;
882         }
883
884         /// <summary>
885         /// Sets the keyboard repeat information.
886         /// </summary>
887         /// <param name="rate">The key repeat rate value in seconds.</param>
888         /// <param name="delay">The key repeat delay value in seconds.</param>
889         /// <returns>True if setting the keyboard repeat succeeds.</returns>
890         /// <since_tizen> 5 </since_tizen>
891         public bool SetKeyboardRepeatInfo(float rate, float delay)
892         {
893             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
894             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
895             return ret;
896         }
897
898         /// <summary>
899         /// Gets the keyboard repeat information.
900         /// </summary>
901         /// <param name="rate">The key repeat rate value in seconds.</param>
902         /// <param name="delay">The key repeat delay value in seconds.</param>
903         /// <returns>True if setting the keyboard repeat succeeds.</returns>
904         /// <since_tizen> 5 </since_tizen>
905         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
906         {
907             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
908             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
909             return ret;
910         }
911
912         /// <summary>
913         /// Adds a layer to the stage.
914         /// </summary>
915         /// <param name="layer">Layer to add.</param>
916         /// <since_tizen> 3 </since_tizen>
917         public void AddLayer(Layer layer)
918         {
919             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
920             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921
922             LayersChildren?.Add(layer);
923             layer.SetWindow(this);
924         }
925
926         /// <summary>
927         /// Removes a layer from the stage.
928         /// </summary>
929         /// <param name="layer">Layer to remove.</param>
930         /// <since_tizen> 3 </since_tizen>
931         public void RemoveLayer(Layer layer)
932         {
933             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
934             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935
936             LayersChildren?.Remove(layer);
937             layer.SetWindow(null);
938         }
939
940         /// <summary>
941         /// Feeds a key event into the window.
942         /// </summary>
943         /// <param name="keyEvent">The key event to feed.</param>
944         /// <since_tizen> 5 </since_tizen>
945         public void FeedKey(Key keyEvent)
946         {
947             Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
948             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949         }
950
951         /// <summary>
952         /// Allows at least one more render, even when paused.
953         /// The window should be shown, not minimised.
954         /// </summary>
955         /// <since_tizen> 4 </since_tizen>
956         public void RenderOnce()
957         {
958             Interop.Window.Window_RenderOnce(swigCPtr);
959             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960         }
961
962         /// <summary>
963         /// Sets whether the window is transparent or not.
964         /// </summary>
965         /// <param name="transparent">Whether the window is transparent or not.</param>
966         /// <since_tizen> 5 </since_tizen>
967         public void SetTransparency(bool transparent)
968         {
969             Interop.Window.SetTransparency(swigCPtr, transparent);
970             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971
972             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
973         }
974
975         /// <summary>
976         /// Sets parent window of the window.
977         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
978         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
979         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
980         /// </summary>
981         /// <param name="parent">The parent window.</param>
982         /// <since_tizen> 6 </since_tizen>
983         public void SetParent(Window parent)
984         {
985             Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
986             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
987         }
988
989         /// <summary>
990         /// Unsets parent window of the window.
991         /// After unsetting, the window is disconnected his parent window.
992         /// </summary>
993         /// <since_tizen> 6 </since_tizen>
994         public void Unparent()
995         {
996             Interop.Window.Unparent(swigCPtr);
997             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
998         }
999
1000         /// <summary>
1001         /// Gets parent window of the window.
1002         /// </summary>
1003         /// <returns>The parent window of the window.</returns>
1004         /// <since_tizen> 6 </since_tizen>
1005         public Window GetParent()
1006         {
1007             Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(swigCPtr)) as Window;
1008             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1009             return ret;
1010         }
1011
1012         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1013         {
1014             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1015         }
1016
1017         internal static Window GetCurrent()
1018         {
1019             Window ret = new Window(Interop.Stage.Stage_GetCurrent(), true);
1020             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1021             return ret;
1022         }
1023
1024         internal static bool IsInstalled()
1025         {
1026             bool ret = Interop.Stage.Stage_IsInstalled();
1027             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1028             return ret;
1029         }
1030
1031         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1032         {
1033             Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1034             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035         }
1036
1037         internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1038         {
1039             Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1040             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041         }
1042
1043         internal void RotateIndicator(Window.WindowOrientation orientation)
1044         {
1045             Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1046             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1047         }
1048
1049         /// <summary>
1050         /// Adds an orientation to the list of available orientations.
1051         /// </summary>
1052         /// <param name="orientation">The available orientation to add</param>
1053         /// <since_tizen> 6 </since_tizen>
1054         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1055         {
1056             Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1057             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1058         }
1059
1060         /// <summary>
1061         /// Removes an orientation from the list of available orientations.
1062         /// </summary>
1063         /// <param name="orientation">The available orientation to remove.</param>
1064         /// <since_tizen> 6 </since_tizen>
1065         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1066         {
1067             Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1068             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1069         }
1070
1071         /// <summary>
1072         /// Sets a preferred orientation.
1073         /// </summary>
1074         /// <param name="orientation">The preferred orientation.</param>
1075         /// <since_tizen> 6 </since_tizen>
1076         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1077         {
1078             Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1079             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1080         }
1081
1082         /// <summary>
1083         /// Gets the preferred orientation.
1084         /// </summary>
1085         /// <since_tizen> 6 </since_tizen>
1086         /// <returns>The preferred orientation if previously set, or none.</returns>
1087         public Window.WindowOrientation GetPreferredOrientation()
1088         {
1089             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
1090             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091             return ret;
1092         }
1093
1094         internal Any GetNativeHandle()
1095         {
1096             Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1097             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1098             return ret;
1099         }
1100
1101         internal void Add(Layer layer)
1102         {
1103             Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1105
1106             LayersChildren?.Add(layer);
1107             layer.SetWindow(this);
1108         }
1109
1110         internal void Remove(Layer layer)
1111         {
1112             Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1113             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1114
1115             LayersChildren?.Remove(layer);
1116             layer.SetWindow(null);
1117         }
1118
1119         internal Vector2 GetSize()
1120         {
1121             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1122             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124             return ret;
1125         }
1126
1127         internal RenderTaskList GetRenderTaskList()
1128         {
1129             RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1131             return ret;
1132         }
1133
1134         /// <summary>
1135         /// Queries the number of on-window layers.
1136         /// </summary>
1137         /// <returns>The number of layers.</returns>
1138         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1139         internal uint GetLayerCount()
1140         {
1141             if (LayersChildren == null || LayersChildren.Count < 0)
1142                 return 0;
1143
1144             return (uint) LayersChildren.Count;
1145         }
1146
1147         internal Layer GetRootLayer()
1148         {
1149             // Window.IsInstalled() is actually true only when called from event thread and
1150             // Core has been initialized, not when Stage is ready.
1151             if (_rootLayer == null && Window.IsInstalled())
1152             {
1153                 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1154                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155                 LayersChildren?.Add(_rootLayer);
1156                 _rootLayer.SetWindow(this);
1157             }
1158             return _rootLayer;
1159         }
1160
1161         internal void SetBackgroundColor(Vector4 color)
1162         {
1163             Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1165         }
1166
1167         internal Vector4 GetBackgroundColor()
1168         {
1169             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1171             return ret;
1172         }
1173
1174         internal Vector2 GetDpi()
1175         {
1176             Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1178             return ret;
1179         }
1180
1181         internal ObjectRegistry GetObjectRegistry()
1182         {
1183             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1184             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185             return ret;
1186         }
1187
1188         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1189         {
1190             Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1192         }
1193
1194         internal RenderingBehaviorType GetRenderingBehavior()
1195         {
1196             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1197             if (NDalicPINVOKE.SWIGPendingException.Pending)
1198                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199             return ret;
1200         }
1201
1202         internal void SetWindowSize(Size2D size)
1203         {
1204             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1205             Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1206
1207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1208
1209             // Resetting Window size should request a relayout of the tree.
1210         }
1211
1212         internal Size2D GetWindowSize()
1213         {
1214             var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1215             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1216
1217             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218             return ret;
1219         }
1220
1221         internal void SetPosition(Position2D position)
1222         {
1223             var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1224             Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1225
1226             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1227             // Setting Position of the window should request a relayout of the tree.
1228         }
1229
1230         internal Position2D GetPosition()
1231         {
1232             var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1233             Position2D ret = new Position2D(val.GetX(), val.GetY());
1234
1235             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1236             return ret;
1237         }
1238
1239         internal void SetPositionSize(Rectangle positionSize)
1240         {
1241             Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1242
1243             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244
1245             // Setting Position of the window should request a relayout of the tree.
1246         }
1247
1248         /// <summary>
1249         /// Dispose for Window
1250         /// </summary>
1251         [EditorBrowsable(EditorBrowsableState.Never)]
1252         protected override void Dispose(DisposeTypes type)
1253         {
1254             if (disposed)
1255             {
1256                 return;
1257             }
1258
1259             if (type == DisposeTypes.Explicit)
1260             {
1261                 //Called by User
1262                 //Release your own managed resources here.
1263                 //You should release all of your own disposable objects here.
1264
1265                 _rootLayer.Dispose();
1266                 localController.Dispose();
1267
1268                 foreach(var layer in _childLayers)
1269                 {
1270                     layer.Dispose();
1271                 }
1272                 _childLayers.Clear();
1273             }
1274
1275             this.DisconnectNativeSignals();
1276
1277             //Release your own unmanaged resources here.
1278             //You should not access any managed member here except static instance.
1279             //because the execution order of Finalizes is non-deterministic.
1280
1281             if (swigCPtr.Handle != global::System.IntPtr.Zero)
1282             {
1283                 if (swigCMemOwn)
1284                 {
1285                     swigCMemOwn = false;
1286                     Interop.Window.delete_Window(swigCPtr);
1287                 }
1288                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1289             }
1290
1291             base.Dispose(type);
1292         }
1293     }
1294 }