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 global::System.IntPtr cPtr = Interop.Stage.GetRenderTaskList(stageCPtr);
1559 RenderTaskList ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as RenderTaskList;
1562 HandleRef CPtr = new HandleRef(this, cPtr);
1563 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1564 CPtr = new HandleRef(null, global::System.IntPtr.Zero);
1568 ret = new RenderTaskList(cPtr, true);
1571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1576 /// Queries the number of on-window layers.
1578 /// <returns>The number of layers.</returns>
1579 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1580 internal uint GetLayerCount()
1582 if (LayersChildren == null || LayersChildren.Count < 0)
1585 return (uint)LayersChildren.Count;
1588 internal Layer GetRootLayer()
1592 if (borderLayer == null)
1594 borderLayer = GetBorderWindowRootLayer();
1595 LayersChildren?.Add(borderLayer);
1596 borderLayer.SetWindow(this);
1602 // Window.IsInstalled() is actually true only when called from event thread and
1603 // Core has been initialized, not when Stage is ready.
1604 if (rootLayer == null && Window.IsInstalled())
1606 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1607 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1608 LayersChildren?.Add(rootLayer);
1609 rootLayer.SetWindow(this);
1615 internal void SetBackgroundColor(Vector4 color)
1617 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1621 internal Vector4 GetBackgroundColor()
1623 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1624 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1628 internal Vector2 GetDpi()
1630 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1635 internal ObjectRegistry GetObjectRegistry()
1637 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1642 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1644 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1645 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1648 internal RenderingBehaviorType GetRenderingBehavior()
1650 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1651 if (NDalicPINVOKE.SWIGPendingException.Pending)
1652 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1656 internal void SetWindowSize(Size2D size)
1660 throw new ArgumentNullException(nameof(size));
1662 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1664 convertBorderWindowSizeToRealWindowSize(val);
1666 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1668 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1669 // Resetting Window size should request a relayout of the tree.
1672 internal Size2D GetWindowSize()
1674 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1676 convertRealWindowSizeToBorderWindowSize(val);
1678 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1679 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1684 internal void SetPosition(Position2D position)
1686 if (null == position)
1688 throw new ArgumentNullException(nameof(position));
1690 var val = new Int32Pair(position.X, position.Y);
1691 Interop.Window.SetPosition(SwigCPtr, Int32Pair.getCPtr(val));
1693 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1694 // Setting Position of the window should request a relayout of the tree.
1697 internal Position2D GetPosition()
1699 var val = new Int32Pair(Interop.Window.GetPosition(SwigCPtr), true);
1700 Position2D ret = new Position2D((int)val.GetX(), (int)val.GetY());
1702 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1706 internal void SetPositionSize(Rectangle positionSize)
1708 if (positionSize == null)
1710 throw new ArgumentNullException(nameof(positionSize));
1712 var val = new Uint16Pair((uint)positionSize.Width, (uint)positionSize.Height);
1714 convertBorderWindowSizeToRealWindowSize(val);
1716 positionSize.Width = val.GetX();
1717 positionSize.Height = val.GetY();
1719 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1724 // Setting Position of the window should request a relayout of the tree.
1728 /// Set the window use partial update or not.
1730 /// <param name="enabled">If window enable partial update or disable.</param>
1731 internal void SetPartialUpdate(bool enabled)
1733 Interop.Window.SetPartialUpdateEnabled(SwigCPtr, enabled);
1734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1738 /// Returns whether the window is enabled partial update or not.
1740 /// <returns>True if the window is enabled partial update, false otherwise.</returns>
1741 internal bool IsPartialUpdate()
1743 bool ret = Interop.Window.IsPartialUpdateEnabled(SwigCPtr);
1744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1749 /// Enables the floating mode of window.
1750 /// The floating mode is to support window is moved or resized by display server.
1751 /// For example, if the video-player window sets the floating mode,
1752 /// then display server changes its geometry and handles it like a popup.
1753 /// The way of handling floating mode window is decided by display server.
1754 /// A special display server(as a Tizen display server) supports this mode.
1756 /// <param name="enable">Enable floating mode or not.</param>
1757 [EditorBrowsable(EditorBrowsableState.Never)]
1758 public void EnableFloatingMode(bool enable)
1760 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1761 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1765 /// Returns whether the window is floating mode or not.
1767 /// <returns>True if the window is enabled floating mode, false otherwise.</returns>
1768 [EditorBrowsable(EditorBrowsableState.Never)]
1769 public bool IsFloatingModeEnabled()
1771 bool ret = Interop.Window.IsFloatingModeEnabled(SwigCPtr);
1772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1777 /// Requests to display server for the window is moved by display server.
1778 /// It can be work with setting window floating mode.
1780 [EditorBrowsable(EditorBrowsableState.Never)]
1781 public void RequestMoveToServer()
1783 Interop.Window.RequestMoveToServer(SwigCPtr);
1784 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1788 /// Requests to display server for the window is resized by display server.
1789 /// It can be work with setting window floating mode.
1791 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1792 [EditorBrowsable(EditorBrowsableState.Never)]
1793 public void RequestResizeToServer(ResizeDirection direction)
1795 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1800 /// Includes input region.
1801 /// This function inlcudes input regions.
1802 /// It can be used multiple times and supports multiple regions.
1803 /// It means input region will be extended.
1804 /// This input is related to mouse and touch event.
1805 /// If device has touch screen, this function is useful.
1806 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1808 /// <param name="inputRegion">The included region to accept input events.</param>
1809 [EditorBrowsable(EditorBrowsableState.Never)]
1810 public void IncludeInputRegion(Rectangle inputRegion)
1812 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1817 /// This function excludes input regions.
1818 /// It can be used multiple times and supports multiple regions.
1819 /// It means input region will be reduced.
1820 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1821 /// This input is related to mouse and touch event.
1822 /// If device has touch screen, this function is useful.
1823 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1825 /// <param name="inputRegion">The excluded region to except input events.</param>
1826 [EditorBrowsable(EditorBrowsableState.Never)]
1827 public void ExcludeInputRegion(Rectangle inputRegion)
1829 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1834 /// Sets the pointer constraints lock.
1836 /// <returns>True if PointerConstraintsLock succeeds.</returns>
1837 [EditorBrowsable(EditorBrowsableState.Never)]
1838 public bool PointerConstraintsLock()
1840 bool ret = Interop.Window.PointerConstraintsLock(SwigCPtr);
1841 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1846 /// Sets the pointer constraints unlock.
1848 /// <returns>True if PointerConstraintsUnlock succeeds.</returns>
1849 [EditorBrowsable(EditorBrowsableState.Never)]
1850 public bool PointerConstraintsUnlock()
1852 bool ret = Interop.Window.PointerConstraintsUnlock(SwigCPtr);
1853 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1858 /// Sets the locked pointer region.
1860 /// <param name="x">The x position.</param>
1861 /// <param name="y">The y position.</param>
1862 /// <param name="width">The width.</param>
1863 /// <param name="height">The height.</param>
1864 [EditorBrowsable(EditorBrowsableState.Never)]
1865 public void LockedPointerRegionSet(int x, int y, int width, int height)
1867 Interop.Window.LockedPointerRegionSet(SwigCPtr, x, y, width, height);
1868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1872 /// Sets the locked pointer cursor position hintset
1874 /// <param name="x">The x position.</param>
1875 /// <param name="y">The y position.</param>
1876 [EditorBrowsable(EditorBrowsableState.Never)]
1877 public void LockedPointerCursorPositionHintSet(int x, int y)
1879 Interop.Window.LockedPointerCursorPositionHintSet(SwigCPtr, x, y);
1880 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1884 /// Sets the pointer warp. The pointer moves to the set coordinates.
1886 /// <param name="x">The x position.</param>
1887 /// <param name="y">The y position.</param>
1888 /// <returns>True if PointerWarp succeeds.</returns>
1889 [EditorBrowsable(EditorBrowsableState.Never)]
1890 public bool PointerWarp(int x, int y)
1892 bool ret = Interop.Window.PointerWarp(SwigCPtr, x, y);
1893 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1898 /// Sets visibility on/off of cursor
1900 /// <param name="visible">The visibility of cursor.</param>
1901 [EditorBrowsable(EditorBrowsableState.Never)]
1902 public void CursorVisibleSet(bool visible)
1904 Interop.Window.CursorVisibleSet(SwigCPtr, visible);
1905 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1909 /// Requests grab key events according to the requested device subtype
1911 /// <param name="deviceSubclass">The deviceSubclass type.</param>
1912 /// <returns>True if KeyboardGrab succeeds.</returns>
1913 [EditorBrowsable(EditorBrowsableState.Never)]
1914 public bool KeyboardGrab(DeviceSubClassType deviceSubclass)
1916 bool ret = Interop.Window.KeyboardGrab(SwigCPtr, (uint)deviceSubclass);
1917 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1922 /// Requests ungrab key events
1924 /// <returns>True if KeyboardUnGrab succeeds.</returns>
1925 [EditorBrowsable(EditorBrowsableState.Never)]
1926 public bool KeyboardUnGrab()
1928 bool ret = Interop.Window.KeyboardUnGrab(SwigCPtr);
1929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1935 /// Maximizes window's size.
1936 /// If this function is called with true, window will be resized with screen size.
1937 /// Otherwise window will be resized with previous size.
1938 /// It is for the window's MAX button in window's border.
1939 /// If window border is supported by display server, it is not necessary.
1941 /// <param name="max">If window is maximized or unmaximized.</param>
1942 [EditorBrowsable(EditorBrowsableState.Never)]
1943 public void Maximize(bool max)
1945 Interop.Window.Maximize(SwigCPtr, max);
1946 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1950 /// Returns whether the window is maximized or not.
1952 /// <returns>True if the window is maximized, false otherwise.</returns>
1953 [EditorBrowsable(EditorBrowsableState.Never)]
1954 public bool IsMaximized()
1956 bool ret = Interop.Window.IsMaximized(SwigCPtr);
1957 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1962 /// Sets window's maximum size.
1964 /// It is to set the maximized size when window is maximized or the window's size is increased by RequestResizeToServer().
1965 /// Although the size is set by this function, window's size can be increased over the limitation by SetPositionSize() or SetSize().
1967 /// After setting, if Maximize() is called, window is resized with the setting size and move the center.
1970 /// <param name="size">the maximum size.</param>
1971 [EditorBrowsable(EditorBrowsableState.Never)]
1972 public void SetMaximumSize(Size2D size)
1976 throw new ArgumentNullException(nameof(size));
1978 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1980 Interop.Window.SetMaximumSize(SwigCPtr, Uint16Pair.getCPtr(val));
1982 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1986 /// Minimizes window's size.
1987 /// If this function is called with true, window will be iconified.
1988 /// Otherwise window will be activated.
1989 /// It is for the window's MIN button in window border.
1990 /// If window border is supported by display server, it is not necessary.
1992 /// <param name="min">If window is minimized or unminimized.</param>
1993 [EditorBrowsable(EditorBrowsableState.Never)]
1994 public void Minimize(bool min)
1996 Interop.Window.Minimize(SwigCPtr, min);
1997 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2001 /// Returns whether the window is minimized or not.
2003 /// <returns>True if the window is minimized, false otherwise.</returns>
2004 [EditorBrowsable(EditorBrowsableState.Never)]
2005 public bool IsMinimized()
2007 bool ret = Interop.Window.IsMinimized(SwigCPtr);
2008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2013 /// Sets window's minimum size.
2014 /// It is to set the minimum size when window's size is decreased by RequestResizeToServer().
2015 /// Although the size is set by this function, window's size can be decreased over the limitation by SetPositionSize() or SetSize().
2017 /// <param name="size">the minimum size.</param>
2018 [EditorBrowsable(EditorBrowsableState.Never)]
2019 public void SetMimimumSize(Size2D size)
2023 throw new ArgumentNullException(nameof(size));
2025 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
2027 Interop.Window.SetMimimumSize(SwigCPtr, Uint16Pair.getCPtr(val));
2029 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2033 /// Sets the layout of the window.
2035 /// <param name="numCols">The number of columns in the layout.</param>
2036 /// <param name="numRows">The number of rows in the layout.</param>
2037 /// <param name="column">The column number of the window within the layout.</param>
2038 /// <param name="row">The row number of the window within the layout.</param>
2039 /// <param name="colSpan">The number of columns the window should span within the layout.</param>
2040 /// <param name="rowSpan">The number of rows the window should span within the layout.</param>
2041 [EditorBrowsable(EditorBrowsableState.Never)]
2042 public void SetLayout(uint numCols, uint numRows, uint column, uint row, uint colSpan, uint rowSpan)
2044 Interop.Window.SetLayout(SwigCPtr, numCols, numRows, column, row, colSpan, rowSpan);
2045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2050 /// Sets the layout of the window.
2052 /// <param name="layoutType">The type of layout to set for the window.</param>
2053 [EditorBrowsable(EditorBrowsableState.Never)]
2054 public void SetLayout(WindowLayoutType layoutType)
2058 case WindowLayoutType.LeftHalf:
2059 Interop.Window.SetLayout(SwigCPtr, 2, 1, 0, 0, 1, 1);
2061 case WindowLayoutType.RightHalf:
2062 Interop.Window.SetLayout(SwigCPtr, 2, 1, 1, 0, 1, 1);
2065 case WindowLayoutType.TopHalf:
2066 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 0, 1, 1);
2068 case WindowLayoutType.BottomHalf:
2069 Interop.Window.SetLayout(SwigCPtr, 1, 2, 0, 1, 1, 1);
2072 case WindowLayoutType.UpperLeftQuarter:
2073 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 0, 1, 1);
2075 case WindowLayoutType.UpperRightQuarter:
2076 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 0, 1, 1);
2078 case WindowLayoutType.LowerLeftQuarter:
2079 Interop.Window.SetLayout(SwigCPtr, 2, 2, 0, 1, 1, 1);
2081 case WindowLayoutType.LowerRightQuarter:
2082 Interop.Window.SetLayout(SwigCPtr, 2, 2, 1, 1, 1, 1);
2085 case WindowLayoutType.LeftThird:
2086 Interop.Window.SetLayout(SwigCPtr, 3, 1, 0, 0, 1, 1);
2088 case WindowLayoutType.CenterThird:
2089 Interop.Window.SetLayout(SwigCPtr, 3, 1, 1, 0, 1, 1);
2091 case WindowLayoutType.RightThird:
2092 Interop.Window.SetLayout(SwigCPtr, 3, 1, 2, 0, 1, 1);
2095 case WindowLayoutType.TopThird:
2096 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 0, 1, 1);
2098 case WindowLayoutType.MiddleThird:
2099 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 1, 1, 1);
2101 case WindowLayoutType.BottomThird:
2102 Interop.Window.SetLayout(SwigCPtr, 1, 3, 0, 2, 1, 1);
2105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2110 /// Query whether window is rotating or not.
2112 /// <returns>True if window is rotating, false otherwise.</returns>
2113 [EditorBrowsable(EditorBrowsableState.Never)]
2114 public bool IsWindowRotating()
2116 bool ret = Interop.Window.IsWindowRotating(SwigCPtr);
2117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2122 /// Gets the last key event the window gets.
2125 /// We will use weak reference of last key events.
2126 /// Return value will be invalidated if last key event changed internally.
2128 /// <returns>The last key event the window gets.</returns>
2129 [EditorBrowsable(EditorBrowsableState.Never)]
2130 public Key GetLastKeyEvent()
2132 if (internalLastKeyEvent == null)
2134 // Create empty event handle without register.
2135 internalLastKeyEvent = new Key(Interop.Key.New(), true, false);
2137 Interop.Window.InternalRetrievingLastKeyEvent(SwigCPtr, internalLastKeyEvent.SwigCPtr);
2138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2139 return internalLastKeyEvent;
2143 /// Gets the last touch event the window gets.
2146 /// We will use weak reference of last touch events.
2147 /// Return value will be invalidated if last touch event changed internally.
2149 /// <returns>The last touch event the window gets.</returns>
2150 [EditorBrowsable(EditorBrowsableState.Never)]
2151 public Touch GetLastTouchEvent()
2153 if (internalLastTouchEvent == null)
2155 // Create empty event handle without register.
2156 internalLastTouchEvent = new Touch(Interop.Touch.NewTouch(), true, false);
2158 Interop.Window.InternalRetrievingLastTouchEvent(SwigCPtr, internalLastTouchEvent.SwigCPtr);
2159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2160 return internalLastTouchEvent;
2164 /// Gets the last hover event the window gets.
2167 /// We will use weak reference of last hover events.
2168 /// Return value will be invalidated if last hover event changed internally.
2170 /// <returns>The last hover event the window gets.</returns>
2171 [EditorBrowsable(EditorBrowsableState.Never)]
2172 public Hover GetLastHoverEvent()
2174 if (internalLastHoverEvent == null)
2176 // Create empty event handle without register.
2177 internalLastHoverEvent = new Hover(Interop.Hover.New(0u), true, false);
2179 Interop.Window.InternalRetrievingLastHoverEvent(SwigCPtr, internalLastHoverEvent.SwigCPtr);
2180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2181 return internalLastHoverEvent;
2185 /// Sets the necessary for window rotation Acknowledgement.
2186 /// After this function called, SendRotationCompletedAcknowledgement() should be called to complete window rotation.
2188 /// This function is supprot that application has the window rotation acknowledgement's control.
2189 /// It means display server waits when application's rotation work is finished.
2190 /// It is useful application has the other rendering engine which works asynchronous.
2191 /// For instance, GlView.
2193 /// <param name="needAcknowledgement">the flag is true if window rotation acknowledge is sent.</param>
2194 [EditorBrowsable(EditorBrowsableState.Never)]
2195 public void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
2197 Interop.Window.SetNeedsRotationCompletedAcknowledgement(SwigCPtr, needAcknowledgement);
2198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2202 /// send the Acknowledgement to complete window rotation.
2203 /// For this function, SetNeedsRotationCompletedAcknowledgement should be already called with true.
2205 [EditorBrowsable(EditorBrowsableState.Never)]
2206 public void SendRotationCompletedAcknowledgement()
2208 Interop.Window.SendRotationCompletedAcknowledgement(SwigCPtr);
2209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2213 /// Add FrameUpdateCallback
2215 [EditorBrowsable(EditorBrowsableState.Never)]
2216 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2218 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
2222 /// Remove FrameUpdateCallback
2224 [EditorBrowsable(EditorBrowsableState.Never)]
2225 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
2227 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
2231 /// Dispose for Window
2233 [EditorBrowsable(EditorBrowsableState.Never)]
2234 protected override void Dispose(DisposeTypes type)
2241 this.DisconnectNativeSignals();
2243 if (type == DisposeTypes.Explicit)
2246 //Release your own managed resources here.
2247 //You should release all of your own disposable objects here.
2249 if (IsBorderEnabled)
2254 foreach (var layer in childLayers)
2262 childLayers.Clear();
2264 localController?.Dispose();
2266 internalLastKeyEvent?.Dispose();
2267 internalLastKeyEvent = null;
2268 internalLastTouchEvent?.Dispose();
2269 internalLastTouchEvent = null;
2270 internalLastHoverEvent?.Dispose();
2271 internalLastHoverEvent = null;
2273 internalHoverTimer?.Stop();
2274 internalHoverTimer?.Dispose();
2275 internalHoverTimer = null;
2282 /// This will not be public opened.
2283 [EditorBrowsable(EditorBrowsableState.Never)]
2284 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
2286 Interop.Window.DeleteWindow(swigCPtr);
2289 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
2291 private static readonly object locker = new object();
2293 private static int key = 0;
2295 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
2297 private struct internalHookCallbackType
2299 public FrameCallbackType userCallback;
2303 private static void OnInternalHookFrameCallback(int id)
2307 if (frameCallbackList.ContainsKey(id))
2309 if (frameCallbackList[id].userCallback != null)
2311 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
2312 frameCallbackList.Remove(id);
2316 NUILog.Error($"found userCallback is NULL");
2317 frameCallbackList.Remove(id);
2323 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
2325 if (null == callback)
2327 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
2329 var assignedKey = 0;
2334 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
2336 userCallback = callback,
2344 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
2346 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2347 [EditorBrowsable(EditorBrowsableState.Never)]
2348 public delegate void FrameCallbackType(int frameId);
2351 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
2352 /// A callback of the following type may be used:
2354 /// void MyFunction( int frameId )
2356 /// This callback will be deleted once it is called.
2358 /// Ownership of the callback is passed onto this class
2361 /// <param name="callback">The function to call</param>
2362 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2363 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2364 [EditorBrowsable(EditorBrowsableState.Never)]
2365 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
2367 var assignedKey = AddInterHookCallback(callback, frameId);
2368 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2370 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2374 /// Adds a callback that is called when the frame is displayed on the display.
2375 /// A callback of the following type may be used:
2377 /// void MyFunction( int frameId )
2379 /// This callback will be deleted once it is called.
2381 /// Ownership of the callback is passed onto this class
2384 /// <param name="callback">The function to call</param>
2385 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
2386 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
2387 [EditorBrowsable(EditorBrowsableState.Never)]
2388 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
2390 var assignedKey = AddInterHookCallback(callback, frameId);
2391 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
2393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2397 /// Search through this Window for a Layer with the given unique ID.
2399 /// <param name="id">The ID of the Layer to find.</param>
2400 /// <remarks>Hidden-API</remarks>
2401 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
2402 [EditorBrowsable(EditorBrowsableState.Never)]
2403 public Layer FindLayerByID(uint id)
2405 Layer defaultLayer = this.GetDefaultLayer();
2406 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
2407 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
2409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2414 /// Get Native Window handle.
2416 /// How to get Native Window handle
2418 /// Window window = NUIApplication.GetDefaultWindow();
2419 /// var handle = window.NativeHandle;
2420 /// if(handle.IsInvalid == false)
2422 /// IntPtr nativeHandle = handle.DangerousGetHandle();
2423 /// // do something with nativeHandle
2428 /// <since_tizen> 9 </since_tizen>
2429 public SafeHandle NativeHandle
2433 return new NUI.SafeNativeWindowHandle(this);