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();
159 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
161 /// <since_tizen> 3 </since_tizen>
162 public enum WindowOrientation
165 /// Portrait orientation. The height of the display area is greater than the width.
167 /// <since_tizen> 3 </since_tizen>
170 /// Landscape orientation. A wide view area is needed.
172 /// <since_tizen> 3 </since_tizen>
175 /// Portrait inverse orientation.
177 /// <since_tizen> 3 </since_tizen>
178 PortraitInverse = 180,
180 /// Landscape inverse orientation.
182 /// <since_tizen> 3 </since_tizen>
183 LandscapeInverse = 270,
185 /// No orientation. It is for the preferred orientation
186 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
187 /// It is used to unset the preferred orientation with SetPreferredOrientation.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 NoOrientationPreference = -1
194 /// Enumeration for the key grab mode for platform-level APIs.
196 /// <since_tizen> 3 </since_tizen>
197 public enum KeyGrabMode
200 /// Grabs a key only when on the top of the grabbing-window stack mode.
204 /// Grabs a key together with the other client window(s) mode.
208 /// 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.
212 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
218 /// Enumeration for transition effect's state.
220 [Obsolete("Do not use this, that will be removed. Use Window.EffectState instead.")]
221 [EditorBrowsable(EditorBrowsableState.Never)]
222 // This is already deprecated, so suppress warning here.
223 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
224 public enum EffectStates
229 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.None instead.")]
230 [EditorBrowsable(EditorBrowsableState.Never)]
233 /// Transition effect is started.
235 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.Start instead.")]
236 [EditorBrowsable(EditorBrowsableState.Never)]
239 /// Transition effect is ended.
241 [Obsolete("Do not use this, that will be removed. Use Window.EffectState.End instead.")]
242 [EditorBrowsable(EditorBrowsableState.Never)]
247 /// Enumeration for transition effect's state.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public enum EffectState
255 [EditorBrowsable(EditorBrowsableState.Never)]
258 /// Transition effect is started.
260 [EditorBrowsable(EditorBrowsableState.Never)]
263 /// Transition effect is ended.
265 [EditorBrowsable(EditorBrowsableState.Never)]
270 /// Enumeration for transition effect's type.
272 [Obsolete("Do not use this, that will be removed. Use Window.EffectType instead.")]
273 [EditorBrowsable(EditorBrowsableState.Never)]
274 // This is already deprecated, so suppress warning here.
275 [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names", Justification = "<Pending>")]
276 public enum EffectTypes
281 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.None instead.")]
282 [EditorBrowsable(EditorBrowsableState.Never)]
285 /// Window show effect.
287 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Show instead.")]
288 [EditorBrowsable(EditorBrowsableState.Never)]
291 /// Window hide effect.
293 [Obsolete("Do not use this, that will be removed. Use Window.EffectType.Hide instead.")]
294 [EditorBrowsable(EditorBrowsableState.Never)]
299 /// Enumeration for transition effect's type.
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public enum EffectType
307 [EditorBrowsable(EditorBrowsableState.Never)]
310 /// Window show effect.
312 [EditorBrowsable(EditorBrowsableState.Never)]
315 /// Window hide effect.
317 [EditorBrowsable(EditorBrowsableState.Never)]
322 /// Enumeration for result of window operation.
324 internal enum OperationResult
327 /// Failed for unknown reason
335 /// Permission denied
339 /// The operation is not supported.
345 /// Enumeration for window resized mode by display server.
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public enum ResizeDirection
353 [EditorBrowsable(EditorBrowsableState.Never)]
356 /// Start resizing window to the top-left edge.
358 [EditorBrowsable(EditorBrowsableState.Never)]
361 /// Start resizing window to the top side.
363 [EditorBrowsable(EditorBrowsableState.Never)]
366 /// Start resizing window to the top-right edge.
368 [EditorBrowsable(EditorBrowsableState.Never)]
371 /// Start resizing window to the left side.
373 [EditorBrowsable(EditorBrowsableState.Never)]
376 /// Start resizing window to the right side.
378 [EditorBrowsable(EditorBrowsableState.Never)]
381 /// Start resizing window to the bottom-left edge.
383 [EditorBrowsable(EditorBrowsableState.Never)]
386 /// Start resizing window to the bottom side.
388 [EditorBrowsable(EditorBrowsableState.Never)]
391 /// Start resizing window to the bottom-right edge.
393 [EditorBrowsable(EditorBrowsableState.Never)]
399 /// The stage instance property (read-only).<br />
400 /// Gets the current window.<br />
402 /// <since_tizen> 3 </since_tizen>
403 public static Window Instance { get; internal set; }
406 /// Gets or sets a window type.
407 /// Most of window type can be set to use WindowType, except for IME type.
408 /// IME type can be set to use one of NUIApplication's constrcutors.
410 /// <since_tizen> 3 </since_tizen>
411 public WindowType Type
415 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
416 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
421 Interop.Window.SetType(SwigCPtr, (int)value);
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427 /// Gets/Sets a window title.
429 /// <since_tizen> 4 </since_tizen>
439 SetClass(windowTitle, "");
444 /// The rendering behavior of a Window.
446 /// <since_tizen> 5 </since_tizen>
447 public RenderingBehaviorType RenderingBehavior
451 return GetRenderingBehavior();
455 SetRenderingBehavior(value);
460 /// The window size property (read-only).
462 /// <since_tizen> 3 </since_tizen>
467 Size2D ret = GetSize();
473 /// The background color property.
475 /// <since_tizen> 3 </since_tizen>
476 public Color BackgroundColor
480 SetBackgroundColor(value);
484 Color ret = GetBackgroundColor();
490 /// The DPI property (read-only).<br />
491 /// Retrieves the DPI of the display device to which the Window is connected.<br />
493 /// <since_tizen> 3 </since_tizen>
503 /// The layer count property (read-only).<br />
504 /// Queries the number of on-Window layers.<br />
506 /// <since_tizen> 3 </since_tizen>
507 public uint LayerCount
511 return GetLayerCount();
516 /// Gets or sets a size of the window.
518 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
519 /// <since_tizen> 4 </since_tizen>
520 public Size2D WindowSize
524 return GetWindowSize();
528 SetWindowSize(value);
533 /// Gets or sets a position of the window.
535 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
536 /// <since_tizen> 4 </since_tizen>
537 public Position2D WindowPosition
541 return GetPosition();
550 /// Sets position and size of the window. This API guarantees that
551 /// both moving and resizing of window will appear on the screen at once.
553 [EditorBrowsable(EditorBrowsableState.Never)]
554 public Rectangle WindowPositionSize
558 Position2D position = GetPosition();
559 Size2D size = GetSize();
560 Rectangle ret = new Rectangle(position?.X ?? 0, position?.Y ?? 0, size?.Width ?? 0, size?.Height ?? 0);
566 SetPositionSize(value);
571 /// Gets or sets whether the window will update partial area or full area.
572 /// If this value is true, window will update and render partial area.
573 /// If false, full area updated.
575 [EditorBrowsable(EditorBrowsableState.Never)]
576 public bool PartialUpdate
580 return IsPartialUpdate();
584 SetPartialUpdate(value);
588 internal static Vector4 DEFAULT_BACKGROUND_COLOR
592 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
593 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
594 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 internal static Vector4 DEBUG_BACKGROUND_COLOR
603 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
604 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610 internal List<Layer> LayersChildren
619 /// Get the LayoutController for this Window.
621 internal LayoutController LayoutController
625 return localController;
630 /// Feed a key-event into the window.
632 /// <param name="keyEvent">The key event to feed.</param>
633 /// <since_tizen> 4 </since_tizen>
634 [Obsolete("Do not use this, that will be deprecated. Use FeedKey(Key keyEvent) instead.")]
635 public static void FeedKeyEvent(Key keyEvent)
637 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642 /// Sets whether the window accepts a focus or not.
644 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
645 /// <since_tizen> 3 </since_tizen>
646 public void SetAcceptFocus(bool accept)
648 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
649 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
653 /// Returns whether the window accepts a focus or not.
655 /// <returns>True if the window accepts a focus, false otherwise.</returns>
656 /// <since_tizen> 3 </since_tizen>
657 public bool IsFocusAcceptable()
659 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
666 /// Shows the window if it is hidden.
668 /// <since_tizen> 3 </since_tizen>
671 Interop.Window.Show(SwigCPtr);
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 /// Hides the window if it is showing.
678 /// <since_tizen> 3 </since_tizen>
681 Interop.Window.Hide(SwigCPtr);
682 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
686 /// Retrieves whether the window is visible or not.
688 /// <returns>True if the window is visible.</returns>
689 /// <since_tizen> 3 </since_tizen>
690 public bool IsVisible()
692 bool temp = Interop.Window.IsVisible(SwigCPtr);
693 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698 /// Gets the count of supported auxiliary hints of the window.
700 /// <returns>The number of supported auxiliary hints.</returns>
701 /// <since_tizen> 3 </since_tizen>
702 public uint GetSupportedAuxiliaryHintCount()
704 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
705 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 /// Gets the supported auxiliary hint string of the window.
712 /// <param name="index">The index of the supported auxiliary hint lists.</param>
713 /// <returns>The auxiliary hint string of the index.</returns>
714 /// <since_tizen> 3 </since_tizen>
715 public string GetSupportedAuxiliaryHint(uint index)
717 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723 /// Creates an auxiliary hint of the window.
725 /// <param name="hint">The auxiliary hint string.</param>
726 /// <param name="value">The value string.</param>
727 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
728 /// <since_tizen> 3 </since_tizen>
729 public uint AddAuxiliaryHint(string hint, string value)
731 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 /// Removes an auxiliary hint of the window.
739 /// <param name="id">The ID of the auxiliary hint.</param>
740 /// <returns>True if no error occurred, false otherwise.</returns>
741 /// <since_tizen> 3 </since_tizen>
742 public bool RemoveAuxiliaryHint(uint id)
744 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 /// Changes a value of the auxiliary hint.
752 /// <param name="id">The auxiliary hint ID.</param>
753 /// <param name="value">The value string to be set.</param>
754 /// <returns>True if no error occurred, false otherwise.</returns>
755 /// <since_tizen> 3 </since_tizen>
756 public bool SetAuxiliaryHintValue(uint id, string value)
758 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 /// Gets a value of the auxiliary hint.
766 /// <param name="id">The auxiliary hint ID.</param>
767 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
768 /// <since_tizen> 3 </since_tizen>
769 public string GetAuxiliaryHintValue(uint id)
771 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 /// Gets an ID of the auxiliary hint string.
779 /// <param name="hint">The auxiliary hint string.</param>
780 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
781 /// <since_tizen> 3 </since_tizen>
782 public uint GetAuxiliaryHintId(string hint)
784 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
790 /// Sets a region to accept input events.
792 /// <param name="inputRegion">The region to accept input events.</param>
793 /// <since_tizen> 3 </since_tizen>
794 public void SetInputRegion(Rectangle inputRegion)
796 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
797 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 /// Sets a priority level for the specified notification window.
803 /// <param name="level">The notification window level.</param>
804 /// <returns>True if no error occurred, false otherwise.</returns>
805 /// <since_tizen> 3 </since_tizen>
806 public bool SetNotificationLevel(NotificationLevel level)
808 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
809 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 return ret == OperationResult.Succeed;
814 /// Gets a priority level for the specified notification window.
816 /// <returns>The notification window level.</returns>
817 /// <since_tizen> 3 </since_tizen>
818 public NotificationLevel GetNotificationLevel()
820 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
821 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
826 /// Sets a transparent window's visual state to opaque. <br />
827 /// If a visual state of a transparent window is opaque, <br />
828 /// then the window manager could handle it as an opaque window when calculating visibility.
830 /// <param name="opaque">Whether the window's visual state is opaque.</param>
831 /// <remarks>This will have no effect on an opaque window. <br />
832 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
834 /// <since_tizen> 3 </since_tizen>
835 public void SetOpaqueState(bool opaque)
837 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
838 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
842 /// Returns whether a transparent window's visual state is opaque or not.
844 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
845 /// <remarks> The return value has no meaning on an opaque window. </remarks>
846 /// <since_tizen> 3 </since_tizen>
847 public bool IsOpaqueState()
849 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
850 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
855 /// Sets a window's screen off mode.
857 /// <param name="screenOffMode">The screen mode.</param>
858 /// <returns>True if no error occurred, false otherwise.</returns>
859 /// <since_tizen> 4 </since_tizen>
860 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
862 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
863 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 return ret == OperationResult.Succeed;
868 /// Gets the screen mode of the window.
870 /// <returns>The screen off mode.</returns>
871 /// <since_tizen> 4 </since_tizen>
872 public ScreenOffMode GetScreenOffMode()
874 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
875 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
880 /// Sets preferred brightness of the window.
882 /// <param name="brightness">The preferred brightness (0 to 100).</param>
883 /// <returns>True if no error occurred, false otherwise.</returns>
884 /// <since_tizen> 3 </since_tizen>
885 public bool SetBrightness(int brightness)
887 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
888 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
889 return ret == OperationResult.Succeed;
893 /// Gets the preferred brightness of the window.
895 /// <returns>The preferred brightness.</returns>
896 /// <since_tizen> 3 </since_tizen>
897 public int GetBrightness()
899 int ret = Interop.Window.GetBrightness(SwigCPtr);
900 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
905 /// Sets the window name and the class string.
907 /// <param name="name">The name of the window.</param>
908 /// <param name="klass">The class of the window.</param>
909 /// <since_tizen> 4 </since_tizen>
910 public void SetClass(string name, string klass)
912 Interop.Window.SetClass(SwigCPtr, name, klass);
913 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
917 /// Raises the window to the top of the window stack.
919 /// <since_tizen> 3 </since_tizen>
922 Interop.Window.Raise(SwigCPtr);
923 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
927 /// Lowers the window to the bottom of the window stack.
929 /// <since_tizen> 3 </since_tizen>
932 Interop.Window.Lower(SwigCPtr);
933 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
937 /// Activates the window to the top of the window stack even it is iconified.
939 /// <since_tizen> 3 </since_tizen>
940 public void Activate()
942 Interop.Window.Activate(SwigCPtr);
943 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
947 /// Gets the default ( root ) layer.
949 /// <returns>The root layer.</returns>
950 /// <since_tizen> 3 </since_tizen>
951 public Layer GetDefaultLayer()
953 return this.GetRootLayer();
957 /// Gets the overlay layer.
959 /// <returns>The overlay layer.</returns>
960 [EditorBrowsable(EditorBrowsableState.Never)]
961 public Layer GetOverlayLayer()
963 // Window.IsInstalled() is actually true only when called from event thread and
964 // Core has been initialized, not when Stage is ready.
965 if (overlayLayer == null && Window.IsInstalled())
967 overlayLayer = new Layer(Interop.Window.GetOverlayLayer(SwigCPtr), true);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
969 LayersChildren?.Add(overlayLayer);
970 overlayLayer.SetWindow(this);
976 /// Add a child view to window.
978 /// <param name="view">the child should be added to the window.</param>
979 /// <since_tizen> 3 </since_tizen>
980 public void Add(View view)
982 this.GetRootLayer().Add(view);
986 /// Remove a child view from window.
988 /// <param name="view">the child to be removed.</param>
989 /// <since_tizen> 3 </since_tizen>
990 public void Remove(View view)
992 this.GetRootLayer().Remove(view);
996 /// Retrieves the layer at a specified depth.
998 /// <param name="depth">The layer's depth index.</param>
999 /// <returns>The layer found at the given depth.</returns>
1000 /// <since_tizen> 3 </since_tizen>
1001 public Layer GetLayer(uint depth)
1003 if (depth < LayersChildren?.Count)
1005 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
1015 /// Destroy the window immediately.
1017 [EditorBrowsable(EditorBrowsableState.Never)]
1018 public void Destroy()
1024 /// Keep rendering for at least the given amount of time.
1026 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
1027 /// <since_tizen> 3 </since_tizen>
1028 public void KeepRendering(float durationSeconds)
1030 Interop.Window.KeepRendering(SwigCPtr, durationSeconds);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
1036 /// This function can be used for following example scenarios: <br />
1037 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
1039 /// <param name="DaliKey">The key code to grab.</param>
1040 /// <returns>True if the grab succeeds.</returns>
1041 /// <since_tizen> 3 </since_tizen>
1042 public bool GrabKeyTopmost(int DaliKey)
1044 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1050 /// Ungrabs the key specified by a key for the window.<br />
1051 /// 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 />
1053 /// <param name="DaliKey">The key code to ungrab.</param>
1054 /// <returns>True if the ungrab succeeds.</returns>
1055 /// <since_tizen> 3 </since_tizen>
1056 public bool UngrabKeyTopmost(int DaliKey)
1058 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1059 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1064 /// Grabs the key specified by a key for a window in a GrabMode. <br />
1065 /// Details: This function can be used for following example scenarios: <br />
1066 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
1067 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
1068 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1070 /// <param name="DaliKey">The key code to grab.</param>
1071 /// <param name="GrabMode">The grab mode for the key.</param>
1072 /// <returns>True if the grab succeeds.</returns>
1073 /// <since_tizen> 3 </since_tizen>
1074 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1076 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1077 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 /// Ungrabs the key specified by a key for a window.<br />
1083 /// 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 />
1085 /// <param name="DaliKey">The key code to ungrab.</param>
1086 /// <returns>True if the ungrab succeeds.</returns>
1087 /// <since_tizen> 3 </since_tizen>
1088 public bool UngrabKey(int DaliKey)
1090 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1096 /// Sets the keyboard repeat information.
1098 /// <param name="rate">The key repeat rate value in seconds.</param>
1099 /// <param name="delay">The key repeat delay value in seconds.</param>
1100 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1101 /// <since_tizen> 5 </since_tizen>
1102 public bool SetKeyboardRepeatInfo(float rate, float delay)
1104 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1110 /// Gets the keyboard repeat information.
1112 /// <param name="rate">The key repeat rate value in seconds.</param>
1113 /// <param name="delay">The key repeat delay value in seconds.</param>
1114 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1115 /// <since_tizen> 5 </since_tizen>
1116 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1118 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1124 /// Sets the keyboard repeat information of horizontal way.
1126 /// <param name="rate">The key repeat rate value in seconds.</param>
1127 /// <param name="delay">The key repeat delay value in seconds.</param>
1128 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1129 [EditorBrowsable(EditorBrowsableState.Never)]
1130 public bool SetKeyboardHorizentalRepeatInfo(float rate, float delay)
1132 bool ret = Interop.Window.SetKeyboardHorizentalRepeatInfo(rate, delay);
1133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1138 /// Gets the keyboard repeat information of horizontal way.
1140 /// <param name="rate">The key repeat rate value in seconds.</param>
1141 /// <param name="delay">The key repeat delay value in seconds.</param>
1142 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1143 [EditorBrowsable(EditorBrowsableState.Never)]
1144 public bool GetKeyboardHorizentalRepeatInfo(out float rate, out float delay)
1146 bool ret = Interop.Window.GetKeyboardHorizentalRepeatInfo(out rate, out delay);
1147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1152 /// Sets the keyboard repeat information of vertical way.
1154 /// <param name="rate">The key repeat rate value in seconds.</param>
1155 /// <param name="delay">The key repeat delay value in seconds.</param>
1156 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1157 [EditorBrowsable(EditorBrowsableState.Never)]
1158 public bool SetKeyboardVerticalRepeatInfo(float rate, float delay)
1160 bool ret = Interop.Window.SetKeyboardVerticalRepeatInfo(rate, delay);
1161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1166 /// Gets the keyboard repeat information of vertical way.
1168 /// <param name="rate">The key repeat rate value in seconds.</param>
1169 /// <param name="delay">The key repeat delay value in seconds.</param>
1170 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1171 [EditorBrowsable(EditorBrowsableState.Never)]
1172 public bool GetKeyboardVerticalRepeatInfo(out float rate, out float delay)
1174 bool ret = Interop.Window.GetKeyboardVerticalRepeatInfo(out rate, out delay);
1175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1180 /// Adds a layer to the stage.
1182 /// <param name="layer">Layer to add.</param>
1183 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1184 /// <since_tizen> 3 </since_tizen>
1185 public void AddLayer(Layer layer)
1191 /// Removes a layer from the stage.
1193 /// <param name="layer">Layer to remove.</param>
1194 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1195 /// <since_tizen> 3 </since_tizen>
1196 public void RemoveLayer(Layer layer)
1202 /// Feeds a key event into the window.
1204 /// <param name="keyEvent">The key event to feed.</param>
1205 /// <since_tizen> 5 </since_tizen>
1206 public void FeedKey(Key keyEvent)
1208 Interop.Window.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
1209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 /// Feeds a hover event into the window. <br />
1214 /// This is feed after a default time of 48 ms. You can also set this time.
1216 /// <param name="time">The time of how much later it will be feed (default is 48ms)</param>
1217 /// <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 />
1218 /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover.
1220 [EditorBrowsable(EditorBrowsableState.Never)]
1221 public void LazyFeedHover(uint time = 48)
1223 if (internalHoverTimer == null)
1225 internalHoverTimer = new Timer(time);
1226 internalHoverTimer.Tick += (s, e) =>
1229 internalHoverTimer?.Stop();
1230 internalHoverTimer?.Dispose();
1231 internalHoverTimer = null;
1234 internalHoverTimer.Start();
1238 internalHoverTimer.Start();
1243 /// Feeds a touch point into the window.
1245 /// <param name="touchPoint">The touch point to feed.</param>
1246 /// <param name="timeStamp">The timeStamp.</param>
1247 internal void FeedTouch(TouchPoint touchPoint, int timeStamp)
1249 Interop.Window.FeedTouchPoint(SwigCPtr, TouchPoint.getCPtr(touchPoint), timeStamp);
1250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1254 /// Feeds a wheel event into the window.
1256 /// <param name="wheelEvent">The wheel event to feed.</param>
1257 internal void FeedWheel(Wheel wheelEvent)
1259 Interop.Window.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 /// Feeds a hover event into the window.
1266 /// <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>
1267 [EditorBrowsable(EditorBrowsableState.Never)]
1268 internal void FeedHover(TouchPoint touchPoint = null)
1270 if (touchPoint == null)
1272 Hover hover = GetLastHoverEvent();
1273 if (hover == null || hover.GetPointCount() < 1)
1277 using Vector2 screenPosition = hover.GetScreenPosition(0);
1278 touchPoint = new TouchPoint(hover.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
1280 Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
1281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 /// Allows at least one more render, even when paused.
1286 /// The window should be shown, not minimised.
1288 /// <since_tizen> 4 </since_tizen>
1289 public void RenderOnce()
1291 Interop.Window.RenderOnce(SwigCPtr);
1292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1296 /// Sets whether the window is transparent or not.
1298 /// <param name="transparent">Whether the window is transparent or not.</param>
1299 /// <since_tizen> 5 </since_tizen>
1300 public void SetTransparency(bool transparent)
1302 Interop.Window.SetTransparency(SwigCPtr, transparent);
1303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1309 /// Sets parent window of the window.
1310 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1311 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1312 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1314 /// <param name="parent">The parent window.</param>
1315 /// <since_tizen> 6 </since_tizen>
1316 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1317 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1318 public void SetParent(Window parent)
1320 if (IsSupportedMultiWindow() == false)
1322 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1324 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1329 /// Sets parent window of the window.
1330 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1331 /// This function has the additional flag whether the child is located above or below of the parent.
1333 /// <param name="parent">The parent window.</param>
1334 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1335 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1336 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1337 [EditorBrowsable(EditorBrowsableState.Never)]
1338 public void SetParent(Window parent, bool belowParent)
1340 if (IsSupportedMultiWindow() == false)
1342 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1344 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 /// Unsets parent window of the window.
1350 /// After unsetting, the window is disconnected his parent window.
1352 /// <since_tizen> 6 </since_tizen>
1353 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1354 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1355 public void Unparent()
1357 if (IsSupportedMultiWindow() == false)
1359 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1361 Interop.Window.Unparent(SwigCPtr);
1362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1366 /// Gets parent window of the window.
1368 /// <returns>The parent window of the window.</returns>
1369 /// <since_tizen> 6 </since_tizen>
1370 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1371 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1372 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1373 public Window GetParent()
1375 if (IsSupportedMultiWindow() == false)
1377 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1379 Window ret = this.GetInstanceSafely<Window>(Interop.Window.GetParent(SwigCPtr));
1380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1384 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1385 [EditorBrowsable(EditorBrowsableState.Never)]
1386 public void ObjectDump()
1388 Layer rootLayer = GetRootLayer();
1389 foreach (View view in rootLayer.Children)
1395 internal static bool IsInstalled()
1397 bool ret = Interop.Stage.IsInstalled();
1398 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1403 /// Adds an orientation to the list of available orientations.
1405 /// <param name="orientation">The available orientation to add</param>
1406 /// <since_tizen> 6 </since_tizen>
1407 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1409 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1410 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1414 /// Removes an orientation from the list of available orientations.
1416 /// <param name="orientation">The available orientation to remove.</param>
1417 /// <since_tizen> 6 </since_tizen>
1418 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1420 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1421 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425 /// Sets a preferred orientation.
1427 /// <param name="orientation">The preferred orientation.</param>
1428 /// <since_tizen> 6 </since_tizen>
1429 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1431 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1432 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1436 /// Gets the preferred orientation.
1438 /// <since_tizen> 6 </since_tizen>
1439 /// <returns>The preferred orientation if previously set, or none.</returns>
1440 public Window.WindowOrientation GetPreferredOrientation()
1442 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448 /// Gets current orientation of the window.
1450 /// <since_tizen> 6 </since_tizen>
1451 /// <returns>The current window orientation if previously set, or none.</returns>
1452 [EditorBrowsable(EditorBrowsableState.Never)]
1453 public Window.WindowOrientation GetCurrentOrientation()
1455 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1461 /// Sets available orientations of the window.
1462 /// This API is for setting several orientations one time.
1464 /// <param name="orientations">The list of orientations.</param>
1465 /// <since_tizen> 6 </since_tizen>
1466 [EditorBrowsable(EditorBrowsableState.Never)]
1467 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1469 if (null == orientations)
1471 throw new ArgumentNullException(nameof(orientations));
1474 PropertyArray orientationArray = new PropertyArray();
1475 for (int i = 0; i < orientations.Count; i++)
1477 PropertyValue value = new PropertyValue((int)orientations[i]);
1478 orientationArray.PushBack(value);
1482 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1483 orientationArray.Dispose();
1484 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1488 /// Get native window ID
1490 /// <returns>native window ID</returns>
1491 [EditorBrowsable(EditorBrowsableState.Never)]
1492 public int GetNativeId()
1494 int ret = Interop.Window.GetNativeId(SwigCPtr);
1495 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1499 internal Any GetNativeHandle()
1501 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1506 internal void Add(Layer layer)
1510 throw new ArgumentNullException(nameof(layer));
1515 Interop.Actor.Add(GetRootLayer().SwigCPtr, layer.SwigCPtr);
1516 if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
1520 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1521 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1524 LayersChildren?.Add(layer);
1525 layer.SetWindow(this);
1528 internal void Remove(Layer layer)
1532 throw new ArgumentNullException(nameof(layer));
1534 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1535 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1537 LayersChildren?.Remove(layer);
1538 layer.SetWindow(null);
1541 internal Vector2 GetSize()
1543 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1545 convertRealWindowSizeToBorderWindowSize(val);
1547 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1553 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1554 [EditorBrowsable(EditorBrowsableState.Never)]
1555 public RenderTaskList GetRenderTaskList()
1557 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1558 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1563 /// Queries the number of on-window layers.
1565 /// <returns>The number of layers.</returns>
1566 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1567 internal uint GetLayerCount()
1569 if (LayersChildren == null || LayersChildren.Count < 0)
1572 return (uint)LayersChildren.Count;
1575 internal Layer GetRootLayer()
1579 if (borderLayer == null)
1581 borderLayer = GetBorderWindowRootLayer();
1582 LayersChildren?.Add(borderLayer);
1583 borderLayer.SetWindow(this);
1589 // Window.IsInstalled() is actually true only when called from event thread and
1590 // Core has been initialized, not when Stage is ready.
1591 if (rootLayer == null && Window.IsInstalled())
1593 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1594 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1595 LayersChildren?.Add(rootLayer);
1596 rootLayer.SetWindow(this);
1602 internal void SetBackgroundColor(Vector4 color)
1604 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1608 internal Vector4 GetBackgroundColor()
1610 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1615 internal Vector2 GetDpi()
1617 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1622 internal ObjectRegistry GetObjectRegistry()
1624 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1625 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1629 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1631 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1635 internal RenderingBehaviorType GetRenderingBehavior()
1637 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1638 if (NDalicPINVOKE.SWIGPendingException.Pending)
1639 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1643 internal void SetWindowSize(Size2D size)
1647 throw new ArgumentNullException(nameof(size));
1649 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1651 convertBorderWindowSizeToRealWindowSize(val);
1653 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1656 // Resetting Window size should request a relayout of the tree.
1659 internal Size2D GetWindowSize()
1661 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1663 convertRealWindowSizeToBorderWindowSize(val);
1665 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1666 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1671 internal void SetPosition(Position2D position)
1673 if (null == position)
1675 throw new ArgumentNullException(nameof(position));
1677 var val = new Int32Pair(position.X, position.Y);
1678 Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1680 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1681 // Setting Position of the window should request a relayout of the tree.
1684 internal Position2D GetPosition()
1686 var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1687 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1689 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1693 internal void SetPositionSize(Rectangle positionSize)
1695 if (positionSize == null)
1697 throw new ArgumentNullException(nameof(positionSize));
1699 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1701 convertBorderWindowSizeToRealWindowSize(val);
1703 positionSize.Width = val.GetX();
1704 positionSize.Height = val.GetY();
1706 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1709 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1711 // Setting Position of the window should request a relayout of the tree.
1715 /// Set the window use partial update or not.
1717 /// <param name="enabled">If window enable partial update or disable.</param>
1718 internal void SetPartialUpdate(bool enabled)
1720 Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled);
1721 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1725 /// Returns whether the window is enabled partial update or not.
1727 /// <returns>True if the window is enabled partial update, false otherwise.</returns>
1728 internal bool IsPartialUpdate()
1730 bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr);
1731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1736 /// Enables the floating mode of window.
1737 /// The floating mode is to support window is moved or resized by display server.
1738 /// For example, if the video-player window sets the floating mode,
1739 /// then display server changes its geometry and handles it like a popup.
1740 /// The way of handling floating mode window is decided by display server.
1741 /// A special display server(as a Tizen display server) supports this mode.
1743 /// <param name="enable">Enable floating mode or not.</param>
1744 [EditorBrowsable(EditorBrowsableState.Never)]
1745 public void EnableFloatingMode(bool enable)
1747 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1748 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1752 /// Returns whether the window is floating mode or not.
1754 /// <returns>True if the window is enabled floating mode, false otherwise.</returns>
1755 [EditorBrowsable(EditorBrowsableState.Never)]
1756 public bool IsFloatingModeEnabled()
1758 bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
1759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1764 /// Requests to display server for the window is moved by display server.
1765 /// It can be work with setting window floating mode.
1767 [EditorBrowsable(EditorBrowsableState.Never)]
1768 public void RequestMoveToServer()
1770 Interop.Window.RequestMoveToServer(SwigCPtr);
1771 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1775 /// Requests to display server for the window is resized by display server.
1776 /// It can be work with setting window floating mode.
1778 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1779 [EditorBrowsable(EditorBrowsableState.Never)]
1780 public void RequestResizeToServer(ResizeDirection direction)
1782 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1783 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1787 /// Includes input region.
1788 /// This function inlcudes input regions.
1789 /// It can be used multiple times and supports multiple regions.
1790 /// It means input region will be extended.
1791 /// This input is related to mouse and touch event.
1792 /// If device has touch screen, this function is useful.
1793 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1795 /// <param name="inputRegion">The included region to accept input events.</param>
1796 [EditorBrowsable(EditorBrowsableState.Never)]
1797 public void IncludeInputRegion(Rectangle inputRegion)
1799 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1804 /// This function excludes input regions.
1805 /// It can be used multiple times and supports multiple regions.
1806 /// It means input region will be reduced.
1807 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1808 /// This input is related to mouse and touch event.
1809 /// If device has touch screen, this function is useful.
1810 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1812 /// <param name="inputRegion">The excluded region to except input events.</param>
1813 [EditorBrowsable(EditorBrowsableState.Never)]
1814 public void ExcludeInputRegion(Rectangle inputRegion)
1816 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1821 /// Sets the pointer constraints lock.
1823 /// <returns>True if PointerConstraintsLock succeeds.</returns>
1824 [EditorBrowsable(EditorBrowsableState.Never)]
1825 public bool PointerConstraintsLock()
1827 bool ret = Interop.Window.PointerConstraintsLock(SwigCPtr);
1828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1833 /// Sets the pointer constraints unlock.
1835 /// <returns>True if PointerConstraintsUnlock succeeds.</returns>
1836 [EditorBrowsable(EditorBrowsableState.Never)]
1837 public bool PointerConstraintsUnlock()
1839 bool ret = Interop.Window.PointerConstraintsUnlock(SwigCPtr);
1840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1845 /// Sets the locked pointer region.
1847 /// <param name="x">The x position.</param>
1848 /// <param name="y">The y position.</param>
1849 /// <param name="width">The width.</param>
1850 /// <param name="height">The height.</param>
1851 [EditorBrowsable(EditorBrowsableState.Never)]
1852 public void LockedPointerRegionSet(int x, int y, int width, int height)
1854 Interop.Window.LockedPointerRegionSet(SwigCPtr, x, y, width, height);
1855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1859 /// Sets the locked pointer cursor position hintset
1861 /// <param name="x">The x position.</param>
1862 /// <param name="y">The y position.</param>
1863 [EditorBrowsable(EditorBrowsableState.Never)]
1864 public void LockedPointerCursorPositionHintSet(int x, int y)
1866 Interop.Window.LockedPointerCursorPositionHintSet(SwigCPtr, x, y);
1867 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1871 /// Sets the pointer warp. The pointer moves to the set coordinates.
1873 /// <param name="x">The x position.</param>
1874 /// <param name="y">The y position.</param>
1875 /// <returns>True if PointerWarp succeeds.</returns>
1876 [EditorBrowsable(EditorBrowsableState.Never)]
1877 public bool PointerWarp(int x, int y)
1879 bool ret = Interop.Window.PointerWarp(SwigCPtr, x, y);
1880 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1885 /// Sets visibility on/off of cursor
1887 /// <param name="visible">The visibility of cursor.</param>
1888 [EditorBrowsable(EditorBrowsableState.Never)]
1889 public void CursorVisibleSet(bool visible)
1891 Interop.Window.CursorVisibleSet(SwigCPtr, visible);
1892 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1896 /// Requests grab key events according to the requested device subtype
1898 /// <param name="deviceSubclass">The deviceSubclass type.</param>
1899 /// <returns>True if KeyboardGrab succeeds.</returns>
1900 [EditorBrowsable(EditorBrowsableState.Never)]
1901 public bool KeyboardGrab(DeviceSubClassType deviceSubclass)
1903 bool ret = Interop.Window.KeyboardGrab(SwigCPtr, (uint)deviceSubclass);
1904 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1909 /// Requests ungrab key events
1911 /// <returns>True if KeyboardUnGrab succeeds.</returns>
1912 [EditorBrowsable(EditorBrowsableState.Never)]
1913 public bool KeyboardUnGrab()
1915 bool ret = Interop.Window.KeyboardUnGrab(SwigCPtr);
1916 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1922 /// Maximizes window's size.
1923 /// If this function is called with true, window will be resized with screen size.
1924 /// Otherwise window will be resized with previous size.
1925 /// It is for the window's MAX button in window's border.
1926 /// If window border is supported by display server, it is not necessary.
1928 /// <param name="max">If window is maximized or unmaximized.</param>
1929 [EditorBrowsable(EditorBrowsableState.Never)]
1930 public void Maximize(bool max)
1932 Interop.Window.Maximize(SwigCPtr, max);
1933 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1937 /// Returns whether the window is maximized or not.
1939 /// <returns>True if the window is maximized, false otherwise.</returns>
1940 [EditorBrowsable(EditorBrowsableState.Never)]
1941 public bool IsMaximized()
1943 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1949 /// Sets window's maximum size.
1951 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1952 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1954 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1957 /// <param name="size">the maximum size.</param>
1958 [EditorBrowsable(EditorBrowsableState.Never)]
1959 public void SetMaximumSize(Size2D size)
1963 throw new ArgumentNullException(nameof(size));
1965 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1967 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1969 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1973 /// Minimizes window's size.
1974 /// If this function is called with true, window will be iconified.
1975 /// Otherwise window will be activated.
1976 /// It is for the window's MIN button in window border.
1977 /// If window border is supported by display server, it is not necessary.
1979 /// <param name="min">If window is minimized or unminimized.</param>
1980 [EditorBrowsable(EditorBrowsableState.Never)]
1981 public void Minimize(bool min)
1983 Interop.Window.Minimize(SwigCPtr, min);
1984 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1988 /// Returns whether the window is minimized or not.
1990 /// <returns>True if the window is minimized, false otherwise.</returns>
1991 [EditorBrowsable(EditorBrowsableState.Never)]
1992 public bool IsMinimized()
1994 bool ret = Interop.Window.IsMinimized(SwigCPtr);
1995 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2000 /// Sets window's minimum size.
2001 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
2002 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
2004 /// <param name="size">the minimum size.</param>
2005 [EditorBrowsable(EditorBrowsableState.Never)]
2006 public void SetMimimumSize(Size2D size)
2010 throw new ArgumentNullException(nameof(size));
2012 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
2014 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
2016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2020 /// Sets the layout of the window.
2022 /// <param name="numCols">The number of columns in the layout.</param>
2023 /// <param name="numRows">The number of rows in the layout.</param>
2024 /// <param name="column">The column number of the window within the layout.</param>
2025 /// <param name="row">The row number of the window within the layout.</param>
2026 /// <param name="colSpan">The number of columns the window should span within the layout.</param>
2027 /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
2028 [EditorBrowsable(EditorBrowsableState.Never)]
2029 public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
2031 Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
2032 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2037 /// Sets the layout of the window.
2039 /// <param name="layoutType">The type of layout to set for the window.</param>
2040 [EditorBrowsable(EditorBrowsableState.Never)]
2041 public void SetLayout(WindowLayoutType layoutType)
2045 case WindowLayoutType.LeftHalf:
2046 Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
2048 case WindowLayoutType.RightHalf:
2049 Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
2052 case WindowLayoutType.TopHalf:
2053 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
2055 case WindowLayoutType.BottomHalf:
2056 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
2059 case WindowLayoutType.UpperLeftQuarter:
2060 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
2062 case WindowLayoutType.UpperRightQuarter:
2063 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
2065 case WindowLayoutType.LowerLeftQuarter:
2066 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
2068 case WindowLayoutType.LowerRightQuarter:
2069 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
2072 case WindowLayoutType.LeftThird:
2073 Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
2075 case WindowLayoutType.CenterThird:
2076 Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
2078 case WindowLayoutType.RightThird:
2079 Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
2082 case WindowLayoutType.TopThird:
2083 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
2085 case WindowLayoutType.MiddleThird:
2086 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
2088 case WindowLayoutType.BottomThird:
2089 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
2092 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2097 /// Query whether window is rotating or not.
2099 /// <returns>True if window is rotating, false otherwise.</returns>
2100 [EditorBrowsable(EditorBrowsableState.Never)]
2101 public bool IsWindowRotating()
2103 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
2104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2109 /// Gets the last key event the window gets.
2112 /// We will use weak reference of last key events.
2113 /// Return value will be invalidated if last key event changed internally.
2115 /// <returns>The last key event the window gets.</returns>
2116 [EditorBrowsable(EditorBrowsableState.Never)]
2117 public Key GetLastKeyEvent()
2119 if (internalLastKeyEvent == null)
2121 // Create empty event handle without register.
2122 internalLastKeyEvent = new Key(Interop.Key.New(), true, false);
2124 Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr);
2125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2126 return internalLastKeyEvent;
2130 /// Gets the last touch event the window gets.
2133 /// We will use weak reference of last touch events.
2134 /// Return value will be invalidated if last touch event changed internally.
2136 /// <returns>The last touch event the window gets.</returns>
2137 [EditorBrowsable(EditorBrowsableState.Never)]
2138 public Touch GetLastTouchEvent()
2140 if (internalLastTouchEvent == null)
2142 // Create empty event handle without register.
2143 internalLastTouchEvent = new Touch(Interop.Touch.NewTouch(), true, false);
2145 Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr);
2146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2147 return internalLastTouchEvent;
2151 /// Gets the last hover event the window gets.
2154 /// We will use weak reference of last hover events.
2155 /// Return value will be invalidated if last hover event changed internally.
2157 /// <returns>The last hover event the window gets.</returns>
2158 [EditorBrowsable(EditorBrowsableState.Never)]
2159 public Hover GetLastHoverEvent()
2161 if (internalLastHoverEvent == null)
2163 // Create empty event handle without register.
2164 internalLastHoverEvent = new Hover(Interop.Hover.New(0u), true, false);
2166 Interop.Window.InternalRetrievingLastHoverEvent(SwigCPtr, internalLastHoverEvent.SwigCPtr);
2167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2168 return internalLastHoverEvent;
2172 /// Sets the necessary for window rotation Acknowledgement.
2173 /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
2175 /// This function is supprot that application has the window rotation acknowledgement's control.
2176 /// It means display server waits when application's rotation work is finished.
2177 /// It is useful application has the other rendering engine which works asynchronous.
2178 /// For instance, GlView.
2180 /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
2181 [EditorBrowsable(EditorBrowsableState.Never)]
2182 public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
2184 Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
2185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2189 /// send the Acknowledgement to complete window rotation.
2190 /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
2192 [EditorBrowsable(EditorBrowsableState.Never)]
2193 public void SendRotationCompletedAcknowledgement()
2195 Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
2196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2200 /// Add FrameUpdateCallback
2202 [EditorBrowsable(EditorBrowsableState.Never)]
2203 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2205 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
2209 /// Remove FrameUpdateCallback
2211 [EditorBrowsable(EditorBrowsableState.Never)]
2212 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2214 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
2218 /// Dispose for Window
2220 [EditorBrowsable(EditorBrowsableState.Never)]
2221 protected override void Dispose(DisposeTypes type)
2228 this.DisconnectNativeSignals();
2230 if (type == DisposeTypes.Explicit)
2233 //Release your own managed resources here.
2234 //You should release all of your own disposable objects here.
2236 if (IsBorderEnabled)
2241 foreach (var layer in childLayers)
2249 childLayers.Clear();
2251 localController?.Dispose();
2253 internalLastKeyEvent?.Dispose();
2254 internalLastKeyEvent = null;
2255 internalLastTouchEvent?.Dispose();
2256 internalLastTouchEvent = null;
2257 internalLastHoverEvent?.Dispose();
2258 internalLastHoverEvent = null;
2260 internalHoverTimer?.Stop();
2261 internalHoverTimer?.Dispose();
2262 internalHoverTimer = null;
2269 /// This will not be public opened.
2270 [EditorBrowsable(EditorBrowsableState.Never)]
2271 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2273 Interop.Window.DeleteWindow(swigCPtr);
2276 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
2278 private static readonly object locker = new object();
2280 private static int key = 0;
2282 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
2284 private struct internalHookCallbackType
2286 public FrameCallbackType userCallback;
2290 private static void OnInternalHookFrameCallback(int id)
2294 if (frameCallbackList.ContainsKey(id))
2296 if (frameCallbackList[id].userCallback != null)
2298 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
2299 frameCallbackList.Remove(id);
2303 NUILog.Error($"found userCallback is NULL");
2304 frameCallbackList.Remove(id);
2310 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2312 if (null == callback)
2314 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2316 var assignedKey = 0;
2321 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2323 userCallback = callback,
2331 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2333 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2334 [EditorBrowsable(EditorBrowsableState.Never)]
2335 public delegate void FrameCallbackType(int frameId);
2338 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2339 /// A callback of the following type may be used:
2341 /// void MyFunction( int frameId )
2343 /// This callback will be deleted once it is called.
2345 /// Ownership of the callback is passed onto this class
2348 /// <param name="callback">The function to call</param>
2349 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2350 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2351 [EditorBrowsable(EditorBrowsableState.Never)]
2352 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2354 var assignedKey = AddInterHookCallback(callback, frameId);
2355 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2357 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2361 /// Adds a callback that is called when the frame is displayed on the display.
2362 /// A callback of the following type may be used:
2364 /// void MyFunction( int frameId )
2366 /// This callback will be deleted once it is called.
2368 /// Ownership of the callback is passed onto this class
2371 /// <param name="callback">The function to call</param>
2372 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2373 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2374 [EditorBrowsable(EditorBrowsableState.Never)]
2375 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2377 var assignedKey = AddInterHookCallback(callback, frameId);
2378 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2384 /// Search through this Window for a Layer with the given unique ID.
2386 /// <param name="id">The ID of the Layer to find.</param>
2387 /// <remarks>Hidden-API</remarks>
2388 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2389 [EditorBrowsable(EditorBrowsableState.Never)]
2390 public Layer FindLayerByID(uint id)
2392 Layer defaultLayer = this.GetDefaultLayer();
2393 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2394 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2396 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2401 /// Get Native Window handle.
2403 /// How to get Native Window handle
2405 /// Window window = NUIApplication.GetDefaultWindow();
2406 /// var handle = window.NativeHandle;
2407 /// if(handle.IsInvalid == false)
2409 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2410 /// // do something with nativeHandle
2415 /// <since_tizen> 9 </since_tizen>
2416 public SafeHandle NativeHandle
2420 return new NUI.SafeNativeWindowHandle(this);