2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 extern alias TizenSystemInformation;
19 using TizenSystemInformation.Tizen.System;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24 using System.Runtime.InteropServices;
26 using Tizen.NUI.BaseComponents;
31 /// The window class is used internally for drawing.<br />
32 /// The window has an orientation and indicator properties.<br />
34 /// <since_tizen> 3 </since_tizen>
35 public partial class Window : BaseHandle
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;
44 static internal bool IsSupportedMultiWindow()
46 bool isSupported = false;
49 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
51 catch (DllNotFoundException e)
53 Tizen.Log.Fatal("NUI", $"{e}\n");
57 #if NUI_PROPERTY_CHANGE_DEBUG
58 private bool flag1 = false;
60 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
62 if (Interop.Stage.IsInstalled())
64 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
66 localController = new LayoutController(this);
67 NUILog.Debug("layoutController id:" + localController.GetId());
69 #if NUI_PROPERTY_CHANGE_DEBUG
70 Tizen.Log.Fatal("NUITEST", $"Window constructor called!");
74 var curTh = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
75 Tizen.Log.Fatal("NUITEST", $"current threadID : {curTh}");
78 this.KeyEvent += TestWindowKeyEventHandler;
79 Tizen.Log.Fatal("NUITEST", $"TestWindowKeyEventHandler() added");
87 #if NUI_PROPERTY_CHANGE_DEBUG
88 private void TestWindowKeyEventHandler(object o, Window.KeyEventArgs e)
90 if(e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "1")
92 #if NUI_PROPERTY_CHANGE_1
93 Tizen.Log.Fatal("NUITEST", $"### (FIXED) currently used properties ###");
95 Tizen.Log.Fatal("NUITEST", $"### currently used properties ###");
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}");
198 /// A helper method to get the current window where the view is added
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)
207 NUILog.Error("if there is no view, it can not get a window");
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();
218 /// Creates a new Window.<br />
219 /// This creates an extra window in addition to the default main window<br />
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)
229 if (IsSupportedMultiWindow() == false)
231 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
237 /// Creates a new Window with a specific name.<br />
238 /// This creates an extra window in addition to the default main window<br />
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)
249 if (IsSupportedMultiWindow() == false)
251 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
253 this.windowTitle = name;
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 /// Creates a new Window with a specific name.<br />
259 /// This creates an extra window in addition to the default main window<br />
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)
271 if (IsSupportedMultiWindow() == false)
273 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
275 this.windowTitle = name;
276 this.EnableBorder(borderInterface);
277 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
284 /// <since_tizen> 3 </since_tizen>
285 public enum WindowOrientation
288 /// Portrait orientation. The height of the display area is greater than the width.
290 /// <since_tizen> 3 </since_tizen>
293 /// Landscape orientation. A wide view area is needed.
295 /// <since_tizen> 3 </since_tizen>
298 /// Portrait inverse orientation.
300 /// <since_tizen> 3 </since_tizen>
301 PortraitInverse = 180,
303 /// Landscape inverse orientation.
305 /// <since_tizen> 3 </since_tizen>
306 LandscapeInverse = 270,
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.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 NoOrientationPreference = -1
317 /// Enumeration for the key grab mode for platform-level APIs.
319 /// <since_tizen> 3 </since_tizen>
320 public enum KeyGrabMode
323 /// Grabs a key only when on the top of the grabbing-window stack mode.
327 /// Grabs a key together with the other client window(s) mode.
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.
335 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
341 /// Enumeration for transition effect's state.
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
352 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
353 [EditorBrowsable(EditorBrowsableState.Never)]
356 /// Transition effect is started.
358 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
359 [EditorBrowsable(EditorBrowsableState.Never)]
362 /// Transition effect is ended.
364 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
365 [EditorBrowsable(EditorBrowsableState.Never)]
370 /// Enumeration for transition effect's state.
372 [EditorBrowsable(EditorBrowsableState.Never)]
373 public enum EffectState
378 [EditorBrowsable(EditorBrowsableState.Never)]
381 /// Transition effect is started.
383 [EditorBrowsable(EditorBrowsableState.Never)]
386 /// Transition effect is ended.
388 [EditorBrowsable(EditorBrowsableState.Never)]
393 /// Enumeration for transition effect's type.
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
404 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
405 [EditorBrowsable(EditorBrowsableState.Never)]
408 /// Window show effect.
410 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
411 [EditorBrowsable(EditorBrowsableState.Never)]
414 /// Window hide effect.
416 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
417 [EditorBrowsable(EditorBrowsableState.Never)]
422 /// Enumeration for transition effect's type.
424 [EditorBrowsable(EditorBrowsableState.Never)]
425 public enum EffectType
430 [EditorBrowsable(EditorBrowsableState.Never)]
433 /// Window show effect.
435 [EditorBrowsable(EditorBrowsableState.Never)]
438 /// Window hide effect.
440 [EditorBrowsable(EditorBrowsableState.Never)]
445 /// Enumeration for result of window operation.
447 internal enum OperationResult
450 /// Failed for unknown reason
458 /// Permission denied
462 /// The operation is not supported.
468 /// Enumeration for window resized mode by display server.
470 [EditorBrowsable(EditorBrowsableState.Never)]
471 public enum ResizeDirection
476 [EditorBrowsable(EditorBrowsableState.Never)]
479 /// Start resizing window to the top-left edge.
481 [EditorBrowsable(EditorBrowsableState.Never)]
484 /// Start resizing window to the top side.
486 [EditorBrowsable(EditorBrowsableState.Never)]
489 /// Start resizing window to the top-right edge.
491 [EditorBrowsable(EditorBrowsableState.Never)]
494 /// Start resizing window to the left side.
496 [EditorBrowsable(EditorBrowsableState.Never)]
499 /// Start resizing window to the right side.
501 [EditorBrowsable(EditorBrowsableState.Never)]
504 /// Start resizing window to the bottom-left edge.
506 [EditorBrowsable(EditorBrowsableState.Never)]
509 /// Start resizing window to the bottom side.
511 [EditorBrowsable(EditorBrowsableState.Never)]
514 /// Start resizing window to the bottom-right edge.
516 [EditorBrowsable(EditorBrowsableState.Never)]
522 /// The stage instance property (read-only).<br />
523 /// Gets the current window.<br />
525 /// <since_tizen> 3 </since_tizen>
526 public static Window Instance { get; internal set; }
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.
533 /// <since_tizen> 3 </since_tizen>
534 public WindowType Type
538 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
539 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
544 Interop.Window.SetType(SwigCPtr, (int)value);
545 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
550 /// Gets/Sets a window title.
552 /// <since_tizen> 4 </since_tizen>
562 SetClass(windowTitle, "");
567 /// The rendering behavior of a Window.
569 /// <since_tizen> 5 </since_tizen>
570 public RenderingBehaviorType RenderingBehavior
574 return GetRenderingBehavior();
578 SetRenderingBehavior(value);
583 /// The window size property (read-only).
585 /// <since_tizen> 3 </since_tizen>
590 Size2D ret = GetSize();
596 /// The background color property.
598 /// <since_tizen> 3 </since_tizen>
599 public Color BackgroundColor
603 SetBackgroundColor(value);
607 Color ret = GetBackgroundColor();
613 /// The DPI property (read-only).<br />
614 /// Retrieves the DPI of the display device to which the Window is connected.<br />
616 /// <since_tizen> 3 </since_tizen>
626 /// The layer count property (read-only).<br />
627 /// Queries the number of on-Window layers.<br />
629 /// <since_tizen> 3 </since_tizen>
630 public uint LayerCount
634 return GetLayerCount();
639 /// Gets or sets a size of the window.
641 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
642 /// <since_tizen> 4 </since_tizen>
643 public Size2D WindowSize
647 return GetWindowSize();
651 SetWindowSize(value);
656 /// Gets or sets a position of the window.
658 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
659 /// <since_tizen> 4 </since_tizen>
660 public Position2D WindowPosition
664 return GetPosition();
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.
676 [EditorBrowsable(EditorBrowsableState.Never)]
677 public Rectangle WindowPositionSize
681 Position2D position = GetPosition();
682 Size2D size = GetSize();
683 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
689 SetPositionSize(value);
693 internal static Vector4 DEFAULT_BACKGROUND_COLOR
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();
704 internal static Vector4 DEBUG_BACKGROUND_COLOR
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();
715 internal List<Layer> LayersChildren
724 /// Get the LayoutController for this Window.
726 internal LayoutController LayoutController
730 return localController;
735 /// Feed a key-event into the window.
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)
742 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 /// Sets whether the window accepts a focus or not.
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)
753 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 /// Returns whether the window accepts a focus or not.
760 /// <returns>True if the window accepts a focus, false otherwise.</returns>
761 /// <since_tizen> 3 </since_tizen>
762 public bool IsFocusAcceptable()
764 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 /// Shows the window if it is hidden.
773 /// <since_tizen> 3 </since_tizen>
776 Interop.Window.Show(SwigCPtr);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
781 /// Hides the window if it is showing.
783 /// <since_tizen> 3 </since_tizen>
786 Interop.Window.Hide(SwigCPtr);
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Retrieves whether the window is visible or not.
793 /// <returns>True if the window is visible.</returns>
794 /// <since_tizen> 3 </since_tizen>
795 public bool IsVisible()
797 bool temp = Interop.Window.IsVisible(SwigCPtr);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
803 /// Gets the count of supported auxiliary hints of the window.
805 /// <returns>The number of supported auxiliary hints.</returns>
806 /// <since_tizen> 3 </since_tizen>
807 public uint GetSupportedAuxiliaryHintCount()
809 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 /// Gets the supported auxiliary hint string of the window.
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)
822 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
828 /// Creates an auxiliary hint of the window.
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)
836 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
842 /// Removes an auxiliary hint of the window.
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)
849 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
850 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
855 /// Changes a value of the auxiliary hint.
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)
863 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Gets a value of the auxiliary hint.
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)
876 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
877 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 /// Gets an ID of the auxiliary hint string.
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)
889 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
895 /// Sets a region to accept input events.
897 /// <param name="inputRegion">The region to accept input events.</param>
898 /// <since_tizen> 3 </since_tizen>
899 public void SetInputRegion(Rectangle inputRegion)
901 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
902 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
906 /// Sets a priority level for the specified notification window.
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)
913 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
915 return ret == OperationResult.Succeed;
919 /// Gets a priority level for the specified notification window.
921 /// <returns>The notification window level.</returns>
922 /// <since_tizen> 3 </since_tizen>
923 public NotificationLevel GetNotificationLevel()
925 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
926 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
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.
939 /// <since_tizen> 3 </since_tizen>
940 public void SetOpaqueState(bool opaque)
942 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
943 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
947 /// Returns whether a transparent window's visual state is opaque or not.
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()
954 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960 /// Sets a window's screen off mode.
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)
967 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969 return ret == OperationResult.Succeed;
973 /// Gets the screen mode of the window.
975 /// <returns>The screen off mode.</returns>
976 /// <since_tizen> 4 </since_tizen>
977 public ScreenOffMode GetScreenOffMode()
979 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
980 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
985 /// Sets preferred brightness of the window.
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)
992 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
993 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
994 return ret == OperationResult.Succeed;
998 /// Gets the preferred brightness of the window.
1000 /// <returns>The preferred brightness.</returns>
1001 /// <since_tizen> 3 </since_tizen>
1002 public int GetBrightness()
1004 int ret = Interop.Window.GetBrightness(SwigCPtr);
1005 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1010 /// Sets the window name and the class string.
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)
1017 Interop.Window.SetClass(SwigCPtr, name, klass);
1018 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1022 /// Raises the window to the top of the window stack.
1024 /// <since_tizen> 3 </since_tizen>
1027 Interop.Window.Raise(SwigCPtr);
1028 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1032 /// Lowers the window to the bottom of the window stack.
1034 /// <since_tizen> 3 </since_tizen>
1037 Interop.Window.Lower(SwigCPtr);
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 /// Activates the window to the top of the window stack even it is iconified.
1044 /// <since_tizen> 3 </since_tizen>
1045 public void Activate()
1047 Interop.Window.Activate(SwigCPtr);
1048 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1052 /// Gets the default ( root ) layer.
1054 /// <returns>The root layer.</returns>
1055 /// <since_tizen> 3 </since_tizen>
1056 public Layer GetDefaultLayer()
1058 return this.GetRootLayer();
1062 /// Add a child view to window.
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)
1068 this.GetRootLayer().Add(view);
1072 /// Remove a child view from window.
1074 /// <param name="view">the child to be removed.</param>
1075 /// <since_tizen> 3 </since_tizen>
1076 public void Remove(View view)
1078 this.GetRootLayer().Remove(view);
1082 /// Retrieves the layer at a specified depth.
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)
1089 if (depth < LayersChildren?.Count)
1091 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1101 /// Destroy the window immediately.
1103 [EditorBrowsable(EditorBrowsableState.Never)]
1104 public void Destroy()
1110 /// Keep rendering for at least the given amount of time.
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)
1116 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
1117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
1130 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
1144 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
1162 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
1176 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182 /// Sets the keyboard repeat information.
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)
1190 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196 /// Gets the keyboard repeat information.
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)
1204 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1210 /// Adds a layer to the stage.
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)
1221 /// Removes a layer from the stage.
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)
1232 /// Feeds a key event into the window.
1234 /// <param name="keyEvent">The key event to feed.</param>
1235 /// <since_tizen> 5 </since_tizen>
1236 public void FeedKey(Key keyEvent)
1238 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243 /// Feeds a touch point into the window.
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)
1249 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1254 /// Feeds a wheel event into the window.
1256 /// <param name="wheelEvent">The wheel event to feed.</param>
1257 internal void FeedWheel(Wheel wheelEvent)
1259 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 /// Allows at least one more render, even when paused.
1265 /// The window should be shown, not minimised.
1267 /// <since_tizen> 4 </since_tizen>
1268 public void RenderOnce()
1270 Interop.Window.RenderOnce(SwigCPtr);
1271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275 /// Sets whether the window is transparent or not.
1277 /// <param name="transparent">Whether the window is transparent or not.</param>
1278 /// <since_tizen> 5 </since_tizen>
1279 public void SetTransparency(bool transparent)
1281 Interop.Window.SetTransparency(SwigCPtr, transparent);
1282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
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.
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)
1299 if (IsSupportedMultiWindow() == false)
1301 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1303 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
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)
1319 if (IsSupportedMultiWindow() == false)
1321 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1323 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 /// Unsets parent window of the window.
1329 /// After unsetting, the window is disconnected his parent window.
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()
1336 if (IsSupportedMultiWindow() == false)
1338 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1340 Interop.Window.Unparent(SwigCPtr);
1341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1345 /// Gets parent window of the window.
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()
1354 if (IsSupportedMultiWindow() == false)
1356 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1358 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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()
1367 Layer rootLayer = GetRootLayer();
1368 foreach (View view in rootLayer.Children)
1374 internal static bool IsInstalled()
1376 bool ret = Interop.Stage.IsInstalled();
1377 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382 /// Adds an orientation to the list of available orientations.
1384 /// <param name="orientation">The available orientation to add</param>
1385 /// <since_tizen> 6 </since_tizen>
1386 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1388 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393 /// Removes an orientation from the list of available orientations.
1395 /// <param name="orientation">The available orientation to remove.</param>
1396 /// <since_tizen> 6 </since_tizen>
1397 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1399 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404 /// Sets a preferred orientation.
1406 /// <param name="orientation">The preferred orientation.</param>
1407 /// <since_tizen> 6 </since_tizen>
1408 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1410 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1411 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1415 /// Gets the preferred orientation.
1417 /// <since_tizen> 6 </since_tizen>
1418 /// <returns>The preferred orientation if previously set, or none.</returns>
1419 public Window.WindowOrientation GetPreferredOrientation()
1421 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1427 /// Gets current orientation of the window.
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()
1434 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1440 /// Sets available orientations of the window.
1441 /// This API is for setting several orientations one time.
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)
1448 if (null == orientations)
1450 throw new ArgumentNullException(nameof(orientations));
1453 PropertyArray orientationArray = new PropertyArray();
1454 for (int i = 0; i < orientations.Count; i++)
1456 PropertyValue value = new PropertyValue((int)orientations[i]);
1457 orientationArray.PushBack(value);
1461 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1462 orientationArray.Dispose();
1463 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1467 /// Get native window ID
1469 /// <returns>native window ID</returns>
1470 [EditorBrowsable(EditorBrowsableState.Never)]
1471 public int GetNativeId()
1473 int ret = Interop.Window.GetNativeId(SwigCPtr);
1474 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478 internal Any GetNativeHandle()
1480 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485 internal void Add(Layer layer)
1489 throw new ArgumentNullException(nameof(layer));
1494 Interop.Actor.Add(GetBorderWindowRootLayer().SwigCPtr, layer.SwigCPtr);
1495 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1499 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1503 LayersChildren?.Add(layer);
1504 layer.SetWindow(this);
1507 internal void Remove(Layer layer)
1511 throw new ArgumentNullException(nameof(layer));
1513 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1514 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1516 LayersChildren?.Remove(layer);
1517 layer.SetWindow(null);
1520 internal Vector2 GetSize()
1522 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1524 convertRealWindowSizeToBorderWindowSize(val);
1526 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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()
1536 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1542 /// Queries the number of on-window layers.
1544 /// <returns>The number of layers.</returns>
1545 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1546 internal uint GetLayerCount()
1548 if (LayersChildren == null || LayersChildren.Count < 0)
1551 return (uint)LayersChildren.Count;
1554 internal Layer GetRootLayer()
1558 if (borderLayer == null)
1560 borderLayer = GetBorderWindowRootLayer();
1561 LayersChildren?.Add(borderLayer);
1562 borderLayer.SetWindow(this);
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())
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);
1581 internal void SetBackgroundColor(Vector4 color)
1583 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1584 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1587 internal Vector4 GetBackgroundColor()
1589 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1590 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1594 internal Vector2 GetDpi()
1596 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1597 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1601 internal ObjectRegistry GetObjectRegistry()
1603 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1604 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1608 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1610 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1614 internal RenderingBehaviorType GetRenderingBehavior()
1616 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1617 if (NDalicPINVOKE.SWIGPendingException.Pending)
1618 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1622 internal void SetWindowSize(Size2D size)
1626 throw new ArgumentNullException(nameof(size));
1628 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1630 convertBorderWindowSizeToRealWindowSize(val);
1632 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1634 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1635 // Resetting Window size should request a relayout of the tree.
1638 internal Size2D GetWindowSize()
1640 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1642 convertRealWindowSizeToBorderWindowSize(val);
1644 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1645 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1650 internal void SetPosition(Position2D position)
1652 if (null == position)
1654 throw new ArgumentNullException(nameof(position));
1656 var val = new IntPair(position.X, position.Y);
1657 Interop.Window.SetPosition(SwigCPtr, IntPair.getCPtr(val));
1659 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1660 // Setting Position of the window should request a relayout of the tree.
1663 internal Position2D GetPosition()
1665 var val = new IntPair(Interop.Window.GetPosition(SwigCPtr), true);
1666 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1668 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1672 internal void SetPositionSize(Rectangle positionSize)
1674 if (positionSize == null)
1676 throw new ArgumentNullException(nameof(positionSize));
1678 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1680 convertBorderWindowSizeToRealWindowSize(val);
1682 positionSize.Width = val.GetX();
1683 positionSize.Height = val.GetY();
1685 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1688 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1690 // Setting Position of the window should request a relayout of the tree.
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.
1701 /// <param name="enable">Enable floating mode or not.</param>
1702 [EditorBrowsable(EditorBrowsableState.Never)]
1703 public void EnableFloatingMode(bool enable)
1705 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1710 /// Requests to display server for the window is moved by display server.
1711 /// It can be work with setting window floating mode.
1713 [EditorBrowsable(EditorBrowsableState.Never)]
1714 public void RequestMoveToServer()
1716 Interop.Window.RequestMoveToServer(SwigCPtr);
1717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1721 /// Requests to display server for the window is resized by display server.
1722 /// It can be work with setting window floating mode.
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)
1728 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1729 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
1741 /// <param name="inputRegion">The included region to accept input events.</param>
1742 [EditorBrowsable(EditorBrowsableState.Never)]
1743 public void IncludeInputRegion(Rectangle inputRegion)
1745 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
1758 /// <param name="inputRegion">The excluded region to except input events.</param>
1759 [EditorBrowsable(EditorBrowsableState.Never)]
1760 public void ExcludeInputRegion(Rectangle inputRegion)
1762 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
1773 /// <param name="max">If window is maximized or unmaximized.</param>
1774 [EditorBrowsable(EditorBrowsableState.Never)]
1775 public void Maximize(bool max)
1777 Interop.Window.Maximize(SwigCPtr, max);
1778 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1782 /// Returns whether the window is maximized or not.
1784 /// <returns>True if the window is maximized, false otherwise.</returns>
1785 [EditorBrowsable(EditorBrowsableState.Never)]
1786 public bool IsMaximized()
1788 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1794 /// Sets window's maximum size.
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().
1799 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1802 /// <param name="size">the maximum size.</param>
1803 [EditorBrowsable(EditorBrowsableState.Never)]
1804 public void SetMaximumSize(Size2D size)
1808 throw new ArgumentNullException(nameof(size));
1810 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1812 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
1824 /// <param name="min">If window is minimized or unminimized.</param>
1825 [EditorBrowsable(EditorBrowsableState.Never)]
1826 public void Minimize(bool min)
1828 Interop.Window.Minimize(SwigCPtr, min);
1829 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1833 /// Returns whether the window is minimized or not.
1835 /// <returns>True if the window is minimized, false otherwise.</returns>
1836 [EditorBrowsable(EditorBrowsableState.Never)]
1837 public bool IsMinimized()
1839 bool ret = Interop.Window.IsMinimized(SwigCPtr);
1840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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().
1849 /// <param name="size">the minimum size.</param>
1850 [EditorBrowsable(EditorBrowsableState.Never)]
1851 public void SetMimimumSize(Size2D size)
1855 throw new ArgumentNullException(nameof(size));
1857 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1859 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1861 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1865 /// Query whether window is rotating or not.
1867 /// <returns>True if window is rotating, false otherwise.</returns>
1868 [EditorBrowsable(EditorBrowsableState.Never)]
1869 public bool IsWindowRotating()
1871 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1872 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1877 /// Gets the last key event the window gets.
1879 /// <returns>The last key event the window gets.</returns>
1880 [EditorBrowsable(EditorBrowsableState.Never)]
1881 public Key GetLastKeyEvent()
1883 Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
1884 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1889 /// Gets the last touch event the window gets.
1891 /// <returns>The last touch event the window gets.</returns>
1892 [EditorBrowsable(EditorBrowsableState.Never)]
1893 public Touch GetLastTouchEvent()
1895 Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
1896 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1901 /// Add FrameUpdateCallback
1903 [EditorBrowsable(EditorBrowsableState.Never)]
1904 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1906 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1910 /// Remove FrameUpdateCallback
1912 [EditorBrowsable(EditorBrowsableState.Never)]
1913 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1915 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1919 /// Dispose for Window
1921 [EditorBrowsable(EditorBrowsableState.Never)]
1922 protected override void Dispose(DisposeTypes type)
1929 if (type == DisposeTypes.Explicit)
1932 //Release your own managed resources here.
1933 //You should release all of your own disposable objects here.
1935 if (IsBorderEnabled)
1940 foreach (var layer in childLayers)
1948 childLayers.Clear();
1950 localController?.Dispose();
1953 this.DisconnectNativeSignals();
1958 /// This will not be public opened.
1959 [EditorBrowsable(EditorBrowsableState.Never)]
1960 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1962 Interop.Window.DeleteWindow(swigCPtr);
1965 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1967 private static readonly object locker = new object();
1969 private static int key = 0;
1971 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1973 private struct internalHookCallbackType
1975 public FrameCallbackType userCallback;
1979 private static void OnInternalHookFrameCallback(int id)
1983 if (frameCallbackList.ContainsKey(id))
1985 if (frameCallbackList[id].userCallback != null)
1987 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1988 frameCallbackList.Remove(id);
1992 NUILog.Error($"found userCallback is NULL");
1993 frameCallbackList.Remove(id);
1999 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2001 if (null == callback)
2003 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2005 var assignedKey = 0;
2010 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2012 userCallback = callback,
2020 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
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);
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:
2030 /// void MyFunction( int frameId )
2032 /// This callback will be deleted once it is called.
2034 /// Ownership of the callback is passed onto this class
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)
2043 var assignedKey = AddInterHookCallback(callback, frameId);
2044 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2046 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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:
2053 /// void MyFunction( int frameId )
2055 /// This callback will be deleted once it is called.
2057 /// Ownership of the callback is passed onto this class
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)
2066 var assignedKey = AddInterHookCallback(callback, frameId);
2067 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2069 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2073 /// Search through this Window for a Layer with the given unique ID.
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)
2081 Layer defaultLayer = this.GetDefaultLayer();
2082 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2083 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2085 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2090 /// Get Native Window handle.
2092 /// How to get Native Window handle
2094 /// Window window = NUIApplication.GetDefaultWindow();
2095 /// var handle = window.NativeHandle;
2096 /// if(handle.IsInvalid == false)
2098 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2099 /// // do something with nativeHandle
2104 /// <since_tizen> 9 </since_tizen>
2105 public SafeHandle NativeHandle
2109 return new NUI.SafeNativeWindowHandle(this);