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 View's properties ###");
95 Tizen.Log.Fatal("NUITEST", $"### currently used View's properties ###");
97 Tizen.Log.Fatal("NUITEST", $"PropertyValueConstructor: {Tizen.NUI.PropertyValue.PropertyValueConstructor}");
98 Tizen.Log.Fatal("NUITEST", $"SizeGetter: {View.SizeGetter}, SizeSetter: {View.SizeSetter}");
99 Tizen.Log.Fatal("NUITEST", $"Size2DGetter: {View.Size2DGetter}, Size2DSetter: {View.Size2DSetter}");
100 Tizen.Log.Fatal("NUITEST", $"SizeWidthGetter: {View.SizeWidthGetter}, SizeWidthSetter: {View.SizeWidthSetter}");
101 Tizen.Log.Fatal("NUITEST", $"SizeHeightGetter: {View.SizeHeightGetter}, SizeHeightSetter: {View.SizeHeightSetter}");
102 Tizen.Log.Fatal("NUITEST", $"PositionGetter: {View.PositionGetter}, PositionSetter: {View.PositionSetter}");
103 Tizen.Log.Fatal("NUITEST", $"Position2DGetter: {View.Position2DGetter}, Position2DSetter: {View.Position2DSetter}");
104 Tizen.Log.Fatal("NUITEST", $"PositionXGetter: {View.PositionXGetter}, PositionXSetter: {View.PositionXSetter}");
105 Tizen.Log.Fatal("NUITEST", $"PositionYGetter: {View.PositionYGetter}, PositionYSetter: {View.PositionYSetter}");
106 Tizen.Log.Fatal("NUITEST", $"PositionZGetter: {View.PositionZGetter}, PositionZSetter: {View.PositionZSetter}");
107 Tizen.Log.Fatal("NUITEST", $"MaximumSizeGetter: {View.MaximumSizeGetter}, MaximumSizeSetter: {View.MaximumSizeSetter}");
108 Tizen.Log.Fatal("NUITEST", $"MinimumSizeGetter: {View.MinimumSizeGetter}, MinimumSizeSetter: {View.MinimumSizeSetter}");
109 Tizen.Log.Fatal("NUITEST", $"StyleNameGetter: {View.StyleNameGetter}, StyleNameSetter: {View.StyleNameSetter}");
110 Tizen.Log.Fatal("NUITEST", $"KeyInputFocusGetter: {View.KeyInputFocusGetter}, KeyInputFocusSetter: {View.KeyInputFocusSetter}");
111 Tizen.Log.Fatal("NUITEST", $"ColorGetter: {View.ColorGetter}, ColorSetter: {View.ColorSetter}");
112 Tizen.Log.Fatal("NUITEST", $"ColorRedGetter: {View.ColorRedGetter}, ColorRedSetter: {View.ColorRedSetter}");
113 Tizen.Log.Fatal("NUITEST", $"ColorGreenGetter: {View.ColorGreenGetter}, ColorGreenSetter: {View.ColorGreenSetter}");
114 Tizen.Log.Fatal("NUITEST", $"ColorBlueGetter: {View.ColorBlueGetter}, ColorBlueSetter: {View.ColorBlueSetter}");
115 Tizen.Log.Fatal("NUITEST", $"StateGetter: {View.StateGetter}, StateSetter: {View.StateSetter}");
116 Tizen.Log.Fatal("NUITEST", $"SubStateGetter: {View.SubStateGetter}, SubStateSetter: {View.SubStateSetter}");
117 Tizen.Log.Fatal("NUITEST", $"FlexGetter: {View.FlexGetter}, FlexSetter: {View.FlexSetter}");
118 Tizen.Log.Fatal("NUITEST", $"AlignSelfGetter: {View.AlignSelfGetter}, AlignSelfSetter: {View.AlignSelfSetter}");
119 Tizen.Log.Fatal("NUITEST", $"FlexMarginGetter: {View.FlexMarginGetter}, FlexMarginSetter: {View.FlexMarginSetter}");
120 Tizen.Log.Fatal("NUITEST", $"CellIndexGetter: {View.CellIndexGetter}, CellIndexSetter: {View.CellIndexSetter}");
121 Tizen.Log.Fatal("NUITEST", $"RowSpanGetter: {View.RowSpanGetter}, RowSpanSetter: {View.RowSpanSetter}");
122 Tizen.Log.Fatal("NUITEST", $"ColumnSpanGetter: {View.ColumnSpanGetter}, ColumnSpanSetter: {View.ColumnSpanSetter}");
123 Tizen.Log.Fatal("NUITEST", $"CellHorizontalAlignmentGetter: {View.CellHorizontalAlignmentGetter}, CellHorizontalAlignmentSetter: {View.CellHorizontalAlignmentSetter}");
124 Tizen.Log.Fatal("NUITEST", $"CellVerticalAlignmentGetter: {View.CellVerticalAlignmentGetter}, CellVerticalAlignmentSetter: {View.CellVerticalAlignmentSetter}");
125 Tizen.Log.Fatal("NUITEST", $"OpacityGetter: {View.OpacityGetter}, OpacitySetter: {View.OpacitySetter}");
126 Tizen.Log.Fatal("NUITEST", $"PositionUsesPivotPointGetter: {View.PositionUsesPivotPointGetter}, PositionUsesPivotPointSetter: {View.PositionUsesPivotPointSetter}");
127 Tizen.Log.Fatal("NUITEST", $"ParentOriginGetter: {View.ParentOriginGetter}, ParentOriginSetter: {View.ParentOriginSetter}");
128 Tizen.Log.Fatal("NUITEST", $"PivotPointGetter: {View.PivotPointGetter}, PivotPointSetter: {View.PivotPointSetter}");
129 Tizen.Log.Fatal("NUITEST", $"OrientationGetter: {View.OrientationGetter}, OrientationSetter: {View.OrientationSetter}");
130 Tizen.Log.Fatal("NUITEST", $"ScaleGetter: {View.ScaleGetter}, ScaleSetter: {View.ScaleSetter}");
131 Tizen.Log.Fatal("NUITEST", $"ScaleXGetter: {View.ScaleXGetter}, ScaleXSetter: {View.ScaleXSetter}");
132 Tizen.Log.Fatal("NUITEST", $"ScaleYGetter: {View.ScaleYGetter}, ScaleYSetter: {View.ScaleYSetter}");
133 Tizen.Log.Fatal("NUITEST", $"ScaleZGetter: {View.ScaleZGetter}, ScaleZSetter: {View.ScaleZSetter}");
134 Tizen.Log.Fatal("NUITEST", $"NameGetter: {View.NameGetter}, NameSetter: {View.NameSetter}");
135 Tizen.Log.Fatal("NUITEST", $"SensitiveGetter: {View.SensitiveGetter}, SensitiveSetter: {View.SensitiveSetter}");
136 Tizen.Log.Fatal("NUITEST", $"IsEnabledGetter: {View.IsEnabledGetter}, IsEnabledSetter: {View.IsEnabledSetter}");
137 Tizen.Log.Fatal("NUITEST", $"DispatchKeyEventsGetter: {View.DispatchKeyEventsGetter}, DispatchKeyEventsSetter: {View.DispatchKeyEventsSetter}");
138 Tizen.Log.Fatal("NUITEST", $"LeaveRequiredGetter: {View.LeaveRequiredGetter}, LeaveRequiredSetter: {View.LeaveRequiredSetter}");
139 Tizen.Log.Fatal("NUITEST", $"InheritOrientationGetter: {View.InheritOrientationGetter}, InheritOrientationSetter: {View.InheritOrientationSetter}");
140 Tizen.Log.Fatal("NUITEST", $"InheritScaleGetter: {View.InheritScaleGetter}, InheritScaleSetter: {View.InheritScaleSetter}");
141 Tizen.Log.Fatal("NUITEST", $"DrawModeGetter: {View.DrawModeGetter}, DrawModeSetter: {View.DrawModeSetter}");
142 Tizen.Log.Fatal("NUITEST", $"SizeModeFactorGetter: {View.SizeModeFactorGetter}, SizeModeFactorSetter: {View.SizeModeFactorSetter}");
143 Tizen.Log.Fatal("NUITEST", $"WidthResizePolicyGetter: {View.WidthResizePolicyGetter}, WidthResizePolicySetter: {View.WidthResizePolicySetter}");
144 Tizen.Log.Fatal("NUITEST", $"HeightResizePolicyGetter: {View.HeightResizePolicyGetter}, HeightResizePolicySetter: {View.HeightResizePolicySetter}");
145 Tizen.Log.Fatal("NUITEST", $"SizeScalePolicyGetter: {View.SizeScalePolicyGetter}, SizeScalePolicySetter: {View.SizeScalePolicySetter}");
146 Tizen.Log.Fatal("NUITEST", $"WidthForHeightGetter: {View.WidthForHeightGetter}, WidthForHeightSetter: {View.WidthForHeightSetter}");
147 Tizen.Log.Fatal("NUITEST", $"HeightForWidthGetter: {View.HeightForWidthGetter}, HeightForWidthSetter: {View.HeightForWidthSetter}");
148 Tizen.Log.Fatal("NUITEST", $"InheritPositionGetter: {View.InheritPositionGetter}, InheritPositionSetter: {View.InheritPositionSetter}");
149 Tizen.Log.Fatal("NUITEST", $"ClippingModeGetter: {View.ClippingModeGetter}, ClippingModeSetter: {View.ClippingModeSetter}");
150 Tizen.Log.Fatal("NUITEST", $"InheritLayoutDirectionGetter: {View.InheritLayoutDirectionGetter}, InheritLayoutDirectionSetter: {View.InheritLayoutDirectionSetter}");
151 Tizen.Log.Fatal("NUITEST", $"LayoutDirectionGetter: {View.LayoutDirectionGetter}, LayoutDirectionSetter: {View.LayoutDirectionSetter}");
152 Tizen.Log.Fatal("NUITEST", $"UpdateAreaHintGetter: {View.UpdateAreaHintGetter}, UpdateAreaHintSetter: {View.UpdateAreaHintSetter}");
153 Tizen.Log.Fatal("NUITEST", $"AccessibilityNameGetter: {View.AccessibilityNameGetter}, AccessibilityNameSetter: {View.AccessibilityNameSetter}");
154 Tizen.Log.Fatal("NUITEST", $"AccessibilityDescriptionGetter: {View.AccessibilityDescriptionGetter}, AccessibilityDescriptionSetter: {View.AccessibilityDescriptionSetter}");
155 Tizen.Log.Fatal("NUITEST", $"AccessibilityTranslationDomainGetter: {View.AccessibilityTranslationDomainGetter}, AccessibilityTranslationDomainSetter: {View.AccessibilityTranslationDomainSetter}");
156 Tizen.Log.Fatal("NUITEST", $"AccessibilityRoleGetter: {View.AccessibilityRoleGetter}, AccessibilityRoleSetter: {View.AccessibilityRoleSetter}");
157 Tizen.Log.Fatal("NUITEST", $"AccessibilityHighlightableGetter: {View.AccessibilityHighlightableGetter}, AccessibilityHighlightableSetter: {View.AccessibilityHighlightableSetter}");
158 Tizen.Log.Fatal("NUITEST", $"AccessibilityHiddenGetter: {View.AccessibilityHiddenGetter}, AccessibilityHiddenSetter: {View.AccessibilityHiddenSetter}");
159 Tizen.Log.Fatal("NUITEST", $"AutomationIdGetter: {View.AutomationIdGetter}, AutomationIdSetter: {View.AutomationIdSetter}");
165 /// A helper method to get the current window where the view is added
167 /// <param name="view">The View added to the window</param>
168 /// <returns>A Window.</returns>
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 static public Window Get(View view)
174 NUILog.Error("if there is no view, it can not get a window");
178 //to fix memory leak issue, match the handle count with native side.
179 Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
180 if (NDalicPINVOKE.SWIGPendingException.Pending)throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 /// Creates a new Window.<br />
186 /// This creates an extra window in addition to the default main window<br />
188 /// <param name="windowPosition">The position and size of the Window.</param>
189 /// <param name="isTranslucent">Whether Window is translucent.</param>
190 /// <returns>A new Window.</returns>
191 /// <since_tizen> 6 </since_tizen>
192 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
193 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
194 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
196 if (IsSupportedMultiWindow() == false)
198 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 /// Creates a new Window with a specific name.<br />
205 /// This creates an extra window in addition to the default main window<br />
207 /// <param name="name">The name for extra window. </param>
208 /// <param name="windowPosition">The position and size of the Window.</param>
209 /// <param name="isTranslucent">Whether Window is translucent.</param>
210 /// <returns>A new Window.</returns>
211 /// <since_tizen> 6 </since_tizen>
212 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
213 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
214 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
216 if (IsSupportedMultiWindow() == false)
218 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
220 this.windowTitle = name;
221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 /// Creates a new Window with a specific name.<br />
226 /// This creates an extra window in addition to the default main window<br />
228 /// <param name="name">The name for extra window. </param>
229 /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
230 /// <param name="windowPosition">The position and size of the Window.</param>
231 /// <param name="isTranslucent">Whether Window is translucent.</param>
232 /// <returns>A new Window.</returns>
233 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
234 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
238 if (IsSupportedMultiWindow() == false)
240 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
242 this.windowTitle = name;
243 this.EnableBorder(borderInterface);
244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
251 /// <since_tizen> 3 </since_tizen>
252 public enum WindowOrientation
255 /// Portrait orientation. The height of the display area is greater than the width.
257 /// <since_tizen> 3 </since_tizen>
260 /// Landscape orientation. A wide view area is needed.
262 /// <since_tizen> 3 </since_tizen>
265 /// Portrait inverse orientation.
267 /// <since_tizen> 3 </since_tizen>
268 PortraitInverse = 180,
270 /// Landscape inverse orientation.
272 /// <since_tizen> 3 </since_tizen>
273 LandscapeInverse = 270,
275 /// No orientation. It is for the preferred orientation
276 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
277 /// It is used to unset the preferred orientation with SetPreferredOrientation.
279 [EditorBrowsable(EditorBrowsableState.Never)]
280 NoOrientationPreference = -1
284 /// Enumeration for the key grab mode for platform-level APIs.
286 /// <since_tizen> 3 </since_tizen>
287 public enum KeyGrabMode
290 /// Grabs a key only when on the top of the grabbing-window stack mode.
294 /// Grabs a key together with the other client window(s) mode.
298 /// 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.
302 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
308 /// Enumeration for transition effect's state.
310 [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
311 [EditorBrowsable(EditorBrowsableState.Never)]
312 // This is already deprecated, so suppress warning here.
313 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
314 public enum EffectStates
319 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
320 [EditorBrowsable(EditorBrowsableState.Never)]
323 /// Transition effect is started.
325 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
326 [EditorBrowsable(EditorBrowsableState.Never)]
329 /// Transition effect is ended.
331 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
332 [EditorBrowsable(EditorBrowsableState.Never)]
337 /// Enumeration for transition effect's state.
339 [EditorBrowsable(EditorBrowsableState.Never)]
340 public enum EffectState
345 [EditorBrowsable(EditorBrowsableState.Never)]
348 /// Transition effect is started.
350 [EditorBrowsable(EditorBrowsableState.Never)]
353 /// Transition effect is ended.
355 [EditorBrowsable(EditorBrowsableState.Never)]
360 /// Enumeration for transition effect's type.
362 [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
363 [EditorBrowsable(EditorBrowsableState.Never)]
364 // This is already deprecated, so suppress warning here.
365 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
366 public enum EffectTypes
371 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
372 [EditorBrowsable(EditorBrowsableState.Never)]
375 /// Window show effect.
377 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
378 [EditorBrowsable(EditorBrowsableState.Never)]
381 /// Window hide effect.
383 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
384 [EditorBrowsable(EditorBrowsableState.Never)]
389 /// Enumeration for transition effect's type.
391 [EditorBrowsable(EditorBrowsableState.Never)]
392 public enum EffectType
397 [EditorBrowsable(EditorBrowsableState.Never)]
400 /// Window show effect.
402 [EditorBrowsable(EditorBrowsableState.Never)]
405 /// Window hide effect.
407 [EditorBrowsable(EditorBrowsableState.Never)]
412 /// Enumeration for result of window operation.
414 internal enum OperationResult
417 /// Failed for unknown reason
425 /// Permission denied
429 /// The operation is not supported.
435 /// Enumeration for window resized mode by display server.
437 [EditorBrowsable(EditorBrowsableState.Never)]
438 public enum ResizeDirection
443 [EditorBrowsable(EditorBrowsableState.Never)]
446 /// Start resizing window to the top-left edge.
448 [EditorBrowsable(EditorBrowsableState.Never)]
451 /// Start resizing window to the top side.
453 [EditorBrowsable(EditorBrowsableState.Never)]
456 /// Start resizing window to the top-right edge.
458 [EditorBrowsable(EditorBrowsableState.Never)]
461 /// Start resizing window to the left side.
463 [EditorBrowsable(EditorBrowsableState.Never)]
466 /// Start resizing window to the right side.
468 [EditorBrowsable(EditorBrowsableState.Never)]
471 /// Start resizing window to the bottom-left edge.
473 [EditorBrowsable(EditorBrowsableState.Never)]
476 /// Start resizing window to the bottom side.
478 [EditorBrowsable(EditorBrowsableState.Never)]
481 /// Start resizing window to the bottom-right edge.
483 [EditorBrowsable(EditorBrowsableState.Never)]
489 /// The stage instance property (read-only).<br />
490 /// Gets the current window.<br />
492 /// <since_tizen> 3 </since_tizen>
493 public static Window Instance { get; internal set; }
496 /// Gets or sets a window type.
497 /// Most of window type can be set to use WindowType, except for IME type.
498 /// IME type can be set to use one of NUIApplication's constrcutors.
500 /// <since_tizen> 3 </since_tizen>
501 public WindowType Type
505 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
511 Interop.Window.SetType(SwigCPtr, (int)value);
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517 /// Gets/Sets a window title.
519 /// <since_tizen> 4 </since_tizen>
529 SetClass(windowTitle, "");
534 /// The rendering behavior of a Window.
536 /// <since_tizen> 5 </since_tizen>
537 public RenderingBehaviorType RenderingBehavior
541 return GetRenderingBehavior();
545 SetRenderingBehavior(value);
550 /// The window size property (read-only).
552 /// <since_tizen> 3 </since_tizen>
557 Size2D ret = GetSize();
563 /// The background color property.
565 /// <since_tizen> 3 </since_tizen>
566 public Color BackgroundColor
570 SetBackgroundColor(value);
574 Color ret = GetBackgroundColor();
580 /// The DPI property (read-only).<br />
581 /// Retrieves the DPI of the display device to which the Window is connected.<br />
583 /// <since_tizen> 3 </since_tizen>
593 /// The layer count property (read-only).<br />
594 /// Queries the number of on-Window layers.<br />
596 /// <since_tizen> 3 </since_tizen>
597 public uint LayerCount
601 return GetLayerCount();
606 /// Gets or sets a size of the window.
608 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
609 /// <since_tizen> 4 </since_tizen>
610 public Size2D WindowSize
614 return GetWindowSize();
618 SetWindowSize(value);
623 /// Gets or sets a position of the window.
625 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
626 /// <since_tizen> 4 </since_tizen>
627 public Position2D WindowPosition
631 return GetPosition();
640 /// Sets position and size of the window. This API guarantees that
641 /// both moving and resizing of window will appear on the screen at once.
643 [EditorBrowsable(EditorBrowsableState.Never)]
644 public Rectangle WindowPositionSize
648 Position2D position = GetPosition();
649 Size2D size = GetSize();
650 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
656 SetPositionSize(value);
660 internal static Vector4 DEFAULT_BACKGROUND_COLOR
664 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
665 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
666 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671 internal static Vector4 DEBUG_BACKGROUND_COLOR
675 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
676 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
677 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
682 internal List<Layer> LayersChildren
691 /// Get the LayoutController for this Window.
693 internal LayoutController LayoutController
697 return localController;
702 /// Feed a key-event into the window.
704 /// <param name="keyEvent">The key event to feed.</param>
705 /// <since_tizen> 4 </since_tizen>
706 [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
707 public static void FeedKeyEvent(Key keyEvent)
709 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
714 /// Sets whether the window accepts a focus or not.
716 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
717 /// <since_tizen> 3 </since_tizen>
718 public void SetAcceptFocus(bool accept)
720 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
721 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 /// Returns whether the window accepts a focus or not.
727 /// <returns>True if the window accepts a focus, false otherwise.</returns>
728 /// <since_tizen> 3 </since_tizen>
729 public bool IsFocusAcceptable()
731 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 /// Shows the window if it is hidden.
740 /// <since_tizen> 3 </since_tizen>
743 Interop.Window.Show(SwigCPtr);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 /// Hides the window if it is showing.
750 /// <since_tizen> 3 </since_tizen>
753 Interop.Window.Hide(SwigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 /// Retrieves whether the window is visible or not.
760 /// <returns>True if the window is visible.</returns>
761 /// <since_tizen> 3 </since_tizen>
762 public bool IsVisible()
764 bool temp = Interop.Window.IsVisible(SwigCPtr);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 /// Gets the count of supported auxiliary hints of the window.
772 /// <returns>The number of supported auxiliary hints.</returns>
773 /// <since_tizen> 3 </since_tizen>
774 public uint GetSupportedAuxiliaryHintCount()
776 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 /// Gets the supported auxiliary hint string of the window.
784 /// <param name="index">The index of the supported auxiliary hint lists.</param>
785 /// <returns>The auxiliary hint string of the index.</returns>
786 /// <since_tizen> 3 </since_tizen>
787 public string GetSupportedAuxiliaryHint(uint index)
789 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795 /// Creates an auxiliary hint of the window.
797 /// <param name="hint">The auxiliary hint string.</param>
798 /// <param name="value">The value string.</param>
799 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
800 /// <since_tizen> 3 </since_tizen>
801 public uint AddAuxiliaryHint(string hint, string value)
803 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 /// Removes an auxiliary hint of the window.
811 /// <param name="id">The ID of the auxiliary hint.</param>
812 /// <returns>True if no error occurred, false otherwise.</returns>
813 /// <since_tizen> 3 </since_tizen>
814 public bool RemoveAuxiliaryHint(uint id)
816 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 /// Changes a value of the auxiliary hint.
824 /// <param name="id">The auxiliary hint ID.</param>
825 /// <param name="value">The value string to be set.</param>
826 /// <returns>True if no error occurred, false otherwise.</returns>
827 /// <since_tizen> 3 </since_tizen>
828 public bool SetAuxiliaryHintValue(uint id, string value)
830 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
831 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 /// Gets a value of the auxiliary hint.
838 /// <param name="id">The auxiliary hint ID.</param>
839 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
840 /// <since_tizen> 3 </since_tizen>
841 public string GetAuxiliaryHintValue(uint id)
843 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
844 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
849 /// Gets an ID of the auxiliary hint string.
851 /// <param name="hint">The auxiliary hint string.</param>
852 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
853 /// <since_tizen> 3 </since_tizen>
854 public uint GetAuxiliaryHintId(string hint)
856 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
857 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 /// Sets a region to accept input events.
864 /// <param name="inputRegion">The region to accept input events.</param>
865 /// <since_tizen> 3 </since_tizen>
866 public void SetInputRegion(Rectangle inputRegion)
868 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
869 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 /// Sets a priority level for the specified notification window.
875 /// <param name="level">The notification window level.</param>
876 /// <returns>True if no error occurred, false otherwise.</returns>
877 /// <since_tizen> 3 </since_tizen>
878 public bool SetNotificationLevel(NotificationLevel level)
880 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
881 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 return ret == OperationResult.Succeed;
886 /// Gets a priority level for the specified notification window.
888 /// <returns>The notification window level.</returns>
889 /// <since_tizen> 3 </since_tizen>
890 public NotificationLevel GetNotificationLevel()
892 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
893 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898 /// Sets a transparent window's visual state to opaque. <br />
899 /// If a visual state of a transparent window is opaque, <br />
900 /// then the window manager could handle it as an opaque window when calculating visibility.
902 /// <param name="opaque">Whether the window's visual state is opaque.</param>
903 /// <remarks>This will have no effect on an opaque window. <br />
904 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
906 /// <since_tizen> 3 </since_tizen>
907 public void SetOpaqueState(bool opaque)
909 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
910 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914 /// Returns whether a transparent window's visual state is opaque or not.
916 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
917 /// <remarks> The return value has no meaning on an opaque window. </remarks>
918 /// <since_tizen> 3 </since_tizen>
919 public bool IsOpaqueState()
921 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
927 /// Sets a window's screen off mode.
929 /// <param name="screenOffMode">The screen mode.</param>
930 /// <returns>True if no error occurred, false otherwise.</returns>
931 /// <since_tizen> 4 </since_tizen>
932 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
934 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
935 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936 return ret == OperationResult.Succeed;
940 /// Gets the screen mode of the window.
942 /// <returns>The screen off mode.</returns>
943 /// <since_tizen> 4 </since_tizen>
944 public ScreenOffMode GetScreenOffMode()
946 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
947 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
952 /// Sets preferred brightness of the window.
954 /// <param name="brightness">The preferred brightness (0 to 100).</param>
955 /// <returns>True if no error occurred, false otherwise.</returns>
956 /// <since_tizen> 3 </since_tizen>
957 public bool SetBrightness(int brightness)
959 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
960 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961 return ret == OperationResult.Succeed;
965 /// Gets the preferred brightness of the window.
967 /// <returns>The preferred brightness.</returns>
968 /// <since_tizen> 3 </since_tizen>
969 public int GetBrightness()
971 int ret = Interop.Window.GetBrightness(SwigCPtr);
972 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
977 /// Sets the window name and the class string.
979 /// <param name="name">The name of the window.</param>
980 /// <param name="klass">The class of the window.</param>
981 /// <since_tizen> 4 </since_tizen>
982 public void SetClass(string name, string klass)
984 Interop.Window.SetClass(SwigCPtr, name, klass);
985 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989 /// Raises the window to the top of the window stack.
991 /// <since_tizen> 3 </since_tizen>
994 Interop.Window.Raise(SwigCPtr);
995 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
999 /// Lowers the window to the bottom of the window stack.
1001 /// <since_tizen> 3 </since_tizen>
1004 Interop.Window.Lower(SwigCPtr);
1005 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1009 /// Activates the window to the top of the window stack even it is iconified.
1011 /// <since_tizen> 3 </since_tizen>
1012 public void Activate()
1014 Interop.Window.Activate(SwigCPtr);
1015 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019 /// Gets the default ( root ) layer.
1021 /// <returns>The root layer.</returns>
1022 /// <since_tizen> 3 </since_tizen>
1023 public Layer GetDefaultLayer()
1025 return this.GetRootLayer();
1029 /// Add a child view to window.
1031 /// <param name="view">the child should be added to the window.</param>
1032 /// <since_tizen> 3 </since_tizen>
1033 public void Add(View view)
1035 this.GetRootLayer().Add(view);
1039 /// Remove a child view from window.
1041 /// <param name="view">the child to be removed.</param>
1042 /// <since_tizen> 3 </since_tizen>
1043 public void Remove(View view)
1045 this.GetRootLayer().Remove(view);
1049 /// Retrieves the layer at a specified depth.
1051 /// <param name="depth">The layer's depth index.</param>
1052 /// <returns>The layer found at the given depth.</returns>
1053 /// <since_tizen> 3 </since_tizen>
1054 public Layer GetLayer(uint depth)
1056 if (depth < LayersChildren?.Count)
1058 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1068 /// Destroy the window immediately.
1070 [EditorBrowsable(EditorBrowsableState.Never)]
1071 public void Destroy()
1077 /// Keep rendering for at least the given amount of time.
1079 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1080 /// <since_tizen> 3 </since_tizen>
1081 public void KeepRendering(float durationSeconds)
1083 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
1084 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1088 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1089 /// This function can be used for following example scenarios: <br />
1090 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1092 /// <param name="DaliKey">The key code to grab.</param>
1093 /// <returns>True if the grab succeeds.</returns>
1094 /// <since_tizen> 3 </since_tizen>
1095 public bool GrabKeyTopmost(int DaliKey)
1097 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1098 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1103 /// Ungrabs the key specified by a key for the window.<br />
1104 /// 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 />
1106 /// <param name="DaliKey">The key code to ungrab.</param>
1107 /// <returns>True if the ungrab succeeds.</returns>
1108 /// <since_tizen> 3 </since_tizen>
1109 public bool UngrabKeyTopmost(int DaliKey)
1111 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1117 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1118 /// Details: This function can be used for following example scenarios: <br />
1119 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1120 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1121 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1123 /// <param name="DaliKey">The key code to grab.</param>
1124 /// <param name="GrabMode">The grab mode for the key.</param>
1125 /// <returns>True if the grab succeeds.</returns>
1126 /// <since_tizen> 3 </since_tizen>
1127 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1129 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1135 /// Ungrabs the key specified by a key for a window.<br />
1136 /// 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 /// <param name="DaliKey">The key code to ungrab.</param>
1139 /// <returns>True if the ungrab succeeds.</returns>
1140 /// <since_tizen> 3 </since_tizen>
1141 public bool UngrabKey(int DaliKey)
1143 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1149 /// Sets the keyboard repeat information.
1151 /// <param name="rate">The key repeat rate value in seconds.</param>
1152 /// <param name="delay">The key repeat delay value in seconds.</param>
1153 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1154 /// <since_tizen> 5 </since_tizen>
1155 public bool SetKeyboardRepeatInfo(float rate, float delay)
1157 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1163 /// Gets the keyboard repeat information.
1165 /// <param name="rate">The key repeat rate value in seconds.</param>
1166 /// <param name="delay">The key repeat delay value in seconds.</param>
1167 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1168 /// <since_tizen> 5 </since_tizen>
1169 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1171 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1177 /// Adds a layer to the stage.
1179 /// <param name="layer">Layer to add.</param>
1180 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1181 /// <since_tizen> 3 </since_tizen>
1182 public void AddLayer(Layer layer)
1188 /// Removes a layer from the stage.
1190 /// <param name="layer">Layer to remove.</param>
1191 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1192 /// <since_tizen> 3 </since_tizen>
1193 public void RemoveLayer(Layer layer)
1199 /// Feeds a key event into the window.
1201 /// <param name="keyEvent">The key event to feed.</param>
1202 /// <since_tizen> 5 </since_tizen>
1203 public void FeedKey(Key keyEvent)
1205 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1210 /// Feeds a touch point into the window.
1212 /// <param name="touchPoint">The touch point to feed.</param>
1213 /// <param name="timeStamp">The timeStamp.</param>
1214 internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1216 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1221 /// Feeds a wheel event into the window.
1223 /// <param name="wheelEvent">The wheel event to feed.</param>
1224 internal void FeedWheel(Wheel wheelEvent)
1226 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231 /// Allows at least one more render, even when paused.
1232 /// The window should be shown, not minimised.
1234 /// <since_tizen> 4 </since_tizen>
1235 public void RenderOnce()
1237 Interop.Window.RenderOnce(SwigCPtr);
1238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1242 /// Sets whether the window is transparent or not.
1244 /// <param name="transparent">Whether the window is transparent or not.</param>
1245 /// <since_tizen> 5 </since_tizen>
1246 public void SetTransparency(bool transparent)
1248 Interop.Window.SetTransparency(SwigCPtr, transparent);
1249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1251 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1255 /// Sets parent window of the window.
1256 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1257 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1258 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1260 /// <param name="parent">The parent window.</param>
1261 /// <since_tizen> 6 </since_tizen>
1262 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1263 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1264 public void SetParent(Window parent)
1266 if (IsSupportedMultiWindow() == false)
1268 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1270 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275 /// Sets parent window of the window.
1276 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1277 /// This function has the additional flag whether the child is located above or below of the parent.
1279 /// <param name="parent">The parent window.</param>
1280 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1281 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1282 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1283 [EditorBrowsable(EditorBrowsableState.Never)]
1284 public void SetParent(Window parent, bool belowParent)
1286 if (IsSupportedMultiWindow() == false)
1288 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1290 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 /// Unsets parent window of the window.
1296 /// After unsetting, the window is disconnected his parent window.
1298 /// <since_tizen> 6 </since_tizen>
1299 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1300 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1301 public void Unparent()
1303 if (IsSupportedMultiWindow() == false)
1305 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1307 Interop.Window.Unparent(SwigCPtr);
1308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1312 /// Gets parent window of the window.
1314 /// <returns>The parent window of the window.</returns>
1315 /// <since_tizen> 6 </since_tizen>
1316 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1317 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1318 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1319 public Window GetParent()
1321 if (IsSupportedMultiWindow() == false)
1323 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1325 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1330 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1331 [EditorBrowsable(EditorBrowsableState.Never)]
1332 public void ObjectDump()
1334 Layer rootLayer = GetRootLayer();
1335 foreach (View view in rootLayer.Children)
1341 internal static bool IsInstalled()
1343 bool ret = Interop.Stage.IsInstalled();
1344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 /// Adds an orientation to the list of available orientations.
1351 /// <param name="orientation">The available orientation to add</param>
1352 /// <since_tizen> 6 </since_tizen>
1353 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1355 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360 /// Removes an orientation from the list of available orientations.
1362 /// <param name="orientation">The available orientation to remove.</param>
1363 /// <since_tizen> 6 </since_tizen>
1364 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1366 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 /// Sets a preferred orientation.
1373 /// <param name="orientation">The preferred orientation.</param>
1374 /// <since_tizen> 6 </since_tizen>
1375 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1377 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382 /// Gets the preferred orientation.
1384 /// <since_tizen> 6 </since_tizen>
1385 /// <returns>The preferred orientation if previously set, or none.</returns>
1386 public Window.WindowOrientation GetPreferredOrientation()
1388 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1394 /// Gets current orientation of the window.
1396 /// <since_tizen> 6 </since_tizen>
1397 /// <returns>The current window orientation if previously set, or none.</returns>
1398 [EditorBrowsable(EditorBrowsableState.Never)]
1399 public Window.WindowOrientation GetCurrentOrientation()
1401 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 /// Sets available orientations of the window.
1408 /// This API is for setting several orientations one time.
1410 /// <param name="orientations">The list of orientations.</param>
1411 /// <since_tizen> 6 </since_tizen>
1412 [EditorBrowsable(EditorBrowsableState.Never)]
1413 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1415 if (null == orientations)
1417 throw new ArgumentNullException(nameof(orientations));
1420 PropertyArray orientationArray = new PropertyArray();
1421 for (int i = 0; i < orientations.Count; i++)
1423 PropertyValue value = new PropertyValue((int)orientations[i]);
1424 orientationArray.PushBack(value);
1428 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1429 orientationArray.Dispose();
1430 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1434 /// Get native window ID
1436 /// <returns>native window ID</returns>
1437 [EditorBrowsable(EditorBrowsableState.Never)]
1438 public int GetNativeId()
1440 int ret = Interop.Window.GetNativeId(SwigCPtr);
1441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1445 internal Any GetNativeHandle()
1447 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1452 internal void Add(Layer layer)
1456 throw new ArgumentNullException(nameof(layer));
1461 Interop.Actor.Add(GetBorderWindowRootLayer().SwigCPtr, layer.SwigCPtr);
1462 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1466 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1467 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1470 LayersChildren?.Add(layer);
1471 layer.SetWindow(this);
1474 internal void Remove(Layer layer)
1478 throw new ArgumentNullException(nameof(layer));
1480 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1483 LayersChildren?.Remove(layer);
1484 layer.SetWindow(null);
1487 internal Vector2 GetSize()
1489 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1491 convertRealWindowSizeToBorderWindowSize(val);
1493 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1494 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1499 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1500 [EditorBrowsable(EditorBrowsableState.Never)]
1501 public RenderTaskList GetRenderTaskList()
1503 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1509 /// Queries the number of on-window layers.
1511 /// <returns>The number of layers.</returns>
1512 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1513 internal uint GetLayerCount()
1515 if (LayersChildren == null || LayersChildren.Count < 0)
1518 return (uint)LayersChildren.Count;
1521 internal Layer GetRootLayer()
1525 if(borderLayer == null)
1527 borderLayer = GetBorderWindowRootLayer();
1528 LayersChildren?.Add(borderLayer);
1529 borderLayer.SetWindow(this);
1535 // Window.IsInstalled() is actually true only when called from event thread and
1536 // Core has been initialized, not when Stage is ready.
1537 if (rootLayer == null && Window.IsInstalled())
1539 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1541 LayersChildren?.Add(rootLayer);
1542 rootLayer.SetWindow(this);
1548 internal void SetBackgroundColor(Vector4 color)
1550 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1551 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1554 internal Vector4 GetBackgroundColor()
1556 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1557 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1561 internal Vector2 GetDpi()
1563 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1564 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1568 internal ObjectRegistry GetObjectRegistry()
1570 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1575 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1577 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1578 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1581 internal RenderingBehaviorType GetRenderingBehavior()
1583 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1584 if (NDalicPINVOKE.SWIGPendingException.Pending)
1585 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1589 internal void SetWindowSize(Size2D size)
1593 throw new ArgumentNullException(nameof(size));
1595 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1597 convertBorderWindowSizeToRealWindowSize(val);
1599 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1601 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1602 // Resetting Window size should request a relayout of the tree.
1605 internal Size2D GetWindowSize()
1607 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1609 convertRealWindowSizeToBorderWindowSize(val);
1611 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1612 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1617 internal void SetPosition(Position2D position)
1619 if (null == position)
1621 throw new ArgumentNullException(nameof(position));
1623 var val = new IntPair(position.X, position.Y);
1624 Interop.Window.SetPosition(SwigCPtr, IntPair.getCPtr(val));
1626 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1627 // Setting Position of the window should request a relayout of the tree.
1630 internal Position2D GetPosition()
1632 var val = new IntPair(Interop.Window.GetPosition(SwigCPtr), true);
1633 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1635 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1639 internal void SetPositionSize(Rectangle positionSize)
1641 if (positionSize == null)
1643 throw new ArgumentNullException(nameof(positionSize));
1645 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1647 convertBorderWindowSizeToRealWindowSize(val);
1649 positionSize.Width = val.GetX();
1650 positionSize.Height = val.GetY();
1652 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1657 // Setting Position of the window should request a relayout of the tree.
1661 /// Enables the floating mode of window.
1662 /// The floating mode is to support window is moved or resized by display server.
1663 /// For example, if the video-player window sets the floating mode,
1664 /// then display server changes its geometry and handles it like a popup.
1665 /// The way of handling floating mode window is decided by display server.
1666 /// A special display server(as a Tizen display server) supports this mode.
1668 /// <param name="enable">Enable floating mode or not.</param>
1669 [EditorBrowsable(EditorBrowsableState.Never)]
1670 public void EnableFloatingMode(bool enable)
1672 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1677 /// Requests to display server for the window is moved by display server.
1678 /// It can be work with setting window floating mode.
1680 [EditorBrowsable(EditorBrowsableState.Never)]
1681 public void RequestMoveToServer()
1683 Interop.Window.RequestMoveToServer(SwigCPtr);
1684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1688 /// Requests to display server for the window is resized by display server.
1689 /// It can be work with setting window floating mode.
1691 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1692 [EditorBrowsable(EditorBrowsableState.Never)]
1693 public void RequestResizeToServer(ResizeDirection direction)
1695 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1696 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1700 /// Includes input region.
1701 /// This function inlcudes input regions.
1702 /// It can be used multiple times and supports multiple regions.
1703 /// It means input region will be extended.
1704 /// This input is related to mouse and touch event.
1705 /// If device has touch screen, this function is useful.
1706 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1708 /// <param name="inputRegion">The included region to accept input events.</param>
1709 [EditorBrowsable(EditorBrowsableState.Never)]
1710 public void IncludeInputRegion(Rectangle inputRegion)
1712 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1713 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1717 /// This function excludes input regions.
1718 /// It can be used multiple times and supports multiple regions.
1719 /// It means input region will be reduced.
1720 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1721 /// This input is related to mouse and touch event.
1722 /// If device has touch screen, this function is useful.
1723 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1725 /// <param name="inputRegion">The excluded region to except input events.</param>
1726 [EditorBrowsable(EditorBrowsableState.Never)]
1727 public void ExcludeInputRegion(Rectangle inputRegion)
1729 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1730 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1734 /// Maximizes window's size.
1735 /// If this function is called with true, window will be resized with screen size.
1736 /// Otherwise window will be resized with previous size.
1737 /// It is for the window's MAX button in window's border.
1738 /// If window border is supported by display server, it is not necessary.
1740 /// <param name="max">If window is maximized or unmaximized.</param>
1741 [EditorBrowsable(EditorBrowsableState.Never)]
1742 public void Maximize(bool max)
1744 Interop.Window.Maximize(SwigCPtr, max);
1745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1749 /// Returns whether the window is maximized or not.
1751 /// <returns>True if the window is maximized, false otherwise.</returns>
1752 [EditorBrowsable(EditorBrowsableState.Never)]
1753 public bool IsMaximized()
1755 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1761 /// Sets window's maximum size.
1763 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1764 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1766 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1769 /// <param name="size">the maximum size.</param>
1770 [EditorBrowsable(EditorBrowsableState.Never)]
1771 public void SetMaximumSize(Size2D size)
1775 throw new ArgumentNullException(nameof(size));
1777 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1779 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1781 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1785 /// Minimizes window's size.
1786 /// If this function is called with true, window will be iconified.
1787 /// Otherwise window will be activated.
1788 /// It is for the window's MIN button in window border.
1789 /// If window border is supported by display server, it is not necessary.
1791 /// <param name="min">If window is minimized or unminimized.</param>
1792 [EditorBrowsable(EditorBrowsableState.Never)]
1793 public void Minimize(bool min)
1795 Interop.Window.Minimize(SwigCPtr, min);
1796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1800 /// Returns whether the window is minimized or not.
1802 /// <returns>True if the window is minimized, false otherwise.</returns>
1803 [EditorBrowsable(EditorBrowsableState.Never)]
1804 public bool IsMinimized()
1806 bool ret = Interop.Window.IsMinimized(SwigCPtr);
1807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1812 /// Sets window's minimum size.
1813 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1814 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1816 /// <param name="size">the minimum size.</param>
1817 [EditorBrowsable(EditorBrowsableState.Never)]
1818 public void SetMimimumSize(Size2D size)
1822 throw new ArgumentNullException(nameof(size));
1824 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1826 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1832 /// Query whether window is rotating or not.
1834 /// <returns>True if window is rotating, false otherwise.</returns>
1835 [EditorBrowsable(EditorBrowsableState.Never)]
1836 public bool IsWindowRotating()
1838 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1839 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1844 /// Gets the last key event the window gets.
1846 /// <returns>The last key event the window gets.</returns>
1847 [EditorBrowsable(EditorBrowsableState.Never)]
1848 public Key GetLastKeyEvent()
1850 Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
1851 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1856 /// Gets the last touch event the window gets.
1858 /// <returns>The last touch event the window gets.</returns>
1859 [EditorBrowsable(EditorBrowsableState.Never)]
1860 public Touch GetLastTouchEvent()
1862 Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
1863 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1868 /// Add FrameUpdateCallback
1870 [EditorBrowsable(EditorBrowsableState.Never)]
1871 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1873 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1877 /// Remove FrameUpdateCallback
1879 [EditorBrowsable(EditorBrowsableState.Never)]
1880 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1882 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1886 /// Dispose for Window
1888 [EditorBrowsable(EditorBrowsableState.Never)]
1889 protected override void Dispose(DisposeTypes type)
1896 if (type == DisposeTypes.Explicit)
1899 //Release your own managed resources here.
1900 //You should release all of your own disposable objects here.
1902 if (IsBorderEnabled)
1907 foreach (var layer in childLayers)
1915 childLayers.Clear();
1917 localController?.Dispose();
1920 this.DisconnectNativeSignals();
1925 /// This will not be public opened.
1926 [EditorBrowsable(EditorBrowsableState.Never)]
1927 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1929 Interop.Window.DeleteWindow(swigCPtr);
1932 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1934 private static readonly object locker = new object();
1936 private static int key = 0;
1938 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1940 private struct internalHookCallbackType
1942 public FrameCallbackType userCallback;
1946 private static void OnInternalHookFrameCallback(int id)
1950 if (frameCallbackList.ContainsKey(id))
1952 if (frameCallbackList[id].userCallback != null)
1954 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1955 frameCallbackList.Remove(id);
1959 NUILog.Error($"found userCallback is NULL");
1960 frameCallbackList.Remove(id);
1966 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1968 if (null == callback)
1970 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1972 var assignedKey = 0;
1977 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1979 userCallback = callback,
1987 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1989 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1990 [EditorBrowsable(EditorBrowsableState.Never)]
1991 public delegate void FrameCallbackType(int frameId);
1994 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1995 /// A callback of the following type may be used:
1997 /// void MyFunction( int frameId )
1999 /// This callback will be deleted once it is called.
2001 /// Ownership of the callback is passed onto this class
2004 /// <param name="callback">The function to call</param>
2005 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2006 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2007 [EditorBrowsable(EditorBrowsableState.Never)]
2008 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2010 var assignedKey = AddInterHookCallback(callback, frameId);
2011 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2013 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2017 /// Adds a callback that is called when the frame is displayed on the display.
2018 /// A callback of the following type may be used:
2020 /// void MyFunction( int frameId )
2022 /// This callback will be deleted once it is called.
2024 /// Ownership of the callback is passed onto this class
2027 /// <param name="callback">The function to call</param>
2028 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2029 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2030 [EditorBrowsable(EditorBrowsableState.Never)]
2031 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2033 var assignedKey = AddInterHookCallback(callback, frameId);
2034 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2040 /// Search through this Window for a Layer with the given unique ID.
2042 /// <param name="id">The ID of the Layer to find.</param>
2043 /// <remarks>Hidden-API</remarks>
2044 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2045 [EditorBrowsable(EditorBrowsableState.Never)]
2046 public Layer FindLayerByID(uint id)
2048 Layer defaultLayer = this.GetDefaultLayer();
2049 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2050 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2052 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2057 /// Get Native Window handle.
2059 /// How to get Native Window handle
2061 /// Window window = NUIApplication.GetDefaultWindow();
2062 /// var handle = window.NativeHandle;
2063 /// if(handle.IsInvalid == false)
2065 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2066 /// // do something with nativeHandle
2071 /// <since_tizen> 9 </since_tizen>
2072 public SafeHandle NativeHandle
2076 return new NUI.SafeNativeWindowHandle(this);