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 string windowTitle;
40 private List<Layer> childLayers = new List<Layer>();
41 private LayoutController localController;
43 static internal bool IsSupportedMultiWindow()
45 bool isSupported = false;
48 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
50 catch (DllNotFoundException e)
52 Tizen.Log.Fatal("NUI", $"{e}\n");
57 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
59 if (Interop.Stage.IsInstalled())
61 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
63 localController = new LayoutController(this);
64 NUILog.Debug("layoutController id:" + localController.GetId());
69 /// A helper method to get the current window where the view is added
71 /// <param name="view">The View added to the window</param>
72 /// <returns>A Window.</returns>
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 static public Window Get(View view)
78 NUILog.Error("if there is no view, it can not get a window");
82 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.Get(View.getCPtr(view))) as Window;
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 /// Creates a new Window.<br />
89 /// This creates an extra window in addition to the default main window<br />
91 /// <param name="windowPosition">The position and size of the Window.</param>
92 /// <param name="isTranslucent">Whether Window is translucent.</param>
93 /// <returns>A new Window.</returns>
94 /// <since_tizen> 6 </since_tizen>
95 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
96 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
97 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
99 if (IsSupportedMultiWindow() == false)
101 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 /// Creates a new Window with a specific name.<br />
108 /// This creates an extra window in addition to the default main window<br />
110 /// <param name="name">The name for extra window. </param>
111 /// <param name="windowPosition">The position and size of the Window.</param>
112 /// <param name="isTranslucent">Whether Window is translucent.</param>
113 /// <returns>A new Window.</returns>
114 /// <since_tizen> 6 </since_tizen>
115 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
116 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
117 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
119 if (IsSupportedMultiWindow() == false)
121 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
123 this.windowTitle = name;
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
130 /// <since_tizen> 3 </since_tizen>
131 public enum WindowOrientation
134 /// Portrait orientation. The height of the display area is greater than the width.
136 /// <since_tizen> 3 </since_tizen>
139 /// Landscape orientation. A wide view area is needed.
141 /// <since_tizen> 3 </since_tizen>
144 /// Portrait inverse orientation.
146 /// <since_tizen> 3 </since_tizen>
147 PortraitInverse = 180,
149 /// Landscape inverse orientation.
151 /// <since_tizen> 3 </since_tizen>
152 LandscapeInverse = 270,
154 /// No orientation. It is for the preferred orientation
155 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
156 /// It is used to unset the preferred orientation with SetPreferredOrientation.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 NoOrientationPreference = -1
163 /// Enumeration for the key grab mode for platform-level APIs.
165 /// <since_tizen> 3 </since_tizen>
166 public enum KeyGrabMode
169 /// Grabs a key only when on the top of the grabbing-window stack mode.
173 /// Grabs a key together with the other client window(s) mode.
177 /// 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.
181 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
187 /// Enumeration for transition effect's state.
189 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState instead!")]
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public enum EffectStates
196 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.None instead!")]
197 [EditorBrowsable(EditorBrowsableState.Never)]
200 /// Transition effect is started.
202 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.Start instead!")]
203 [EditorBrowsable(EditorBrowsableState.Never)]
206 /// Transition effect is ended.
208 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.End instead!")]
209 [EditorBrowsable(EditorBrowsableState.Never)]
214 /// Enumeration for transition effect's state.
216 [EditorBrowsable(EditorBrowsableState.Never)]
217 public enum EffectState
222 [EditorBrowsable(EditorBrowsableState.Never)]
225 /// Transition effect is started.
227 [EditorBrowsable(EditorBrowsableState.Never)]
230 /// Transition effect is ended.
232 [EditorBrowsable(EditorBrowsableState.Never)]
237 /// Enumeration for transition effect's type.
239 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType instead!")]
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public enum EffectTypes
246 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.None instead!")]
247 [EditorBrowsable(EditorBrowsableState.Never)]
250 /// Window show effect.
252 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Show instead!")]
253 [EditorBrowsable(EditorBrowsableState.Never)]
256 /// Window hide effect.
258 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Hide instead!")]
259 [EditorBrowsable(EditorBrowsableState.Never)]
264 /// Enumeration for transition effect's type.
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public enum EffectType
272 [EditorBrowsable(EditorBrowsableState.Never)]
275 /// Window show effect.
277 [EditorBrowsable(EditorBrowsableState.Never)]
280 /// Window hide effect.
282 [EditorBrowsable(EditorBrowsableState.Never)]
287 /// Enumeration for result of window operation.
289 internal enum OperationResult
292 /// Failed for unknown reason
300 /// Permission denied
304 /// The operation is not supported.
310 /// Enumeration for window resized mode by display server.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 public enum ResizeDirection
316 /// Start resizing window to the top-left edge.
318 [EditorBrowsable(EditorBrowsableState.Never)]
321 /// Start resizing window to the top side.
323 [EditorBrowsable(EditorBrowsableState.Never)]
326 /// Start resizing window to the top-right edge.
328 [EditorBrowsable(EditorBrowsableState.Never)]
331 /// Start resizing window to the left side.
333 [EditorBrowsable(EditorBrowsableState.Never)]
336 /// Start resizing window to the right side.
338 [EditorBrowsable(EditorBrowsableState.Never)]
341 /// Start resizing window to the bottom-left edge.
343 [EditorBrowsable(EditorBrowsableState.Never)]
346 /// Start resizing window to the bottom side.
348 [EditorBrowsable(EditorBrowsableState.Never)]
351 /// Start resizing window to the bottom-right edge.
353 [EditorBrowsable(EditorBrowsableState.Never)]
359 /// The stage instance property (read-only).<br />
360 /// Gets the current window.<br />
362 /// <since_tizen> 3 </since_tizen>
363 public static Window Instance { get; internal set; }
366 /// Gets or sets a window type.
367 /// Most of window type can be set to use WindowType, except for IME type.
368 /// IME type can be set to use one of NUIApplication's constrcutors.
370 /// <since_tizen> 3 </since_tizen>
371 public WindowType Type
375 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
381 Interop.Window.SetType(SwigCPtr, (int)value);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 /// Gets/Sets a window title.
389 /// <since_tizen> 4 </since_tizen>
399 SetClass(windowTitle, "");
404 /// The rendering behavior of a Window.
406 /// <since_tizen> 5 </since_tizen>
407 public RenderingBehaviorType RenderingBehavior
411 return GetRenderingBehavior();
415 SetRenderingBehavior(value);
420 /// The window size property (read-only).
422 /// <since_tizen> 3 </since_tizen>
427 Size2D ret = GetSize();
433 /// The background color property.
435 /// <since_tizen> 3 </since_tizen>
436 public Color BackgroundColor
440 SetBackgroundColor(value);
444 Color ret = GetBackgroundColor();
450 /// The DPI property (read-only).<br />
451 /// Retrieves the DPI of the display device to which the Window is connected.<br />
453 /// <since_tizen> 3 </since_tizen>
463 /// The layer count property (read-only).<br />
464 /// Queries the number of on-Window layers.<br />
466 /// <since_tizen> 3 </since_tizen>
467 public uint LayerCount
471 return GetLayerCount();
476 /// Gets or sets a size of the window.
478 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
479 /// <since_tizen> 4 </since_tizen>
480 public Size2D WindowSize
484 return GetWindowSize();
488 SetWindowSize(value);
493 /// Gets or sets a position of the window.
495 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
496 /// <since_tizen> 4 </since_tizen>
497 public Position2D WindowPosition
501 return GetPosition();
510 /// Sets position and size of the window. This API guarantees that
511 /// both moving and resizing of window will appear on the screen at once.
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 public Rectangle WindowPositionSize
518 Position2D position = GetPosition();
519 Size2D size = GetSize();
520 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
526 SetPositionSize(value);
530 internal static Vector4 DEFAULT_BACKGROUND_COLOR
534 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
535 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541 internal static Vector4 DEBUG_BACKGROUND_COLOR
545 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
546 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
547 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 internal List<Layer> LayersChildren
561 /// Get the LayoutController for this Window.
563 internal LayoutController LayoutController
567 return localController;
572 /// Feed a key-event into the window.
574 /// <param name="keyEvent">The key event to feed.</param>
575 /// <since_tizen> 4 </since_tizen>
576 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
577 public static void FeedKeyEvent(Key keyEvent)
579 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
580 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584 /// Sets whether the window accepts a focus or not.
586 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
587 /// <since_tizen> 3 </since_tizen>
588 public void SetAcceptFocus(bool accept)
590 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
591 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
595 /// Returns whether the window accepts a focus or not.
597 /// <returns>True if the window accepts a focus, false otherwise.</returns>
598 /// <since_tizen> 3 </since_tizen>
599 public bool IsFocusAcceptable()
601 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 /// Shows the window if it is hidden.
610 /// <since_tizen> 3 </since_tizen>
613 Interop.Window.Show(SwigCPtr);
614 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 /// Hides the window if it is showing.
620 /// <since_tizen> 3 </since_tizen>
623 Interop.Window.Hide(SwigCPtr);
624 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628 /// Retrieves whether the window is visible or not.
630 /// <returns>True if the window is visible.</returns>
631 /// <since_tizen> 3 </since_tizen>
632 public bool IsVisible()
634 bool temp = Interop.Window.IsVisible(SwigCPtr);
635 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
640 /// Gets the count of supported auxiliary hints of the window.
642 /// <returns>The number of supported auxiliary hints.</returns>
643 /// <since_tizen> 3 </since_tizen>
644 public uint GetSupportedAuxiliaryHintCount()
646 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
647 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 /// Gets the supported auxiliary hint string of the window.
654 /// <param name="index">The index of the supported auxiliary hint lists.</param>
655 /// <returns>The auxiliary hint string of the index.</returns>
656 /// <since_tizen> 3 </since_tizen>
657 public string GetSupportedAuxiliaryHint(uint index)
659 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Creates an auxiliary hint of the window.
667 /// <param name="hint">The auxiliary hint string.</param>
668 /// <param name="value">The value string.</param>
669 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
670 /// <since_tizen> 3 </since_tizen>
671 public uint AddAuxiliaryHint(string hint, string value)
673 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
679 /// Removes an auxiliary hint of the window.
681 /// <param name="id">The ID of the auxiliary hint.</param>
682 /// <returns>True if no error occurred, false otherwise.</returns>
683 /// <since_tizen> 3 </since_tizen>
684 public bool RemoveAuxiliaryHint(uint id)
686 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
687 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
692 /// Changes a value of the auxiliary hint.
694 /// <param name="id">The auxiliary hint ID.</param>
695 /// <param name="value">The value string to be set.</param>
696 /// <returns>True if no error occurred, false otherwise.</returns>
697 /// <since_tizen> 3 </since_tizen>
698 public bool SetAuxiliaryHintValue(uint id, string value)
700 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
701 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
706 /// Gets a value of the auxiliary hint.
708 /// <param name="id">The auxiliary hint ID.</param>
709 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
710 /// <since_tizen> 3 </since_tizen>
711 public string GetAuxiliaryHintValue(uint id)
713 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
719 /// Gets an ID of the auxiliary hint string.
721 /// <param name="hint">The auxiliary hint string.</param>
722 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
723 /// <since_tizen> 3 </since_tizen>
724 public uint GetAuxiliaryHintId(string hint)
726 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Sets a region to accept input events.
734 /// <param name="inputRegion">The region to accept input events.</param>
735 /// <since_tizen> 3 </since_tizen>
736 public void SetInputRegion(Rectangle inputRegion)
738 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
739 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743 /// Sets a priority level for the specified notification window.
745 /// <param name="level">The notification window level.</param>
746 /// <returns>True if no error occurred, false otherwise.</returns>
747 /// <since_tizen> 3 </since_tizen>
748 public bool SetNotificationLevel(NotificationLevel level)
750 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
751 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
752 return ret == OperationResult.Succeed;
756 /// Gets a priority level for the specified notification window.
758 /// <returns>The notification window level.</returns>
759 /// <since_tizen> 3 </since_tizen>
760 public NotificationLevel GetNotificationLevel()
762 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768 /// Sets a transparent window's visual state to opaque. <br />
769 /// If a visual state of a transparent window is opaque, <br />
770 /// then the window manager could handle it as an opaque window when calculating visibility.
772 /// <param name="opaque">Whether the window's visual state is opaque.</param>
773 /// <remarks>This will have no effect on an opaque window. <br />
774 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
776 /// <since_tizen> 3 </since_tizen>
777 public void SetOpaqueState(bool opaque)
779 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 /// Returns whether a transparent window's visual state is opaque or not.
786 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
787 /// <remarks> The return value has no meaning on an opaque window. </remarks>
788 /// <since_tizen> 3 </since_tizen>
789 public bool IsOpaqueState()
791 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
792 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 /// Sets a window's screen off mode.
799 /// <param name="screenOffMode">The screen mode.</param>
800 /// <returns>True if no error occurred, false otherwise.</returns>
801 /// <since_tizen> 4 </since_tizen>
802 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
804 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
806 return ret == OperationResult.Succeed;
810 /// Gets the screen mode of the window.
812 /// <returns>The screen off mode.</returns>
813 /// <since_tizen> 4 </since_tizen>
814 public ScreenOffMode GetScreenOffMode()
816 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 /// Sets preferred brightness of the window.
824 /// <param name="brightness">The preferred brightness (0 to 100).</param>
825 /// <returns>True if no error occurred, false otherwise.</returns>
826 /// <since_tizen> 3 </since_tizen>
827 public bool SetBrightness(int brightness)
829 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831 return ret == OperationResult.Succeed;
835 /// Gets the preferred brightness of the window.
837 /// <returns>The preferred brightness.</returns>
838 /// <since_tizen> 3 </since_tizen>
839 public int GetBrightness()
841 int ret = Interop.Window.GetBrightness(SwigCPtr);
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 /// Sets the window name and the class string.
849 /// <param name="name">The name of the window.</param>
850 /// <param name="klass">The class of the window.</param>
851 /// <since_tizen> 4 </since_tizen>
852 public void SetClass(string name, string klass)
854 Interop.Window.SetClass(SwigCPtr, name, klass);
855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859 /// Raises the window to the top of the window stack.
861 /// <since_tizen> 3 </since_tizen>
864 Interop.Window.Raise(SwigCPtr);
865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Lowers the window to the bottom of the window stack.
871 /// <since_tizen> 3 </since_tizen>
874 Interop.Window.Lower(SwigCPtr);
875 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879 /// Activates the window to the top of the window stack even it is iconified.
881 /// <since_tizen> 3 </since_tizen>
882 public void Activate()
884 Interop.Window.Activate(SwigCPtr);
885 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
889 /// Gets the default ( root ) layer.
891 /// <returns>The root layer.</returns>
892 /// <since_tizen> 3 </since_tizen>
893 public Layer GetDefaultLayer()
895 return this.GetRootLayer();
899 /// Add a child view to window.
901 /// <param name="view">the child should be added to the window.</param>
902 /// <since_tizen> 3 </since_tizen>
903 public void Add(View view)
905 Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
906 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
907 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
910 view.InternalParent = this.GetRootLayer();
912 this.GetRootLayer().LayoutCount += view.LayoutCount;
917 /// Remove a child view from window.
919 /// <param name="view">the child to be removed.</param>
920 /// <since_tizen> 3 </since_tizen>
921 public void Remove(View view)
923 Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
924 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
927 view.InternalParent = null;
929 this.GetRootLayer().LayoutCount -= view.LayoutCount;
934 /// Retrieves the layer at a specified depth.
936 /// <param name="depth">The layer's depth index.</param>
937 /// <returns>The layer found at the given depth.</returns>
938 /// <since_tizen> 3 </since_tizen>
939 public Layer GetLayer(uint depth)
941 if (depth < LayersChildren?.Count)
943 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
953 /// Destroy the window immediately.
955 [EditorBrowsable(EditorBrowsableState.Never)]
956 public void Destroy()
962 /// Keep rendering for at least the given amount of time.
964 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
965 /// <since_tizen> 3 </since_tizen>
966 public void KeepRendering(float durationSeconds)
968 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
969 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
974 /// This function can be used for following example scenarios: <br />
975 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
977 /// <param name="DaliKey">The key code to grab.</param>
978 /// <returns>True if the grab succeeds.</returns>
979 /// <since_tizen> 3 </since_tizen>
980 public bool GrabKeyTopmost(int DaliKey)
982 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
983 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
988 /// Ungrabs the key specified by a key for the window.<br />
989 /// 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 />
991 /// <param name="DaliKey">The key code to ungrab.</param>
992 /// <returns>True if the ungrab succeeds.</returns>
993 /// <since_tizen> 3 </since_tizen>
994 public bool UngrabKeyTopmost(int DaliKey)
996 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
997 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1002 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1003 /// Details: This function can be used for following example scenarios: <br />
1004 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1005 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1006 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1008 /// <param name="DaliKey">The key code to grab.</param>
1009 /// <param name="GrabMode">The grab mode for the key.</param>
1010 /// <returns>True if the grab succeeds.</returns>
1011 /// <since_tizen> 3 </since_tizen>
1012 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1014 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1015 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020 /// Ungrabs the key specified by a key for a window.<br />
1021 /// 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 />
1023 /// <param name="DaliKey">The key code to ungrab.</param>
1024 /// <returns>True if the ungrab succeeds.</returns>
1025 /// <since_tizen> 3 </since_tizen>
1026 public bool UngrabKey(int DaliKey)
1028 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1029 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1034 /// Sets the keyboard repeat information.
1036 /// <param name="rate">The key repeat rate value in seconds.</param>
1037 /// <param name="delay">The key repeat delay value in seconds.</param>
1038 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1039 /// <since_tizen> 5 </since_tizen>
1040 public bool SetKeyboardRepeatInfo(float rate, float delay)
1042 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1043 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1048 /// Gets the keyboard repeat information.
1050 /// <param name="rate">The key repeat rate value in seconds.</param>
1051 /// <param name="delay">The key repeat delay value in seconds.</param>
1052 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1053 /// <since_tizen> 5 </since_tizen>
1054 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1056 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1057 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1062 /// Adds a layer to the stage.
1064 /// <param name="layer">Layer to add.</param>
1065 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1066 /// <since_tizen> 3 </since_tizen>
1067 public void AddLayer(Layer layer)
1073 /// Removes a layer from the stage.
1075 /// <param name="layer">Layer to remove.</param>
1076 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1077 /// <since_tizen> 3 </since_tizen>
1078 public void RemoveLayer(Layer layer)
1084 /// Feeds a key event into the window.
1086 /// <param name="keyEvent">The key event to feed.</param>
1087 /// <since_tizen> 5 </since_tizen>
1088 public void FeedKey(Key keyEvent)
1090 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1095 /// Allows at least one more render, even when paused.
1096 /// The window should be shown, not minimised.
1098 /// <since_tizen> 4 </since_tizen>
1099 public void RenderOnce()
1101 Interop.Window.RenderOnce(SwigCPtr);
1102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 /// Sets whether the window is transparent or not.
1108 /// <param name="transparent">Whether the window is transparent or not.</param>
1109 /// <since_tizen> 5 </since_tizen>
1110 public void SetTransparency(bool transparent)
1112 Interop.Window.SetTransparency(SwigCPtr, transparent);
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1115 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1119 /// Sets parent window of the window.
1120 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1121 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1122 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1124 /// <param name="parent">The parent window.</param>
1125 /// <since_tizen> 6 </since_tizen>
1126 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1127 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1128 public void SetParent(Window parent)
1130 if (IsSupportedMultiWindow() == false)
1132 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1134 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1139 /// Sets parent window of the window.
1140 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1141 /// This function has the additional flag whether the child is located above or below of the parent.
1143 /// <param name="parent">The parent window.</param>
1144 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1145 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1146 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1147 [EditorBrowsable(EditorBrowsableState.Never)]
1148 public void SetParent(Window parent, bool belowParent)
1150 if (IsSupportedMultiWindow() == false)
1152 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1154 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1159 /// Unsets parent window of the window.
1160 /// After unsetting, the window is disconnected his parent window.
1162 /// <since_tizen> 6 </since_tizen>
1163 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1164 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1165 public void Unparent()
1167 if (IsSupportedMultiWindow() == false)
1169 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1171 Interop.Window.Unparent(SwigCPtr);
1172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1176 /// Gets parent window of the window.
1178 /// <returns>The parent window of the window.</returns>
1179 /// <since_tizen> 6 </since_tizen>
1180 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1181 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1182 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1183 public Window GetParent()
1185 if (IsSupportedMultiWindow() == false)
1187 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1189 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window;
1190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1194 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1195 [EditorBrowsable(EditorBrowsableState.Never)]
1196 public void ObjectDump()
1198 Layer rootLayer = GetRootLayer();
1199 foreach (View view in rootLayer.Children)
1205 internal static bool IsInstalled()
1207 bool ret = Interop.Stage.IsInstalled();
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 /// Adds an orientation to the list of available orientations.
1215 /// <param name="orientation">The available orientation to add</param>
1216 /// <since_tizen> 6 </since_tizen>
1217 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1219 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1224 /// Removes an orientation from the list of available orientations.
1226 /// <param name="orientation">The available orientation to remove.</param>
1227 /// <since_tizen> 6 </since_tizen>
1228 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1230 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1235 /// Sets a preferred orientation.
1237 /// <param name="orientation">The preferred orientation.</param>
1238 /// <since_tizen> 6 </since_tizen>
1239 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1241 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246 /// Gets the preferred orientation.
1248 /// <since_tizen> 6 </since_tizen>
1249 /// <returns>The preferred orientation if previously set, or none.</returns>
1250 public Window.WindowOrientation GetPreferredOrientation()
1252 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1258 /// Gets current orientation of the window.
1260 /// <since_tizen> 6 </since_tizen>
1261 /// <returns>The current window orientation if previously set, or none.</returns>
1262 [EditorBrowsable(EditorBrowsableState.Never)]
1263 public Window.WindowOrientation GetCurrentOrientation()
1265 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1271 /// Sets available orientations of the window.
1272 /// This API is for setting several orientations one time.
1274 /// <param name="orientations">The list of orientations.</param>
1275 /// <since_tizen> 6 </since_tizen>
1276 [EditorBrowsable(EditorBrowsableState.Never)]
1277 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1279 if (null == orientations)
1281 throw new ArgumentNullException(nameof(orientations));
1284 PropertyArray orientationArray = new PropertyArray();
1285 for (int i = 0; i < orientations.Count; i++)
1287 PropertyValue value = new PropertyValue((int)orientations[i]);
1288 orientationArray.PushBack(value);
1292 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1293 orientationArray.Dispose();
1294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1298 /// Get native window ID
1300 /// <returns>native window ID</returns>
1301 [EditorBrowsable(EditorBrowsableState.Never)]
1302 public int GetNativeId()
1304 int ret = Interop.Window.GetNativeId(SwigCPtr);
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 internal Any GetNativeHandle()
1311 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1316 internal void Add(Layer layer)
1320 throw new ArgumentNullException(nameof(layer));
1322 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325 LayersChildren?.Add(layer);
1326 layer.SetWindow(this);
1329 internal void Remove(Layer layer)
1333 throw new ArgumentNullException(nameof(layer));
1335 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1338 LayersChildren?.Remove(layer);
1339 layer.SetWindow(null);
1342 internal Vector2 GetSize()
1344 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1345 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1350 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1351 [EditorBrowsable(EditorBrowsableState.Never)]
1352 public RenderTaskList GetRenderTaskList()
1354 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360 /// Queries the number of on-window layers.
1362 /// <returns>The number of layers.</returns>
1363 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1364 internal uint GetLayerCount()
1366 if (LayersChildren == null || LayersChildren.Count < 0)
1369 return (uint)LayersChildren.Count;
1372 internal Layer GetRootLayer()
1374 // Window.IsInstalled() is actually true only when called from event thread and
1375 // Core has been initialized, not when Stage is ready.
1376 if (rootLayer == null && Window.IsInstalled())
1378 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1380 LayersChildren?.Add(rootLayer);
1381 rootLayer.SetWindow(this);
1386 internal void SetBackgroundColor(Vector4 color)
1388 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal Vector4 GetBackgroundColor()
1394 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal Vector2 GetDpi()
1401 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 internal ObjectRegistry GetObjectRegistry()
1408 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1413 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1415 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1416 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1419 internal RenderingBehaviorType GetRenderingBehavior()
1421 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1422 if (NDalicPINVOKE.SWIGPendingException.Pending)
1423 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1427 internal void SetWindowSize(Size2D size)
1431 throw new ArgumentNullException(nameof(size));
1433 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1434 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1437 // Resetting Window size should request a relayout of the tree.
1440 internal Size2D GetWindowSize()
1442 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1443 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1444 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448 internal void SetPosition(Position2D position)
1450 if (null == position)
1452 throw new ArgumentNullException(nameof(position));
1454 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1455 Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
1457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458 // Setting Position of the window should request a relayout of the tree.
1461 internal Position2D GetPosition()
1463 var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
1464 Position2D ret = new Position2D(val.GetX(), val.GetY());
1466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1470 internal void SetPositionSize(Rectangle positionSize)
1472 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1474 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1476 // Setting Position of the window should request a relayout of the tree.
1480 /// Enables the floating mode of window.
1481 /// The floating mode is to support window is moved or resized by display server.
1482 /// For example, if the video-player window sets the floating mode,
1483 /// then display server changes its geometry and handles it like a popup.
1484 /// The way of handling floating mode window is decided by display server.
1485 /// A special display server(as a Tizen display server) supports this mode.
1487 /// <param name="enable">Enable floating mode or not.</param>
1488 [EditorBrowsable(EditorBrowsableState.Never)]
1489 public void EnableFloatingMode(bool enable)
1491 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1492 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1496 /// Requests to display server for the window is moved by display server.
1497 /// It can be work with setting window floating mode.
1499 [EditorBrowsable(EditorBrowsableState.Never)]
1500 public void RequestMoveToServer()
1502 Interop.Window.RequestMoveToServer(SwigCPtr);
1503 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1507 /// Requests to display server for the window is resized by display server.
1508 /// It can be work with setting window floating mode.
1510 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1511 [EditorBrowsable(EditorBrowsableState.Never)]
1512 public void RequestResizeToServer(ResizeDirection direction)
1514 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1519 /// Includes input region.
1520 /// This function inlcudes input regions.
1521 /// It can be used multiple times and supports multiple regions.
1522 /// It means input region will be extended.
1523 /// This input is related to mouse and touch event.
1524 /// If device has touch screen, this function is useful.
1525 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1527 /// <param name="inputRegion">The included region to accept input events.</param>
1528 [EditorBrowsable(EditorBrowsableState.Never)]
1529 public void IncludeInputRegion(Rectangle inputRegion)
1531 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1532 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1536 /// This function excludes input regions.
1537 /// It can be used multiple times and supports multiple regions.
1538 /// It means input region will be reduced.
1539 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1540 /// This input is related to mouse and touch event.
1541 /// If device has touch screen, this function is useful.
1542 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1544 /// <param name="inputRegion">The excluded region to except input events.</param>
1545 [EditorBrowsable(EditorBrowsableState.Never)]
1546 public void ExcludeInputRegion(Rectangle inputRegion)
1548 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1553 /// Add FrameUpdateCallback
1555 [EditorBrowsable(EditorBrowsableState.Never)]
1556 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1558 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1562 /// Remove FrameUpdateCallback
1564 [EditorBrowsable(EditorBrowsableState.Never)]
1565 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1567 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1571 /// Dispose for Window
1573 [EditorBrowsable(EditorBrowsableState.Never)]
1574 protected override void Dispose(DisposeTypes type)
1581 if (type == DisposeTypes.Explicit)
1584 //Release your own managed resources here.
1585 //You should release all of your own disposable objects here.
1587 if (rootLayer != null)
1589 rootLayer.Dispose();
1592 localController?.Dispose();
1594 foreach (var layer in childLayers)
1602 childLayers.Clear();
1605 this.DisconnectNativeSignals();
1610 /// This will not be public opened.
1611 [EditorBrowsable(EditorBrowsableState.Never)]
1612 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1614 Interop.Window.DeleteWindow(swigCPtr);
1617 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1619 private static readonly object locker = new object();
1621 private static int key = 0;
1623 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1625 private struct internalHookCallbackType
1627 public FrameCallbackType userCallback;
1631 private static void OnInternalHookFrameCallback(int id)
1635 if (frameCallbackList.ContainsKey(id))
1637 if (frameCallbackList[id].userCallback != null)
1639 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1640 frameCallbackList.Remove(id);
1644 NUILog.Error($"found userCallback is NULL");
1645 frameCallbackList.Remove(id);
1651 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1653 if (null == callback)
1655 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1657 var assignedKey = 0;
1662 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1664 userCallback = callback,
1672 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1674 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1675 [EditorBrowsable(EditorBrowsableState.Never)]
1676 public delegate void FrameCallbackType(int frameId);
1679 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1680 /// A callback of the following type may be used:
1682 /// void MyFunction( int frameId )
1684 /// This callback will be deleted once it is called.
1686 /// Ownership of the callback is passed onto this class
1689 /// <param name="callback">The function to call</param>
1690 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1691 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1692 [EditorBrowsable(EditorBrowsableState.Never)]
1693 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
1695 var assignedKey = AddInterHookCallback(callback, frameId);
1696 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1698 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1702 /// Adds a callback that is called when the frame is displayed on the display.
1703 /// A callback of the following type may be used:
1705 /// void MyFunction( int frameId )
1707 /// This callback will be deleted once it is called.
1709 /// Ownership of the callback is passed onto this class
1712 /// <param name="callback">The function to call</param>
1713 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1714 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1715 [EditorBrowsable(EditorBrowsableState.Never)]
1716 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
1718 var assignedKey = AddInterHookCallback(callback, frameId);
1719 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1721 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1725 /// Search through this Window for a Layer with the given unique ID.
1727 /// <param name="id">The ID of the Layer to find.</param>
1728 /// <remarks>Hidden-API</remarks>
1729 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
1730 [EditorBrowsable(EditorBrowsableState.Never)]
1731 public Layer FindLayerByID(uint id)
1733 Layer defaultLayer = this.GetDefaultLayer();
1734 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
1735 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
1737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1742 /// Get Native Window handle.
1744 /// How to get Native Window handle
1746 /// Window window = NUIApplication.GetDefaultWindow();
1747 /// var handle = window.NativeHandle;
1748 /// if(handle.IsInvalid == false)
1750 /// IntPtr nativeHandle = handle.DangerousGetHandle();
1751 /// // do something with nativeHandle
1756 /// <since_tizen> 9 </since_tizen>
1757 public SafeHandle NativeHandle
1761 return new NUI.SafeNativeWindowHandle(this);