[NUI] Change property get/set not to use PropertyValue (patch set4)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window / Window.cs
1 /*
2  * Copyright(c) 2021 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
18 extern alias TizenSystemInformation;
19 using TizenSystemInformation.Tizen.System;
20
21 using System;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24 using System.Runtime.InteropServices;
25
26 using Tizen.NUI.BaseComponents;
27
28 namespace Tizen.NUI
29 {
30     /// <summary>
31     /// The window class is used internally for drawing.<br />
32     /// The window has an orientation and indicator properties.<br />
33     /// </summary>
34     /// <since_tizen> 3 </since_tizen>
35     public partial class Window : BaseHandle
36     {
37         private HandleRef stageCPtr;
38         private Layer rootLayer;
39         private Layer borderLayer;
40         private string windowTitle;
41         private List<Layer> childLayers = new List<Layer>();
42         private LayoutController localController;
43
44         static internal bool IsSupportedMultiWindow()
45         {
46             bool isSupported = false;
47             try
48             {
49                 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
50             }
51             catch (DllNotFoundException e)
52             {
53                 Tizen.Log.Fatal("NUI", $"{e}\n");
54             }
55             return isSupported;
56         }
57 #if NUI_PROPERTY_CHANGE_DEBUG
58 private bool flag1 = false;
59 #endif
60         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
61         {
62             if (Interop.Stage.IsInstalled())
63             {
64                 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
65
66                 localController = new LayoutController(this);
67                 NUILog.Debug("layoutController id:" + localController.GetId());
68
69 #if NUI_PROPERTY_CHANGE_DEBUG
70 Tizen.Log.Fatal("NUITEST", $"Window constructor called!");
71 if(flag1 == false)
72 {
73     flag1 = true;
74     var curTh = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
75     Tizen.Log.Fatal("NUITEST", $"current threadID : {curTh}");
76     if(curTh == 1)
77     {
78         this.KeyEvent += TestWindowKeyEventHandler;
79         Tizen.Log.Fatal("NUITEST", $"TestWindowKeyEventHandler() added");
80     }
81 }
82 #endif
83
84             }
85         }
86
87 #if NUI_PROPERTY_CHANGE_DEBUG
88 private void TestWindowKeyEventHandler(object o, Window.KeyEventArgs e)
89 {
90     if(e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "1")
91     {
92 #if NUI_PROPERTY_CHANGE_1
93         Tizen.Log.Fatal("NUITEST", $"### (FIXED) currently used properties ###");
94 #else
95         Tizen.Log.Fatal("NUITEST", $"### currently used properties ###");
96 #endif
97         Tizen.Log.Fatal("NUITEST", $"View properties =>");
98         Tizen.Log.Fatal("NUITEST", $"PropertyValueConstructor: {Tizen.NUI.PropertyValue.PropertyValueConstructor}");
99         Tizen.Log.Fatal("NUITEST", $"SizeGetter: {View.SizeGetter}, SizeSetter: {View.SizeSetter}");
100         Tizen.Log.Fatal("NUITEST", $"Size2DGetter: {View.Size2DGetter}, Size2DSetter: {View.Size2DSetter}");
101         Tizen.Log.Fatal("NUITEST", $"SizeWidthGetter: {View.SizeWidthGetter}, SizeWidthSetter: {View.SizeWidthSetter}");
102         Tizen.Log.Fatal("NUITEST", $"SizeHeightGetter: {View.SizeHeightGetter}, SizeHeightSetter: {View.SizeHeightSetter}");
103         Tizen.Log.Fatal("NUITEST", $"PositionGetter: {View.PositionGetter}, PositionSetter: {View.PositionSetter}");
104         Tizen.Log.Fatal("NUITEST", $"Position2DGetter: {View.Position2DGetter}, Position2DSetter: {View.Position2DSetter}");
105         Tizen.Log.Fatal("NUITEST", $"PositionXGetter: {View.PositionXGetter}, PositionXSetter: {View.PositionXSetter}");
106         Tizen.Log.Fatal("NUITEST", $"PositionYGetter: {View.PositionYGetter}, PositionYSetter: {View.PositionYSetter}");
107         Tizen.Log.Fatal("NUITEST", $"PositionZGetter: {View.PositionZGetter}, PositionZSetter: {View.PositionZSetter}");
108         Tizen.Log.Fatal("NUITEST", $"MaximumSizeGetter: {View.MaximumSizeGetter}, MaximumSizeSetter: {View.MaximumSizeSetter}");
109         Tizen.Log.Fatal("NUITEST", $"MinimumSizeGetter: {View.MinimumSizeGetter}, MinimumSizeSetter: {View.MinimumSizeSetter}");
110         Tizen.Log.Fatal("NUITEST", $"StyleNameGetter: {View.StyleNameGetter}, StyleNameSetter: {View.StyleNameSetter}");
111         Tizen.Log.Fatal("NUITEST", $"KeyInputFocusGetter: {View.KeyInputFocusGetter}, KeyInputFocusSetter: {View.KeyInputFocusSetter}");
112         Tizen.Log.Fatal("NUITEST", $"ColorGetter: {View.ColorGetter}, ColorSetter: {View.ColorSetter}");
113         Tizen.Log.Fatal("NUITEST", $"ColorRedGetter: {View.ColorRedGetter}, ColorRedSetter: {View.ColorRedSetter}");
114         Tizen.Log.Fatal("NUITEST", $"ColorGreenGetter: {View.ColorGreenGetter}, ColorGreenSetter: {View.ColorGreenSetter}");
115         Tizen.Log.Fatal("NUITEST", $"ColorBlueGetter: {View.ColorBlueGetter}, ColorBlueSetter: {View.ColorBlueSetter}");
116         Tizen.Log.Fatal("NUITEST", $"StateGetter: {View.StateGetter}, StateSetter: {View.StateSetter}");
117         Tizen.Log.Fatal("NUITEST", $"SubStateGetter: {View.SubStateGetter}, SubStateSetter: {View.SubStateSetter}");
118         Tizen.Log.Fatal("NUITEST", $"FlexGetter: {View.FlexGetter}, FlexSetter: {View.FlexSetter}");
119         Tizen.Log.Fatal("NUITEST", $"AlignSelfGetter: {View.AlignSelfGetter}, AlignSelfSetter: {View.AlignSelfSetter}");
120         Tizen.Log.Fatal("NUITEST", $"FlexMarginGetter: {View.FlexMarginGetter}, FlexMarginSetter: {View.FlexMarginSetter}");
121         Tizen.Log.Fatal("NUITEST", $"CellIndexGetter: {View.CellIndexGetter}, CellIndexSetter: {View.CellIndexSetter}");
122         Tizen.Log.Fatal("NUITEST", $"RowSpanGetter: {View.RowSpanGetter}, RowSpanSetter: {View.RowSpanSetter}");
123         Tizen.Log.Fatal("NUITEST", $"ColumnSpanGetter: {View.ColumnSpanGetter}, ColumnSpanSetter: {View.ColumnSpanSetter}");
124         Tizen.Log.Fatal("NUITEST", $"CellHorizontalAlignmentGetter: {View.CellHorizontalAlignmentGetter}, CellHorizontalAlignmentSetter: {View.CellHorizontalAlignmentSetter}");
125         Tizen.Log.Fatal("NUITEST", $"CellVerticalAlignmentGetter: {View.CellVerticalAlignmentGetter}, CellVerticalAlignmentSetter: {View.CellVerticalAlignmentSetter}");
126         Tizen.Log.Fatal("NUITEST", $"OpacityGetter: {View.OpacityGetter}, OpacitySetter: {View.OpacitySetter}");
127         Tizen.Log.Fatal("NUITEST", $"PositionUsesPivotPointGetter: {View.PositionUsesPivotPointGetter}, PositionUsesPivotPointSetter: {View.PositionUsesPivotPointSetter}");
128         Tizen.Log.Fatal("NUITEST", $"ParentOriginGetter: {View.ParentOriginGetter}, ParentOriginSetter: {View.ParentOriginSetter}");
129         Tizen.Log.Fatal("NUITEST", $"PivotPointGetter: {View.PivotPointGetter}, PivotPointSetter: {View.PivotPointSetter}");
130         Tizen.Log.Fatal("NUITEST", $"OrientationGetter: {View.OrientationGetter}, OrientationSetter: {View.OrientationSetter}");
131         Tizen.Log.Fatal("NUITEST", $"ScaleGetter: {View.ScaleGetter}, ScaleSetter: {View.ScaleSetter}");
132         Tizen.Log.Fatal("NUITEST", $"ScaleXGetter: {View.ScaleXGetter}, ScaleXSetter: {View.ScaleXSetter}");
133         Tizen.Log.Fatal("NUITEST", $"ScaleYGetter: {View.ScaleYGetter}, ScaleYSetter: {View.ScaleYSetter}");
134         Tizen.Log.Fatal("NUITEST", $"ScaleZGetter: {View.ScaleZGetter}, ScaleZSetter: {View.ScaleZSetter}");
135         Tizen.Log.Fatal("NUITEST", $"NameGetter: {View.NameGetter}, NameSetter: {View.NameSetter}");
136         Tizen.Log.Fatal("NUITEST", $"SensitiveGetter: {View.SensitiveGetter}, SensitiveSetter: {View.SensitiveSetter}");
137         Tizen.Log.Fatal("NUITEST", $"IsEnabledGetter: {View.IsEnabledGetter}, IsEnabledSetter: {View.IsEnabledSetter}");
138         Tizen.Log.Fatal("NUITEST", $"DispatchKeyEventsGetter: {View.DispatchKeyEventsGetter}, DispatchKeyEventsSetter: {View.DispatchKeyEventsSetter}");
139         Tizen.Log.Fatal("NUITEST", $"LeaveRequiredGetter: {View.LeaveRequiredGetter}, LeaveRequiredSetter: {View.LeaveRequiredSetter}");
140         Tizen.Log.Fatal("NUITEST", $"InheritOrientationGetter: {View.InheritOrientationGetter}, InheritOrientationSetter: {View.InheritOrientationSetter}");
141         Tizen.Log.Fatal("NUITEST", $"InheritScaleGetter: {View.InheritScaleGetter}, InheritScaleSetter: {View.InheritScaleSetter}");
142         Tizen.Log.Fatal("NUITEST", $"DrawModeGetter: {View.DrawModeGetter}, DrawModeSetter: {View.DrawModeSetter}");
143         Tizen.Log.Fatal("NUITEST", $"SizeModeFactorGetter: {View.SizeModeFactorGetter}, SizeModeFactorSetter: {View.SizeModeFactorSetter}");
144         Tizen.Log.Fatal("NUITEST", $"WidthResizePolicyGetter: {View.WidthResizePolicyGetter}, WidthResizePolicySetter: {View.WidthResizePolicySetter}");
145         Tizen.Log.Fatal("NUITEST", $"HeightResizePolicyGetter: {View.HeightResizePolicyGetter}, HeightResizePolicySetter: {View.HeightResizePolicySetter}");
146         Tizen.Log.Fatal("NUITEST", $"SizeScalePolicyGetter: {View.SizeScalePolicyGetter}, SizeScalePolicySetter: {View.SizeScalePolicySetter}");
147         Tizen.Log.Fatal("NUITEST", $"WidthForHeightGetter: {View.WidthForHeightGetter}, WidthForHeightSetter: {View.WidthForHeightSetter}");
148         Tizen.Log.Fatal("NUITEST", $"HeightForWidthGetter: {View.HeightForWidthGetter}, HeightForWidthSetter: {View.HeightForWidthSetter}");
149         Tizen.Log.Fatal("NUITEST", $"InheritPositionGetter: {View.InheritPositionGetter}, InheritPositionSetter: {View.InheritPositionSetter}");
150         Tizen.Log.Fatal("NUITEST", $"ClippingModeGetter: {View.ClippingModeGetter}, ClippingModeSetter: {View.ClippingModeSetter}");
151         Tizen.Log.Fatal("NUITEST", $"InheritLayoutDirectionGetter: {View.InheritLayoutDirectionGetter}, InheritLayoutDirectionSetter: {View.InheritLayoutDirectionSetter}");
152         Tizen.Log.Fatal("NUITEST", $"LayoutDirectionGetter: {View.LayoutDirectionGetter}, LayoutDirectionSetter: {View.LayoutDirectionSetter}");
153         Tizen.Log.Fatal("NUITEST", $"UpdateAreaHintGetter: {View.UpdateAreaHintGetter}, UpdateAreaHintSetter: {View.UpdateAreaHintSetter}");
154         Tizen.Log.Fatal("NUITEST", $"AccessibilityNameGetter: {View.AccessibilityNameGetter}, AccessibilityNameSetter: {View.AccessibilityNameSetter}");
155         Tizen.Log.Fatal("NUITEST", $"AccessibilityDescriptionGetter: {View.AccessibilityDescriptionGetter}, AccessibilityDescriptionSetter: {View.AccessibilityDescriptionSetter}");
156         Tizen.Log.Fatal("NUITEST", $"AccessibilityTranslationDomainGetter: {View.AccessibilityTranslationDomainGetter}, AccessibilityTranslationDomainSetter: {View.AccessibilityTranslationDomainSetter}");
157         Tizen.Log.Fatal("NUITEST", $"AccessibilityRoleGetter: {View.AccessibilityRoleGetter}, AccessibilityRoleSetter: {View.AccessibilityRoleSetter}");
158         Tizen.Log.Fatal("NUITEST", $"AccessibilityHighlightableGetter: {View.AccessibilityHighlightableGetter}, AccessibilityHighlightableSetter: {View.AccessibilityHighlightableSetter}");
159         Tizen.Log.Fatal("NUITEST", $"AccessibilityHiddenGetter: {View.AccessibilityHiddenGetter}, AccessibilityHiddenSetter: {View.AccessibilityHiddenSetter}");
160         Tizen.Log.Fatal("NUITEST", $"AutomationIdGetter: {View.AutomationIdGetter}, AutomationIdSetter: {View.AutomationIdSetter}");
161         Tizen.Log.Fatal("NUITEST", $"ImageView properties =>");
162         Tizen.Log.Fatal("NUITEST", $"PreMultipliedAlphaGetter: {ImageView.PreMultipliedAlphaGetter}, PreMultipliedAlphaSetter: {ImageView.PreMultipliedAlphaSetter}");
163         Tizen.Log.Fatal("NUITEST", $"PixelAreaGetter: {ImageView.PixelAreaGetter}, PixelAreaSetter: {ImageView.PixelAreaSetter}");
164         Tizen.Log.Fatal("NUITEST", $"TextLabel properties =>");
165         Tizen.Log.Fatal("NUITEST", $"TextGetter: {TextLabel.TextGetter}, TextSetter: {TextLabel.TextSetter}");
166         Tizen.Log.Fatal("NUITEST", $"FontFamilyGetter: {TextLabel.FontFamilyGetter}, FontFamilySetter: {TextLabel.FontFamilySetter}");
167         Tizen.Log.Fatal("NUITEST", $"PointSizeGetter: {TextLabel.PointSizeGetter}");
168 #if NUI_PROPERTY_CHANGE_3
169         Tizen.Log.Fatal("NUITEST", $"View internal properties =>");
170         Tizen.Log.Fatal("NUITEST", $"WorldPositionXGetter: {View.WorldPositionXGetter}, WorldPositionYGetter: {View.WorldPositionYGetter}, WorldPositionZGetter: {View.WorldPositionZGetter}");
171         Tizen.Log.Fatal("NUITEST", $"ParentOriginXGetter: {View.ParentOriginXGetter} ParentOriginXSetter: {View.ParentOriginXSetter}");
172         Tizen.Log.Fatal("NUITEST", $"ParentOriginYGetter: {View.ParentOriginYGetter} ParentOriginYSetter: {View.ParentOriginYSetter}");
173         Tizen.Log.Fatal("NUITEST", $"ParentOriginZGetter: {View.ParentOriginZGetter} ParentOriginZSetter: {View.ParentOriginZSetter}");
174         Tizen.Log.Fatal("NUITEST", $"PivotPointXGetter: {View.PivotPointXGetter} PivotPointXSetter: {View.PivotPointXSetter}");
175         Tizen.Log.Fatal("NUITEST", $"PivotPointYGetter: {View.PivotPointYGetter} PivotPointXSetter: {View.PivotPointYSetter}");
176         Tizen.Log.Fatal("NUITEST", $"PivotPointZGetter: {View.PivotPointZGetter} PivotPointXSetter: {View.PivotPointZSetter}");
177         Tizen.Log.Fatal("NUITEST", $"LeftFocusableViewIdGetter: {View.LeftFocusableViewIdGetter} LeftFocusableViewIdSetter: {View.LeftFocusableViewIdSetter}");
178         Tizen.Log.Fatal("NUITEST", $"RightFocusableViewIdGetter: {View.RightFocusableViewIdGetter} RightFocusableViewIdSetter: {View.RightFocusableViewIdSetter}");
179         Tizen.Log.Fatal("NUITEST", $"UpFocusableViewIdGetter: {View.UpFocusableViewIdGetter} UpFocusableViewIdSetter: {View.UpFocusableViewIdSetter}");
180         Tizen.Log.Fatal("NUITEST", $"DownFocusableViewIdGetter: {View.DownFocusableViewIdGetter} DownFocusableViewIdSetter: {View.DownFocusableViewIdSetter}");
181         Tizen.Log.Fatal("NUITEST", $"ClockwiseFocusableViewIdGetter: {View.ClockwiseFocusableViewIdGetter} ClockwiseFocusableViewIdSetter: {View.ClockwiseFocusableViewIdSetter}");
182         Tizen.Log.Fatal("NUITEST", $"CounterClockwiseFocusableViewIdGetter: {View.CounterClockwiseFocusableViewIdGetter} CounterClockwiseFocusableViewIdSetter: {View.CounterClockwiseFocusableViewIdSetter}");        
183         Tizen.Log.Fatal("NUITEST", $"View internal method =>");
184         Tizen.Log.Fatal("NUITEST", $"GetCurrentParentOriginCnt: {View.GetCurrentParentOriginCnt} GetCurrentAnchorPointCnt: {View.GetCurrentAnchorPointCnt}");        
185         Tizen.Log.Fatal("NUITEST", $"GetTargetSizeCnt: {View.GetTargetSizeCnt} GetCurrentSizeCnt: {View.GetCurrentSizeCnt}");        
186         Tizen.Log.Fatal("NUITEST", $"GetCurrentSizeFloatCnt: {View.GetCurrentSizeFloatCnt} GetNaturalSizeCnt: {View.GetNaturalSizeCnt}");        
187         Tizen.Log.Fatal("NUITEST", $"GetCurrentPositionCnt: {View.GetCurrentPositionCnt} GetCurrentWorldPositionCnt: {View.GetCurrentWorldPositionCnt}");
188         Tizen.Log.Fatal("NUITEST", $"GetCurrentScaleCnt: {View.GetCurrentScaleCnt} GetCurrentWorldScaleCnt: {View.GetCurrentWorldScaleCnt}");
189         Tizen.Log.Fatal("NUITEST", $"GetCurrentColorCnt: {View.GetCurrentColorCnt} GetCurrentWorldColorCnt: {View.GetCurrentWorldColorCnt}");
190         Tizen.Log.Fatal("NUITEST", $"GetSizeModeFactorCnt: {View.GetSizeModeFactorCnt} GetMinimumSizeCnt: {View.GetMinimumSizeCnt}");
191         Tizen.Log.Fatal("NUITEST", $"GetMaximumSizeCnt: {View.GetMaximumSizeCnt}");
192 #endif
193     }
194 }
195 #endif
196
197         /// <summary>
198         /// A helper method to get the current window where the view is added
199         /// </summary>
200         /// <param name="view">The View added to the window</param>
201         /// <returns>A Window.</returns>
202         [EditorBrowsable(EditorBrowsableState.Never)]
203         static public Window Get(View view)
204         {
205             if (view == null)
206             {
207                 NUILog.Error("if there is no view, it can not get a window");
208                 return null;
209             }
210
211             //to fix memory leak issue, match the handle count with native side.
212             Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         /// <summary>
218         /// Creates a new Window.<br />
219         /// This creates an extra window in addition to the default main window<br />
220         /// </summary>
221         /// <param name="windowPosition">The position and size of the Window.</param>
222         /// <param name="isTranslucent">Whether Window is translucent.</param>
223         /// <returns>A new Window.</returns>
224         /// <since_tizen> 6 </since_tizen>
225         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
226         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
227         public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
228         {
229             if (IsSupportedMultiWindow() == false)
230             {
231                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
232             }
233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234         }
235
236         /// <summary>
237         /// Creates a new Window with a specific name.<br />
238         /// This creates an extra window in addition to the default main window<br />
239         /// </summary>
240         /// <param name="name">The name for extra window. </param>
241         /// <param name="windowPosition">The position and size of the Window.</param>
242         /// <param name="isTranslucent">Whether Window is translucent.</param>
243         /// <returns>A new Window.</returns>
244         /// <since_tizen> 6 </since_tizen>
245         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
246         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
247         public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
248         {
249             if (IsSupportedMultiWindow() == false)
250             {
251                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
252             }
253             this.windowTitle = name;
254             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255         }
256
257         /// <summary>
258         /// Creates a new Window with a specific name.<br />
259         /// This creates an extra window in addition to the default main window<br />
260         /// </summary>
261         /// <param name="name">The name for extra window. </param>
262         /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
263         /// <param name="windowPosition">The position and size of the Window.</param>
264         /// <param name="isTranslucent">Whether Window is translucent.</param>
265         /// <returns>A new Window.</returns>
266         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
267         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
268         [EditorBrowsable(EditorBrowsableState.Never)]
269         public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
270         {
271             if (IsSupportedMultiWindow() == false)
272             {
273                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
274             }
275             this.windowTitle = name;
276             this.EnableBorder(borderInterface);
277             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278         }
279
280
281         /// <summary>
282         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
283         /// </summary>
284         /// <since_tizen> 3 </since_tizen>
285         public enum WindowOrientation
286         {
287             /// <summary>
288             /// Portrait orientation. The height of the display area is greater than the width.
289             /// </summary>
290             /// <since_tizen> 3 </since_tizen>
291             Portrait = 0,
292             /// <summary>
293             /// Landscape orientation. A wide view area is needed.
294             /// </summary>
295             /// <since_tizen> 3 </since_tizen>
296             Landscape = 90,
297             /// <summary>
298             /// Portrait inverse orientation.
299             /// </summary>
300             /// <since_tizen> 3 </since_tizen>
301             PortraitInverse = 180,
302             /// <summary>
303             /// Landscape inverse orientation.
304             /// </summary>
305             /// <since_tizen> 3 </since_tizen>
306             LandscapeInverse = 270,
307             /// <summary>
308             /// No orientation. It is for the preferred orientation
309             /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
310             /// It is used to unset the preferred orientation with SetPreferredOrientation.
311             /// </summary>
312             [EditorBrowsable(EditorBrowsableState.Never)]
313             NoOrientationPreference = -1
314         }
315
316         /// <summary>
317         /// Enumeration for the key grab mode for platform-level APIs.
318         /// </summary>
319         /// <since_tizen> 3 </since_tizen>
320         public enum KeyGrabMode
321         {
322             /// <summary>
323             /// Grabs a key only when on the top of the grabbing-window stack mode.
324             /// </summary>
325             Topmost = 0,
326             /// <summary>
327             /// Grabs a key together with the other client window(s) mode.
328             /// </summary>
329             Shared,
330             /// <summary>
331             /// 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.
332             /// </summary>
333             OverrideExclusive,
334             /// <summary>
335             /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
336             /// </summary>
337             Exclusive
338         };
339
340         /// <summary>
341         /// Enumeration for transition effect's state.
342         /// </summary>
343         [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
344         [EditorBrowsable(EditorBrowsableState.Never)]
345         //  This is already deprecated, so suppress warning here.
346         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
347         public enum EffectStates
348         {
349             /// <summary>
350             /// None state.
351             /// </summary>
352             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
353             [EditorBrowsable(EditorBrowsableState.Never)]
354             None = 0,
355             /// <summary>
356             /// Transition effect is started.
357             /// </summary>
358             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
359             [EditorBrowsable(EditorBrowsableState.Never)]
360             Start,
361             /// <summary>
362             /// Transition effect is ended.
363             /// </summary>
364             [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
365             [EditorBrowsable(EditorBrowsableState.Never)]
366             End,
367         }
368
369         /// <summary>
370         /// Enumeration for transition effect's state.
371         /// </summary>
372         [EditorBrowsable(EditorBrowsableState.Never)]
373         public enum EffectState
374         {
375             /// <summary>
376             /// None state.
377             /// </summary>
378             [EditorBrowsable(EditorBrowsableState.Never)]
379             None = 0,
380             /// <summary>
381             /// Transition effect is started.
382             /// </summary>
383             [EditorBrowsable(EditorBrowsableState.Never)]
384             Start,
385             /// <summary>
386             /// Transition effect is ended.
387             /// </summary>
388             [EditorBrowsable(EditorBrowsableState.Never)]
389             End,
390         }
391
392         /// <summary>
393         /// Enumeration for transition effect's type.
394         /// </summary>
395         [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
396         [EditorBrowsable(EditorBrowsableState.Never)]
397         //  This is already deprecated, so suppress warning here.
398         [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
399         public enum EffectTypes
400         {
401             /// <summary>
402             /// None type.
403             /// </summary>
404             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
405             [EditorBrowsable(EditorBrowsableState.Never)]
406             None = 0,
407             /// <summary>
408             /// Window show effect.
409             /// </summary>
410             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
411             [EditorBrowsable(EditorBrowsableState.Never)]
412             Show,
413             /// <summary>
414             /// Window hide effect.
415             /// </summary>
416             [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
417             [EditorBrowsable(EditorBrowsableState.Never)]
418             Hide,
419         }
420
421         /// <summary>
422         /// Enumeration for transition effect's type.
423         /// </summary>
424         [EditorBrowsable(EditorBrowsableState.Never)]
425         public enum EffectType
426         {
427             /// <summary>
428             /// None type.
429             /// </summary>
430             [EditorBrowsable(EditorBrowsableState.Never)]
431             None = 0,
432             /// <summary>
433             /// Window show effect.
434             /// </summary>
435             [EditorBrowsable(EditorBrowsableState.Never)]
436             Show,
437             /// <summary>
438             /// Window hide effect.
439             /// </summary>
440             [EditorBrowsable(EditorBrowsableState.Never)]
441             Hide,
442         }
443
444         /// <summary>
445         /// Enumeration for result of window operation.
446         /// </summary>
447         internal enum OperationResult
448         {
449             /// <summary>
450             /// Failed for unknown reason
451             /// </summary>
452             UnknownError = 0,
453             /// <summary>
454             /// Succeed
455             /// </summary>
456             Succeed,
457             /// <summary>
458             /// Permission denied
459             /// </summary>
460             PermissionDenied,
461             /// <summary>
462             /// The operation is not supported.
463             /// </summary>
464             NotSupported,
465         }
466
467         /// <summary>
468         /// Enumeration for window resized mode by display server.
469         /// </summary>
470         [EditorBrowsable(EditorBrowsableState.Never)]
471         public enum ResizeDirection
472         {
473             /// <summary>
474             /// None type.
475             /// </summary>
476             [EditorBrowsable(EditorBrowsableState.Never)]
477             None = 0,
478             /// <summary>
479             /// Start resizing window to the top-left edge.
480             /// </summary>
481             [EditorBrowsable(EditorBrowsableState.Never)]
482             TopLeft = 1,
483             /// <summary>
484             /// Start resizing window to the top side.
485             /// </summary>
486             [EditorBrowsable(EditorBrowsableState.Never)]
487             Top = 2,
488             /// <summary>
489             /// Start resizing window to the top-right edge.
490             /// </summary>
491             [EditorBrowsable(EditorBrowsableState.Never)]
492             TopRight = 3,
493             /// <summary>
494             /// Start resizing window to the left side.
495             /// </summary>
496             [EditorBrowsable(EditorBrowsableState.Never)]
497             Left = 4,
498             /// <summary>
499             /// Start resizing window to the right side.
500             /// </summary>
501             [EditorBrowsable(EditorBrowsableState.Never)]
502             Right = 5,
503             /// <summary>
504             /// Start resizing window to the bottom-left edge.
505             /// </summary>
506             [EditorBrowsable(EditorBrowsableState.Never)]
507             BottomLeft = 6,
508             /// <summary>
509             /// Start resizing window to the bottom side.
510             /// </summary>
511             [EditorBrowsable(EditorBrowsableState.Never)]
512             Bottom = 7,
513             /// <summary>
514             /// Start resizing window to the bottom-right edge.
515             /// </summary>
516             [EditorBrowsable(EditorBrowsableState.Never)]
517             BottomRight = 8,
518         }
519
520
521         /// <summary>
522         /// The stage instance property (read-only).<br />
523         /// Gets the current window.<br />
524         /// </summary>
525         /// <since_tizen> 3 </since_tizen>
526         public static Window Instance { get; internal set; }
527
528         /// <summary>
529         /// Gets or sets a window type.
530         /// Most of window type can be set to use WindowType, except for IME type.
531         /// IME type can be set to use one of NUIApplication's constrcutors.
532         /// </summary>
533         /// <since_tizen> 3 </since_tizen>
534         public WindowType Type
535         {
536             get
537             {
538                 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
539                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
540                 return ret;
541             }
542             set
543             {
544                 Interop.Window.SetType(SwigCPtr, (int)value);
545                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546             }
547         }
548
549         /// <summary>
550         /// Gets/Sets a window title.
551         /// </summary>
552         /// <since_tizen> 4 </since_tizen>
553         public string Title
554         {
555             get
556             {
557                 return windowTitle;
558             }
559             set
560             {
561                 windowTitle = value;
562                 SetClass(windowTitle, "");
563             }
564         }
565
566         /// <summary>
567         /// The rendering behavior of a Window.
568         /// </summary>
569         /// <since_tizen> 5 </since_tizen>
570         public RenderingBehaviorType RenderingBehavior
571         {
572             get
573             {
574                 return GetRenderingBehavior();
575             }
576             set
577             {
578                 SetRenderingBehavior(value);
579             }
580         }
581
582         /// <summary>
583         /// The window size property (read-only).
584         /// </summary>
585         /// <since_tizen> 3 </since_tizen>
586         public Size2D Size
587         {
588             get
589             {
590                 Size2D ret = GetSize();
591                 return ret;
592             }
593         }
594
595         /// <summary>
596         /// The background color property.
597         /// </summary>
598         /// <since_tizen> 3 </since_tizen>
599         public Color BackgroundColor
600         {
601             set
602             {
603                 SetBackgroundColor(value);
604             }
605             get
606             {
607                 Color ret = GetBackgroundColor();
608                 return ret;
609             }
610         }
611
612         /// <summary>
613         /// The DPI property (read-only).<br />
614         /// Retrieves the DPI of the display device to which the Window is connected.<br />
615         /// </summary>
616         /// <since_tizen> 3 </since_tizen>
617         public Vector2 Dpi
618         {
619             get
620             {
621                 return GetDpi();
622             }
623         }
624
625         /// <summary>
626         /// The layer count property (read-only).<br />
627         /// Queries the number of on-Window layers.<br />
628         /// </summary>
629         /// <since_tizen> 3 </since_tizen>
630         public uint LayerCount
631         {
632             get
633             {
634                 return GetLayerCount();
635             }
636         }
637
638         /// <summary>
639         /// Gets or sets a size of the window.
640         /// </summary>
641         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
642         /// <since_tizen> 4 </since_tizen>
643         public Size2D WindowSize
644         {
645             get
646             {
647                 return GetWindowSize();
648             }
649             set
650             {
651                 SetWindowSize(value);
652             }
653         }
654
655         /// <summary>
656         /// Gets or sets a position of the window.
657         /// </summary>
658         /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
659         /// <since_tizen> 4 </since_tizen>
660         public Position2D WindowPosition
661         {
662             get
663             {
664                 return GetPosition();
665             }
666             set
667             {
668                 SetPosition(value);
669             }
670         }
671
672         /// <summary>
673         /// Sets position and size of the window. This API guarantees that
674         /// both moving and resizing of window will appear on the screen at once.
675         /// </summary>
676         [EditorBrowsable(EditorBrowsableState.Never)]
677         public Rectangle WindowPositionSize
678         {
679             get
680             {
681                 Position2D position = GetPosition();
682                 Size2D size = GetSize();
683                 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
684                 position.Dispose();
685                 return ret;
686             }
687             set
688             {
689                 SetPositionSize(value);
690             }
691         }
692
693         internal static Vector4 DEFAULT_BACKGROUND_COLOR
694         {
695             get
696             {
697                 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
698                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
699                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700                 return ret;
701             }
702         }
703
704         internal static Vector4 DEBUG_BACKGROUND_COLOR
705         {
706             get
707             {
708                 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
709                 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
710                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711                 return ret;
712             }
713         }
714
715         internal List<Layer> LayersChildren
716         {
717             get
718             {
719                 return childLayers;
720             }
721         }
722
723         /// <summary>
724         ///  Get the LayoutController for this Window.
725         /// </summary>
726         internal LayoutController LayoutController
727         {
728             get
729             {
730                 return localController;
731             }
732         }
733
734         /// <summary>
735         /// Feed a key-event into the window.
736         /// </summary>
737         /// <param name="keyEvent">The key event to feed.</param>
738         /// <since_tizen> 4 </since_tizen>
739         [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
740         public static void FeedKeyEvent(Key keyEvent)
741         {
742             Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
743             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744         }
745
746         /// <summary>
747         /// Sets whether the window accepts a focus or not.
748         /// </summary>
749         /// <param name="accept">If a focus is accepted or not. The default is true.</param>
750         /// <since_tizen> 3 </since_tizen>
751         public void SetAcceptFocus(bool accept)
752         {
753             Interop.Window.SetAcceptFocus(SwigCPtr, accept);
754             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755         }
756
757         /// <summary>
758         /// Returns whether the window accepts a focus or not.
759         /// </summary>
760         /// <returns>True if the window accepts a focus, false otherwise.</returns>
761         /// <since_tizen> 3 </since_tizen>
762         public bool IsFocusAcceptable()
763         {
764             bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
765             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
766
767             return ret;
768         }
769
770         /// <summary>
771         /// Shows the window if it is hidden.
772         /// </summary>
773         /// <since_tizen> 3 </since_tizen>
774         public void Show()
775         {
776             Interop.Window.Show(SwigCPtr);
777             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778         }
779
780         /// <summary>
781         /// Hides the window if it is showing.
782         /// </summary>
783         /// <since_tizen> 3 </since_tizen>
784         public void Hide()
785         {
786             Interop.Window.Hide(SwigCPtr);
787             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788         }
789
790         /// <summary>
791         /// Retrieves whether the window is visible or not.
792         /// </summary>
793         /// <returns>True if the window is visible.</returns>
794         /// <since_tizen> 3 </since_tizen>
795         public bool IsVisible()
796         {
797             bool temp = Interop.Window.IsVisible(SwigCPtr);
798             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799             return temp;
800         }
801
802         /// <summary>
803         /// Gets the count of supported auxiliary hints of the window.
804         /// </summary>
805         /// <returns>The number of supported auxiliary hints.</returns>
806         /// <since_tizen> 3 </since_tizen>
807         public uint GetSupportedAuxiliaryHintCount()
808         {
809             uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
810             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811             return ret;
812         }
813
814         /// <summary>
815         /// Gets the supported auxiliary hint string of the window.
816         /// </summary>
817         /// <param name="index">The index of the supported auxiliary hint lists.</param>
818         /// <returns>The auxiliary hint string of the index.</returns>
819         /// <since_tizen> 3 </since_tizen>
820         public string GetSupportedAuxiliaryHint(uint index)
821         {
822             string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
823             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
824             return ret;
825         }
826
827         /// <summary>
828         /// Creates an auxiliary hint of the window.
829         /// </summary>
830         /// <param name="hint">The auxiliary hint string.</param>
831         /// <param name="value">The value string.</param>
832         /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
833         /// <since_tizen> 3 </since_tizen>
834         public uint AddAuxiliaryHint(string hint, string value)
835         {
836             uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
837             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838             return ret;
839         }
840
841         /// <summary>
842         /// Removes an auxiliary hint of the window.
843         /// </summary>
844         /// <param name="id">The ID of the auxiliary hint.</param>
845         /// <returns>True if no error occurred, false otherwise.</returns>
846         /// <since_tizen> 3 </since_tizen>
847         public bool RemoveAuxiliaryHint(uint id)
848         {
849             bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
850             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851             return ret;
852         }
853
854         /// <summary>
855         /// Changes a value of the auxiliary hint.
856         /// </summary>
857         /// <param name="id">The auxiliary hint ID.</param>
858         /// <param name="value">The value string to be set.</param>
859         /// <returns>True if no error occurred, false otherwise.</returns>
860         /// <since_tizen> 3 </since_tizen>
861         public bool SetAuxiliaryHintValue(uint id, string value)
862         {
863             bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
864             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
865             return ret;
866         }
867
868         /// <summary>
869         /// Gets a value of the auxiliary hint.
870         /// </summary>
871         /// <param name="id">The auxiliary hint ID.</param>
872         /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
873         /// <since_tizen> 3 </since_tizen>
874         public string GetAuxiliaryHintValue(uint id)
875         {
876             string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
877             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
878             return ret;
879         }
880
881         /// <summary>
882         /// Gets an ID of the auxiliary hint string.
883         /// </summary>
884         /// <param name="hint">The auxiliary hint string.</param>
885         /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
886         /// <since_tizen> 3 </since_tizen>
887         public uint GetAuxiliaryHintId(string hint)
888         {
889             uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
890             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891             return ret;
892         }
893
894         /// <summary>
895         /// Sets a region to accept input events.
896         /// </summary>
897         /// <param name="inputRegion">The region to accept input events.</param>
898         /// <since_tizen> 3 </since_tizen>
899         public void SetInputRegion(Rectangle inputRegion)
900         {
901             Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
902             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
903         }
904
905         /// <summary>
906         /// Sets a priority level for the specified notification window.
907         /// </summary>
908         /// <param name="level">The notification window level.</param>
909         /// <returns>True if no error occurred, false otherwise.</returns>
910         /// <since_tizen> 3 </since_tizen>
911         public bool SetNotificationLevel(NotificationLevel level)
912         {
913             var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
914             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
915             return ret == OperationResult.Succeed;
916         }
917
918         /// <summary>
919         /// Gets a priority level for the specified notification window.
920         /// </summary>
921         /// <returns>The notification window level.</returns>
922         /// <since_tizen> 3 </since_tizen>
923         public NotificationLevel GetNotificationLevel()
924         {
925             NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
926             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
927             return ret;
928         }
929
930         /// <summary>
931         /// Sets a transparent window's visual state to opaque. <br />
932         /// If a visual state of a transparent window is opaque, <br />
933         /// then the window manager could handle it as an opaque window when calculating visibility.
934         /// </summary>
935         /// <param name="opaque">Whether the window's visual state is opaque.</param>
936         /// <remarks>This will have no effect on an opaque window. <br />
937         /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
938         /// </remarks>
939         /// <since_tizen> 3 </since_tizen>
940         public void SetOpaqueState(bool opaque)
941         {
942             Interop.Window.SetOpaqueState(SwigCPtr, opaque);
943             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
944         }
945
946         /// <summary>
947         /// Returns whether a transparent window's visual state is opaque or not.
948         /// </summary>
949         /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
950         /// <remarks> The return value has no meaning on an opaque window. </remarks>
951         /// <since_tizen> 3 </since_tizen>
952         public bool IsOpaqueState()
953         {
954             bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
955             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
956             return ret;
957         }
958
959         /// <summary>
960         /// Sets a window's screen off mode.
961         /// </summary>
962         /// <param name="screenOffMode">The screen mode.</param>
963         /// <returns>True if no error occurred, false otherwise.</returns>
964         /// <since_tizen> 4 </since_tizen>
965         public bool SetScreenOffMode(ScreenOffMode screenOffMode)
966         {
967             var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
968             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969             return ret == OperationResult.Succeed;
970         }
971
972         /// <summary>
973         /// Gets the screen mode of the window.
974         /// </summary>
975         /// <returns>The screen off mode.</returns>
976         /// <since_tizen> 4 </since_tizen>
977         public ScreenOffMode GetScreenOffMode()
978         {
979             ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
980             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
981             return ret;
982         }
983
984         /// <summary>
985         /// Sets preferred brightness of the window.
986         /// </summary>
987         /// <param name="brightness">The preferred brightness (0 to 100).</param>
988         /// <returns>True if no error occurred, false otherwise.</returns>
989         /// <since_tizen> 3 </since_tizen>
990         public bool SetBrightness(int brightness)
991         {
992             var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
993             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
994             return ret == OperationResult.Succeed;
995         }
996
997         /// <summary>
998         /// Gets the preferred brightness of the window.
999         /// </summary>
1000         /// <returns>The preferred brightness.</returns>
1001         /// <since_tizen> 3 </since_tizen>
1002         public int GetBrightness()
1003         {
1004             int ret = Interop.Window.GetBrightness(SwigCPtr);
1005             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1006             return ret;
1007         }
1008
1009         /// <summary>
1010         /// Sets the window name and the class string.
1011         /// </summary>
1012         /// <param name="name">The name of the window.</param>
1013         /// <param name="klass">The class of the window.</param>
1014         /// <since_tizen> 4 </since_tizen>
1015         public void SetClass(string name, string klass)
1016         {
1017             Interop.Window.SetClass(SwigCPtr, name, klass);
1018             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019         }
1020
1021         /// <summary>
1022         /// Raises the window to the top of the window stack.
1023         /// </summary>
1024         /// <since_tizen> 3 </since_tizen>
1025         public void Raise()
1026         {
1027             Interop.Window.Raise(SwigCPtr);
1028             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1029         }
1030
1031         /// <summary>
1032         /// Lowers the window to the bottom of the window stack.
1033         /// </summary>
1034         /// <since_tizen> 3 </since_tizen>
1035         public void Lower()
1036         {
1037             Interop.Window.Lower(SwigCPtr);
1038             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1039         }
1040
1041         /// <summary>
1042         /// Activates the window to the top of the window stack even it is iconified.
1043         /// </summary>
1044         /// <since_tizen> 3 </since_tizen>
1045         public void Activate()
1046         {
1047             Interop.Window.Activate(SwigCPtr);
1048             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049         }
1050
1051         /// <summary>
1052         /// Gets the default ( root ) layer.
1053         /// </summary>
1054         /// <returns>The root layer.</returns>
1055         /// <since_tizen> 3 </since_tizen>
1056         public Layer GetDefaultLayer()
1057         {
1058             return this.GetRootLayer();
1059         }
1060
1061         /// <summary>
1062         /// Add a child view to window.
1063         /// </summary>
1064         /// <param name="view">the child should be added to the window.</param>
1065         /// <since_tizen> 3 </since_tizen>
1066         public void Add(View view)
1067         {
1068             this.GetRootLayer().Add(view);
1069         }
1070
1071         /// <summary>
1072         /// Remove a child view from window.
1073         /// </summary>
1074         /// <param name="view">the child to be removed.</param>
1075         /// <since_tizen> 3 </since_tizen>
1076         public void Remove(View view)
1077         {
1078             this.GetRootLayer().Remove(view);
1079         }
1080
1081         /// <summary>
1082         /// Retrieves the layer at a specified depth.
1083         /// </summary>
1084         /// <param name="depth">The layer's depth index.</param>
1085         /// <returns>The layer found at the given depth.</returns>
1086         /// <since_tizen> 3 </since_tizen>
1087         public Layer GetLayer(uint depth)
1088         {
1089             if (depth < LayersChildren?.Count)
1090             {
1091                 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1092                 return ret;
1093             }
1094             else
1095             {
1096                 return null;
1097             }
1098         }
1099
1100         /// <summary>
1101         /// Destroy the window immediately.
1102         /// </summary>
1103         [EditorBrowsable(EditorBrowsableState.Never)]
1104         public void Destroy()
1105         {
1106             this.Dispose();
1107         }
1108
1109         /// <summary>
1110         /// Keep rendering for at least the given amount of time.
1111         /// </summary>
1112         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1113         /// <since_tizen> 3 </since_tizen>
1114         public void KeepRendering(float durationSeconds)
1115         {
1116             Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
1117             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118         }
1119
1120         /// <summary>
1121         /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1122         /// This function can be used for following example scenarios: <br />
1123         /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1124         /// </summary>
1125         /// <param name="DaliKey">The key code to grab.</param>
1126         /// <returns>True if the grab succeeds.</returns>
1127         /// <since_tizen> 3 </since_tizen>
1128         public bool GrabKeyTopmost(int DaliKey)
1129         {
1130             bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132             return ret;
1133         }
1134
1135         /// <summary>
1136         /// Ungrabs the key specified by a key for the window.<br />
1137         /// 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 />
1138         /// </summary>
1139         /// <param name="DaliKey">The key code to ungrab.</param>
1140         /// <returns>True if the ungrab succeeds.</returns>
1141         /// <since_tizen> 3 </since_tizen>
1142         public bool UngrabKeyTopmost(int DaliKey)
1143         {
1144             bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146             return ret;
1147         }
1148
1149         /// <summary>
1150         ///  Grabs the key specified by a key for a window in a GrabMode. <br />
1151         ///  Details: This function can be used for following example scenarios: <br />
1152         ///  - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1153         ///  - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1154         ///  - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1155         /// </summary>
1156         /// <param name="DaliKey">The key code to grab.</param>
1157         /// <param name="GrabMode">The grab mode for the key.</param>
1158         /// <returns>True if the grab succeeds.</returns>
1159         /// <since_tizen> 3 </since_tizen>
1160         public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1161         {
1162             bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1164             return ret;
1165         }
1166
1167         /// <summary>
1168         /// Ungrabs the key specified by a key for a window.<br />
1169         /// 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 />
1170         /// </summary>
1171         /// <param name="DaliKey">The key code to ungrab.</param>
1172         /// <returns>True if the ungrab succeeds.</returns>
1173         /// <since_tizen> 3 </since_tizen>
1174         public bool UngrabKey(int DaliKey)
1175         {
1176             bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1177             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1178             return ret;
1179         }
1180
1181         /// <summary>
1182         /// Sets the keyboard repeat information.
1183         /// </summary>
1184         /// <param name="rate">The key repeat rate value in seconds.</param>
1185         /// <param name="delay">The key repeat delay value in seconds.</param>
1186         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1187         /// <since_tizen> 5 </since_tizen>
1188         public bool SetKeyboardRepeatInfo(float rate, float delay)
1189         {
1190             bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1192             return ret;
1193         }
1194
1195         /// <summary>
1196         /// Gets the keyboard repeat information.
1197         /// </summary>
1198         /// <param name="rate">The key repeat rate value in seconds.</param>
1199         /// <param name="delay">The key repeat delay value in seconds.</param>
1200         /// <returns>True if setting the keyboard repeat succeeds.</returns>
1201         /// <since_tizen> 5 </since_tizen>
1202         public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1203         {
1204             bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206             return ret;
1207         }
1208
1209         /// <summary>
1210         /// Adds a layer to the stage.
1211         /// </summary>
1212         /// <param name="layer">Layer to add.</param>
1213         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1214         /// <since_tizen> 3 </since_tizen>
1215         public void AddLayer(Layer layer)
1216         {
1217             Add(layer);
1218         }
1219
1220         /// <summary>
1221         /// Removes a layer from the stage.
1222         /// </summary>
1223         /// <param name="layer">Layer to remove.</param>
1224         /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1225         /// <since_tizen> 3 </since_tizen>
1226         public void RemoveLayer(Layer layer)
1227         {
1228             Remove(layer);
1229         }
1230
1231         /// <summary>
1232         /// Feeds a key event into the window.
1233         /// </summary>
1234         /// <param name="keyEvent">The key event to feed.</param>
1235         /// <since_tizen> 5 </since_tizen>
1236         public void FeedKey(Key keyEvent)
1237         {
1238             Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1239             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1240         }
1241
1242         /// <summary>
1243         /// Feeds a touch point into the window.
1244         /// </summary>
1245         /// <param name="touchPoint">The touch point to feed.</param>
1246         /// <param name="timeStamp">The timeStamp.</param>
1247         internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1248         {
1249             Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1250             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1251         }
1252
1253         /// <summary>
1254         /// Feeds a wheel event into the window.
1255         /// </summary>
1256         /// <param name="wheelEvent">The wheel event to feed.</param>
1257         internal void FeedWheel(Wheel wheelEvent)
1258         {
1259             Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1260             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1261         }
1262
1263         /// <summary>
1264         /// Allows at least one more render, even when paused.
1265         /// The window should be shown, not minimised.
1266         /// </summary>
1267         /// <since_tizen> 4 </since_tizen>
1268         public void RenderOnce()
1269         {
1270             Interop.Window.RenderOnce(SwigCPtr);
1271             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1272         }
1273
1274         /// <summary>
1275         /// Sets whether the window is transparent or not.
1276         /// </summary>
1277         /// <param name="transparent">Whether the window is transparent or not.</param>
1278         /// <since_tizen> 5 </since_tizen>
1279         public void SetTransparency(bool transparent)
1280         {
1281             Interop.Window.SetTransparency(SwigCPtr, transparent);
1282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283
1284             // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1285         }
1286
1287         /// <summary>
1288         /// Sets parent window of the window.
1289         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1290         /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1291         /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1292         /// </summary>
1293         /// <param name="parent">The parent window.</param>
1294         /// <since_tizen> 6 </since_tizen>
1295         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1296         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1297         public void SetParent(Window parent)
1298         {
1299             if (IsSupportedMultiWindow() == false)
1300             {
1301                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1302             }
1303             Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1304             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305         }
1306
1307         /// <summary>
1308         /// Sets parent window of the window.
1309         /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1310         /// This function has the additional flag whether the child is located above or below of the parent.
1311         /// </summary>
1312         /// <param name="parent">The parent window.</param>
1313         /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1314         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1315         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1316         [EditorBrowsable(EditorBrowsableState.Never)]
1317         public void SetParent(Window parent, bool belowParent)
1318         {
1319             if (IsSupportedMultiWindow() == false)
1320             {
1321                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1322             }
1323             Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325         }
1326
1327         /// <summary>
1328         /// Unsets parent window of the window.
1329         /// After unsetting, the window is disconnected his parent window.
1330         /// </summary>
1331         /// <since_tizen> 6 </since_tizen>
1332         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1333         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1334         public void Unparent()
1335         {
1336             if (IsSupportedMultiWindow() == false)
1337             {
1338                 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1339             }
1340             Interop.Window.Unparent(SwigCPtr);
1341             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1342         }
1343
1344         /// <summary>
1345         /// Gets parent window of the window.
1346         /// </summary>
1347         /// <returns>The parent window of the window.</returns>
1348         /// <since_tizen> 6 </since_tizen>
1349         /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1350         /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1351         [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1352         public Window GetParent()
1353         {
1354             if (IsSupportedMultiWindow() == false)
1355             {
1356                 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1357             }
1358             Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1359             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360             return ret;
1361         }
1362
1363         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1364         [EditorBrowsable(EditorBrowsableState.Never)]
1365         public void ObjectDump()
1366         {
1367             Layer rootLayer = GetRootLayer();
1368             foreach (View view in rootLayer.Children)
1369             {
1370                 view.ObjectDump();
1371             }
1372         }
1373
1374         internal static bool IsInstalled()
1375         {
1376             bool ret = Interop.Stage.IsInstalled();
1377             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378             return ret;
1379         }
1380
1381         /// <summary>
1382         /// Adds an orientation to the list of available orientations.
1383         /// </summary>
1384         /// <param name="orientation">The available orientation to add</param>
1385         /// <since_tizen> 6 </since_tizen>
1386         public void AddAvailableOrientation(Window.WindowOrientation orientation)
1387         {
1388             Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1389             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1390         }
1391
1392         /// <summary>
1393         /// Removes an orientation from the list of available orientations.
1394         /// </summary>
1395         /// <param name="orientation">The available orientation to remove.</param>
1396         /// <since_tizen> 6 </since_tizen>
1397         public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1398         {
1399             Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1400             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1401         }
1402
1403         /// <summary>
1404         /// Sets a preferred orientation.
1405         /// </summary>
1406         /// <param name="orientation">The preferred orientation.</param>
1407         /// <since_tizen> 6 </since_tizen>
1408         public void SetPreferredOrientation(Window.WindowOrientation orientation)
1409         {
1410             Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1411             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1412         }
1413
1414         /// <summary>
1415         /// Gets the preferred orientation.
1416         /// </summary>
1417         /// <since_tizen> 6 </since_tizen>
1418         /// <returns>The preferred orientation if previously set, or none.</returns>
1419         public Window.WindowOrientation GetPreferredOrientation()
1420         {
1421             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1422             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1423             return ret;
1424         }
1425
1426         /// <summary>
1427         /// Gets current orientation of the window.
1428         /// </summary>
1429         /// <since_tizen> 6 </since_tizen>
1430         /// <returns>The current window orientation if previously set, or none.</returns>
1431         [EditorBrowsable(EditorBrowsableState.Never)]
1432         public Window.WindowOrientation GetCurrentOrientation()
1433         {
1434             Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1435             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436             return ret;
1437         }
1438
1439         /// <summary>
1440         /// Sets available orientations of the window.
1441         /// This API is for setting several orientations one time.
1442         /// </summary>
1443         /// <param name="orientations">The list of orientations.</param>
1444         /// <since_tizen> 6 </since_tizen>
1445         [EditorBrowsable(EditorBrowsableState.Never)]
1446         public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1447         {
1448             if (null == orientations)
1449             {
1450                 throw new ArgumentNullException(nameof(orientations));
1451             }
1452
1453             PropertyArray orientationArray = new PropertyArray();
1454             for (int i = 0; i < orientations.Count; i++)
1455             {
1456                 PropertyValue value = new PropertyValue((int)orientations[i]);
1457                 orientationArray.PushBack(value);
1458                 value.Dispose();
1459             }
1460
1461             Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1462             orientationArray.Dispose();
1463             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1464         }
1465
1466         /// <summary>
1467         /// Get native window ID
1468         /// </summary>
1469         /// <returns>native window ID</returns>
1470         [EditorBrowsable(EditorBrowsableState.Never)]
1471         public int GetNativeId()
1472         {
1473             int ret = Interop.Window.GetNativeId(SwigCPtr);
1474             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1475             return ret;
1476         }
1477
1478         internal Any GetNativeHandle()
1479         {
1480             Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1481             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1482             return ret;
1483         }
1484
1485         internal void Add(Layer layer)
1486         {
1487             if (null == layer)
1488             {
1489                 throw new ArgumentNullException(nameof(layer));
1490             }
1491
1492             if (isBorderWindow)
1493             {
1494                 Interop.Actor.Add(GetBorderWindowRootLayer().SwigCPtr, layer.SwigCPtr);
1495                 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1496             }
1497             else
1498             {
1499                 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1500                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501             }
1502
1503             LayersChildren?.Add(layer);
1504             layer.SetWindow(this);
1505         }
1506
1507         internal void Remove(Layer layer)
1508         {
1509             if (null == layer)
1510             {
1511                 throw new ArgumentNullException(nameof(layer));
1512             }
1513             Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1514             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1515
1516             LayersChildren?.Remove(layer);
1517             layer.SetWindow(null);
1518         }
1519
1520         internal Vector2 GetSize()
1521         {
1522             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1523
1524             convertRealWindowSizeToBorderWindowSize(val);
1525
1526             Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1527             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1528             val.Dispose();
1529             return ret;
1530         }
1531
1532         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1533         [EditorBrowsable(EditorBrowsableState.Never)]
1534         public RenderTaskList GetRenderTaskList()
1535         {
1536             RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1537             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1538             return ret;
1539         }
1540
1541         /// <summary>
1542         /// Queries the number of on-window layers.
1543         /// </summary>
1544         /// <returns>The number of layers.</returns>
1545         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1546         internal uint GetLayerCount()
1547         {
1548             if (LayersChildren == null || LayersChildren.Count < 0)
1549                 return 0;
1550
1551             return (uint)LayersChildren.Count;
1552         }
1553
1554         internal Layer GetRootLayer()
1555         {
1556             if (isBorderWindow)
1557             {
1558                 if (borderLayer == null)
1559                 {
1560                     borderLayer = GetBorderWindowRootLayer();
1561                     LayersChildren?.Add(borderLayer);
1562                     borderLayer.SetWindow(this);
1563                 }
1564                 return borderLayer;
1565             }
1566             else
1567             {
1568                 // Window.IsInstalled() is actually true only when called from event thread and
1569                 // Core has been initialized, not when Stage is ready.
1570                 if (rootLayer == null && Window.IsInstalled())
1571                 {
1572                     rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1573                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1574                     LayersChildren?.Add(rootLayer);
1575                     rootLayer.SetWindow(this);
1576                 }
1577                 return rootLayer;
1578             }
1579         }
1580
1581         internal void SetBackgroundColor(Vector4 color)
1582         {
1583             Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1585         }
1586
1587         internal Vector4 GetBackgroundColor()
1588         {
1589             Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1590             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1591             return ret;
1592         }
1593
1594         internal Vector2 GetDpi()
1595         {
1596             Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1598             return ret;
1599         }
1600
1601         internal ObjectRegistry GetObjectRegistry()
1602         {
1603             ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1604             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1605             return ret;
1606         }
1607
1608         internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1609         {
1610             Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1611             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1612         }
1613
1614         internal RenderingBehaviorType GetRenderingBehavior()
1615         {
1616             RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1617             if (NDalicPINVOKE.SWIGPendingException.Pending)
1618                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1619             return ret;
1620         }
1621
1622         internal void SetWindowSize(Size2D size)
1623         {
1624             if (null == size)
1625             {
1626                 throw new ArgumentNullException(nameof(size));
1627             }
1628             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1629
1630             convertBorderWindowSizeToRealWindowSize(val);
1631
1632             Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1633             val.Dispose();
1634             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1635             // Resetting Window size should request a relayout of the tree.
1636         }
1637
1638         internal Size2D GetWindowSize()
1639         {
1640             var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1641
1642             convertRealWindowSizeToBorderWindowSize(val);
1643
1644             Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1645             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1646             val.Dispose();
1647             return ret;
1648         }
1649
1650         internal void SetPosition(Position2D position)
1651         {
1652             if (null == position)
1653             {
1654                 throw new ArgumentNullException(nameof(position));
1655             }
1656             var val = new IntPair(position.X, position.Y);
1657             Interop.Window.SetPosition(SwigCPtr, IntPair.getCPtr(val));
1658             val.Dispose();
1659             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1660             // Setting Position of the window should request a relayout of the tree.
1661         }
1662
1663         internal Position2D GetPosition()
1664         {
1665             var val = new IntPair(Interop.Window.GetPosition(SwigCPtr), true);
1666             Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1667             val.Dispose();
1668             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1669             return ret;
1670         }
1671
1672         internal void SetPositionSize(Rectangle positionSize)
1673         {
1674             if (positionSize == null)
1675             {
1676                 throw new ArgumentNullException(nameof(positionSize));
1677             }
1678             var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1679
1680             convertBorderWindowSizeToRealWindowSize(val);
1681
1682             positionSize.Width = val.GetX();
1683             positionSize.Height = val.GetY();
1684
1685             Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1686             val.Dispose();
1687
1688             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1689
1690             // Setting Position of the window should request a relayout of the tree.
1691         }
1692
1693         /// <summary>
1694         /// Enables the floating mode of window.
1695         /// The floating mode is to support window is moved or resized by display server.
1696         /// For example, if the video-player window sets the floating mode,
1697         /// then display server changes its geometry and handles it like a popup.
1698         /// The way of handling floating mode window is decided by display server.
1699         /// A special display server(as a Tizen display server) supports this mode.
1700         /// </summary>
1701         /// <param name="enable">Enable floating mode or not.</param>
1702         [EditorBrowsable(EditorBrowsableState.Never)]
1703         public void EnableFloatingMode(bool enable)
1704         {
1705             Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1706             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707         }
1708
1709         /// <summary>
1710         /// Requests to display server for the window is moved by display server.
1711         /// It can be work with setting window floating mode.
1712         /// </summary>
1713         [EditorBrowsable(EditorBrowsableState.Never)]
1714         public void RequestMoveToServer()
1715         {
1716             Interop.Window.RequestMoveToServer(SwigCPtr);
1717             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1718         }
1719
1720         /// <summary>
1721         ///  Requests to display server for the window is resized by display server.
1722         /// It can be work with setting window floating mode.
1723         /// </summary>
1724         /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1725         [EditorBrowsable(EditorBrowsableState.Never)]
1726         public void RequestResizeToServer(ResizeDirection direction)
1727         {
1728             Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1729             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1730         }
1731
1732         /// <summary>
1733         /// Includes input region.
1734         /// This function inlcudes input regions.
1735         /// It can be used multiple times and supports multiple regions.
1736         /// It means input region will be extended.
1737         /// This input is related to mouse and touch event.
1738         /// If device has touch screen, this function is useful.
1739         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1740         /// </summary>
1741         /// <param name="inputRegion">The included region to accept input events.</param>
1742         [EditorBrowsable(EditorBrowsableState.Never)]
1743         public void IncludeInputRegion(Rectangle inputRegion)
1744         {
1745             Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1746             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1747         }
1748
1749         /// <summary>
1750         /// This function excludes input regions.
1751         /// It can be used multiple times and supports multiple regions.
1752         /// It means input region will be reduced.
1753         /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1754         /// This input is related to mouse and touch event.
1755         /// If device has touch screen, this function is useful.
1756         /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1757         /// </summary>
1758         /// <param name="inputRegion">The excluded region to except input events.</param>
1759         [EditorBrowsable(EditorBrowsableState.Never)]
1760         public void ExcludeInputRegion(Rectangle inputRegion)
1761         {
1762             Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1763             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1764         }
1765
1766         /// <summary>
1767         /// Maximizes window's size.
1768         /// If this function is called with true, window will be resized with screen size.
1769         /// Otherwise window will be resized with previous size.
1770         /// It is for the window's MAX button in window's border.
1771         /// If window border is supported by display server, it is not necessary.
1772         /// </summary>
1773         /// <param name="max">If window is maximized or unmaximized.</param>
1774         [EditorBrowsable(EditorBrowsableState.Never)]
1775         public void Maximize(bool max)
1776         {
1777             Interop.Window.Maximize(SwigCPtr, max);
1778             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1779         }
1780
1781         /// <summary>
1782         /// Returns whether the window is maximized or not.
1783         /// </summary>
1784         /// <returns>True if the window is maximized, false otherwise.</returns>
1785         [EditorBrowsable(EditorBrowsableState.Never)]
1786         public bool IsMaximized()
1787         {
1788             bool ret = Interop.Window.IsMaximized(SwigCPtr);
1789             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1790             return ret;
1791         }
1792
1793         /// <summary>
1794         /// Sets window's maximum size.
1795         ///
1796         /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1797         /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1798         ///
1799         /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1800         ///
1801         /// </summary>
1802         /// <param name="size">the maximum size.</param>
1803         [EditorBrowsable(EditorBrowsableState.Never)]
1804         public void SetMaximumSize(Size2D size)
1805         {
1806             if (null == size)
1807             {
1808                 throw new ArgumentNullException(nameof(size));
1809             }
1810             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1811
1812             Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1813             val.Dispose();
1814             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1815         }
1816
1817         /// <summary>
1818         /// Minimizes window's size.
1819         /// If this function is called with true, window will be iconified.
1820         /// Otherwise window will be activated.
1821         /// It is for the window's MIN button in window border.
1822         /// If window border is supported by display server, it is not necessary.
1823         /// </summary>
1824         /// <param name="min">If window is minimized or unminimized.</param>
1825         [EditorBrowsable(EditorBrowsableState.Never)]
1826         public void Minimize(bool min)
1827         {
1828             Interop.Window.Minimize(SwigCPtr, min);
1829             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1830         }
1831
1832         /// <summary>
1833         /// Returns whether the window is minimized or not.
1834         /// </summary>
1835         /// <returns>True if the window is minimized, false otherwise.</returns>
1836         [EditorBrowsable(EditorBrowsableState.Never)]
1837         public bool IsMinimized()
1838         {
1839             bool ret = Interop.Window.IsMinimized(SwigCPtr);
1840             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1841             return ret;
1842         }
1843
1844         /// <summary>
1845         /// Sets window's minimum size.
1846         /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1847         /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1848         /// </summary>
1849         /// <param name="size">the minimum size.</param>
1850         [EditorBrowsable(EditorBrowsableState.Never)]
1851         public void SetMimimumSize(Size2D size)
1852         {
1853             if (null == size)
1854             {
1855                 throw new ArgumentNullException(nameof(size));
1856             }
1857             var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1858
1859             Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1860             val.Dispose();
1861             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1862         }
1863
1864         /// <summary>
1865         /// Query whether window is rotating or not.
1866         /// </summary>
1867         /// <returns>True if window is rotating, false otherwise.</returns>
1868         [EditorBrowsable(EditorBrowsableState.Never)]
1869         public bool IsWindowRotating()
1870         {
1871             bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1872             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1873             return ret;
1874         }
1875
1876         /// <summary>
1877         /// Gets the last key event the window gets.
1878         /// </summary>
1879         /// <returns>The last key event the window gets.</returns>
1880         [EditorBrowsable(EditorBrowsableState.Never)]
1881         public Key GetLastKeyEvent()
1882         {
1883             Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
1884             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1885             return ret;
1886         }
1887
1888         /// <summary>
1889         /// Gets the last touch event the window gets.
1890         /// </summary>
1891         /// <returns>The last touch event the window gets.</returns>
1892         [EditorBrowsable(EditorBrowsableState.Never)]
1893         public Touch GetLastTouchEvent()
1894         {
1895             Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
1896             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1897             return ret;
1898         }
1899
1900         /// <summary>
1901         /// Add FrameUpdateCallback
1902         /// </summary>
1903         [EditorBrowsable(EditorBrowsableState.Never)]
1904         public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1905         {
1906             frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1907         }
1908
1909         /// <summary>
1910         /// Remove FrameUpdateCallback
1911         /// </summary>
1912         [EditorBrowsable(EditorBrowsableState.Never)]
1913         public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1914         {
1915             frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1916         }
1917
1918         /// <summary>
1919         /// Dispose for Window
1920         /// </summary>
1921         [EditorBrowsable(EditorBrowsableState.Never)]
1922         protected override void Dispose(DisposeTypes type)
1923         {
1924             if (disposed)
1925             {
1926                 return;
1927             }
1928
1929             if (type == DisposeTypes.Explicit)
1930             {
1931                 //Called by User
1932                 //Release your own managed resources here.
1933                 //You should release all of your own disposable objects here.
1934
1935                 if (IsBorderEnabled)
1936                 {
1937                     DisposeBorder();
1938                 }
1939
1940                 foreach (var layer in childLayers)
1941                 {
1942                     if (layer != null)
1943                     {
1944                         layer.Dispose();
1945                     }
1946                 }
1947
1948                 childLayers.Clear();
1949
1950                 localController?.Dispose();
1951             }
1952
1953             this.DisconnectNativeSignals();
1954
1955             base.Dispose(type);
1956         }
1957
1958         /// This will not be public opened.
1959         [EditorBrowsable(EditorBrowsableState.Never)]
1960         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1961         {
1962             Interop.Window.DeleteWindow(swigCPtr);
1963         }
1964
1965         private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1966
1967         private static readonly object locker = new object();
1968
1969         private static int key = 0;
1970
1971         private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1972
1973         private struct internalHookCallbackType
1974         {
1975             public FrameCallbackType userCallback;
1976             public int frameId;
1977         }
1978
1979         private static void OnInternalHookFrameCallback(int id)
1980         {
1981             lock (locker)
1982             {
1983                 if (frameCallbackList.ContainsKey(id))
1984                 {
1985                     if (frameCallbackList[id].userCallback != null)
1986                     {
1987                         frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1988                         frameCallbackList.Remove(id);
1989                     }
1990                     else
1991                     {
1992                         NUILog.Error($"found userCallback is NULL");
1993                         frameCallbackList.Remove(id);
1994                     }
1995                 }
1996             }
1997         }
1998
1999         private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2000         {
2001             if (null == callback)
2002             {
2003                 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2004             }
2005             var assignedKey = 0;
2006             lock (locker)
2007             {
2008                 key++;
2009                 assignedKey = key;
2010                 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2011                 {
2012                     userCallback = callback,
2013                     frameId = frameId,
2014                 });
2015             }
2016             return assignedKey;
2017         }
2018
2019         /// <summary>
2020         /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2021         /// </summary>
2022         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2023         [EditorBrowsable(EditorBrowsableState.Never)]
2024         public delegate void FrameCallbackType(int frameId);
2025
2026         /// <summary>
2027         /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2028         /// A callback of the following type may be used:
2029         /// <code>
2030         /// void MyFunction( int frameId )
2031         /// </code>
2032         /// This callback will be deleted once it is called.
2033         /// <remarks>
2034         /// Ownership of the callback is passed onto this class
2035         /// </remarks>
2036         /// </summary>
2037         /// <param name="callback">The function to call</param>
2038         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2039         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2040         [EditorBrowsable(EditorBrowsableState.Never)]
2041         public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2042         {
2043             var assignedKey = AddInterHookCallback(callback, frameId);
2044             Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2045
2046             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2047         }
2048
2049         /// <summary>
2050         /// Adds a callback that is called when the frame is displayed on the display.
2051         /// A callback of the following type may be used:
2052         /// <code>
2053         /// void MyFunction( int frameId )
2054         /// </code>
2055         /// This callback will be deleted once it is called.
2056         /// <remarks>
2057         /// Ownership of the callback is passed onto this class
2058         /// </remarks>
2059         /// </summary>
2060         /// <param name="callback">The function to call</param>
2061         /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2062         /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2063         [EditorBrowsable(EditorBrowsableState.Never)]
2064         public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2065         {
2066             var assignedKey = AddInterHookCallback(callback, frameId);
2067             Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2068
2069             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2070         }
2071
2072         /// <summary>
2073         /// Search through this Window for a Layer with the given unique ID.
2074         /// </summary>
2075         /// <param name="id">The ID of the Layer to find.</param>
2076         /// <remarks>Hidden-API</remarks>
2077         /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2078         [EditorBrowsable(EditorBrowsableState.Never)]
2079         public Layer FindLayerByID(uint id)
2080         {
2081             Layer defaultLayer = this.GetDefaultLayer();
2082             IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2083             Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2084
2085             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2086             return ret;
2087         }
2088
2089         /// <summary>
2090         /// Get Native Window handle.
2091         /// <example>
2092         /// How to get Native Window handle
2093         /// <code>
2094         /// Window window = NUIApplication.GetDefaultWindow();
2095         /// var handle = window.NativeHandle;
2096         /// if(handle.IsInvalid == false)
2097         /// {
2098         ///     IntPtr nativeHandle = handle.DangerousGetHandle();
2099         ///     // do something with nativeHandle
2100         /// }
2101         /// </code>
2102         /// </example>
2103         /// </summary>
2104         /// <since_tizen> 9 </since_tizen>
2105         public SafeHandle NativeHandle
2106         {
2107             get
2108             {
2109                 return new NUI.SafeNativeWindowHandle(this);
2110             }
2111         }
2112     }
2113 }