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;
45 static internal bool IsSupportedMultiWindow()
47 bool isSupported = false;
50 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
52 catch (DllNotFoundException e)
54 Tizen.Log.Fatal("NUI", $"{e}\n");
59 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
61 if (Interop.Stage.IsInstalled())
63 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
65 localController = new LayoutController(this);
66 NUILog.Debug("layoutController id:" + localController.GetId());
71 /// A helper method to get the current window where the view is added
73 /// <param name="view">The View added to the window</param>
74 /// <returns>A Window.</returns>
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 static public Window Get(View view)
80 NUILog.Error("if there is no view, it can not get a window");
84 //to fix memory leak issue, match the handle count with native side.
85 Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 /// Creates a new Window.<br />
92 /// This creates an extra window in addition to the default main window<br />
94 /// <param name="windowPosition">The position and size of the Window.</param>
95 /// <param name="isTranslucent">Whether Window is translucent.</param>
96 /// <returns>A new Window.</returns>
97 /// <since_tizen> 6 </since_tizen>
98 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
99 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
100 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
102 if (IsSupportedMultiWindow() == false)
104 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 /// Creates a new Window with a specific name.<br />
111 /// This creates an extra window in addition to the default main window<br />
113 /// <param name="name">The name for extra window. </param>
114 /// <param name="windowPosition">The position and size of the Window.</param>
115 /// <param name="isTranslucent">Whether Window is translucent.</param>
116 /// <returns>A new Window.</returns>
117 /// <since_tizen> 6 </since_tizen>
118 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
119 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
120 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
122 if (IsSupportedMultiWindow() == false)
124 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
126 this.windowTitle = name;
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 /// Creates a new Window with a specific name.<br />
132 /// This creates an extra window in addition to the default main window<br />
134 /// <param name="name">The name for extra window. </param>
135 /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
136 /// <param name="windowPosition">The position and size of the Window.</param>
137 /// <param name="isTranslucent">Whether Window is translucent.</param>
138 /// <returns>A new Window.</returns>
139 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
140 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
144 if (IsSupportedMultiWindow() == false)
146 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
148 this.windowTitle = name;
149 this.EnableBorder(borderInterface);
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
157 /// <since_tizen> 3 </since_tizen>
158 public enum WindowOrientation
161 /// Portrait orientation. The height of the display area is greater than the width.
163 /// <since_tizen> 3 </since_tizen>
166 /// Landscape orientation. A wide view area is needed.
168 /// <since_tizen> 3 </since_tizen>
171 /// Portrait inverse orientation.
173 /// <since_tizen> 3 </since_tizen>
174 PortraitInverse = 180,
176 /// Landscape inverse orientation.
178 /// <since_tizen> 3 </since_tizen>
179 LandscapeInverse = 270,
181 /// No orientation. It is for the preferred orientation
182 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
183 /// It is used to unset the preferred orientation with SetPreferredOrientation.
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 NoOrientationPreference = -1
190 /// Enumeration for the key grab mode for platform-level APIs.
192 /// <since_tizen> 3 </since_tizen>
193 public enum KeyGrabMode
196 /// Grabs a key only when on the top of the grabbing-window stack mode.
200 /// Grabs a key together with the other client window(s) mode.
204 /// 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.
208 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
214 /// Enumeration for transition effect's state.
216 [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 // This is already deprecated, so suppress warning here.
219 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
220 public enum EffectStates
225 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
226 [EditorBrowsable(EditorBrowsableState.Never)]
229 /// Transition effect is started.
231 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
232 [EditorBrowsable(EditorBrowsableState.Never)]
235 /// Transition effect is ended.
237 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
238 [EditorBrowsable(EditorBrowsableState.Never)]
243 /// Enumeration for transition effect's state.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public enum EffectState
251 [EditorBrowsable(EditorBrowsableState.Never)]
254 /// Transition effect is started.
256 [EditorBrowsable(EditorBrowsableState.Never)]
259 /// Transition effect is ended.
261 [EditorBrowsable(EditorBrowsableState.Never)]
266 /// Enumeration for transition effect's type.
268 [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
269 [EditorBrowsable(EditorBrowsableState.Never)]
270 // This is already deprecated, so suppress warning here.
271 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
272 public enum EffectTypes
277 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
278 [EditorBrowsable(EditorBrowsableState.Never)]
281 /// Window show effect.
283 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
284 [EditorBrowsable(EditorBrowsableState.Never)]
287 /// Window hide effect.
289 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
290 [EditorBrowsable(EditorBrowsableState.Never)]
295 /// Enumeration for transition effect's type.
297 [EditorBrowsable(EditorBrowsableState.Never)]
298 public enum EffectType
303 [EditorBrowsable(EditorBrowsableState.Never)]
306 /// Window show effect.
308 [EditorBrowsable(EditorBrowsableState.Never)]
311 /// Window hide effect.
313 [EditorBrowsable(EditorBrowsableState.Never)]
318 /// Enumeration for result of window operation.
320 internal enum OperationResult
323 /// Failed for unknown reason
331 /// Permission denied
335 /// The operation is not supported.
341 /// Enumeration for window resized mode by display server.
343 [EditorBrowsable(EditorBrowsableState.Never)]
344 public enum ResizeDirection
349 [EditorBrowsable(EditorBrowsableState.Never)]
352 /// Start resizing window to the top-left edge.
354 [EditorBrowsable(EditorBrowsableState.Never)]
357 /// Start resizing window to the top side.
359 [EditorBrowsable(EditorBrowsableState.Never)]
362 /// Start resizing window to the top-right edge.
364 [EditorBrowsable(EditorBrowsableState.Never)]
367 /// Start resizing window to the left side.
369 [EditorBrowsable(EditorBrowsableState.Never)]
372 /// Start resizing window to the right side.
374 [EditorBrowsable(EditorBrowsableState.Never)]
377 /// Start resizing window to the bottom-left edge.
379 [EditorBrowsable(EditorBrowsableState.Never)]
382 /// Start resizing window to the bottom side.
384 [EditorBrowsable(EditorBrowsableState.Never)]
387 /// Start resizing window to the bottom-right edge.
389 [EditorBrowsable(EditorBrowsableState.Never)]
395 /// The stage instance property (read-only).<br />
396 /// Gets the current window.<br />
398 /// <since_tizen> 3 </since_tizen>
399 public static Window Instance { get; internal set; }
402 /// Gets or sets a window type.
403 /// Most of window type can be set to use WindowType, except for IME type.
404 /// IME type can be set to use one of NUIApplication's constrcutors.
406 /// <since_tizen> 3 </since_tizen>
407 public WindowType Type
411 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
417 Interop.Window.SetType(SwigCPtr, (int)value);
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
423 /// Gets/Sets a window title.
425 /// <since_tizen> 4 </since_tizen>
435 SetClass(windowTitle, "");
440 /// The rendering behavior of a Window.
442 /// <since_tizen> 5 </since_tizen>
443 public RenderingBehaviorType RenderingBehavior
447 return GetRenderingBehavior();
451 SetRenderingBehavior(value);
456 /// The window size property (read-only).
458 /// <since_tizen> 3 </since_tizen>
463 Size2D ret = GetSize();
469 /// The background color property.
471 /// <since_tizen> 3 </since_tizen>
472 public Color BackgroundColor
476 SetBackgroundColor(value);
480 Color ret = GetBackgroundColor();
486 /// The DPI property (read-only).<br />
487 /// Retrieves the DPI of the display device to which the Window is connected.<br />
489 /// <since_tizen> 3 </since_tizen>
499 /// The layer count property (read-only).<br />
500 /// Queries the number of on-Window layers.<br />
502 /// <since_tizen> 3 </since_tizen>
503 public uint LayerCount
507 return GetLayerCount();
512 /// Gets or sets a size of the window.
514 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
515 /// <since_tizen> 4 </since_tizen>
516 public Size2D WindowSize
520 return GetWindowSize();
524 SetWindowSize(value);
529 /// Gets or sets a position of the window.
531 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
532 /// <since_tizen> 4 </since_tizen>
533 public Position2D WindowPosition
537 return GetPosition();
546 /// Sets position and size of the window. This API guarantees that
547 /// both moving and resizing of window will appear on the screen at once.
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public Rectangle WindowPositionSize
554 Position2D position = GetPosition();
555 Size2D size = GetSize();
556 Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
562 SetPositionSize(value);
566 internal static Vector4 DEFAULT_BACKGROUND_COLOR
570 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
571 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577 internal static Vector4 DEBUG_BACKGROUND_COLOR
581 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
582 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
588 internal List<Layer> LayersChildren
597 /// Get the LayoutController for this Window.
599 internal LayoutController LayoutController
603 return localController;
608 /// Feed a key-event into the window.
610 /// <param name="keyEvent">The key event to feed.</param>
611 /// <since_tizen> 4 </since_tizen>
612 [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
613 public static void FeedKeyEvent(Key keyEvent)
615 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
616 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620 /// Sets whether the window accepts a focus or not.
622 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
623 /// <since_tizen> 3 </since_tizen>
624 public void SetAcceptFocus(bool accept)
626 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 /// Returns whether the window accepts a focus or not.
633 /// <returns>True if the window accepts a focus, false otherwise.</returns>
634 /// <since_tizen> 3 </since_tizen>
635 public bool IsFocusAcceptable()
637 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 /// Shows the window if it is hidden.
646 /// <since_tizen> 3 </since_tizen>
649 Interop.Window.Show(SwigCPtr);
650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654 /// Hides the window if it is showing.
656 /// <since_tizen> 3 </since_tizen>
659 Interop.Window.Hide(SwigCPtr);
660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
664 /// Retrieves whether the window is visible or not.
666 /// <returns>True if the window is visible.</returns>
667 /// <since_tizen> 3 </since_tizen>
668 public bool IsVisible()
670 bool temp = Interop.Window.IsVisible(SwigCPtr);
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 /// Gets the count of supported auxiliary hints of the window.
678 /// <returns>The number of supported auxiliary hints.</returns>
679 /// <since_tizen> 3 </since_tizen>
680 public uint GetSupportedAuxiliaryHintCount()
682 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 /// Gets the supported auxiliary hint string of the window.
690 /// <param name="index">The index of the supported auxiliary hint lists.</param>
691 /// <returns>The auxiliary hint string of the index.</returns>
692 /// <since_tizen> 3 </since_tizen>
693 public string GetSupportedAuxiliaryHint(uint index)
695 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
696 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
701 /// Creates an auxiliary hint of the window.
703 /// <param name="hint">The auxiliary hint string.</param>
704 /// <param name="value">The value string.</param>
705 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
706 /// <since_tizen> 3 </since_tizen>
707 public uint AddAuxiliaryHint(string hint, string value)
709 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 /// Removes an auxiliary hint of the window.
717 /// <param name="id">The ID of the auxiliary hint.</param>
718 /// <returns>True if no error occurred, false otherwise.</returns>
719 /// <since_tizen> 3 </since_tizen>
720 public bool RemoveAuxiliaryHint(uint id)
722 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
723 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
728 /// Changes a value of the auxiliary hint.
730 /// <param name="id">The auxiliary hint ID.</param>
731 /// <param name="value">The value string to be set.</param>
732 /// <returns>True if no error occurred, false otherwise.</returns>
733 /// <since_tizen> 3 </since_tizen>
734 public bool SetAuxiliaryHintValue(uint id, string value)
736 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
742 /// Gets a value of the auxiliary hint.
744 /// <param name="id">The auxiliary hint ID.</param>
745 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
746 /// <since_tizen> 3 </since_tizen>
747 public string GetAuxiliaryHintValue(uint id)
749 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 /// Gets an ID of the auxiliary hint string.
757 /// <param name="hint">The auxiliary hint string.</param>
758 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
759 /// <since_tizen> 3 </since_tizen>
760 public uint GetAuxiliaryHintId(string hint)
762 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768 /// Sets a region to accept input events.
770 /// <param name="inputRegion">The region to accept input events.</param>
771 /// <since_tizen> 3 </since_tizen>
772 public void SetInputRegion(Rectangle inputRegion)
774 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 /// Sets a priority level for the specified notification window.
781 /// <param name="level">The notification window level.</param>
782 /// <returns>True if no error occurred, false otherwise.</returns>
783 /// <since_tizen> 3 </since_tizen>
784 public bool SetNotificationLevel(NotificationLevel level)
786 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788 return ret == OperationResult.Succeed;
792 /// Gets a priority level for the specified notification window.
794 /// <returns>The notification window level.</returns>
795 /// <since_tizen> 3 </since_tizen>
796 public NotificationLevel GetNotificationLevel()
798 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 /// Sets a transparent window's visual state to opaque. <br />
805 /// If a visual state of a transparent window is opaque, <br />
806 /// then the window manager could handle it as an opaque window when calculating visibility.
808 /// <param name="opaque">Whether the window's visual state is opaque.</param>
809 /// <remarks>This will have no effect on an opaque window. <br />
810 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
812 /// <since_tizen> 3 </since_tizen>
813 public void SetOpaqueState(bool opaque)
815 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
816 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
820 /// Returns whether a transparent window's visual state is opaque or not.
822 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
823 /// <remarks> The return value has no meaning on an opaque window. </remarks>
824 /// <since_tizen> 3 </since_tizen>
825 public bool IsOpaqueState()
827 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 /// Sets a window's screen off mode.
835 /// <param name="screenOffMode">The screen mode.</param>
836 /// <returns>True if no error occurred, false otherwise.</returns>
837 /// <since_tizen> 4 </since_tizen>
838 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
840 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
841 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
842 return ret == OperationResult.Succeed;
846 /// Gets the screen mode of the window.
848 /// <returns>The screen off mode.</returns>
849 /// <since_tizen> 4 </since_tizen>
850 public ScreenOffMode GetScreenOffMode()
852 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
853 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
858 /// Sets preferred brightness of the window.
860 /// <param name="brightness">The preferred brightness (0 to 100).</param>
861 /// <returns>True if no error occurred, false otherwise.</returns>
862 /// <since_tizen> 3 </since_tizen>
863 public bool SetBrightness(int brightness)
865 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
866 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867 return ret == OperationResult.Succeed;
871 /// Gets the preferred brightness of the window.
873 /// <returns>The preferred brightness.</returns>
874 /// <since_tizen> 3 </since_tizen>
875 public int GetBrightness()
877 int ret = Interop.Window.GetBrightness(SwigCPtr);
878 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883 /// Sets the window name and the class string.
885 /// <param name="name">The name of the window.</param>
886 /// <param name="klass">The class of the window.</param>
887 /// <since_tizen> 4 </since_tizen>
888 public void SetClass(string name, string klass)
890 Interop.Window.SetClass(SwigCPtr, name, klass);
891 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
895 /// Raises the window to the top of the window stack.
897 /// <since_tizen> 3 </since_tizen>
900 Interop.Window.Raise(SwigCPtr);
901 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
905 /// Lowers the window to the bottom of the window stack.
907 /// <since_tizen> 3 </since_tizen>
910 Interop.Window.Lower(SwigCPtr);
911 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
915 /// Activates the window to the top of the window stack even it is iconified.
917 /// <since_tizen> 3 </since_tizen>
918 public void Activate()
920 Interop.Window.Activate(SwigCPtr);
921 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
925 /// Gets the default ( root ) layer.
927 /// <returns>The root layer.</returns>
928 /// <since_tizen> 3 </since_tizen>
929 public Layer GetDefaultLayer()
931 return this.GetRootLayer();
935 /// Gets the overlay layer.
937 /// <returns>The overlay layer.</returns>
938 [EditorBrowsable(EditorBrowsableState.Never)]
939 public Layer GetOverlayLayer()
941 // Window.IsInstalled() is actually true only when called from event thread and
942 // Core has been initialized, not when Stage is ready.
943 if (overlayLayer == null && Window.IsInstalled())
945 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
946 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
947 overlayLayer.SetWindow(this);
953 /// Add a child view to window.
955 /// <param name="view">the child should be added to the window.</param>
956 /// <since_tizen> 3 </since_tizen>
957 public void Add(View view)
959 this.GetRootLayer().Add(view);
963 /// Remove a child view from window.
965 /// <param name="view">the child to be removed.</param>
966 /// <since_tizen> 3 </since_tizen>
967 public void Remove(View view)
969 this.GetRootLayer().Remove(view);
973 /// Retrieves the layer at a specified depth.
975 /// <param name="depth">The layer's depth index.</param>
976 /// <returns>The layer found at the given depth.</returns>
977 /// <since_tizen> 3 </since_tizen>
978 public Layer GetLayer(uint depth)
980 if (depth < LayersChildren?.Count)
982 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
992 /// Destroy the window immediately.
994 [EditorBrowsable(EditorBrowsableState.Never)]
995 public void Destroy()
1001 /// Keep rendering for at least the given amount of time.
1003 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1004 /// <since_tizen> 3 </since_tizen>
1005 public void KeepRendering(float durationSeconds)
1007 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
1008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1012 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1013 /// This function can be used for following example scenarios: <br />
1014 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1016 /// <param name="DaliKey">The key code to grab.</param>
1017 /// <returns>True if the grab succeeds.</returns>
1018 /// <since_tizen> 3 </since_tizen>
1019 public bool GrabKeyTopmost(int DaliKey)
1021 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1027 /// Ungrabs the key specified by a key for the window.<br />
1028 /// 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 />
1030 /// <param name="DaliKey">The key code to ungrab.</param>
1031 /// <returns>True if the ungrab succeeds.</returns>
1032 /// <since_tizen> 3 </since_tizen>
1033 public bool UngrabKeyTopmost(int DaliKey)
1035 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1042 /// Details: This function can be used for following example scenarios: <br />
1043 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1044 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1045 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1047 /// <param name="DaliKey">The key code to grab.</param>
1048 /// <param name="GrabMode">The grab mode for the key.</param>
1049 /// <returns>True if the grab succeeds.</returns>
1050 /// <since_tizen> 3 </since_tizen>
1051 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1053 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1054 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1059 /// Ungrabs the key specified by a key for a window.<br />
1060 /// 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 />
1062 /// <param name="DaliKey">The key code to ungrab.</param>
1063 /// <returns>True if the ungrab succeeds.</returns>
1064 /// <since_tizen> 3 </since_tizen>
1065 public bool UngrabKey(int DaliKey)
1067 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1073 /// Sets the keyboard repeat information.
1075 /// <param name="rate">The key repeat rate value in seconds.</param>
1076 /// <param name="delay">The key repeat delay value in seconds.</param>
1077 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1078 /// <since_tizen> 5 </since_tizen>
1079 public bool SetKeyboardRepeatInfo(float rate, float delay)
1081 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087 /// Gets the keyboard repeat information.
1089 /// <param name="rate">The key repeat rate value in seconds.</param>
1090 /// <param name="delay">The key repeat delay value in seconds.</param>
1091 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1092 /// <since_tizen> 5 </since_tizen>
1093 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1095 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1096 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1101 /// Adds a layer to the stage.
1103 /// <param name="layer">Layer to add.</param>
1104 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1105 /// <since_tizen> 3 </since_tizen>
1106 public void AddLayer(Layer layer)
1112 /// Removes a layer from the stage.
1114 /// <param name="layer">Layer to remove.</param>
1115 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1116 /// <since_tizen> 3 </since_tizen>
1117 public void RemoveLayer(Layer layer)
1123 /// Feeds a key event into the window.
1125 /// <param name="keyEvent">The key event to feed.</param>
1126 /// <since_tizen> 5 </since_tizen>
1127 public void FeedKey(Key keyEvent)
1129 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1134 /// Feeds a touch point into the window.
1136 /// <param name="touchPoint">The touch point to feed.</param>
1137 /// <param name="timeStamp">The timeStamp.</param>
1138 internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1140 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1145 /// Feeds a wheel event into the window.
1147 /// <param name="wheelEvent">The wheel event to feed.</param>
1148 internal void FeedWheel(Wheel wheelEvent)
1150 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155 /// Allows at least one more render, even when paused.
1156 /// The window should be shown, not minimised.
1158 /// <since_tizen> 4 </since_tizen>
1159 public void RenderOnce()
1161 Interop.Window.RenderOnce(SwigCPtr);
1162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1166 /// Sets whether the window is transparent or not.
1168 /// <param name="transparent">Whether the window is transparent or not.</param>
1169 /// <since_tizen> 5 </since_tizen>
1170 public void SetTransparency(bool transparent)
1172 Interop.Window.SetTransparency(SwigCPtr, transparent);
1173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1175 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1179 /// Sets parent window of the window.
1180 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1181 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1182 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1184 /// <param name="parent">The parent window.</param>
1185 /// <since_tizen> 6 </since_tizen>
1186 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1187 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1188 public void SetParent(Window parent)
1190 if (IsSupportedMultiWindow() == false)
1192 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1194 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 /// Sets parent window of the window.
1200 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1201 /// This function has the additional flag whether the child is located above or below of the parent.
1203 /// <param name="parent">The parent window.</param>
1204 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1205 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1206 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1207 [EditorBrowsable(EditorBrowsableState.Never)]
1208 public void SetParent(Window parent, bool belowParent)
1210 if (IsSupportedMultiWindow() == false)
1212 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1214 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1219 /// Unsets parent window of the window.
1220 /// After unsetting, the window is disconnected his parent window.
1222 /// <since_tizen> 6 </since_tizen>
1223 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1224 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1225 public void Unparent()
1227 if (IsSupportedMultiWindow() == false)
1229 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1231 Interop.Window.Unparent(SwigCPtr);
1232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1236 /// Gets parent window of the window.
1238 /// <returns>The parent window of the window.</returns>
1239 /// <since_tizen> 6 </since_tizen>
1240 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1241 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1242 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1243 public Window GetParent()
1245 if (IsSupportedMultiWindow() == false)
1247 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1249 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1254 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1255 [EditorBrowsable(EditorBrowsableState.Never)]
1256 public void ObjectDump()
1258 Layer rootLayer = GetRootLayer();
1259 foreach (View view in rootLayer.Children)
1265 internal static bool IsInstalled()
1267 bool ret = Interop.Stage.IsInstalled();
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1273 /// Adds an orientation to the list of available orientations.
1275 /// <param name="orientation">The available orientation to add</param>
1276 /// <since_tizen> 6 </since_tizen>
1277 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1279 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284 /// Removes an orientation from the list of available orientations.
1286 /// <param name="orientation">The available orientation to remove.</param>
1287 /// <since_tizen> 6 </since_tizen>
1288 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1290 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 /// Sets a preferred orientation.
1297 /// <param name="orientation">The preferred orientation.</param>
1298 /// <since_tizen> 6 </since_tizen>
1299 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1301 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1306 /// Gets the preferred orientation.
1308 /// <since_tizen> 6 </since_tizen>
1309 /// <returns>The preferred orientation if previously set, or none.</returns>
1310 public Window.WindowOrientation GetPreferredOrientation()
1312 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1318 /// Gets current orientation of the window.
1320 /// <since_tizen> 6 </since_tizen>
1321 /// <returns>The current window orientation if previously set, or none.</returns>
1322 [EditorBrowsable(EditorBrowsableState.Never)]
1323 public Window.WindowOrientation GetCurrentOrientation()
1325 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1331 /// Sets available orientations of the window.
1332 /// This API is for setting several orientations one time.
1334 /// <param name="orientations">The list of orientations.</param>
1335 /// <since_tizen> 6 </since_tizen>
1336 [EditorBrowsable(EditorBrowsableState.Never)]
1337 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1339 if (null == orientations)
1341 throw new ArgumentNullException(nameof(orientations));
1344 PropertyArray orientationArray = new PropertyArray();
1345 for (int i = 0; i < orientations.Count; i++)
1347 PropertyValue value = new PropertyValue((int)orientations[i]);
1348 orientationArray.PushBack(value);
1352 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1353 orientationArray.Dispose();
1354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1358 /// Get native window ID
1360 /// <returns>native window ID</returns>
1361 [EditorBrowsable(EditorBrowsableState.Never)]
1362 public int GetNativeId()
1364 int ret = Interop.Window.GetNativeId(SwigCPtr);
1365 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1369 internal Any GetNativeHandle()
1371 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1376 internal void Add(Layer layer)
1380 throw new ArgumentNullException(nameof(layer));
1385 Interop.Actor.Add(GetBorderWindowRootLayer().SwigCPtr, layer.SwigCPtr);
1386 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1390 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1394 LayersChildren?.Add(layer);
1395 layer.SetWindow(this);
1398 internal void Remove(Layer layer)
1402 throw new ArgumentNullException(nameof(layer));
1404 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1405 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 LayersChildren?.Remove(layer);
1408 layer.SetWindow(null);
1411 internal Vector2 GetSize()
1413 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1415 convertRealWindowSizeToBorderWindowSize(val);
1417 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1423 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1424 [EditorBrowsable(EditorBrowsableState.Never)]
1425 public RenderTaskList GetRenderTaskList()
1427 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1433 /// Queries the number of on-window layers.
1435 /// <returns>The number of layers.</returns>
1436 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1437 internal uint GetLayerCount()
1439 if (LayersChildren == null || LayersChildren.Count < 0)
1442 return (uint)LayersChildren.Count;
1445 internal Layer GetRootLayer()
1449 if (borderLayer == null)
1451 borderLayer = GetBorderWindowRootLayer();
1452 LayersChildren?.Add(borderLayer);
1453 borderLayer.SetWindow(this);
1459 // Window.IsInstalled() is actually true only when called from event thread and
1460 // Core has been initialized, not when Stage is ready.
1461 if (rootLayer == null && Window.IsInstalled())
1463 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1465 LayersChildren?.Add(rootLayer);
1466 rootLayer.SetWindow(this);
1472 internal void SetBackgroundColor(Vector4 color)
1474 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478 internal Vector4 GetBackgroundColor()
1480 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485 internal Vector2 GetDpi()
1487 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1492 internal ObjectRegistry GetObjectRegistry()
1494 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1495 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1499 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1501 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1505 internal RenderingBehaviorType GetRenderingBehavior()
1507 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1508 if (NDalicPINVOKE.SWIGPendingException.Pending)
1509 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1513 internal void SetWindowSize(Size2D size)
1517 throw new ArgumentNullException(nameof(size));
1519 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1521 convertBorderWindowSizeToRealWindowSize(val);
1523 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1525 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1526 // Resetting Window size should request a relayout of the tree.
1529 internal Size2D GetWindowSize()
1531 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1533 convertRealWindowSizeToBorderWindowSize(val);
1535 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1541 internal void SetPosition(Position2D position)
1543 if (null == position)
1545 throw new ArgumentNullException(nameof(position));
1547 var val = new Int32Pair(position.X, position.Y);
1548 Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1551 // Setting Position of the window should request a relayout of the tree.
1554 internal Position2D GetPosition()
1556 var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1557 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1559 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1563 internal void SetPositionSize(Rectangle positionSize)
1565 if (positionSize == null)
1567 throw new ArgumentNullException(nameof(positionSize));
1569 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1571 convertBorderWindowSizeToRealWindowSize(val);
1573 positionSize.Width = val.GetX();
1574 positionSize.Height = val.GetY();
1576 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1579 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1581 // Setting Position of the window should request a relayout of the tree.
1585 /// Enables the floating mode of window.
1586 /// The floating mode is to support window is moved or resized by display server.
1587 /// For example, if the video-player window sets the floating mode,
1588 /// then display server changes its geometry and handles it like a popup.
1589 /// The way of handling floating mode window is decided by display server.
1590 /// A special display server(as a Tizen display server) supports this mode.
1592 /// <param name="enable">Enable floating mode or not.</param>
1593 [EditorBrowsable(EditorBrowsableState.Never)]
1594 public void EnableFloatingMode(bool enable)
1596 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1597 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1601 /// Requests to display server for the window is moved by display server.
1602 /// It can be work with setting window floating mode.
1604 [EditorBrowsable(EditorBrowsableState.Never)]
1605 public void RequestMoveToServer()
1607 Interop.Window.RequestMoveToServer(SwigCPtr);
1608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1612 /// Requests to display server for the window is resized by display server.
1613 /// It can be work with setting window floating mode.
1615 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1616 [EditorBrowsable(EditorBrowsableState.Never)]
1617 public void RequestResizeToServer(ResizeDirection direction)
1619 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1624 /// Includes input region.
1625 /// This function inlcudes input regions.
1626 /// It can be used multiple times and supports multiple regions.
1627 /// It means input region will be extended.
1628 /// This input is related to mouse and touch event.
1629 /// If device has touch screen, this function is useful.
1630 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1632 /// <param name="inputRegion">The included region to accept input events.</param>
1633 [EditorBrowsable(EditorBrowsableState.Never)]
1634 public void IncludeInputRegion(Rectangle inputRegion)
1636 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1637 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1641 /// This function excludes input regions.
1642 /// It can be used multiple times and supports multiple regions.
1643 /// It means input region will be reduced.
1644 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1645 /// This input is related to mouse and touch event.
1646 /// If device has touch screen, this function is useful.
1647 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1649 /// <param name="inputRegion">The excluded region to except input events.</param>
1650 [EditorBrowsable(EditorBrowsableState.Never)]
1651 public void ExcludeInputRegion(Rectangle inputRegion)
1653 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1658 /// Maximizes window's size.
1659 /// If this function is called with true, window will be resized with screen size.
1660 /// Otherwise window will be resized with previous size.
1661 /// It is for the window's MAX button in window's border.
1662 /// If window border is supported by display server, it is not necessary.
1664 /// <param name="max">If window is maximized or unmaximized.</param>
1665 [EditorBrowsable(EditorBrowsableState.Never)]
1666 public void Maximize(bool max)
1668 Interop.Window.Maximize(SwigCPtr, max);
1669 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1673 /// Returns whether the window is maximized or not.
1675 /// <returns>True if the window is maximized, false otherwise.</returns>
1676 [EditorBrowsable(EditorBrowsableState.Never)]
1677 public bool IsMaximized()
1679 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1680 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1685 /// Sets window's maximum size.
1687 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1688 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1690 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1693 /// <param name="size">the maximum size.</param>
1694 [EditorBrowsable(EditorBrowsableState.Never)]
1695 public void SetMaximumSize(Size2D size)
1699 throw new ArgumentNullException(nameof(size));
1701 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1703 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1705 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1709 /// Minimizes window's size.
1710 /// If this function is called with true, window will be iconified.
1711 /// Otherwise window will be activated.
1712 /// It is for the window's MIN button in window border.
1713 /// If window border is supported by display server, it is not necessary.
1715 /// <param name="min">If window is minimized or unminimized.</param>
1716 [EditorBrowsable(EditorBrowsableState.Never)]
1717 public void Minimize(bool min)
1719 Interop.Window.Minimize(SwigCPtr, min);
1720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1724 /// Returns whether the window is minimized or not.
1726 /// <returns>True if the window is minimized, false otherwise.</returns>
1727 [EditorBrowsable(EditorBrowsableState.Never)]
1728 public bool IsMinimized()
1730 bool ret = Interop.Window.IsMinimized(SwigCPtr);
1731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1736 /// Sets window's minimum size.
1737 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
1738 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
1740 /// <param name="size">the minimum size.</param>
1741 [EditorBrowsable(EditorBrowsableState.Never)]
1742 public void SetMimimumSize(Size2D size)
1746 throw new ArgumentNullException(nameof(size));
1748 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1750 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1752 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1756 /// Query whether window is rotating or not.
1758 /// <returns>True if window is rotating, false otherwise.</returns>
1759 [EditorBrowsable(EditorBrowsableState.Never)]
1760 public bool IsWindowRotating()
1762 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
1763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1768 /// Gets the last key event the window gets.
1770 /// <returns>The last key event the window gets.</returns>
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public Key GetLastKeyEvent()
1774 Key ret = new Key(Interop.Window.GetLastKeyEvent(SwigCPtr), false);
1775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1780 /// Gets the last touch event the window gets.
1782 /// <returns>The last touch event the window gets.</returns>
1783 [EditorBrowsable(EditorBrowsableState.Never)]
1784 public Touch GetLastTouchEvent()
1786 Touch ret = new Touch(Interop.Window.GetLastTouchEvent(SwigCPtr), false);
1787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1792 /// Sets the necessary for window rotation Acknowledgement.
1793 /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
1795 /// This function is supprot that application has the window rotation acknowledgement's control.
1796 /// It means display server waits when application's rotation work is finished.
1797 /// It is useful application has the other rendering engine which works asynchronous.
1798 /// For instance, GlView.
1800 /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
1801 [EditorBrowsable(EditorBrowsableState.Never)]
1802 public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
1804 Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
1805 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1809 /// send the Acknowledgement to complete window rotation.
1810 /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
1812 [EditorBrowsable(EditorBrowsableState.Never)]
1813 public void SendRotationCompletedAcknowledgement()
1815 Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
1816 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1820 /// Add FrameUpdateCallback
1822 [EditorBrowsable(EditorBrowsableState.Never)]
1823 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1825 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1829 /// Remove FrameUpdateCallback
1831 [EditorBrowsable(EditorBrowsableState.Never)]
1832 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1834 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1838 /// Dispose for Window
1840 [EditorBrowsable(EditorBrowsableState.Never)]
1841 protected override void Dispose(DisposeTypes type)
1848 this.DisconnectNativeSignals();
1850 if (type == DisposeTypes.Explicit)
1853 //Release your own managed resources here.
1854 //You should release all of your own disposable objects here.
1856 if (IsBorderEnabled)
1861 foreach (var layer in childLayers)
1869 childLayers.Clear();
1871 localController?.Dispose();
1878 /// This will not be public opened.
1879 [EditorBrowsable(EditorBrowsableState.Never)]
1880 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1882 Interop.Window.DeleteWindow(swigCPtr);
1885 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1887 private static readonly object locker = new object();
1889 private static int key = 0;
1891 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1893 private struct internalHookCallbackType
1895 public FrameCallbackType userCallback;
1899 private static void OnInternalHookFrameCallback(int id)
1903 if (frameCallbackList.ContainsKey(id))
1905 if (frameCallbackList[id].userCallback != null)
1907 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1908 frameCallbackList.Remove(id);
1912 NUILog.Error($"found userCallback is NULL");
1913 frameCallbackList.Remove(id);
1919 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1921 if (null == callback)
1923 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1925 var assignedKey = 0;
1930 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1932 userCallback = callback,
1940 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1942 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1943 [EditorBrowsable(EditorBrowsableState.Never)]
1944 public delegate void FrameCallbackType(int frameId);
1947 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1948 /// A callback of the following type may be used:
1950 /// void MyFunction( int frameId )
1952 /// This callback will be deleted once it is called.
1954 /// Ownership of the callback is passed onto this class
1957 /// <param name="callback">The function to call</param>
1958 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1959 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1960 [EditorBrowsable(EditorBrowsableState.Never)]
1961 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
1963 var assignedKey = AddInterHookCallback(callback, frameId);
1964 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1966 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1970 /// Adds a callback that is called when the frame is displayed on the display.
1971 /// A callback of the following type may be used:
1973 /// void MyFunction( int frameId )
1975 /// This callback will be deleted once it is called.
1977 /// Ownership of the callback is passed onto this class
1980 /// <param name="callback">The function to call</param>
1981 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1982 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1983 [EditorBrowsable(EditorBrowsableState.Never)]
1984 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
1986 var assignedKey = AddInterHookCallback(callback, frameId);
1987 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1989 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1993 /// Search through this Window for a Layer with the given unique ID.
1995 /// <param name="id">The ID of the Layer to find.</param>
1996 /// <remarks>Hidden-API</remarks>
1997 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
1998 [EditorBrowsable(EditorBrowsableState.Never)]
1999 public Layer FindLayerByID(uint id)
2001 Layer defaultLayer = this.GetDefaultLayer();
2002 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2003 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2005 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2010 /// Get Native Window handle.
2012 /// How to get Native Window handle
2014 /// Window window = NUIApplication.GetDefaultWindow();
2015 /// var handle = window.NativeHandle;
2016 /// if(handle.IsInvalid == false)
2018 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2019 /// // do something with nativeHandle
2024 /// <since_tizen> 9 </since_tizen>
2025 public SafeHandle NativeHandle
2029 return new NUI.SafeNativeWindowHandle(this);