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 overlayLayer;
40 private Layer borderLayer;
41 private string windowTitle;
42 private List<Layer> childLayers = new List<Layer>();
43 private LayoutController localController;
44 private Key internalLastKeyEvent;
45 private Touch internalLastTouchEvent;
46 private Timer internalHoverTimer;
48 static internal bool IsSupportedMultiWindow()
50 bool isSupported = false;
53 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
55 catch (DllNotFoundException e)
57 Tizen.Log.Fatal("NUI", $"{e}\n");
62 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
64 if (Interop.Stage.IsInstalled())
66 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
68 localController = new LayoutController(this);
69 NUILog.Debug("layoutController id:" + localController.GetId());
74 /// A helper method to get the current window where the view is added
76 /// <param name="view">The View added to the window</param>
77 /// <returns>A Window.</returns>
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 static public Window Get(View view)
83 NUILog.Error("if there is no view, it can not get a window");
87 //to fix memory leak issue, match the handle count with native side.
88 Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// Creates a new Window.<br />
95 /// This creates an extra window in addition to the default main window<br />
97 /// <param name="windowPosition">The position and size of the Window.</param>
98 /// <param name="isTranslucent">Whether Window is translucent.</param>
99 /// <returns>A new Window.</returns>
100 /// <since_tizen> 6 </since_tizen>
101 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
102 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
103 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
105 if (IsSupportedMultiWindow() == false)
107 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 /// Creates a new Window with a specific name.<br />
114 /// This creates an extra window in addition to the default main window<br />
116 /// <param name="name">The name for extra window. </param>
117 /// <param name="windowPosition">The position and size of the Window.</param>
118 /// <param name="isTranslucent">Whether Window is translucent.</param>
119 /// <returns>A new Window.</returns>
120 /// <since_tizen> 6 </since_tizen>
121 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
122 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
123 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
125 if (IsSupportedMultiWindow() == false)
127 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
129 this.windowTitle = name;
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 /// Creates a new Window with a specific name.<br />
135 /// This creates an extra window in addition to the default main window<br />
137 /// <param name="name">The name for extra window. </param>
138 /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
139 /// <param name="windowPosition">The position and size of the Window.</param>
140 /// <param name="isTranslucent">Whether Window is translucent.</param>
141 /// <returns>A new Window.</returns>
142 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
143 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
147 if (IsSupportedMultiWindow() == false)
149 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
151 this.windowTitle = name;
152 this.EnableBorder(borderInterface);
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
160 /// <since_tizen> 3 </since_tizen>
161 public enum WindowOrientation
164 /// Portrait orientation. The height of the display area is greater than the width.
166 /// <since_tizen> 3 </since_tizen>
169 /// Landscape orientation. A wide view area is needed.
171 /// <since_tizen> 3 </since_tizen>
174 /// Portrait inverse orientation.
176 /// <since_tizen> 3 </since_tizen>
177 PortraitInverse = 180,
179 /// Landscape inverse orientation.
181 /// <since_tizen> 3 </since_tizen>
182 LandscapeInverse = 270,
184 /// No orientation. It is for the preferred orientation
185 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
186 /// It is used to unset the preferred orientation with SetPreferredOrientation.
188 [EditorBrowsable(EditorBrowsableState.Never)]
189 NoOrientationPreference = -1
193 /// Enumeration for the key grab mode for platform-level APIs.
195 /// <since_tizen> 3 </since_tizen>
196 public enum KeyGrabMode
199 /// Grabs a key only when on the top of the grabbing-window stack mode.
203 /// Grabs a key together with the other client window(s) mode.
207 /// 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.
211 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
217 /// Enumeration for transition effect's state.
219 [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 // This is already deprecated, so suppress warning here.
222 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
223 public enum EffectStates
228 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
229 [EditorBrowsable(EditorBrowsableState.Never)]
232 /// Transition effect is started.
234 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
235 [EditorBrowsable(EditorBrowsableState.Never)]
238 /// Transition effect is ended.
240 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
241 [EditorBrowsable(EditorBrowsableState.Never)]
246 /// Enumeration for transition effect's state.
248 [EditorBrowsable(EditorBrowsableState.Never)]
249 public enum EffectState
254 [EditorBrowsable(EditorBrowsableState.Never)]
257 /// Transition effect is started.
259 [EditorBrowsable(EditorBrowsableState.Never)]
262 /// Transition effect is ended.
264 [EditorBrowsable(EditorBrowsableState.Never)]
269 /// Enumeration for transition effect's type.
271 [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 // This is already deprecated, so suppress warning here.
274 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
275 public enum EffectTypes
280 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
281 [EditorBrowsable(EditorBrowsableState.Never)]
284 /// Window show effect.
286 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
287 [EditorBrowsable(EditorBrowsableState.Never)]
290 /// Window hide effect.
292 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
293 [EditorBrowsable(EditorBrowsableState.Never)]
298 /// Enumeration for transition effect's type.
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public enum EffectType
306 [EditorBrowsable(EditorBrowsableState.Never)]
309 /// Window show effect.
311 [EditorBrowsable(EditorBrowsableState.Never)]
314 /// Window hide effect.
316 [EditorBrowsable(EditorBrowsableState.Never)]
321 /// Enumeration for result of window operation.
323 internal enum OperationResult
326 /// Failed for unknown reason
334 /// Permission denied
338 /// The operation is not supported.
344 /// Enumeration for window resized mode by display server.
346 [EditorBrowsable(EditorBrowsableState.Never)]
347 public enum ResizeDirection
352 [EditorBrowsable(EditorBrowsableState.Never)]
355 /// Start resizing window to the top-left edge.
357 [EditorBrowsable(EditorBrowsableState.Never)]
360 /// Start resizing window to the top side.
362 [EditorBrowsable(EditorBrowsableState.Never)]
365 /// Start resizing window to the top-right edge.
367 [EditorBrowsable(EditorBrowsableState.Never)]
370 /// Start resizing window to the left side.
372 [EditorBrowsable(EditorBrowsableState.Never)]
375 /// Start resizing window to the right side.
377 [EditorBrowsable(EditorBrowsableState.Never)]
380 /// Start resizing window to the bottom-left edge.
382 [EditorBrowsable(EditorBrowsableState.Never)]
385 /// Start resizing window to the bottom side.
387 [EditorBrowsable(EditorBrowsableState.Never)]
390 /// Start resizing window to the bottom-right edge.
392 [EditorBrowsable(EditorBrowsableState.Never)]
398 /// The stage instance property (read-only).<br />
399 /// Gets the current window.<br />
401 /// <since_tizen> 3 </since_tizen>
402 public static Window Instance { get; internal set; }
405 /// Gets or sets a window type.
406 /// Most of window type can be set to use WindowType, except for IME type.
407 /// IME type can be set to use one of NUIApplication's constrcutors.
409 /// <since_tizen> 3 </since_tizen>
410 public WindowType Type
414 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
420 Interop.Window.SetType(SwigCPtr, (int)value);
421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
426 /// Gets/Sets a window title.
428 /// <since_tizen> 4 </since_tizen>
438 SetClass(windowTitle, "");
443 /// The rendering behavior of a Window.
445 /// <since_tizen> 5 </since_tizen>
446 public RenderingBehaviorType RenderingBehavior
450 return GetRenderingBehavior();
454 SetRenderingBehavior(value);
459 /// The window size property (read-only).
461 /// <since_tizen> 3 </since_tizen>
466 Size2D ret = GetSize();
472 /// The background color property.
474 /// <since_tizen> 3 </since_tizen>
475 public Color BackgroundColor
479 SetBackgroundColor(value);
483 Color ret = GetBackgroundColor();
489 /// The DPI property (read-only).<br />
490 /// Retrieves the DPI of the display device to which the Window is connected.<br />
492 /// <since_tizen> 3 </since_tizen>
502 /// The layer count property (read-only).<br />
503 /// Queries the number of on-Window layers.<br />
505 /// <since_tizen> 3 </since_tizen>
506 public uint LayerCount
510 return GetLayerCount();
515 /// Gets or sets a size of the window.
517 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
518 /// <since_tizen> 4 </since_tizen>
519 public Size2D WindowSize
523 return GetWindowSize();
527 SetWindowSize(value);
532 /// Gets or sets a position of the window.
534 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
535 /// <since_tizen> 4 </since_tizen>
536 public Position2D WindowPosition
540 return GetPosition();
549 /// Sets position and size of the window. This API guarantees that
550 /// both moving and resizing of window will appear on the screen at once.
552 [EditorBrowsable(EditorBrowsableState.Never)]
553 public Rectangle WindowPositionSize
557 Position2D position = GetPosition();
558 Size2D size = GetSize();
559 Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
565 SetPositionSize(value);
570 /// Gets or sets whether the window will update partial area or full area.
571 /// If this value is true, window will update and render partial area.
572 /// If false, full area updated.
574 [EditorBrowsable(EditorBrowsableState.Never)]
575 public bool PartialUpdate
579 return IsPartialUpdate();
583 SetPartialUpdate(value);
587 internal static Vector4 DEFAULT_BACKGROUND_COLOR
591 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
592 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598 internal static Vector4 DEBUG_BACKGROUND_COLOR
602 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
603 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
604 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609 internal List<Layer> LayersChildren
618 /// Get the LayoutController for this Window.
620 internal LayoutController LayoutController
624 return localController;
629 /// Feed a key-event into the window.
631 /// <param name="keyEvent">The key event to feed.</param>
632 /// <since_tizen> 4 </since_tizen>
633 [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
634 public static void FeedKeyEvent(Key keyEvent)
636 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
637 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641 /// Sets whether the window accepts a focus or not.
643 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
644 /// <since_tizen> 3 </since_tizen>
645 public void SetAcceptFocus(bool accept)
647 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
648 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 /// Returns whether the window accepts a focus or not.
654 /// <returns>True if the window accepts a focus, false otherwise.</returns>
655 /// <since_tizen> 3 </since_tizen>
656 public bool IsFocusAcceptable()
658 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
659 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Shows the window if it is hidden.
667 /// <since_tizen> 3 </since_tizen>
670 Interop.Window.Show(SwigCPtr);
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 /// Hides the window if it is showing.
677 /// <since_tizen> 3 </since_tizen>
680 Interop.Window.Hide(SwigCPtr);
681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 /// Retrieves whether the window is visible or not.
687 /// <returns>True if the window is visible.</returns>
688 /// <since_tizen> 3 </since_tizen>
689 public bool IsVisible()
691 bool temp = Interop.Window.IsVisible(SwigCPtr);
692 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697 /// Gets the count of supported auxiliary hints of the window.
699 /// <returns>The number of supported auxiliary hints.</returns>
700 /// <since_tizen> 3 </since_tizen>
701 public uint GetSupportedAuxiliaryHintCount()
703 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
709 /// Gets the supported auxiliary hint string of the window.
711 /// <param name="index">The index of the supported auxiliary hint lists.</param>
712 /// <returns>The auxiliary hint string of the index.</returns>
713 /// <since_tizen> 3 </since_tizen>
714 public string GetSupportedAuxiliaryHint(uint index)
716 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 /// Creates an auxiliary hint of the window.
724 /// <param name="hint">The auxiliary hint string.</param>
725 /// <param name="value">The value string.</param>
726 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
727 /// <since_tizen> 3 </since_tizen>
728 public uint AddAuxiliaryHint(string hint, string value)
730 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 /// Removes an auxiliary hint of the window.
738 /// <param name="id">The ID of the auxiliary hint.</param>
739 /// <returns>True if no error occurred, false otherwise.</returns>
740 /// <since_tizen> 3 </since_tizen>
741 public bool RemoveAuxiliaryHint(uint id)
743 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
749 /// Changes a value of the auxiliary hint.
751 /// <param name="id">The auxiliary hint ID.</param>
752 /// <param name="value">The value string to be set.</param>
753 /// <returns>True if no error occurred, false otherwise.</returns>
754 /// <since_tizen> 3 </since_tizen>
755 public bool SetAuxiliaryHintValue(uint id, string value)
757 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 /// Gets a value of the auxiliary hint.
765 /// <param name="id">The auxiliary hint ID.</param>
766 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
767 /// <since_tizen> 3 </since_tizen>
768 public string GetAuxiliaryHintValue(uint id)
770 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
771 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 /// Gets an ID of the auxiliary hint string.
778 /// <param name="hint">The auxiliary hint string.</param>
779 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
780 /// <since_tizen> 3 </since_tizen>
781 public uint GetAuxiliaryHintId(string hint)
783 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
784 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 /// Sets a region to accept input events.
791 /// <param name="inputRegion">The region to accept input events.</param>
792 /// <since_tizen> 3 </since_tizen>
793 public void SetInputRegion(Rectangle inputRegion)
795 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 /// Sets a priority level for the specified notification window.
802 /// <param name="level">The notification window level.</param>
803 /// <returns>True if no error occurred, false otherwise.</returns>
804 /// <since_tizen> 3 </since_tizen>
805 public bool SetNotificationLevel(NotificationLevel level)
807 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
809 return ret == OperationResult.Succeed;
813 /// Gets a priority level for the specified notification window.
815 /// <returns>The notification window level.</returns>
816 /// <since_tizen> 3 </since_tizen>
817 public NotificationLevel GetNotificationLevel()
819 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 /// Sets a transparent window's visual state to opaque. <br />
826 /// If a visual state of a transparent window is opaque, <br />
827 /// then the window manager could handle it as an opaque window when calculating visibility.
829 /// <param name="opaque">Whether the window's visual state is opaque.</param>
830 /// <remarks>This will have no effect on an opaque window. <br />
831 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
833 /// <since_tizen> 3 </since_tizen>
834 public void SetOpaqueState(bool opaque)
836 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
841 /// Returns whether a transparent window's visual state is opaque or not.
843 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
844 /// <remarks> The return value has no meaning on an opaque window. </remarks>
845 /// <since_tizen> 3 </since_tizen>
846 public bool IsOpaqueState()
848 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
849 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
854 /// Sets a window's screen off mode.
856 /// <param name="screenOffMode">The screen mode.</param>
857 /// <returns>True if no error occurred, false otherwise.</returns>
858 /// <since_tizen> 4 </since_tizen>
859 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
861 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
862 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
863 return ret == OperationResult.Succeed;
867 /// Gets the screen mode of the window.
869 /// <returns>The screen off mode.</returns>
870 /// <since_tizen> 4 </since_tizen>
871 public ScreenOffMode GetScreenOffMode()
873 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
874 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879 /// Sets preferred brightness of the window.
881 /// <param name="brightness">The preferred brightness (0 to 100).</param>
882 /// <returns>True if no error occurred, false otherwise.</returns>
883 /// <since_tizen> 3 </since_tizen>
884 public bool SetBrightness(int brightness)
886 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
887 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888 return ret == OperationResult.Succeed;
892 /// Gets the preferred brightness of the window.
894 /// <returns>The preferred brightness.</returns>
895 /// <since_tizen> 3 </since_tizen>
896 public int GetBrightness()
898 int ret = Interop.Window.GetBrightness(SwigCPtr);
899 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
904 /// Sets the window name and the class string.
906 /// <param name="name">The name of the window.</param>
907 /// <param name="klass">The class of the window.</param>
908 /// <since_tizen> 4 </since_tizen>
909 public void SetClass(string name, string klass)
911 Interop.Window.SetClass(SwigCPtr, name, klass);
912 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
916 /// Raises the window to the top of the window stack.
918 /// <since_tizen> 3 </since_tizen>
921 Interop.Window.Raise(SwigCPtr);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 /// Lowers the window to the bottom of the window stack.
928 /// <since_tizen> 3 </since_tizen>
931 Interop.Window.Lower(SwigCPtr);
932 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
936 /// Activates the window to the top of the window stack even it is iconified.
938 /// <since_tizen> 3 </since_tizen>
939 public void Activate()
941 Interop.Window.Activate(SwigCPtr);
942 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 /// Gets the default ( root ) layer.
948 /// <returns>The root layer.</returns>
949 /// <since_tizen> 3 </since_tizen>
950 public Layer GetDefaultLayer()
952 return this.GetRootLayer();
956 /// Gets the overlay layer.
958 /// <returns>The overlay layer.</returns>
959 [EditorBrowsable(EditorBrowsableState.Never)]
960 public Layer GetOverlayLayer()
962 // Window.IsInstalled() is actually true only when called from event thread and
963 // Core has been initialized, not when Stage is ready.
964 if (overlayLayer == null && Window.IsInstalled())
966 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
967 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968 LayersChildren?.Add(overlayLayer);
969 overlayLayer.SetWindow(this);
975 /// Add a child view to window.
977 /// <param name="view">the child should be added to the window.</param>
978 /// <since_tizen> 3 </since_tizen>
979 public void Add(View view)
981 this.GetRootLayer().Add(view);
985 /// Remove a child view from window.
987 /// <param name="view">the child to be removed.</param>
988 /// <since_tizen> 3 </since_tizen>
989 public void Remove(View view)
991 this.GetRootLayer().Remove(view);
995 /// Retrieves the layer at a specified depth.
997 /// <param name="depth">The layer's depth index.</param>
998 /// <returns>The layer found at the given depth.</returns>
999 /// <since_tizen> 3 </since_tizen>
1000 public Layer GetLayer(uint depth)
1002 if (depth < LayersChildren?.Count)
1004 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1014 /// Destroy the window immediately.
1016 [EditorBrowsable(EditorBrowsableState.Never)]
1017 public void Destroy()
1023 /// Keep rendering for at least the given amount of time.
1025 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1026 /// <since_tizen> 3 </since_tizen>
1027 public void KeepRendering(float durationSeconds)
1029 Interop.Window.KeepRendering(SwigCPtr, durationSeconds);
1030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1034 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1035 /// This function can be used for following example scenarios: <br />
1036 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1038 /// <param name="DaliKey">The key code to grab.</param>
1039 /// <returns>True if the grab succeeds.</returns>
1040 /// <since_tizen> 3 </since_tizen>
1041 public bool GrabKeyTopmost(int DaliKey)
1043 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1044 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 /// Ungrabs the key specified by a key for the window.<br />
1050 /// 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 />
1052 /// <param name="DaliKey">The key code to ungrab.</param>
1053 /// <returns>True if the ungrab succeeds.</returns>
1054 /// <since_tizen> 3 </since_tizen>
1055 public bool UngrabKeyTopmost(int DaliKey)
1057 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1063 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1064 /// Details: This function can be used for following example scenarios: <br />
1065 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1066 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1067 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1069 /// <param name="DaliKey">The key code to grab.</param>
1070 /// <param name="GrabMode">The grab mode for the key.</param>
1071 /// <returns>True if the grab succeeds.</returns>
1072 /// <since_tizen> 3 </since_tizen>
1073 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1075 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1076 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1081 /// Ungrabs the key specified by a key for a window.<br />
1082 /// 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 />
1084 /// <param name="DaliKey">The key code to ungrab.</param>
1085 /// <returns>True if the ungrab succeeds.</returns>
1086 /// <since_tizen> 3 </since_tizen>
1087 public bool UngrabKey(int DaliKey)
1089 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1090 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1095 /// Sets the keyboard repeat information.
1097 /// <param name="rate">The key repeat rate value in seconds.</param>
1098 /// <param name="delay">The key repeat delay value in seconds.</param>
1099 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1100 /// <since_tizen> 5 </since_tizen>
1101 public bool SetKeyboardRepeatInfo(float rate, float delay)
1103 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1109 /// Gets the keyboard repeat information.
1111 /// <param name="rate">The key repeat rate value in seconds.</param>
1112 /// <param name="delay">The key repeat delay value in seconds.</param>
1113 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1114 /// <since_tizen> 5 </since_tizen>
1115 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1117 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1123 /// Adds a layer to the stage.
1125 /// <param name="layer">Layer to add.</param>
1126 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1127 /// <since_tizen> 3 </since_tizen>
1128 public void AddLayer(Layer layer)
1134 /// Removes a layer from the stage.
1136 /// <param name="layer">Layer to remove.</param>
1137 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1138 /// <since_tizen> 3 </since_tizen>
1139 public void RemoveLayer(Layer layer)
1145 /// Feeds a key event into the window.
1147 /// <param name="keyEvent">The key event to feed.</param>
1148 /// <since_tizen> 5 </since_tizen>
1149 public void FeedKey(Key keyEvent)
1151 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1156 /// Feeds a hover event into the window. <br />
1157 /// This is feed after a default time of 48 ms. You can also set this time.
1159 /// <param name="time">The time of how much later it will be feed (default is 48ms)</param>
1160 /// <remarks>If you want to do FeedHover after the UI is updated, it is recommended to set the time to at least 16ms. This will be a good time waiting for the UI to update.<br />
1161 /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover.
1163 [EditorBrowsable(EditorBrowsableState.Never)]
1164 public void LazyFeedHover(uint time = 48)
1166 if (internalHoverTimer == null)
1168 internalHoverTimer = new Timer(time);
1169 internalHoverTimer.Tick += (s, e) =>
1172 internalHoverTimer?.Stop();
1173 internalHoverTimer?.Dispose();
1174 internalHoverTimer = null;
1177 internalHoverTimer.Start();
1181 internalHoverTimer.Start();
1186 /// Feeds a touch point into the window.
1188 /// <param name="touchPoint">The touch point to feed.</param>
1189 /// <param name="timeStamp">The timeStamp.</param>
1190 internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1192 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1197 /// Feeds a wheel event into the window.
1199 /// <param name="wheelEvent">The wheel event to feed.</param>
1200 internal void FeedWheel(Wheel wheelEvent)
1202 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207 /// Feeds a hover event into the window.
1209 /// <param name="touchPoint">The touch point to feed hover event. If null is entered, the feed hover event is generated with the last inputed touch point.</param>
1210 [EditorBrowsable(EditorBrowsableState.Never)]
1211 internal void FeedHover(TouchPoint touchPoint = null)
1213 if (touchPoint == null)
1215 using Touch touch = GetLastTouchEvent();
1216 if (touch == null || touch.GetPointCount() < 1)
1220 using Vector2 screenPosition = touch.GetScreenPosition(0);
1221 touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
1223 Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
1224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1228 /// Allows at least one more render, even when paused.
1229 /// The window should be shown, not minimised.
1231 /// <since_tizen> 4 </since_tizen>
1232 public void RenderOnce()
1234 Interop.Window.RenderOnce(SwigCPtr);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 /// Sets whether the window is transparent or not.
1241 /// <param name="transparent">Whether the window is transparent or not.</param>
1242 /// <since_tizen> 5 </since_tizen>
1243 public void SetTransparency(bool transparent)
1245 Interop.Window.SetTransparency(SwigCPtr, transparent);
1246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1248 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1252 /// Sets parent window of the window.
1253 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1254 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1255 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1257 /// <param name="parent">The parent window.</param>
1258 /// <since_tizen> 6 </since_tizen>
1259 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1260 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1261 public void SetParent(Window parent)
1263 if (IsSupportedMultiWindow() == false)
1265 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1267 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1272 /// Sets parent window of the window.
1273 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1274 /// This function has the additional flag whether the child is located above or below of the parent.
1276 /// <param name="parent">The parent window.</param>
1277 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1278 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1279 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1280 [EditorBrowsable(EditorBrowsableState.Never)]
1281 public void SetParent(Window parent, bool belowParent)
1283 if (IsSupportedMultiWindow() == false)
1285 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1287 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1292 /// Unsets parent window of the window.
1293 /// After unsetting, the window is disconnected his parent window.
1295 /// <since_tizen> 6 </since_tizen>
1296 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1297 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1298 public void Unparent()
1300 if (IsSupportedMultiWindow() == false)
1302 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1304 Interop.Window.Unparent(SwigCPtr);
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 /// Gets parent window of the window.
1311 /// <returns>The parent window of the window.</returns>
1312 /// <since_tizen> 6 </since_tizen>
1313 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1314 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1315 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1316 public Window GetParent()
1318 if (IsSupportedMultiWindow() == false)
1320 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1322 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1327 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1328 [EditorBrowsable(EditorBrowsableState.Never)]
1329 public void ObjectDump()
1331 Layer rootLayer = GetRootLayer();
1332 foreach (View view in rootLayer.Children)
1338 internal static bool IsInstalled()
1340 bool ret = Interop.Stage.IsInstalled();
1341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1346 /// Adds an orientation to the list of available orientations.
1348 /// <param name="orientation">The available orientation to add</param>
1349 /// <since_tizen> 6 </since_tizen>
1350 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1352 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1357 /// Removes an orientation from the list of available orientations.
1359 /// <param name="orientation">The available orientation to remove.</param>
1360 /// <since_tizen> 6 </since_tizen>
1361 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1363 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1368 /// Sets a preferred orientation.
1370 /// <param name="orientation">The preferred orientation.</param>
1371 /// <since_tizen> 6 </since_tizen>
1372 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1374 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1379 /// Gets the preferred orientation.
1381 /// <since_tizen> 6 </since_tizen>
1382 /// <returns>The preferred orientation if previously set, or none.</returns>
1383 public Window.WindowOrientation GetPreferredOrientation()
1385 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1391 /// Gets current orientation of the window.
1393 /// <since_tizen> 6 </since_tizen>
1394 /// <returns>The current window orientation if previously set, or none.</returns>
1395 [EditorBrowsable(EditorBrowsableState.Never)]
1396 public Window.WindowOrientation GetCurrentOrientation()
1398 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1404 /// Sets available orientations of the window.
1405 /// This API is for setting several orientations one time.
1407 /// <param name="orientations">The list of orientations.</param>
1408 /// <since_tizen> 6 </since_tizen>
1409 [EditorBrowsable(EditorBrowsableState.Never)]
1410 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1412 if (null == orientations)
1414 throw new ArgumentNullException(nameof(orientations));
1417 PropertyArray orientationArray = new PropertyArray();
1418 for (int i = 0; i < orientations.Count; i++)
1420 PropertyValue value = new PropertyValue((int)orientations[i]);
1421 orientationArray.PushBack(value);
1425 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1426 orientationArray.Dispose();
1427 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1431 /// Get native window ID
1433 /// <returns>native window ID</returns>
1434 [EditorBrowsable(EditorBrowsableState.Never)]
1435 public int GetNativeId()
1437 int ret = Interop.Window.GetNativeId(SwigCPtr);
1438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442 internal Any GetNativeHandle()
1444 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1449 internal void Add(Layer layer)
1453 throw new ArgumentNullException(nameof(layer));
1458 Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr);
1459 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1463 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1467 LayersChildren?.Add(layer);
1468 layer.SetWindow(this);
1471 internal void Remove(Layer layer)
1475 throw new ArgumentNullException(nameof(layer));
1477 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1478 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1480 LayersChildren?.Remove(layer);
1481 layer.SetWindow(null);
1484 internal Vector2 GetSize()
1486 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1488 convertRealWindowSizeToBorderWindowSize(val);
1490 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1491 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1496 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1497 [EditorBrowsable(EditorBrowsableState.Never)]
1498 public RenderTaskList GetRenderTaskList()
1500 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1501 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1506 /// Queries the number of on-window layers.
1508 /// <returns>The number of layers.</returns>
1509 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1510 internal uint GetLayerCount()
1512 if (LayersChildren == null || LayersChildren.Count < 0)
1515 return (uint)LayersChildren.Count;
1518 internal Layer GetRootLayer()
1522 if (borderLayer == null)
1524 borderLayer = GetBorderWindowRootLayer();
1525 LayersChildren?.Add(borderLayer);
1526 borderLayer.SetWindow(this);
1532 // Window.IsInstalled() is actually true only when called from event thread and
1533 // Core has been initialized, not when Stage is ready.
1534 if (rootLayer == null && Window.IsInstalled())
1536 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1538 LayersChildren?.Add(rootLayer);
1539 rootLayer.SetWindow(this);
1545 internal void SetBackgroundColor(Vector4 color)
1547 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1551 internal Vector4 GetBackgroundColor()
1553 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1558 internal Vector2 GetDpi()
1560 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1561 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1565 internal ObjectRegistry GetObjectRegistry()
1567 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1572 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1574 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1575 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1578 internal RenderingBehaviorType GetRenderingBehavior()
1580 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1581 if (NDalicPINVOKE.SWIGPendingException.Pending)
1582 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1586 internal void SetWindowSize(Size2D size)
1590 throw new ArgumentNullException(nameof(size));
1592 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1594 convertBorderWindowSizeToRealWindowSize(val);
1596 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1598 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1599 // Resetting Window size should request a relayout of the tree.
1602 internal Size2D GetWindowSize()
1604 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1606 convertRealWindowSizeToBorderWindowSize(val);
1608 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1614 internal void SetPosition(Position2D position)
1616 if (null == position)
1618 throw new ArgumentNullException(nameof(position));
1620 var val = new Int32Pair(position.X, position.Y);
1621 Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1624 // Setting Position of the window should request a relayout of the tree.
1627 internal Position2D GetPosition()
1629 var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1630 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1636 internal void SetPositionSize(Rectangle positionSize)
1638 if (positionSize == null)
1640 throw new ArgumentNullException(nameof(positionSize));
1642 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1644 convertBorderWindowSizeToRealWindowSize(val);
1646 positionSize.Width = val.GetX();
1647 positionSize.Height = val.GetY();
1649 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1652 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1654 // Setting Position of the window should request a relayout of the tree.
1658 /// Set the window use partial update or not.
1660 /// <param name="enabled">If window enable partial update or disable.</param>
1661 internal void SetPartialUpdate(bool enabled)
1663 Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled);
1664 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1668 /// Returns whether the window is enabled partial update or not.
1670 /// <returns>True if the window is enabled partial update, false otherwise.</returns>
1671 internal bool IsPartialUpdate()
1673 bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr);
1674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1679 /// Enables the floating mode of window.
1680 /// The floating mode is to support window is moved or resized by display server.
1681 /// For example, if the video-player window sets the floating mode,
1682 /// then display server changes its geometry and handles it like a popup.
1683 /// The way of handling floating mode window is decided by display server.
1684 /// A special display server(as a Tizen display server) supports this mode.
1686 /// <param name="enable">Enable floating mode or not.</param>
1687 [EditorBrowsable(EditorBrowsableState.Never)]
1688 public void EnableFloatingMode(bool enable)
1690 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1691 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1695 /// Returns whether the window is floating mode or not.
1697 /// <returns>True if the window is enabled floating mode, false otherwise.</returns>
1698 [EditorBrowsable(EditorBrowsableState.Never)]
1699 public bool IsFloatingModeEnabled()
1701 bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
1702 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707 /// Requests to display server for the window is moved by display server.
1708 /// It can be work with setting window floating mode.
1710 [EditorBrowsable(EditorBrowsableState.Never)]
1711 public void RequestMoveToServer()
1713 Interop.Window.RequestMoveToServer(SwigCPtr);
1714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1718 /// Requests to display server for the window is resized by display server.
1719 /// It can be work with setting window floating mode.
1721 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1722 [EditorBrowsable(EditorBrowsableState.Never)]
1723 public void RequestResizeToServer(ResizeDirection direction)
1725 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1726 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1730 /// Includes input region.
1731 /// This function inlcudes input regions.
1732 /// It can be used multiple times and supports multiple regions.
1733 /// It means input region will be extended.
1734 /// This input is related to mouse and touch event.
1735 /// If device has touch screen, this function is useful.
1736 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1738 /// <param name="inputRegion">The included region to accept input events.</param>
1739 [EditorBrowsable(EditorBrowsableState.Never)]
1740 public void IncludeInputRegion(Rectangle inputRegion)
1742 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1747 /// This function excludes input regions.
1748 /// It can be used multiple times and supports multiple regions.
1749 /// It means input region will be reduced.
1750 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1751 /// This input is related to mouse and touch event.
1752 /// If device has touch screen, this function is useful.
1753 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1755 /// <param name="inputRegion">The excluded region to except input events.</param>
1756 [EditorBrowsable(EditorBrowsableState.Never)]
1757 public void ExcludeInputRegion(Rectangle inputRegion)
1759 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1764 /// Maximizes window's size.
1765 /// If this function is called with true, window will be resized with screen size.
1766 /// Otherwise window will be resized with previous size.
1767 /// It is for the window's MAX button in window's border.
1768 /// If window border is supported by display server, it is not necessary.
1770 /// <param name="max">If window is maximized or unmaximized.</param>
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public void Maximize(bool max)
1774 Interop.Window.Maximize(SwigCPtr, max);
1775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1779 /// Returns whether the window is maximized or not.
1781 /// <returns>True if the window is maximized, false otherwise.</returns>
1782 [EditorBrowsable(EditorBrowsableState.Never)]
1783 public bool IsMaximized()
1785 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1786 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1791 /// Sets window's maximum size.
1793 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1794 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1796 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1799 /// <param name="size">the maximum size.</param>
1800 [EditorBrowsable(EditorBrowsableState.Never)]
1801 public void SetMaximumSize(Size2D size)
1805 throw new ArgumentNullException(nameof(size));
1807 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1809 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1815 /// Minimizes window's size.
1816 /// If this function is called with true, window will be iconified.
1817 /// Otherwise window will be activated.
1818 /// It is for the window's MIN button in window border.
1819 /// If window border is supported by display server, it is not necessary.
1821 /// <param name="min">If window is minimized or unminimized.</param>
1822 [EditorBrowsable(EditorBrowsableState.Never)]
1823 public void Minimize(bool min)
1825 Interop.Window.Minimize(SwigCPtr, min);
1826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1830 /// Returns whether the window is minimized or not.
1832 /// <returns>True if the window is minimized, false otherwise.</returns>
1833 [EditorBrowsable(EditorBrowsableState.Never)]
1834 public bool IsMinimized()
1836 bool ret = Interop.Window.IsMinimized(SwigCPtr);
1837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1842 /// Sets window's minimum size.
1843 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1844 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1846 /// <param name="size">the minimum size.</param>
1847 [EditorBrowsable(EditorBrowsableState.Never)]
1848 public void SetMimimumSize(Size2D size)
1852 throw new ArgumentNullException(nameof(size));
1854 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1856 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1862 /// Sets the layout of the window.
1864 /// <param name="numCols">The number of columns in the layout.</param>
1865 /// <param name="numRows">The number of rows in the layout.</param>
1866 /// <param name="column">The column number of the window within the layout.</param>
1867 /// <param name="row">The row number of the window within the layout.</param>
1868 /// <param name="colSpan">The number of columns the window should span within the layout.</param>
1869 /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
1870 [EditorBrowsable(EditorBrowsableState.Never)]
1871 public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
1873 Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
1874 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1879 /// Sets the layout of the window.
1881 /// <param name="layoutType">The type of layout to set for the window.</param>
1882 [EditorBrowsable(EditorBrowsableState.Never)]
1883 public void SetLayout(WindowLayoutType layoutType)
1887 case WindowLayoutType.LeftHalf:
1888 Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
1890 case WindowLayoutType.RightHalf:
1891 Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
1894 case WindowLayoutType.TopHalf:
1895 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
1897 case WindowLayoutType.BottomHalf:
1898 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
1901 case WindowLayoutType.UpperLeftQuarter:
1902 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
1904 case WindowLayoutType.UpperRightQuarter:
1905 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
1907 case WindowLayoutType.LowerLeftQuarter:
1908 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
1910 case WindowLayoutType.LowerRightQuarter:
1911 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
1914 case WindowLayoutType.LeftThird:
1915 Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
1917 case WindowLayoutType.CenterThird:
1918 Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
1920 case WindowLayoutType.RightThird:
1921 Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
1924 case WindowLayoutType.TopThird:
1925 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
1927 case WindowLayoutType.MiddleThird:
1928 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
1930 case WindowLayoutType.BottomThird:
1931 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
1934 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1939 /// Query whether window is rotating or not.
1941 /// <returns>True if window is rotating, false otherwise.</returns>
1942 [EditorBrowsable(EditorBrowsableState.Never)]
1943 public bool IsWindowRotating()
1945 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1946 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1951 /// Gets the last key event the window gets.
1953 /// <returns>The last key event the window gets.</returns>
1954 [EditorBrowsable(EditorBrowsableState.Never)]
1955 public Key GetLastKeyEvent()
1957 if(internalLastKeyEvent == null)
1959 internalLastKeyEvent = new Key();
1961 Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr);
1962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1963 return internalLastKeyEvent;
1967 /// Gets the last touch event the window gets.
1969 /// <returns>The last touch event the window gets.</returns>
1970 [EditorBrowsable(EditorBrowsableState.Never)]
1971 public Touch GetLastTouchEvent()
1973 if(internalLastTouchEvent == null)
1975 internalLastTouchEvent = new Touch();
1977 Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr);
1978 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1979 return internalLastTouchEvent;
1983 /// Sets the necessary for window rotation Acknowledgement.
1984 /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
1986 /// This function is supprot that application has the window rotation acknowledgement's control.
1987 /// It means display server waits when application's rotation work is finished.
1988 /// It is useful application has the other rendering engine which works asynchronous.
1989 /// For instance, GlView.
1991 /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
1992 [EditorBrowsable(EditorBrowsableState.Never)]
1993 public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
1995 Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
1996 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2000 /// send the Acknowledgement to complete window rotation.
2001 /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
2003 [EditorBrowsable(EditorBrowsableState.Never)]
2004 public void SendRotationCompletedAcknowledgement()
2006 Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
2007 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2011 /// Add FrameUpdateCallback
2013 [EditorBrowsable(EditorBrowsableState.Never)]
2014 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2016 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
2020 /// Remove FrameUpdateCallback
2022 [EditorBrowsable(EditorBrowsableState.Never)]
2023 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2025 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
2029 /// Dispose for Window
2031 [EditorBrowsable(EditorBrowsableState.Never)]
2032 protected override void Dispose(DisposeTypes type)
2039 this.DisconnectNativeSignals();
2041 if (type == DisposeTypes.Explicit)
2044 //Release your own managed resources here.
2045 //You should release all of your own disposable objects here.
2047 if (IsBorderEnabled)
2052 foreach (var layer in childLayers)
2060 childLayers.Clear();
2062 localController?.Dispose();
2064 internalLastKeyEvent?.Dispose();
2065 internalLastKeyEvent = null;
2066 internalLastTouchEvent?.Dispose();
2067 internalLastTouchEvent = null;
2069 internalHoverTimer?.Stop();
2070 internalHoverTimer?.Dispose();
2071 internalHoverTimer = null;
2078 /// This will not be public opened.
2079 [EditorBrowsable(EditorBrowsableState.Never)]
2080 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2082 Interop.Window.DeleteWindow(swigCPtr);
2085 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
2087 private static readonly object locker = new object();
2089 private static int key = 0;
2091 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
2093 private struct internalHookCallbackType
2095 public FrameCallbackType userCallback;
2099 private static void OnInternalHookFrameCallback(int id)
2103 if (frameCallbackList.ContainsKey(id))
2105 if (frameCallbackList[id].userCallback != null)
2107 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
2108 frameCallbackList.Remove(id);
2112 NUILog.Error($"found userCallback is NULL");
2113 frameCallbackList.Remove(id);
2119 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2121 if (null == callback)
2123 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2125 var assignedKey = 0;
2130 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2132 userCallback = callback,
2140 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2142 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2143 [EditorBrowsable(EditorBrowsableState.Never)]
2144 public delegate void FrameCallbackType(int frameId);
2147 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2148 /// A callback of the following type may be used:
2150 /// void MyFunction( int frameId )
2152 /// This callback will be deleted once it is called.
2154 /// Ownership of the callback is passed onto this class
2157 /// <param name="callback">The function to call</param>
2158 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2159 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2160 [EditorBrowsable(EditorBrowsableState.Never)]
2161 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2163 var assignedKey = AddInterHookCallback(callback, frameId);
2164 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2170 /// Adds a callback that is called when the frame is displayed on the display.
2171 /// A callback of the following type may be used:
2173 /// void MyFunction( int frameId )
2175 /// This callback will be deleted once it is called.
2177 /// Ownership of the callback is passed onto this class
2180 /// <param name="callback">The function to call</param>
2181 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2182 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2183 [EditorBrowsable(EditorBrowsableState.Never)]
2184 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2186 var assignedKey = AddInterHookCallback(callback, frameId);
2187 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2193 /// Search through this Window for a Layer with the given unique ID.
2195 /// <param name="id">The ID of the Layer to find.</param>
2196 /// <remarks>Hidden-API</remarks>
2197 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2198 [EditorBrowsable(EditorBrowsableState.Never)]
2199 public Layer FindLayerByID(uint id)
2201 Layer defaultLayer = this.GetDefaultLayer();
2202 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2203 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2210 /// Get Native Window handle.
2212 /// How to get Native Window handle
2214 /// Window window = NUIApplication.GetDefaultWindow();
2215 /// var handle = window.NativeHandle;
2216 /// if(handle.IsInvalid == false)
2218 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2219 /// // do something with nativeHandle
2224 /// <since_tizen> 9 </since_tizen>
2225 public SafeHandle NativeHandle
2229 return new NUI.SafeNativeWindowHandle(this);