2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 extern alias TizenSystemInformation;
19 using TizenSystemInformation.Tizen.System;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24 using System.Runtime.InteropServices;
26 using Tizen.NUI.BaseComponents;
31 /// The window class is used internally for drawing.<br />
32 /// The window has an orientation and indicator properties.<br />
34 /// <since_tizen> 3 </since_tizen>
35 public partial class Window : BaseHandle
37 private HandleRef stageCPtr;
38 private Layer rootLayer;
39 private Layer overlayLayer;
40 private Layer borderLayer;
41 private string windowTitle;
42 private List<Layer> childLayers = new List<Layer>();
43 private LayoutController localController;
44 private Key internalLastKeyEvent;
45 private Touch internalLastTouchEvent;
46 private Hover internalLastHoverEvent;
47 private Timer internalHoverTimer;
49 static internal bool IsSupportedMultiWindow()
51 bool isSupported = false;
54 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
56 catch (DllNotFoundException e)
58 Tizen.Log.Fatal("NUI", $"{e}\n");
63 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
65 if (Interop.Stage.IsInstalled())
67 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
69 localController = new LayoutController(this);
70 NUILog.Debug("layoutController id:" + localController.GetId());
75 /// A helper method to get the current window where the view is added
77 /// <param name="view">The View added to the window</param>
78 /// <returns>A Window.</returns>
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 static public Window Get(View view)
84 NUILog.Error("if there is no view, it can not get a window");
88 //to fix memory leak issue, match the handle count with native side.
89 Window ret = view.GetInstanceSafely<Window>(Interop.Window.Get(View.getCPtr(view)));
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 /// Creates a new Window.<br />
96 /// This creates an extra window in addition to the default main window<br />
98 /// <param name="windowPosition">The position and size of the Window.</param>
99 /// <param name="isTranslucent">Whether Window is translucent.</param>
100 /// <returns>A new Window.</returns>
101 /// <since_tizen> 6 </since_tizen>
102 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
103 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
104 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
106 if (IsSupportedMultiWindow() == false)
108 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 /// Creates a new Window with a specific name.<br />
115 /// This creates an extra window in addition to the default main window<br />
117 /// <param name="name">The name for extra window. </param>
118 /// <param name="windowPosition">The position and size of the Window.</param>
119 /// <param name="isTranslucent">Whether Window is translucent.</param>
120 /// <returns>A new Window.</returns>
121 /// <since_tizen> 6 </since_tizen>
122 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
123 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
124 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
126 if (IsSupportedMultiWindow() == false)
128 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
130 this.windowTitle = name;
131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 /// Creates a new Window with a specific name.<br />
136 /// This creates an extra window in addition to the default main window<br />
138 /// <param name="name">The name for extra window. </param>
139 /// <param name="borderInterface"><see cref="Tizen.NUI.IBorderInterface"/>If borderInterface is null, defaultBorder is enabled.</param>
140 /// <param name="windowPosition">The position and size of the Window.</param>
141 /// <param name="isTranslucent">Whether Window is translucent.</param>
142 /// <returns>A new Window.</returns>
143 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
144 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public Window(string name, IBorderInterface borderInterface, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
148 if (IsSupportedMultiWindow() == false)
150 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
152 this.windowTitle = name;
153 this.EnableBorder(borderInterface);
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 /// Creates a new Window with a specific name using WindowData.<br />
159 /// This creates an extra window in addition to the default main window<br />
161 /// <param name="name">The name for extra window. </param>
162 /// <param name="windowData">The window data</param>
163 /// <returns>A new Window.</returns>
164 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
165 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
166 [EditorBrowsable(EditorBrowsableState.Never)]
167 public Window(string name, WindowData windowData) : this(Interop.Window.New(name, "", WindowData.getCPtr(windowData)), true)
169 if (IsSupportedMultiWindow() == false)
171 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
173 this.windowTitle = name;
174 this.EnableBorder(windowData.BorderInterface);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
183 /// <since_tizen> 3 </since_tizen>
184 public enum WindowOrientation
187 /// Portrait orientation. The height of the display area is greater than the width.
189 /// <since_tizen> 3 </since_tizen>
192 /// Landscape orientation. A wide view area is needed.
194 /// <since_tizen> 3 </since_tizen>
197 /// Portrait inverse orientation.
199 /// <since_tizen> 3 </since_tizen>
200 PortraitInverse = 180,
202 /// Landscape inverse orientation.
204 /// <since_tizen> 3 </since_tizen>
205 LandscapeInverse = 270,
207 /// No orientation. It is for the preferred orientation
208 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
209 /// It is used to unset the preferred orientation with SetPreferredOrientation.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 NoOrientationPreference = -1
216 /// Enumeration for the key grab mode for platform-level APIs.
218 /// <since_tizen> 3 </since_tizen>
219 public enum KeyGrabMode
222 /// Grabs a key only when on the top of the grabbing-window stack mode.
226 /// Grabs a key together with the other client window(s) mode.
230 /// 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.
234 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
240 /// Enumeration for transition effect's state.
242 [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
243 [EditorBrowsable(EditorBrowsableState.Never)]
244 // This is already deprecated, so suppress warning here.
245 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
246 public enum EffectStates
251 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
252 [EditorBrowsable(EditorBrowsableState.Never)]
255 /// Transition effect is started.
257 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
258 [EditorBrowsable(EditorBrowsableState.Never)]
261 /// Transition effect is ended.
263 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
264 [EditorBrowsable(EditorBrowsableState.Never)]
269 /// Enumeration for transition effect's state.
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public enum EffectState
277 [EditorBrowsable(EditorBrowsableState.Never)]
280 /// Transition effect is started.
282 [EditorBrowsable(EditorBrowsableState.Never)]
285 /// Transition effect is ended.
287 [EditorBrowsable(EditorBrowsableState.Never)]
292 /// Enumeration for transition effect's type.
294 [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
295 [EditorBrowsable(EditorBrowsableState.Never)]
296 // This is already deprecated, so suppress warning here.
297 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
298 public enum EffectTypes
303 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
304 [EditorBrowsable(EditorBrowsableState.Never)]
307 /// Window show effect.
309 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
310 [EditorBrowsable(EditorBrowsableState.Never)]
313 /// Window hide effect.
315 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
316 [EditorBrowsable(EditorBrowsableState.Never)]
321 /// Enumeration for transition effect's type.
323 [EditorBrowsable(EditorBrowsableState.Never)]
324 public enum EffectType
329 [EditorBrowsable(EditorBrowsableState.Never)]
332 /// Window show effect.
334 [EditorBrowsable(EditorBrowsableState.Never)]
337 /// Window hide effect.
339 [EditorBrowsable(EditorBrowsableState.Never)]
344 /// Enumeration for result of window operation.
346 internal enum OperationResult
349 /// Failed for unknown reason
357 /// Permission denied
361 /// The operation is not supported.
367 /// Enumeration for window resized mode by display server.
369 [EditorBrowsable(EditorBrowsableState.Never)]
370 public enum ResizeDirection
375 [EditorBrowsable(EditorBrowsableState.Never)]
378 /// Start resizing window to the top-left edge.
380 [EditorBrowsable(EditorBrowsableState.Never)]
383 /// Start resizing window to the top side.
385 [EditorBrowsable(EditorBrowsableState.Never)]
388 /// Start resizing window to the top-right edge.
390 [EditorBrowsable(EditorBrowsableState.Never)]
393 /// Start resizing window to the left side.
395 [EditorBrowsable(EditorBrowsableState.Never)]
398 /// Start resizing window to the right side.
400 [EditorBrowsable(EditorBrowsableState.Never)]
403 /// Start resizing window to the bottom-left edge.
405 [EditorBrowsable(EditorBrowsableState.Never)]
408 /// Start resizing window to the bottom side.
410 [EditorBrowsable(EditorBrowsableState.Never)]
413 /// Start resizing window to the bottom-right edge.
415 [EditorBrowsable(EditorBrowsableState.Never)]
421 /// The stage instance property (read-only).<br />
422 /// Gets the current window.<br />
424 /// <since_tizen> 3 </since_tizen>
425 public static Window Instance { get; internal set; }
428 /// Gets or sets a window type.
429 /// Most of window type can be set to use WindowType, except for IME type.
430 /// IME type can be set to use one of NUIApplication's constrcutors.
432 /// <since_tizen> 3 </since_tizen>
433 public WindowType Type
437 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
438 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
443 Interop.Window.SetType(SwigCPtr, (int)value);
444 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
449 /// Gets/Sets a window title.
451 /// <since_tizen> 4 </since_tizen>
461 SetClass(windowTitle, "");
466 /// The rendering behavior of a Window.
468 /// <since_tizen> 5 </since_tizen>
469 public RenderingBehaviorType RenderingBehavior
473 return GetRenderingBehavior();
477 SetRenderingBehavior(value);
482 /// The window size property (read-only).
484 /// <since_tizen> 3 </since_tizen>
489 Size2D ret = GetSize();
495 /// The background color property.
497 /// <since_tizen> 3 </since_tizen>
498 public Color BackgroundColor
502 SetBackgroundColor(value);
506 Color ret = GetBackgroundColor();
512 /// The DPI property (read-only).<br />
513 /// Retrieves the DPI of the display device to which the Window is connected.<br />
515 /// <since_tizen> 3 </since_tizen>
525 /// The layer count property (read-only).<br />
526 /// Queries the number of on-Window layers.<br />
528 /// <since_tizen> 3 </since_tizen>
529 public uint LayerCount
533 return GetLayerCount();
538 /// Gets or sets a size of the window.
540 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
541 /// <since_tizen> 4 </since_tizen>
542 public Size2D WindowSize
546 return GetWindowSize();
550 SetWindowSize(value);
555 /// Gets or sets a position of the window.
557 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
558 /// <since_tizen> 4 </since_tizen>
559 public Position2D WindowPosition
563 return GetPosition();
572 /// Sets position and size of the window. This API guarantees that
573 /// both moving and resizing of window will appear on the screen at once.
575 [EditorBrowsable(EditorBrowsableState.Never)]
576 public Rectangle WindowPositionSize
580 Position2D position = GetPosition();
581 Size2D size = GetSize();
582 Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
588 SetPositionSize(value);
593 /// Gets or sets whether the window will update partial area or full area.
594 /// If this value is true, window will update and render partial area.
595 /// If false, full area updated.
597 [EditorBrowsable(EditorBrowsableState.Never)]
598 public bool PartialUpdate
602 return IsPartialUpdate();
606 SetPartialUpdate(value);
610 internal static Vector4 DEFAULT_BACKGROUND_COLOR
614 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
615 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
616 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621 internal static Vector4 DEBUG_BACKGROUND_COLOR
625 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
626 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632 internal List<Layer> LayersChildren
641 /// Get the LayoutController for this Window.
643 internal LayoutController LayoutController
647 return localController;
652 /// Feed a key-event into the window.
654 /// <param name="keyEvent">The key event to feed.</param>
655 /// <since_tizen> 4 </since_tizen>
656 [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
657 public static void FeedKeyEvent(Key keyEvent)
659 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
664 /// Sets whether the window accepts a focus or not.
666 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
667 /// <since_tizen> 3 </since_tizen>
668 public void SetAcceptFocus(bool accept)
670 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 /// Returns whether the window accepts a focus or not.
677 /// <returns>True if the window accepts a focus, false otherwise.</returns>
678 /// <since_tizen> 3 </since_tizen>
679 public bool IsFocusAcceptable()
681 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
682 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 /// Shows the window if it is hidden.
690 /// <since_tizen> 3 </since_tizen>
693 Interop.Window.Show(SwigCPtr);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698 /// Hides the window if it is showing.
700 /// <since_tizen> 3 </since_tizen>
703 Interop.Window.Hide(SwigCPtr);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
708 /// Retrieves whether the window is visible or not.
710 /// <returns>True if the window is visible.</returns>
711 /// <since_tizen> 3 </since_tizen>
712 public bool IsVisible()
714 bool temp = Interop.Window.IsVisible(SwigCPtr);
715 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
720 /// Gets the count of supported auxiliary hints of the window.
722 /// <returns>The number of supported auxiliary hints.</returns>
723 /// <since_tizen> 3 </since_tizen>
724 public uint GetSupportedAuxiliaryHintCount()
726 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Gets the supported auxiliary hint string of the window.
734 /// <param name="index">The index of the supported auxiliary hint lists.</param>
735 /// <returns>The auxiliary hint string of the index.</returns>
736 /// <since_tizen> 3 </since_tizen>
737 public string GetSupportedAuxiliaryHint(uint index)
739 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 /// Creates an auxiliary hint of the window.
747 /// <param name="hint">The auxiliary hint string.</param>
748 /// <param name="value">The value string.</param>
749 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
750 /// <since_tizen> 3 </since_tizen>
751 public uint AddAuxiliaryHint(string hint, string value)
753 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 /// Removes an auxiliary hint of the window.
761 /// <param name="id">The ID of the auxiliary hint.</param>
762 /// <returns>True if no error occurred, false otherwise.</returns>
763 /// <since_tizen> 3 </since_tizen>
764 public bool RemoveAuxiliaryHint(uint id)
766 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772 /// Changes a value of the auxiliary hint.
774 /// <param name="id">The auxiliary hint ID.</param>
775 /// <param name="value">The value string to be set.</param>
776 /// <returns>True if no error occurred, false otherwise.</returns>
777 /// <since_tizen> 3 </since_tizen>
778 public bool SetAuxiliaryHintValue(uint id, string value)
780 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
781 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 /// Gets a value of the auxiliary hint.
788 /// <param name="id">The auxiliary hint ID.</param>
789 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
790 /// <since_tizen> 3 </since_tizen>
791 public string GetAuxiliaryHintValue(uint id)
793 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
794 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799 /// Gets an ID of the auxiliary hint string.
801 /// <param name="hint">The auxiliary hint string.</param>
802 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
803 /// <since_tizen> 3 </since_tizen>
804 public uint GetAuxiliaryHintId(string hint)
806 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 /// Sets a region to accept input events.
814 /// <param name="inputRegion">The region to accept input events.</param>
815 /// <since_tizen> 3 </since_tizen>
816 public void SetInputRegion(Rectangle inputRegion)
818 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
819 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 /// Sets a priority level for the specified notification window.
825 /// <param name="level">The notification window level.</param>
826 /// <returns>True if no error occurred, false otherwise.</returns>
827 /// <since_tizen> 3 </since_tizen>
828 public bool SetNotificationLevel(NotificationLevel level)
830 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
831 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832 return ret == OperationResult.Succeed;
836 /// Gets a priority level for the specified notification window.
838 /// <returns>The notification window level.</returns>
839 /// <since_tizen> 3 </since_tizen>
840 public NotificationLevel GetNotificationLevel()
842 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 /// Sets a transparent window's visual state to opaque. <br />
849 /// If a visual state of a transparent window is opaque, <br />
850 /// then the window manager could handle it as an opaque window when calculating visibility.
852 /// <param name="opaque">Whether the window's visual state is opaque.</param>
853 /// <remarks>This will have no effect on an opaque window. <br />
854 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
856 /// <since_tizen> 3 </since_tizen>
857 public void SetOpaqueState(bool opaque)
859 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
860 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 /// Returns whether a transparent window's visual state is opaque or not.
866 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
867 /// <remarks> The return value has no meaning on an opaque window. </remarks>
868 /// <since_tizen> 3 </since_tizen>
869 public bool IsOpaqueState()
871 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
872 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
877 /// Sets a window's screen off mode.
879 /// <param name="screenOffMode">The screen mode.</param>
880 /// <returns>True if no error occurred, false otherwise.</returns>
881 /// <since_tizen> 4 </since_tizen>
882 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
884 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
885 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
886 return ret == OperationResult.Succeed;
890 /// Gets the screen mode of the window.
892 /// <returns>The screen off mode.</returns>
893 /// <since_tizen> 4 </since_tizen>
894 public ScreenOffMode GetScreenOffMode()
896 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
897 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
902 /// Sets preferred brightness of the window.
904 /// <param name="brightness">The preferred brightness (0 to 100).</param>
905 /// <returns>True if no error occurred, false otherwise.</returns>
906 /// <since_tizen> 3 </since_tizen>
907 public bool SetBrightness(int brightness)
909 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
910 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
911 return ret == OperationResult.Succeed;
915 /// Gets the preferred brightness of the window.
917 /// <returns>The preferred brightness.</returns>
918 /// <since_tizen> 3 </since_tizen>
919 public int GetBrightness()
921 int ret = Interop.Window.GetBrightness(SwigCPtr);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
927 /// Sets the window name and the class string.
929 /// <param name="name">The name of the window.</param>
930 /// <param name="klass">The class of the window.</param>
931 /// <since_tizen> 4 </since_tizen>
932 public void SetClass(string name, string klass)
934 Interop.Window.SetClass(SwigCPtr, name, klass);
935 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
939 /// Raises the window to the top of the window stack.
941 /// <since_tizen> 3 </since_tizen>
944 Interop.Window.Raise(SwigCPtr);
945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949 /// Lowers the window to the bottom of the window stack.
951 /// <since_tizen> 3 </since_tizen>
954 Interop.Window.Lower(SwigCPtr);
955 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959 /// Activates the window to the top of the window stack even it is iconified.
961 /// <since_tizen> 3 </since_tizen>
962 public void Activate()
964 Interop.Window.Activate(SwigCPtr);
965 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969 /// Gets the default ( root ) layer.
971 /// <returns>The root layer.</returns>
972 /// <since_tizen> 3 </since_tizen>
973 public Layer GetDefaultLayer()
975 return this.GetRootLayer();
979 /// Gets the overlay layer.
981 /// <returns>The overlay layer.</returns>
982 [EditorBrowsable(EditorBrowsableState.Never)]
983 public Layer GetOverlayLayer()
985 // Window.IsInstalled() is actually true only when called from event thread and
986 // Core has been initialized, not when Stage is ready.
987 if (overlayLayer == null && Window.IsInstalled())
989 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
990 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991 LayersChildren?.Add(overlayLayer);
992 overlayLayer.SetWindow(this);
998 /// Add a child view to window.
1000 /// <param name="view">the child should be added to the window.</param>
1001 /// <since_tizen> 3 </since_tizen>
1002 public void Add(View view)
1004 this.GetRootLayer().Add(view);
1008 /// Remove a child view from window.
1010 /// <param name="view">the child to be removed.</param>
1011 /// <since_tizen> 3 </since_tizen>
1012 public void Remove(View view)
1014 this.GetRootLayer().Remove(view);
1018 /// Retrieves the layer at a specified depth.
1020 /// <param name="depth">The layer's depth index.</param>
1021 /// <returns>The layer found at the given depth.</returns>
1022 /// <since_tizen> 3 </since_tizen>
1023 public Layer GetLayer(uint depth)
1025 if (depth < LayersChildren?.Count)
1027 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1037 /// Destroy the window immediately.
1039 [EditorBrowsable(EditorBrowsableState.Never)]
1040 public void Destroy()
1046 /// Keep rendering for at least the given amount of time.
1048 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1049 /// <since_tizen> 3 </since_tizen>
1050 public void KeepRendering(float durationSeconds)
1052 Interop.Window.KeepRendering(SwigCPtr, durationSeconds);
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1057 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1058 /// This function can be used for following example scenarios: <br />
1059 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1061 /// <param name="DaliKey">The key code to grab.</param>
1062 /// <returns>True if the grab succeeds.</returns>
1063 /// <since_tizen> 3 </since_tizen>
1064 public bool GrabKeyTopmost(int DaliKey)
1066 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1067 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1072 /// Ungrabs the key specified by a key for the window.<br />
1073 /// 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 />
1075 /// <param name="DaliKey">The key code to ungrab.</param>
1076 /// <returns>True if the ungrab succeeds.</returns>
1077 /// <since_tizen> 3 </since_tizen>
1078 public bool UngrabKeyTopmost(int DaliKey)
1080 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1081 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1086 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1087 /// Details: This function can be used for following example scenarios: <br />
1088 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1089 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1090 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1092 /// <param name="DaliKey">The key code to grab.</param>
1093 /// <param name="GrabMode">The grab mode for the key.</param>
1094 /// <returns>True if the grab succeeds.</returns>
1095 /// <since_tizen> 3 </since_tizen>
1096 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1098 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1099 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1104 /// Ungrabs the key specified by a key for a window.<br />
1105 /// 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 />
1107 /// <param name="DaliKey">The key code to ungrab.</param>
1108 /// <returns>True if the ungrab succeeds.</returns>
1109 /// <since_tizen> 3 </since_tizen>
1110 public bool UngrabKey(int DaliKey)
1112 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1118 /// Sets the keyboard repeat information.
1120 /// <param name="rate">The key repeat rate value in seconds.</param>
1121 /// <param name="delay">The key repeat delay value in seconds.</param>
1122 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1123 /// <since_tizen> 5 </since_tizen>
1124 public bool SetKeyboardRepeatInfo(float rate, float delay)
1126 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 /// Gets the keyboard repeat information.
1134 /// <param name="rate">The key repeat rate value in seconds.</param>
1135 /// <param name="delay">The key repeat delay value in seconds.</param>
1136 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1137 /// <since_tizen> 5 </since_tizen>
1138 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1140 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146 /// Sets the keyboard repeat information of horizontal way.
1148 /// <param name="rate">The key repeat rate value in seconds.</param>
1149 /// <param name="delay">The key repeat delay value in seconds.</param>
1150 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1151 [EditorBrowsable(EditorBrowsableState.Never)]
1152 public bool SetKeyboardHorizentalRepeatInfo(float rate, float delay)
1154 bool ret = Interop.Window.SetKeyboardHorizentalRepeatInfo(rate, delay);
1155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1160 /// Gets the keyboard repeat information of horizontal way.
1162 /// <param name="rate">The key repeat rate value in seconds.</param>
1163 /// <param name="delay">The key repeat delay value in seconds.</param>
1164 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1165 [EditorBrowsable(EditorBrowsableState.Never)]
1166 public bool GetKeyboardHorizentalRepeatInfo(out float rate, out float delay)
1168 bool ret = Interop.Window.GetKeyboardHorizentalRepeatInfo(out rate, out delay);
1169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1174 /// Sets the keyboard repeat information of vertical way.
1176 /// <param name="rate">The key repeat rate value in seconds.</param>
1177 /// <param name="delay">The key repeat delay value in seconds.</param>
1178 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1179 [EditorBrowsable(EditorBrowsableState.Never)]
1180 public bool SetKeyboardVerticalRepeatInfo(float rate, float delay)
1182 bool ret = Interop.Window.SetKeyboardVerticalRepeatInfo(rate, delay);
1183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188 /// Gets the keyboard repeat information of vertical way.
1190 /// <param name="rate">The key repeat rate value in seconds.</param>
1191 /// <param name="delay">The key repeat delay value in seconds.</param>
1192 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1193 [EditorBrowsable(EditorBrowsableState.Never)]
1194 public bool GetKeyboardVerticalRepeatInfo(out float rate, out float delay)
1196 bool ret = Interop.Window.GetKeyboardVerticalRepeatInfo(out rate, out delay);
1197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1202 /// Adds a layer to the stage.
1204 /// <param name="layer">Layer to add.</param>
1205 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1206 /// <since_tizen> 3 </since_tizen>
1207 public void AddLayer(Layer layer)
1213 /// Removes a layer from the stage.
1215 /// <param name="layer">Layer to remove.</param>
1216 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1217 /// <since_tizen> 3 </since_tizen>
1218 public void RemoveLayer(Layer layer)
1224 /// Feeds a key event into the window.
1226 /// <param name="keyEvent">The key event to feed.</param>
1227 /// <since_tizen> 5 </since_tizen>
1228 public void FeedKey(Key keyEvent)
1230 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1235 /// Feeds a hover event into the window. <br />
1236 /// This is feed after a default time of 48 ms. You can also set this time.
1238 /// <param name="time">The time of how much later it will be feed (default is 48ms)</param>
1239 /// <remarks>If you want to do FeedHover after the UI is updated, it is recommended to set the time to at least 16ms. This will be a good time waiting for the UI to update.<br />
1240 /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover.
1242 [EditorBrowsable(EditorBrowsableState.Never)]
1243 public void LazyFeedHover(uint time = 48)
1245 if (internalHoverTimer == null)
1247 internalHoverTimer = new Timer(time);
1248 internalHoverTimer.Tick += (s, e) =>
1251 internalHoverTimer?.Stop();
1252 internalHoverTimer?.Dispose();
1253 internalHoverTimer = null;
1256 internalHoverTimer.Start();
1260 internalHoverTimer.Start();
1265 /// Feeds a touch point into the window.
1267 /// <param name="touchPoint">The touch point to feed.</param>
1268 /// <param name="timeStamp">The timeStamp.</param>
1269 internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1271 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1276 /// Feeds a wheel event into the window.
1278 /// <param name="wheelEvent">The wheel event to feed.</param>
1279 internal void FeedWheel(Wheel wheelEvent)
1281 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1282 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1286 /// Feeds a hover event into the window.
1288 /// <param name="touchPoint">The touch point to feed hover event. If null is entered, the feed hover event is generated with the last inputed touch point.</param>
1289 [EditorBrowsable(EditorBrowsableState.Never)]
1290 internal void FeedHover(TouchPoint touchPoint = null)
1292 if (touchPoint == null)
1294 Hover hover = GetLastHoverEvent();
1295 if (hover == null || hover.GetPointCount() < 1)
1299 using Vector2 screenPosition = hover.GetScreenPosition(0);
1300 touchPoint = new TouchPoint(hover.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
1302 Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
1303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1307 /// Allows at least one more render, even when paused.
1308 /// The window should be shown, not minimised.
1310 /// <since_tizen> 4 </since_tizen>
1311 public void RenderOnce()
1313 Interop.Window.RenderOnce(SwigCPtr);
1314 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1318 /// Sets whether the window is transparent or not.
1320 /// <param name="transparent">Whether the window is transparent or not.</param>
1321 /// <since_tizen> 5 </since_tizen>
1322 public void SetTransparency(bool transparent)
1324 Interop.Window.SetTransparency(SwigCPtr, transparent);
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1327 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1331 /// Sets parent window of the window.
1332 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1333 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1334 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1336 /// <param name="parent">The parent window.</param>
1337 /// <since_tizen> 6 </since_tizen>
1338 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1339 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1340 public void SetParent(Window parent)
1342 if (IsSupportedMultiWindow() == false)
1344 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1346 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1347 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1351 /// Sets parent window of the window.
1352 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1353 /// This function has the additional flag whether the child is located above or below of the parent.
1355 /// <param name="parent">The parent window.</param>
1356 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1357 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1358 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1359 [EditorBrowsable(EditorBrowsableState.Never)]
1360 public void SetParent(Window parent, bool belowParent)
1362 if (IsSupportedMultiWindow() == false)
1364 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1366 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 /// Unsets parent window of the window.
1372 /// After unsetting, the window is disconnected his parent window.
1374 /// <since_tizen> 6 </since_tizen>
1375 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1376 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1377 public void Unparent()
1379 if (IsSupportedMultiWindow() == false)
1381 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1383 Interop.Window.Unparent(SwigCPtr);
1384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1388 /// Gets parent window of the window.
1390 /// <returns>The parent window of the window.</returns>
1391 /// <since_tizen> 6 </since_tizen>
1392 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1393 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1394 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1395 public Window GetParent()
1397 if (IsSupportedMultiWindow() == false)
1399 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1401 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1407 [EditorBrowsable(EditorBrowsableState.Never)]
1408 public void ObjectDump()
1410 Layer rootLayer = GetRootLayer();
1411 foreach (View view in rootLayer.Children)
1417 internal static bool IsInstalled()
1419 bool ret = Interop.Stage.IsInstalled();
1420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425 /// Adds an orientation to the list of available orientations.
1427 /// <param name="orientation">The available orientation to add</param>
1428 /// <since_tizen> 6 </since_tizen>
1429 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1431 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436 /// Removes an orientation from the list of available orientations.
1438 /// <param name="orientation">The available orientation to remove.</param>
1439 /// <since_tizen> 6 </since_tizen>
1440 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1442 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1447 /// Sets a preferred orientation.
1449 /// <param name="orientation">The preferred orientation.</param>
1450 /// <since_tizen> 6 </since_tizen>
1451 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1453 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1454 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1458 /// Gets the preferred orientation.
1460 /// <since_tizen> 6 </since_tizen>
1461 /// <returns>The preferred orientation if previously set, or none.</returns>
1462 public Window.WindowOrientation GetPreferredOrientation()
1464 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1470 /// Gets current orientation of the window.
1472 /// <since_tizen> 6 </since_tizen>
1473 /// <returns>The current window orientation if previously set, or none.</returns>
1474 [EditorBrowsable(EditorBrowsableState.Never)]
1475 public Window.WindowOrientation GetCurrentOrientation()
1477 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1478 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1483 /// Sets available orientations of the window.
1484 /// This API is for setting several orientations one time.
1486 /// <param name="orientations">The list of orientations.</param>
1487 /// <since_tizen> 6 </since_tizen>
1488 [EditorBrowsable(EditorBrowsableState.Never)]
1489 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1491 if (null == orientations)
1493 throw new ArgumentNullException(nameof(orientations));
1496 PropertyArray orientationArray = new PropertyArray();
1497 for (int i = 0; i < orientations.Count; i++)
1499 PropertyValue value = new PropertyValue((int)orientations[i]);
1500 orientationArray.PushBack(value);
1504 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1505 orientationArray.Dispose();
1506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1510 /// Get native window ID
1512 /// <returns>native window ID</returns>
1513 [EditorBrowsable(EditorBrowsableState.Never)]
1514 public int GetNativeId()
1516 int ret = Interop.Window.GetNativeId(SwigCPtr);
1517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1521 internal Any GetNativeHandle()
1523 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1528 internal void Add(Layer layer)
1532 throw new ArgumentNullException(nameof(layer));
1537 Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr);
1538 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1542 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1546 LayersChildren?.Add(layer);
1547 layer.SetWindow(this);
1550 internal void Remove(Layer layer)
1554 throw new ArgumentNullException(nameof(layer));
1556 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1557 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1559 LayersChildren?.Remove(layer);
1560 layer.SetWindow(null);
1563 internal Vector2 GetSize()
1565 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1567 convertRealWindowSizeToBorderWindowSize(val);
1569 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1570 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1575 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1576 [EditorBrowsable(EditorBrowsableState.Never)]
1577 public RenderTaskList GetRenderTaskList()
1579 global::System.IntPtr cPtr = Interop.Stage.GetRenderTaskList(stageCPtr);
1581 RenderTaskList ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as RenderTaskList;
1584 HandleRef CPtr = new HandleRef(this, cPtr);
1585 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1586 CPtr = new HandleRef(null, global::System.IntPtr.Zero);
1590 ret = new RenderTaskList(cPtr, true);
1593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1598 /// Queries the number of on-window layers.
1600 /// <returns>The number of layers.</returns>
1601 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1602 internal uint GetLayerCount()
1604 if (LayersChildren == null || LayersChildren.Count < 0)
1607 return (uint)LayersChildren.Count;
1610 internal Layer GetRootLayer()
1614 if (borderLayer == null)
1616 borderLayer = GetBorderWindowRootLayer();
1617 LayersChildren?.Add(borderLayer);
1618 borderLayer.SetWindow(this);
1624 // Window.IsInstalled() is actually true only when called from event thread and
1625 // Core has been initialized, not when Stage is ready.
1626 if (rootLayer == null && Window.IsInstalled())
1628 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1629 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1630 LayersChildren?.Add(rootLayer);
1631 rootLayer.SetWindow(this);
1637 internal void SetBackgroundColor(Vector4 color)
1639 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1643 internal Vector4 GetBackgroundColor()
1645 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1646 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1650 internal Vector2 GetDpi()
1652 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1653 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1657 internal ObjectRegistry GetObjectRegistry()
1659 global::System.IntPtr cPtr = Interop.Stage.GetObjectRegistry(stageCPtr);
1661 ObjectRegistry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as ObjectRegistry;
1664 global::System.Runtime.InteropServices.HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1665 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1666 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1670 ret = new ObjectRegistry(cPtr, true);
1673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1677 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1679 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1680 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1683 internal RenderingBehaviorType GetRenderingBehavior()
1685 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1686 if (NDalicPINVOKE.SWIGPendingException.Pending)
1687 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1691 internal void SetWindowSize(Size2D size)
1695 throw new ArgumentNullException(nameof(size));
1697 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1699 convertBorderWindowSizeToRealWindowSize(val);
1701 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1703 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1704 // Resetting Window size should request a relayout of the tree.
1707 internal Size2D GetWindowSize()
1709 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1711 convertRealWindowSizeToBorderWindowSize(val);
1713 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1719 internal void SetPosition(Position2D position)
1721 if (null == position)
1723 throw new ArgumentNullException(nameof(position));
1725 var val = new Int32Pair(position.X, position.Y);
1726 Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1728 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1729 // Setting Position of the window should request a relayout of the tree.
1732 internal Position2D GetPosition()
1734 var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1735 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1741 internal void SetPositionSize(Rectangle positionSize)
1743 if (positionSize == null)
1745 throw new ArgumentNullException(nameof(positionSize));
1747 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1749 convertBorderWindowSizeToRealWindowSize(val);
1751 positionSize.Width = val.GetX();
1752 positionSize.Height = val.GetY();
1754 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1757 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1759 // Setting Position of the window should request a relayout of the tree.
1763 /// Set the window use partial update or not.
1765 /// <param name="enabled">If window enable partial update or disable.</param>
1766 internal void SetPartialUpdate(bool enabled)
1768 Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled);
1769 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1773 /// Returns whether the window is enabled partial update or not.
1775 /// <returns>True if the window is enabled partial update, false otherwise.</returns>
1776 internal bool IsPartialUpdate()
1778 bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr);
1779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1784 /// Enables the floating mode of window.
1785 /// The floating mode is to support window is moved or resized by display server.
1786 /// For example, if the video-player window sets the floating mode,
1787 /// then display server changes its geometry and handles it like a popup.
1788 /// The way of handling floating mode window is decided by display server.
1789 /// A special display server(as a Tizen display server) supports this mode.
1791 /// <param name="enable">Enable floating mode or not.</param>
1792 [EditorBrowsable(EditorBrowsableState.Never)]
1793 public void EnableFloatingMode(bool enable)
1795 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1800 /// Returns whether the window is floating mode or not.
1802 /// <returns>True if the window is enabled floating mode, false otherwise.</returns>
1803 [EditorBrowsable(EditorBrowsableState.Never)]
1804 public bool IsFloatingModeEnabled()
1806 bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
1807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1812 /// Requests to display server for the window is moved by display server.
1813 /// It can be work with setting window floating mode.
1815 [EditorBrowsable(EditorBrowsableState.Never)]
1816 public void RequestMoveToServer()
1818 Interop.Window.RequestMoveToServer(SwigCPtr);
1819 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1823 /// Requests to display server for the window is resized by display server.
1824 /// It can be work with setting window floating mode.
1826 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1827 [EditorBrowsable(EditorBrowsableState.Never)]
1828 public void RequestResizeToServer(ResizeDirection direction)
1830 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1831 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1835 /// Includes input region.
1836 /// This function inlcudes input regions.
1837 /// It can be used multiple times and supports multiple regions.
1838 /// It means input region will be extended.
1839 /// This input is related to mouse and touch event.
1840 /// If device has touch screen, this function is useful.
1841 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1843 /// <param name="inputRegion">The included region to accept input events.</param>
1844 [EditorBrowsable(EditorBrowsableState.Never)]
1845 public void IncludeInputRegion(Rectangle inputRegion)
1847 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1848 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1852 /// This function excludes input regions.
1853 /// It can be used multiple times and supports multiple regions.
1854 /// It means input region will be reduced.
1855 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1856 /// This input is related to mouse and touch event.
1857 /// If device has touch screen, this function is useful.
1858 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1860 /// <param name="inputRegion">The excluded region to except input events.</param>
1861 [EditorBrowsable(EditorBrowsableState.Never)]
1862 public void ExcludeInputRegion(Rectangle inputRegion)
1864 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1869 /// Sets the pointer constraints lock.
1871 /// <returns>True if PointerConstraintsLock succeeds.</returns>
1872 [EditorBrowsable(EditorBrowsableState.Never)]
1873 public bool PointerConstraintsLock()
1875 bool ret = Interop.Window.PointerConstraintsLock(SwigCPtr);
1876 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1881 /// Sets the pointer constraints unlock.
1883 /// <returns>True if PointerConstraintsUnlock succeeds.</returns>
1884 [EditorBrowsable(EditorBrowsableState.Never)]
1885 public bool PointerConstraintsUnlock()
1887 bool ret = Interop.Window.PointerConstraintsUnlock(SwigCPtr);
1888 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1893 /// Sets the locked pointer region.
1895 /// <param name="x">The x position.</param>
1896 /// <param name="y">The y position.</param>
1897 /// <param name="width">The width.</param>
1898 /// <param name="height">The height.</param>
1899 [EditorBrowsable(EditorBrowsableState.Never)]
1900 public void LockedPointerRegionSet(int x, int y, int width, int height)
1902 Interop.Window.LockedPointerRegionSet(SwigCPtr, x, y, width, height);
1903 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1907 /// Sets the locked pointer cursor position hintset
1909 /// <param name="x">The x position.</param>
1910 /// <param name="y">The y position.</param>
1911 [EditorBrowsable(EditorBrowsableState.Never)]
1912 public void LockedPointerCursorPositionHintSet(int x, int y)
1914 Interop.Window.LockedPointerCursorPositionHintSet(SwigCPtr, x, y);
1915 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1919 /// Sets the pointer warp. The pointer moves to the set coordinates.
1921 /// <param name="x">The x position.</param>
1922 /// <param name="y">The y position.</param>
1923 /// <returns>True if PointerWarp succeeds.</returns>
1924 [EditorBrowsable(EditorBrowsableState.Never)]
1925 public bool PointerWarp(int x, int y)
1927 bool ret = Interop.Window.PointerWarp(SwigCPtr, x, y);
1928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1933 /// Sets visibility on/off of cursor
1935 /// <param name="visible">The visibility of cursor.</param>
1936 [EditorBrowsable(EditorBrowsableState.Never)]
1937 public void CursorVisibleSet(bool visible)
1939 Interop.Window.CursorVisibleSet(SwigCPtr, visible);
1940 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1944 /// Requests grab key events according to the requested device subtype
1946 /// <param name="deviceSubclass">The deviceSubclass type.</param>
1947 /// <returns>True if KeyboardGrab succeeds.</returns>
1948 [EditorBrowsable(EditorBrowsableState.Never)]
1949 public bool KeyboardGrab(DeviceSubClassType deviceSubclass)
1951 bool ret = Interop.Window.KeyboardGrab(SwigCPtr, (uint)deviceSubclass);
1952 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1957 /// Requests ungrab key events
1959 /// <returns>True if KeyboardUnGrab succeeds.</returns>
1960 [EditorBrowsable(EditorBrowsableState.Never)]
1961 public bool KeyboardUnGrab()
1963 bool ret = Interop.Window.KeyboardUnGrab(SwigCPtr);
1964 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1970 /// Maximizes window's size.
1971 /// If this function is called with true, window will be resized with screen size.
1972 /// Otherwise window will be resized with previous size.
1973 /// It is for the window's MAX button in window's border.
1974 /// If window border is supported by display server, it is not necessary.
1976 /// <param name="max">If window is maximized or unmaximized.</param>
1977 [EditorBrowsable(EditorBrowsableState.Never)]
1978 public void Maximize(bool max)
1980 Interop.Window.Maximize(SwigCPtr, max);
1981 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1985 /// Returns whether the window is maximized or not.
1987 /// <returns>True if the window is maximized, false otherwise.</returns>
1988 [EditorBrowsable(EditorBrowsableState.Never)]
1989 public bool IsMaximized()
1991 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1992 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1997 /// Sets window's maximum size.
1999 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
2000 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
2002 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
2005 /// <param name="size">the maximum size.</param>
2006 [EditorBrowsable(EditorBrowsableState.Never)]
2007 public void SetMaximumSize(Size2D size)
2011 throw new ArgumentNullException(nameof(size));
2013 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
2015 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
2017 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2021 /// Minimizes window's size.
2022 /// If this function is called with true, window will be iconified.
2023 /// Otherwise window will be activated.
2024 /// It is for the window's MIN button in window border.
2025 /// If window border is supported by display server, it is not necessary.
2027 /// <param name="min">If window is minimized or unminimized.</param>
2028 [EditorBrowsable(EditorBrowsableState.Never)]
2029 public void Minimize(bool min)
2031 Interop.Window.Minimize(SwigCPtr, min);
2032 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2036 /// Returns whether the window is minimized or not.
2038 /// <returns>True if the window is minimized, false otherwise.</returns>
2039 [EditorBrowsable(EditorBrowsableState.Never)]
2040 public bool IsMinimized()
2042 bool ret = Interop.Window.IsMinimized(SwigCPtr);
2043 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2048 /// Sets window's minimum size.
2049 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
2050 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
2052 /// <param name="size">the minimum size.</param>
2053 [EditorBrowsable(EditorBrowsableState.Never)]
2054 public void SetMimimumSize(Size2D size)
2058 throw new ArgumentNullException(nameof(size));
2060 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
2062 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
2064 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2068 /// Sets the layout of the window.
2070 /// <param name="numCols">The number of columns in the layout.</param>
2071 /// <param name="numRows">The number of rows in the layout.</param>
2072 /// <param name="column">The column number of the window within the layout.</param>
2073 /// <param name="row">The row number of the window within the layout.</param>
2074 /// <param name="colSpan">The number of columns the window should span within the layout.</param>
2075 /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
2076 [EditorBrowsable(EditorBrowsableState.Never)]
2077 public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
2079 Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
2080 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2085 /// Sets the layout of the window.
2087 /// <param name="layoutType">The type of layout to set for the window.</param>
2088 [EditorBrowsable(EditorBrowsableState.Never)]
2089 public void SetLayout(WindowLayoutType layoutType)
2093 case WindowLayoutType.LeftHalf:
2094 Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
2096 case WindowLayoutType.RightHalf:
2097 Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
2100 case WindowLayoutType.TopHalf:
2101 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
2103 case WindowLayoutType.BottomHalf:
2104 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
2107 case WindowLayoutType.UpperLeftQuarter:
2108 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
2110 case WindowLayoutType.UpperRightQuarter:
2111 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
2113 case WindowLayoutType.LowerLeftQuarter:
2114 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
2116 case WindowLayoutType.LowerRightQuarter:
2117 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
2120 case WindowLayoutType.LeftThird:
2121 Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
2123 case WindowLayoutType.CenterThird:
2124 Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
2126 case WindowLayoutType.RightThird:
2127 Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
2130 case WindowLayoutType.TopThird:
2131 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
2133 case WindowLayoutType.MiddleThird:
2134 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
2136 case WindowLayoutType.BottomThird:
2137 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
2140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2145 /// Query whether window is rotating or not.
2147 /// <returns>True if window is rotating, false otherwise.</returns>
2148 [EditorBrowsable(EditorBrowsableState.Never)]
2149 public bool IsWindowRotating()
2151 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
2152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2157 /// Gets the last key event the window gets.
2160 /// We will use weak reference of last key events.
2161 /// Return value will be invalidated if last key event changed internally.
2163 /// <returns>The last key event the window gets.</returns>
2164 [EditorBrowsable(EditorBrowsableState.Never)]
2165 public Key GetLastKeyEvent()
2167 if (internalLastKeyEvent == null)
2169 // Create empty event handle without register.
2170 internalLastKeyEvent = new Key(Interop.Key.New(), true, false);
2172 Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr);
2173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2174 return internalLastKeyEvent;
2178 /// Gets the last touch event the window gets.
2181 /// We will use weak reference of last touch events.
2182 /// Return value will be invalidated if last touch event changed internally.
2184 /// <returns>The last touch event the window gets.</returns>
2185 [EditorBrowsable(EditorBrowsableState.Never)]
2186 public Touch GetLastTouchEvent()
2188 if (internalLastTouchEvent == null)
2190 // Create empty event handle without register.
2191 internalLastTouchEvent = new Touch(Interop.Touch.NewTouch(), true, false);
2193 Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr);
2194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2195 return internalLastTouchEvent;
2199 /// Gets the last hover event the window gets.
2202 /// We will use weak reference of last hover events.
2203 /// Return value will be invalidated if last hover event changed internally.
2205 /// <returns>The last hover event the window gets.</returns>
2206 [EditorBrowsable(EditorBrowsableState.Never)]
2207 public Hover GetLastHoverEvent()
2209 if (internalLastHoverEvent == null)
2211 // Create empty event handle without register.
2212 internalLastHoverEvent = new Hover(Interop.Hover.New(0u), true, false);
2214 Interop.Window.InternalRetrievingLastHoverEvent(SwigCPtr, internalLastHoverEvent.SwigCPtr);
2215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2216 return internalLastHoverEvent;
2220 /// Sets the necessary for window rotation Acknowledgement.
2221 /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
2223 /// This function is supprot that application has the window rotation acknowledgement's control.
2224 /// It means display server waits when application's rotation work is finished.
2225 /// It is useful application has the other rendering engine which works asynchronous.
2226 /// For instance, GlView.
2228 /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
2229 [EditorBrowsable(EditorBrowsableState.Never)]
2230 public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
2232 Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
2233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2237 /// send the Acknowledgement to complete window rotation.
2238 /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
2240 [EditorBrowsable(EditorBrowsableState.Never)]
2241 public void SendRotationCompletedAcknowledgement()
2243 Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
2244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2248 /// Add FrameUpdateCallback
2250 [EditorBrowsable(EditorBrowsableState.Never)]
2251 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2253 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
2257 /// Add FrameUpdateCallback with root view.
2258 /// FrameUpdateCallbackInterface can only detach Views under given view.
2260 [EditorBrowsable(EditorBrowsableState.Never)]
2261 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback, View rootView)
2263 if(rootView != null)
2265 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, View.getCPtr(rootView));
2270 /// Remove FrameUpdateCallback
2272 [EditorBrowsable(EditorBrowsableState.Never)]
2273 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2275 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
2279 /// Dispose for Window
2281 [EditorBrowsable(EditorBrowsableState.Never)]
2282 protected override void Dispose(DisposeTypes type)
2289 this.DisconnectNativeSignals();
2291 if (type == DisposeTypes.Explicit)
2294 //Release your own managed resources here.
2295 //You should release all of your own disposable objects here.
2297 if (IsBorderEnabled)
2302 foreach (var layer in childLayers)
2310 childLayers.Clear();
2312 localController?.Dispose();
2314 internalLastKeyEvent?.Dispose();
2315 internalLastKeyEvent = null;
2316 internalLastTouchEvent?.Dispose();
2317 internalLastTouchEvent = null;
2318 internalLastHoverEvent?.Dispose();
2319 internalLastHoverEvent = null;
2321 internalHoverTimer?.Stop();
2322 internalHoverTimer?.Dispose();
2323 internalHoverTimer = null;
2330 /// This will not be public opened.
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2332 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2334 Interop.Window.DeleteWindow(swigCPtr);
2337 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
2339 private static readonly object locker = new object();
2341 private static int key = 0;
2343 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
2345 private struct internalHookCallbackType
2347 public FrameCallbackType userCallback;
2351 private static void OnInternalHookFrameCallback(int id)
2355 if (frameCallbackList.ContainsKey(id))
2357 if (frameCallbackList[id].userCallback != null)
2359 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
2360 frameCallbackList.Remove(id);
2364 NUILog.Error($"found userCallback is NULL");
2365 frameCallbackList.Remove(id);
2371 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2373 if (null == callback)
2375 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2377 var assignedKey = 0;
2382 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2384 userCallback = callback,
2392 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2394 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2395 [EditorBrowsable(EditorBrowsableState.Never)]
2396 public delegate void FrameCallbackType(int frameId);
2399 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2400 /// A callback of the following type may be used:
2402 /// void MyFunction( int frameId )
2404 /// This callback will be deleted once it is called.
2406 /// Ownership of the callback is passed onto this class
2409 /// <param name="callback">The function to call</param>
2410 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2411 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2412 [EditorBrowsable(EditorBrowsableState.Never)]
2413 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2415 var assignedKey = AddInterHookCallback(callback, frameId);
2416 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2422 /// Adds a callback that is called when the frame is displayed on the display.
2423 /// A callback of the following type may be used:
2425 /// void MyFunction( int frameId )
2427 /// This callback will be deleted once it is called.
2429 /// Ownership of the callback is passed onto this class
2432 /// <param name="callback">The function to call</param>
2433 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2434 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2435 [EditorBrowsable(EditorBrowsableState.Never)]
2436 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2438 var assignedKey = AddInterHookCallback(callback, frameId);
2439 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2445 /// Search through this Window for a Layer with the given unique ID.
2447 /// <param name="id">The ID of the Layer to find.</param>
2448 /// <remarks>Hidden-API</remarks>
2449 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2450 [EditorBrowsable(EditorBrowsableState.Never)]
2451 public Layer FindLayerByID(uint id)
2453 Layer defaultLayer = this.GetDefaultLayer();
2454 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2455 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2462 /// Sets to resize window with full screen.
2463 /// If full screen size is set for the window,
2464 /// window will be resized with full screen.
2465 /// In addition, the full screen sized window's z-order is the highest.
2467 /// <param name="fullscreen"> If fullscreen is true, set fullscreen or unset.</param>
2468 [EditorBrowsable(EditorBrowsableState.Never)]
2469 public void SetFullScreen(bool fullscreen)
2471 Interop.Window.SetFullScreen(SwigCPtr, fullscreen);
2472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2476 /// Gets whether the full screen sized window or not.
2478 /// <returns>Returns true if the full screen sized window is.</returns>
2479 [EditorBrowsable(EditorBrowsableState.Never)]
2480 public bool GetFullScreen()
2482 bool ret = Interop.Window.GetFullScreen(SwigCPtr);
2483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2488 /// Get Native Window handle.
2490 /// How to get Native Window handle
2492 /// Window window = NUIApplication.GetDefaultWindow();
2493 /// var handle = window.NativeHandle;
2494 /// if(handle.IsInvalid == false)
2496 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2497 /// // do something with nativeHandle
2502 /// <since_tizen> 9 </since_tizen>
2503 public SafeHandle NativeHandle
2507 return new NUI.SafeNativeWindowHandle(this);