2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 extern alias TizenSystemInformation;
19 using TizenSystemInformation.Tizen.System;
22 using System.ComponentModel;
23 using System.Collections.Generic;
24 using System.Runtime.InteropServices;
26 using Tizen.NUI.BaseComponents;
31 /// The window class is used internally for drawing.<br />
32 /// The window has an orientation and indicator properties.<br />
34 /// <since_tizen> 3 </since_tizen>
35 public partial class Window : BaseHandle
37 private HandleRef stageCPtr;
38 private Layer rootLayer;
39 private string windowTitle;
40 private List<Layer> childLayers = new List<Layer>();
41 private LayoutController localController;
43 static internal bool IsSupportedMultiWindow()
45 bool isSupported = false;
46 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
50 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
52 if (Interop.Stage.IsInstalled())
54 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.GetCurrent());
56 localController = new LayoutController(this);
57 NUILog.Debug("layoutController id:" + localController.GetId());
62 /// A helper method to get the current window where the view is added
64 /// <param name="view">The View added to the window</param>
65 /// <returns>A Window.</returns>
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 static public Window Get(View view)
71 NUILog.Error("if there is no view, it can not get a window");
75 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.Get(View.getCPtr(view))) as Window;
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 /// Creates a new Window.<br />
82 /// This creates an extra window in addition to the default main window<br />
84 /// <param name="windowPosition">The position and size of the Window.</param>
85 /// <param name="isTranslucent">Whether Window is translucent.</param>
86 /// <returns>A new Window.</returns>
87 /// <since_tizen> 6 </since_tizen>
88 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
89 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
90 public Window(Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
92 if (IsSupportedMultiWindow() == false)
94 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 /// Creates a new Window with a specific name.<br />
101 /// This creates an extra window in addition to the default main window<br />
103 /// <param name="name">The name for extra window. </param>
104 /// <param name="windowPosition">The position and size of the Window.</param>
105 /// <param name="isTranslucent">Whether Window is translucent.</param>
106 /// <returns>A new Window.</returns>
107 /// <since_tizen> 6 </since_tizen>
108 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
109 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
110 public Window(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.New(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
112 if (IsSupportedMultiWindow() == false)
114 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
116 this.windowTitle = name;
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
123 /// <since_tizen> 3 </since_tizen>
124 public enum WindowOrientation
127 /// Portrait orientation. The height of the display area is greater than the width.
129 /// <since_tizen> 3 </since_tizen>
132 /// Landscape orientation. A wide view area is needed.
134 /// <since_tizen> 3 </since_tizen>
137 /// Portrait inverse orientation.
139 /// <since_tizen> 3 </since_tizen>
140 PortraitInverse = 180,
142 /// Landscape inverse orientation.
144 /// <since_tizen> 3 </since_tizen>
145 LandscapeInverse = 270,
147 /// No orientation. It is for the preferred orientation
148 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
149 /// It is used to unset the preferred orientation with SetPreferredOrientation.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 NoOrientationPreference = -1
156 /// Enumeration for the key grab mode for platform-level APIs.
158 /// <since_tizen> 3 </since_tizen>
159 public enum KeyGrabMode
162 /// Grabs a key only when on the top of the grabbing-window stack mode.
166 /// Grabs a key together with the other client window(s) mode.
170 /// 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.
174 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
180 /// Enumeration for transition effect's state.
182 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState instead!")]
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 public enum EffectStates
189 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.None instead!")]
190 [EditorBrowsable(EditorBrowsableState.Never)]
193 /// Transition effect is started.
195 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.Start instead!")]
196 [EditorBrowsable(EditorBrowsableState.Never)]
199 /// Transition effect is ended.
201 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.End instead!")]
202 [EditorBrowsable(EditorBrowsableState.Never)]
207 /// Enumeration for transition effect's state.
209 [EditorBrowsable(EditorBrowsableState.Never)]
210 public enum EffectState
215 [EditorBrowsable(EditorBrowsableState.Never)]
218 /// Transition effect is started.
220 [EditorBrowsable(EditorBrowsableState.Never)]
223 /// Transition effect is ended.
225 [EditorBrowsable(EditorBrowsableState.Never)]
230 /// Enumeration for transition effect's type.
232 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType instead!")]
233 [EditorBrowsable(EditorBrowsableState.Never)]
234 public enum EffectTypes
239 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.None instead!")]
240 [EditorBrowsable(EditorBrowsableState.Never)]
243 /// Window show effect.
245 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Show instead!")]
246 [EditorBrowsable(EditorBrowsableState.Never)]
249 /// Window hide effect.
251 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Hide instead!")]
252 [EditorBrowsable(EditorBrowsableState.Never)]
257 /// Enumeration for transition effect's type.
259 [EditorBrowsable(EditorBrowsableState.Never)]
260 public enum EffectType
265 [EditorBrowsable(EditorBrowsableState.Never)]
268 /// Window show effect.
270 [EditorBrowsable(EditorBrowsableState.Never)]
273 /// Window hide effect.
275 [EditorBrowsable(EditorBrowsableState.Never)]
280 /// Enumeration for result of window operation.
282 internal enum OperationResult
285 /// Failed for unknown reason
293 /// Permission denied
297 /// The operation is not supported.
303 /// Enumeration for window resized mode by display server.
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public enum ResizeDirection
309 /// Start resizing window to the top-left edge.
311 [EditorBrowsable(EditorBrowsableState.Never)]
314 /// Start resizing window to the top side.
316 [EditorBrowsable(EditorBrowsableState.Never)]
319 /// Start resizing window to the top-right edge.
321 [EditorBrowsable(EditorBrowsableState.Never)]
324 /// Start resizing window to the left side.
326 [EditorBrowsable(EditorBrowsableState.Never)]
329 /// Start resizing window to the right side.
331 [EditorBrowsable(EditorBrowsableState.Never)]
334 /// Start resizing window to the bottom-left edge.
336 [EditorBrowsable(EditorBrowsableState.Never)]
339 /// Start resizing window to the bottom side.
341 [EditorBrowsable(EditorBrowsableState.Never)]
344 /// Start resizing window to the bottom-right edge.
346 [EditorBrowsable(EditorBrowsableState.Never)]
352 /// The stage instance property (read-only).<br />
353 /// Gets the current window.<br />
355 /// <since_tizen> 3 </since_tizen>
356 public static Window Instance { get; internal set; }
359 /// Gets or sets a window type.
361 /// <since_tizen> 3 </since_tizen>
362 public WindowType Type
366 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
372 Interop.Window.SetType(SwigCPtr, (int)value);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
378 /// Gets/Sets a window title.
380 /// <since_tizen> 4 </since_tizen>
390 SetClass(windowTitle, "");
395 /// The rendering behavior of a Window.
397 /// <since_tizen> 5 </since_tizen>
398 public RenderingBehaviorType RenderingBehavior
402 return GetRenderingBehavior();
406 SetRenderingBehavior(value);
411 /// The window size property (read-only).
413 /// <since_tizen> 3 </since_tizen>
418 Size2D ret = GetSize();
424 /// The background color property.
426 /// <since_tizen> 3 </since_tizen>
427 public Color BackgroundColor
431 SetBackgroundColor(value);
435 Color ret = GetBackgroundColor();
441 /// The DPI property (read-only).<br />
442 /// Retrieves the DPI of the display device to which the Window is connected.<br />
444 /// <since_tizen> 3 </since_tizen>
454 /// The layer count property (read-only).<br />
455 /// Queries the number of on-Window layers.<br />
457 /// <since_tizen> 3 </since_tizen>
458 public uint LayerCount
462 return GetLayerCount();
467 /// Gets or sets a size of the window.
469 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
470 /// <since_tizen> 4 </since_tizen>
471 public Size2D WindowSize
475 return GetWindowSize();
479 SetWindowSize(value);
484 /// Gets or sets a position of the window.
486 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
487 /// <since_tizen> 4 </since_tizen>
488 public Position2D WindowPosition
492 return GetPosition();
501 /// Sets position and size of the window. This API guarantees that
502 /// both moving and resizing of window will appear on the screen at once.
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 public Rectangle WindowPositionSize
509 Position2D position = GetPosition();
510 Size2D size = GetSize();
511 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
517 SetPositionSize(value);
521 internal static Vector4 DEFAULT_BACKGROUND_COLOR
525 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
526 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 internal static Vector4 DEBUG_BACKGROUND_COLOR
536 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
537 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543 internal List<Layer> LayersChildren
552 /// Get the LayoutController for this Window.
554 internal LayoutController LayoutController
558 return localController;
563 /// Feed a key-event into the window.
565 /// <param name="keyEvent">The key event to feed.</param>
566 /// <since_tizen> 4 </since_tizen>
567 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
568 public static void FeedKeyEvent(Key keyEvent)
570 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575 /// Sets whether the window accepts a focus or not.
577 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
578 /// <since_tizen> 3 </since_tizen>
579 public void SetAcceptFocus(bool accept)
581 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586 /// Returns whether the window accepts a focus or not.
588 /// <returns>True if the window accepts a focus, false otherwise.</returns>
589 /// <since_tizen> 3 </since_tizen>
590 public bool IsFocusAcceptable()
592 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 /// Shows the window if it is hidden.
601 /// <since_tizen> 3 </since_tizen>
604 Interop.Window.Show(SwigCPtr);
605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609 /// Hides the window if it is showing.
611 /// <since_tizen> 3 </since_tizen>
614 Interop.Window.Hide(SwigCPtr);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619 /// Retrieves whether the window is visible or not.
621 /// <returns>True if the window is visible.</returns>
622 /// <since_tizen> 3 </since_tizen>
623 public bool IsVisible()
625 bool temp = Interop.Window.IsVisible(SwigCPtr);
626 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 /// Gets the count of supported auxiliary hints of the window.
633 /// <returns>The number of supported auxiliary hints.</returns>
634 /// <since_tizen> 3 </since_tizen>
635 public uint GetSupportedAuxiliaryHintCount()
637 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 /// Gets the supported auxiliary hint string of the window.
645 /// <param name="index">The index of the supported auxiliary hint lists.</param>
646 /// <returns>The auxiliary hint string of the index.</returns>
647 /// <since_tizen> 3 </since_tizen>
648 public string GetSupportedAuxiliaryHint(uint index)
650 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
651 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656 /// Creates an auxiliary hint of the window.
658 /// <param name="hint">The auxiliary hint string.</param>
659 /// <param name="value">The value string.</param>
660 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
661 /// <since_tizen> 3 </since_tizen>
662 public uint AddAuxiliaryHint(string hint, string value)
664 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670 /// Removes an auxiliary hint of the window.
672 /// <param name="id">The ID of the auxiliary hint.</param>
673 /// <returns>True if no error occurred, false otherwise.</returns>
674 /// <since_tizen> 3 </since_tizen>
675 public bool RemoveAuxiliaryHint(uint id)
677 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
678 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
683 /// Changes a value of the auxiliary hint.
685 /// <param name="id">The auxiliary hint ID.</param>
686 /// <param name="value">The value string to be set.</param>
687 /// <returns>True if no error occurred, false otherwise.</returns>
688 /// <since_tizen> 3 </since_tizen>
689 public bool SetAuxiliaryHintValue(uint id, string value)
691 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
692 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697 /// Gets a value of the auxiliary hint.
699 /// <param name="id">The auxiliary hint ID.</param>
700 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
701 /// <since_tizen> 3 </since_tizen>
702 public string GetAuxiliaryHintValue(uint id)
704 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
705 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 /// Gets an ID of the auxiliary hint string.
712 /// <param name="hint">The auxiliary hint string.</param>
713 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
714 /// <since_tizen> 3 </since_tizen>
715 public uint GetAuxiliaryHintId(string hint)
717 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723 /// Sets a region to accept input events.
725 /// <param name="inputRegion">The region to accept input events.</param>
726 /// <since_tizen> 3 </since_tizen>
727 public void SetInputRegion(Rectangle inputRegion)
729 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
730 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
734 /// Sets a priority level for the specified notification window.
736 /// <param name="level">The notification window level.</param>
737 /// <returns>True if no error occurred, false otherwise.</returns>
738 /// <since_tizen> 3 </since_tizen>
739 public bool SetNotificationLevel(NotificationLevel level)
741 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
742 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743 return ret == OperationResult.Succeed;
747 /// Gets a priority level for the specified notification window.
749 /// <returns>The notification window level.</returns>
750 /// <since_tizen> 3 </since_tizen>
751 public NotificationLevel GetNotificationLevel()
753 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 /// Sets a transparent window's visual state to opaque. <br />
760 /// If a visual state of a transparent window is opaque, <br />
761 /// then the window manager could handle it as an opaque window when calculating visibility.
763 /// <param name="opaque">Whether the window's visual state is opaque.</param>
764 /// <remarks>This will have no effect on an opaque window. <br />
765 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
767 /// <since_tizen> 3 </since_tizen>
768 public void SetOpaqueState(bool opaque)
770 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
771 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
775 /// Returns whether a transparent window's visual state is opaque or not.
777 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
778 /// <remarks> The return value has no meaning on an opaque window. </remarks>
779 /// <since_tizen> 3 </since_tizen>
780 public bool IsOpaqueState()
782 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
783 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788 /// Sets a window's screen off mode.
790 /// <param name="screenOffMode">The screen mode.</param>
791 /// <returns>True if no error occurred, false otherwise.</returns>
792 /// <since_tizen> 4 </since_tizen>
793 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
795 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 return ret == OperationResult.Succeed;
801 /// Gets the screen mode of the window.
803 /// <returns>The screen off mode.</returns>
804 /// <since_tizen> 4 </since_tizen>
805 public ScreenOffMode GetScreenOffMode()
807 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
813 /// Sets preferred brightness of the window.
815 /// <param name="brightness">The preferred brightness (0 to 100).</param>
816 /// <returns>True if no error occurred, false otherwise.</returns>
817 /// <since_tizen> 3 </since_tizen>
818 public bool SetBrightness(int brightness)
820 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
821 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 return ret == OperationResult.Succeed;
826 /// Gets the preferred brightness of the window.
828 /// <returns>The preferred brightness.</returns>
829 /// <since_tizen> 3 </since_tizen>
830 public int GetBrightness()
832 int ret = Interop.Window.GetBrightness(SwigCPtr);
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 /// Sets the window name and the class string.
840 /// <param name="name">The name of the window.</param>
841 /// <param name="klass">The class of the window.</param>
842 /// <since_tizen> 4 </since_tizen>
843 public void SetClass(string name, string klass)
845 Interop.Window.SetClass(SwigCPtr, name, klass);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 /// Raises the window to the top of the window stack.
852 /// <since_tizen> 3 </since_tizen>
855 Interop.Window.Raise(SwigCPtr);
856 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
860 /// Lowers the window to the bottom of the window stack.
862 /// <since_tizen> 3 </since_tizen>
865 Interop.Window.Lower(SwigCPtr);
866 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
870 /// Activates the window to the top of the window stack even it is iconified.
872 /// <since_tizen> 3 </since_tizen>
873 public void Activate()
875 Interop.Window.Activate(SwigCPtr);
876 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
880 /// Gets the default ( root ) layer.
882 /// <returns>The root layer.</returns>
883 /// <since_tizen> 3 </since_tizen>
884 public Layer GetDefaultLayer()
886 return this.GetRootLayer();
890 /// Add a child view to window.
892 /// <param name="view">the child should be added to the window.</param>
893 /// <since_tizen> 3 </since_tizen>
894 public void Add(View view)
896 Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
897 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
898 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
901 view.InternalParent = this.GetRootLayer();
906 /// Remove a child view from window.
908 /// <param name="view">the child to be removed.</param>
909 /// <since_tizen> 3 </since_tizen>
910 public void Remove(View view)
912 Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
913 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
916 view.InternalParent = null;
921 /// Retrieves the layer at a specified depth.
923 /// <param name="depth">The layer's depth index.</param>
924 /// <returns>The layer found at the given depth.</returns>
925 /// <since_tizen> 3 </since_tizen>
926 public Layer GetLayer(uint depth)
928 if (depth < LayersChildren?.Count)
930 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
940 /// Destroy the window immediately.
942 [EditorBrowsable(EditorBrowsableState.Never)]
943 public void Destroy()
949 /// Keep rendering for at least the given amount of time.
951 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
952 /// <since_tizen> 3 </since_tizen>
953 public void KeepRendering(float durationSeconds)
955 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
956 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
960 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
961 /// This function can be used for following example scenarios: <br />
962 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
964 /// <param name="DaliKey">The key code to grab.</param>
965 /// <returns>True if the grab succeeds.</returns>
966 /// <since_tizen> 3 </since_tizen>
967 public bool GrabKeyTopmost(int DaliKey)
969 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
970 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 /// Ungrabs the key specified by a key for the window.<br />
976 /// 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 />
978 /// <param name="DaliKey">The key code to ungrab.</param>
979 /// <returns>True if the ungrab succeeds.</returns>
980 /// <since_tizen> 3 </since_tizen>
981 public bool UngrabKeyTopmost(int DaliKey)
983 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
984 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
989 /// Grabs the key specified by a key for a window in a GrabMode. <br />
990 /// Details: This function can be used for following example scenarios: <br />
991 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
992 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
993 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
995 /// <param name="DaliKey">The key code to grab.</param>
996 /// <param name="GrabMode">The grab mode for the key.</param>
997 /// <returns>True if the grab succeeds.</returns>
998 /// <since_tizen> 3 </since_tizen>
999 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1001 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1002 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007 /// Ungrabs the key specified by a key for a window.<br />
1008 /// 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 />
1010 /// <param name="DaliKey">The key code to ungrab.</param>
1011 /// <returns>True if the ungrab succeeds.</returns>
1012 /// <since_tizen> 3 </since_tizen>
1013 public bool UngrabKey(int DaliKey)
1015 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1021 /// Sets the keyboard repeat information.
1023 /// <param name="rate">The key repeat rate value in seconds.</param>
1024 /// <param name="delay">The key repeat delay value in seconds.</param>
1025 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1026 /// <since_tizen> 5 </since_tizen>
1027 public bool SetKeyboardRepeatInfo(float rate, float delay)
1029 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 /// Gets the keyboard repeat information.
1037 /// <param name="rate">The key repeat rate value in seconds.</param>
1038 /// <param name="delay">The key repeat delay value in seconds.</param>
1039 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1040 /// <since_tizen> 5 </since_tizen>
1041 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1043 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1044 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 /// Adds a layer to the stage.
1051 /// <param name="layer">Layer to add.</param>
1052 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1053 /// <since_tizen> 3 </since_tizen>
1054 public void AddLayer(Layer layer)
1060 /// Removes a layer from the stage.
1062 /// <param name="layer">Layer to remove.</param>
1063 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1064 /// <since_tizen> 3 </since_tizen>
1065 public void RemoveLayer(Layer layer)
1071 /// Feeds a key event into the window.
1073 /// <param name="keyEvent">The key event to feed.</param>
1074 /// <since_tizen> 5 </since_tizen>
1075 public void FeedKey(Key keyEvent)
1077 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
1078 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 /// Allows at least one more render, even when paused.
1083 /// The window should be shown, not minimised.
1085 /// <since_tizen> 4 </since_tizen>
1086 public void RenderOnce()
1088 Interop.Window.RenderOnce(SwigCPtr);
1089 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1093 /// Sets whether the window is transparent or not.
1095 /// <param name="transparent">Whether the window is transparent or not.</param>
1096 /// <since_tizen> 5 </since_tizen>
1097 public void SetTransparency(bool transparent)
1099 Interop.Window.SetTransparency(SwigCPtr, transparent);
1100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1102 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1106 /// Sets parent window of the window.
1107 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1108 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1109 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1111 /// <param name="parent">The parent window.</param>
1112 /// <since_tizen> 6 </since_tizen>
1113 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1114 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1115 public void SetParent(Window parent)
1117 if (IsSupportedMultiWindow() == false)
1119 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1121 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1126 /// Unsets parent window of the window.
1127 /// After unsetting, the window is disconnected his parent window.
1129 /// <since_tizen> 6 </since_tizen>
1130 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1131 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1132 public void Unparent()
1134 if (IsSupportedMultiWindow() == false)
1136 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1138 Interop.Window.Unparent(SwigCPtr);
1139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143 /// Gets parent window of the window.
1145 /// <returns>The parent window of the window.</returns>
1146 /// <since_tizen> 6 </since_tizen>
1147 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1148 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1149 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1150 public Window GetParent()
1152 if (IsSupportedMultiWindow() == false)
1154 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1156 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window;
1157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1161 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1162 [EditorBrowsable(EditorBrowsableState.Never)]
1163 public void ObjectDump()
1165 Layer rootLayer = GetRootLayer();
1166 foreach (View view in rootLayer.Children)
1172 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1174 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1177 internal static bool IsInstalled()
1179 bool ret = Interop.Stage.IsInstalled();
1180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1185 /// Adds an orientation to the list of available orientations.
1187 /// <param name="orientation">The available orientation to add</param>
1188 /// <since_tizen> 6 </since_tizen>
1189 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1191 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196 /// Removes an orientation from the list of available orientations.
1198 /// <param name="orientation">The available orientation to remove.</param>
1199 /// <since_tizen> 6 </since_tizen>
1200 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1202 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207 /// Sets a preferred orientation.
1209 /// <param name="orientation">The preferred orientation.</param>
1210 /// <since_tizen> 6 </since_tizen>
1211 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1213 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218 /// Gets the preferred orientation.
1220 /// <since_tizen> 6 </since_tizen>
1221 /// <returns>The preferred orientation if previously set, or none.</returns>
1222 public Window.WindowOrientation GetPreferredOrientation()
1224 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1230 /// Gets current orientation of the window.
1232 /// <since_tizen> 6 </since_tizen>
1233 /// <returns>The current window orientation if previously set, or none.</returns>
1234 [EditorBrowsable(EditorBrowsableState.Never)]
1235 public Window.WindowOrientation GetCurrentOrientation()
1237 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1243 /// Sets available orientations of the window.
1244 /// This API is for setting several orientations one time.
1246 /// <param name="orientations">The list of orientations.</param>
1247 /// <since_tizen> 6 </since_tizen>
1248 [EditorBrowsable(EditorBrowsableState.Never)]
1249 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1251 if (null == orientations)
1253 throw new ArgumentNullException(nameof(orientations));
1256 PropertyArray orientationArray = new PropertyArray();
1257 for (int i = 0; i < orientations.Count; i++)
1259 PropertyValue value = new PropertyValue((int)orientations[i]);
1260 orientationArray.PushBack(value);
1264 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1265 orientationArray.Dispose();
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270 /// Sets window position and size for specific orientation.
1271 /// This api reserves the position and size per orientation to display server.
1272 /// When the device is rotated, the window is moved/resized with the reserved position/size by display server.
1273 /// Currently, it only works when the window's type is WindowType::Ime.
1274 /// It means this function is only for IME window of internal keyboard application.
1275 /// It is only for internal keyboard application.
1276 /// This should be hidden.
1278 /// <param name="positionSize">The reserved position and size for the orientation.</param>
1279 /// <param name="orientation">The orientation.</param>
1280 [EditorBrowsable(EditorBrowsableState.Never)]
1281 public void SetPositionSizeWithOrientation(Rectangle positionSize, Window.WindowOrientation orientation)
1283 Interop.Window.SetPositionSizeWithOrientation(SwigCPtr, Rectangle.getCPtr(positionSize), (int)orientation);
1284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1288 /// Get native window ID
1290 /// <returns>native window ID</returns>
1291 [EditorBrowsable(EditorBrowsableState.Never)]
1292 public int GetNativeId()
1294 int ret = Interop.Window.GetNativeId(SwigCPtr);
1295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1299 internal Any GetNativeHandle()
1301 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1306 internal void Add(Layer layer)
1310 throw new ArgumentNullException(nameof(layer));
1312 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315 LayersChildren?.Add(layer);
1316 layer.SetWindow(this);
1319 internal void Remove(Layer layer)
1323 throw new ArgumentNullException(nameof(layer));
1325 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 LayersChildren?.Remove(layer);
1329 layer.SetWindow(null);
1332 internal Vector2 GetSize()
1334 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1335 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1336 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1340 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1341 [EditorBrowsable(EditorBrowsableState.Never)]
1342 public RenderTaskList GetRenderTaskList()
1344 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1350 /// Queries the number of on-window layers.
1352 /// <returns>The number of layers.</returns>
1353 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1354 internal uint GetLayerCount()
1356 if (LayersChildren == null || LayersChildren.Count < 0)
1359 return (uint)LayersChildren.Count;
1362 internal Layer GetRootLayer()
1364 // Window.IsInstalled() is actually true only when called from event thread and
1365 // Core has been initialized, not when Stage is ready.
1366 if (rootLayer == null && Window.IsInstalled())
1368 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370 LayersChildren?.Add(rootLayer);
1371 rootLayer.SetWindow(this);
1376 internal void SetBackgroundColor(Vector4 color)
1378 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382 internal Vector4 GetBackgroundColor()
1384 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1389 internal Vector2 GetDpi()
1391 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1396 internal ObjectRegistry GetObjectRegistry()
1398 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1403 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1405 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1409 internal RenderingBehaviorType GetRenderingBehavior()
1411 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1412 if (NDalicPINVOKE.SWIGPendingException.Pending)
1413 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417 internal void SetWindowSize(Size2D size)
1421 throw new ArgumentNullException(nameof(size));
1423 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1424 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1426 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1427 // Resetting Window size should request a relayout of the tree.
1430 internal Size2D GetWindowSize()
1432 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1433 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1434 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438 internal void SetPosition(Position2D position)
1440 if (null == position)
1442 throw new ArgumentNullException(nameof(position));
1444 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1445 Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
1447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448 // Setting Position of the window should request a relayout of the tree.
1451 internal Position2D GetPosition()
1453 var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
1454 Position2D ret = new Position2D(val.GetX(), val.GetY());
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1460 internal void SetPositionSize(Rectangle positionSize)
1462 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466 // Setting Position of the window should request a relayout of the tree.
1470 /// Enables the floating mode of window.
1471 /// The floating mode is to support window is moved or resized by display server.
1472 /// For example, if the video-player window sets the floating mode,
1473 /// then display server changes its geometry and handles it like a popup.
1474 /// The way of handling floating mode window is decided by display server.
1475 /// A special display server(as a Tizen display server) supports this mode.
1477 /// <param name="enable">Enable floating mode or not.</param>
1478 [EditorBrowsable(EditorBrowsableState.Never)]
1479 public void EnableFloatingMode(bool enable)
1481 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1482 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1486 /// Requests to display server for the window is moved by display server.
1487 /// It can be work with setting window floating mode.
1489 [EditorBrowsable(EditorBrowsableState.Never)]
1490 public void RequestMoveToServer()
1492 Interop.Window.RequestMoveToServer(SwigCPtr);
1493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1497 /// Requests to display server for the window is resized by display server.
1498 /// It can be work with setting window floating mode.
1500 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1501 [EditorBrowsable(EditorBrowsableState.Never)]
1502 public void RequestResizeToServer(ResizeDirection direction)
1504 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1509 /// Add FrameUpdateCallback
1511 [EditorBrowsable(EditorBrowsableState.Never)]
1512 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1514 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1518 /// Remove FrameUpdateCallback
1520 [EditorBrowsable(EditorBrowsableState.Never)]
1521 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1523 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1527 /// Dispose for Window
1529 [EditorBrowsable(EditorBrowsableState.Never)]
1530 protected override void Dispose(DisposeTypes type)
1537 if (type == DisposeTypes.Explicit)
1540 //Release your own managed resources here.
1541 //You should release all of your own disposable objects here.
1543 if (rootLayer != null)
1545 rootLayer.Dispose();
1548 localController?.Dispose();
1550 foreach (var layer in childLayers)
1558 childLayers.Clear();
1561 this.DisconnectNativeSignals();
1566 /// This will not be public opened.
1567 [EditorBrowsable(EditorBrowsableState.Never)]
1568 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1570 Interop.Window.DeleteWindow(swigCPtr);
1573 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1575 private static readonly object locker = new object();
1577 private static int key = 0;
1579 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1581 private struct internalHookCallbackType
1583 public FrameCallbackType userCallback;
1587 private static void OnInternalHookFrameCallback(int id)
1591 if (frameCallbackList.ContainsKey(id))
1593 if (frameCallbackList[id].userCallback != null)
1595 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1596 frameCallbackList.Remove(id);
1600 NUILog.Error($"found userCallback is NULL");
1601 frameCallbackList.Remove(id);
1607 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1609 if (null == callback)
1611 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1613 var assignedKey = 0;
1618 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1620 userCallback = callback,
1628 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1630 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1631 [EditorBrowsable(EditorBrowsableState.Never)]
1632 public delegate void FrameCallbackType(int frameId);
1635 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1636 /// A callback of the following type may be used:
1638 /// void MyFunction( int frameId )
1640 /// This callback will be deleted once it is called.
1642 /// Ownership of the callback is passed onto this class
1645 /// <param name="callback">The function to call</param>
1646 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1647 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1648 [EditorBrowsable(EditorBrowsableState.Never)]
1649 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
1651 var assignedKey = AddInterHookCallback(callback, frameId);
1652 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1658 /// Adds a callback that is called when the frame is displayed on the display.
1659 /// A callback of the following type may be used:
1661 /// void MyFunction( int frameId )
1663 /// This callback will be deleted once it is called.
1665 /// Ownership of the callback is passed onto this class
1668 /// <param name="callback">The function to call</param>
1669 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1670 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1671 [EditorBrowsable(EditorBrowsableState.Never)]
1672 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
1674 var assignedKey = AddInterHookCallback(callback, frameId);
1675 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1677 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1681 /// Search through this Window for a Layer with the given unique ID.
1683 /// <param name="id">The ID of the Layer to find.</param>
1684 /// <remarks>Hidden-API</remarks>
1685 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
1686 [EditorBrowsable(EditorBrowsableState.Never)]
1687 public Layer FindLayerByID(uint id)
1689 Layer defaultLayer = this.GetDefaultLayer();
1690 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
1691 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
1693 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();