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.
360 /// Most of window type can be set to use WindowType, except for IME type.
361 /// IME type can be set to use one of NUIApplication's constrcutors.
363 /// <since_tizen> 3 </since_tizen>
364 public WindowType Type
368 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
374 Interop.Window.SetType(SwigCPtr, (int)value);
375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 /// Gets/Sets a window title.
382 /// <since_tizen> 4 </since_tizen>
392 SetClass(windowTitle, "");
397 /// The rendering behavior of a Window.
399 /// <since_tizen> 5 </since_tizen>
400 public RenderingBehaviorType RenderingBehavior
404 return GetRenderingBehavior();
408 SetRenderingBehavior(value);
413 /// The window size property (read-only).
415 /// <since_tizen> 3 </since_tizen>
420 Size2D ret = GetSize();
426 /// The background color property.
428 /// <since_tizen> 3 </since_tizen>
429 public Color BackgroundColor
433 SetBackgroundColor(value);
437 Color ret = GetBackgroundColor();
443 /// The DPI property (read-only).<br />
444 /// Retrieves the DPI of the display device to which the Window is connected.<br />
446 /// <since_tizen> 3 </since_tizen>
456 /// The layer count property (read-only).<br />
457 /// Queries the number of on-Window layers.<br />
459 /// <since_tizen> 3 </since_tizen>
460 public uint LayerCount
464 return GetLayerCount();
469 /// Gets or sets a size of the window.
471 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
472 /// <since_tizen> 4 </since_tizen>
473 public Size2D WindowSize
477 return GetWindowSize();
481 SetWindowSize(value);
486 /// Gets or sets a position of the window.
488 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
489 /// <since_tizen> 4 </since_tizen>
490 public Position2D WindowPosition
494 return GetPosition();
503 /// Sets position and size of the window. This API guarantees that
504 /// both moving and resizing of window will appear on the screen at once.
506 [EditorBrowsable(EditorBrowsableState.Never)]
507 public Rectangle WindowPositionSize
511 Position2D position = GetPosition();
512 Size2D size = GetSize();
513 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
519 SetPositionSize(value);
523 internal static Vector4 DEFAULT_BACKGROUND_COLOR
527 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
528 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
534 internal static Vector4 DEBUG_BACKGROUND_COLOR
538 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
539 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545 internal List<Layer> LayersChildren
554 /// Get the LayoutController for this Window.
556 internal LayoutController LayoutController
560 return localController;
565 /// Feed a key-event into the window.
567 /// <param name="keyEvent">The key event to feed.</param>
568 /// <since_tizen> 4 </since_tizen>
569 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
570 public static void FeedKeyEvent(Key keyEvent)
572 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577 /// Sets whether the window accepts a focus or not.
579 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
580 /// <since_tizen> 3 </since_tizen>
581 public void SetAcceptFocus(bool accept)
583 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
584 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
588 /// Returns whether the window accepts a focus or not.
590 /// <returns>True if the window accepts a focus, false otherwise.</returns>
591 /// <since_tizen> 3 </since_tizen>
592 public bool IsFocusAcceptable()
594 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 /// Shows the window if it is hidden.
603 /// <since_tizen> 3 </since_tizen>
606 Interop.Window.Show(SwigCPtr);
607 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 /// Hides the window if it is showing.
613 /// <since_tizen> 3 </since_tizen>
616 Interop.Window.Hide(SwigCPtr);
617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621 /// Retrieves whether the window is visible or not.
623 /// <returns>True if the window is visible.</returns>
624 /// <since_tizen> 3 </since_tizen>
625 public bool IsVisible()
627 bool temp = Interop.Window.IsVisible(SwigCPtr);
628 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
633 /// Gets the count of supported auxiliary hints of the window.
635 /// <returns>The number of supported auxiliary hints.</returns>
636 /// <since_tizen> 3 </since_tizen>
637 public uint GetSupportedAuxiliaryHintCount()
639 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645 /// Gets the supported auxiliary hint string of the window.
647 /// <param name="index">The index of the supported auxiliary hint lists.</param>
648 /// <returns>The auxiliary hint string of the index.</returns>
649 /// <since_tizen> 3 </since_tizen>
650 public string GetSupportedAuxiliaryHint(uint index)
652 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
653 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 /// Creates an auxiliary hint of the window.
660 /// <param name="hint">The auxiliary hint string.</param>
661 /// <param name="value">The value string.</param>
662 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
663 /// <since_tizen> 3 </since_tizen>
664 public uint AddAuxiliaryHint(string hint, string value)
666 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
667 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
672 /// Removes an auxiliary hint of the window.
674 /// <param name="id">The ID of the auxiliary hint.</param>
675 /// <returns>True if no error occurred, false otherwise.</returns>
676 /// <since_tizen> 3 </since_tizen>
677 public bool RemoveAuxiliaryHint(uint id)
679 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
680 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 /// Changes a value of the auxiliary hint.
687 /// <param name="id">The auxiliary hint ID.</param>
688 /// <param name="value">The value string to be set.</param>
689 /// <returns>True if no error occurred, false otherwise.</returns>
690 /// <since_tizen> 3 </since_tizen>
691 public bool SetAuxiliaryHintValue(uint id, string value)
693 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
699 /// Gets a value of the auxiliary hint.
701 /// <param name="id">The auxiliary hint ID.</param>
702 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
703 /// <since_tizen> 3 </since_tizen>
704 public string GetAuxiliaryHintValue(uint id)
706 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712 /// Gets an ID of the auxiliary hint string.
714 /// <param name="hint">The auxiliary hint string.</param>
715 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
716 /// <since_tizen> 3 </since_tizen>
717 public uint GetAuxiliaryHintId(string hint)
719 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 /// Sets a region to accept input events.
727 /// <param name="inputRegion">The region to accept input events.</param>
728 /// <since_tizen> 3 </since_tizen>
729 public void SetInputRegion(Rectangle inputRegion)
731 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 /// Sets a priority level for the specified notification window.
738 /// <param name="level">The notification window level.</param>
739 /// <returns>True if no error occurred, false otherwise.</returns>
740 /// <since_tizen> 3 </since_tizen>
741 public bool SetNotificationLevel(NotificationLevel level)
743 var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 return ret == OperationResult.Succeed;
749 /// Gets a priority level for the specified notification window.
751 /// <returns>The notification window level.</returns>
752 /// <since_tizen> 3 </since_tizen>
753 public NotificationLevel GetNotificationLevel()
755 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
761 /// Sets a transparent window's visual state to opaque. <br />
762 /// If a visual state of a transparent window is opaque, <br />
763 /// then the window manager could handle it as an opaque window when calculating visibility.
765 /// <param name="opaque">Whether the window's visual state is opaque.</param>
766 /// <remarks>This will have no effect on an opaque window. <br />
767 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
769 /// <since_tizen> 3 </since_tizen>
770 public void SetOpaqueState(bool opaque)
772 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 /// Returns whether a transparent window's visual state is opaque or not.
779 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
780 /// <remarks> The return value has no meaning on an opaque window. </remarks>
781 /// <since_tizen> 3 </since_tizen>
782 public bool IsOpaqueState()
784 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
790 /// Sets a window's screen off mode.
792 /// <param name="screenOffMode">The screen mode.</param>
793 /// <returns>True if no error occurred, false otherwise.</returns>
794 /// <since_tizen> 4 </since_tizen>
795 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
797 var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799 return ret == OperationResult.Succeed;
803 /// Gets the screen mode of the window.
805 /// <returns>The screen off mode.</returns>
806 /// <since_tizen> 4 </since_tizen>
807 public ScreenOffMode GetScreenOffMode()
809 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 /// Sets preferred brightness of the window.
817 /// <param name="brightness">The preferred brightness (0 to 100).</param>
818 /// <returns>True if no error occurred, false otherwise.</returns>
819 /// <since_tizen> 3 </since_tizen>
820 public bool SetBrightness(int brightness)
822 var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
824 return ret == OperationResult.Succeed;
828 /// Gets the preferred brightness of the window.
830 /// <returns>The preferred brightness.</returns>
831 /// <since_tizen> 3 </since_tizen>
832 public int GetBrightness()
834 int ret = Interop.Window.GetBrightness(SwigCPtr);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 /// Sets the window name and the class string.
842 /// <param name="name">The name of the window.</param>
843 /// <param name="klass">The class of the window.</param>
844 /// <since_tizen> 4 </since_tizen>
845 public void SetClass(string name, string klass)
847 Interop.Window.SetClass(SwigCPtr, name, klass);
848 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
852 /// Raises the window to the top of the window stack.
854 /// <since_tizen> 3 </since_tizen>
857 Interop.Window.Raise(SwigCPtr);
858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 /// Lowers the window to the bottom of the window stack.
864 /// <since_tizen> 3 </since_tizen>
867 Interop.Window.Lower(SwigCPtr);
868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
872 /// Activates the window to the top of the window stack even it is iconified.
874 /// <since_tizen> 3 </since_tizen>
875 public void Activate()
877 Interop.Window.Activate(SwigCPtr);
878 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 /// Gets the default ( root ) layer.
884 /// <returns>The root layer.</returns>
885 /// <since_tizen> 3 </since_tizen>
886 public Layer GetDefaultLayer()
888 return this.GetRootLayer();
892 /// Add a child view to window.
894 /// <param name="view">the child should be added to the window.</param>
895 /// <since_tizen> 3 </since_tizen>
896 public void Add(View view)
898 Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
899 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
903 view.InternalParent = this.GetRootLayer();
905 this.GetRootLayer().LayoutCount += view.LayoutCount;
910 /// Remove a child view from window.
912 /// <param name="view">the child to be removed.</param>
913 /// <since_tizen> 3 </since_tizen>
914 public void Remove(View view)
916 Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
917 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
920 view.InternalParent = null;
922 this.GetRootLayer().LayoutCount -= view.LayoutCount;
927 /// Retrieves the layer at a specified depth.
929 /// <param name="depth">The layer's depth index.</param>
930 /// <returns>The layer found at the given depth.</returns>
931 /// <since_tizen> 3 </since_tizen>
932 public Layer GetLayer(uint depth)
934 if (depth < LayersChildren?.Count)
936 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
946 /// Destroy the window immediately.
948 [EditorBrowsable(EditorBrowsableState.Never)]
949 public void Destroy()
955 /// Keep rendering for at least the given amount of time.
957 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
958 /// <since_tizen> 3 </since_tizen>
959 public void KeepRendering(float durationSeconds)
961 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
962 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
966 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
967 /// This function can be used for following example scenarios: <br />
968 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
970 /// <param name="DaliKey">The key code to grab.</param>
971 /// <returns>True if the grab succeeds.</returns>
972 /// <since_tizen> 3 </since_tizen>
973 public bool GrabKeyTopmost(int DaliKey)
975 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
976 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
981 /// Ungrabs the key specified by a key for the window.<br />
982 /// 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 />
984 /// <param name="DaliKey">The key code to ungrab.</param>
985 /// <returns>True if the ungrab succeeds.</returns>
986 /// <since_tizen> 3 </since_tizen>
987 public bool UngrabKeyTopmost(int DaliKey)
989 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
990 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995 /// Grabs the key specified by a key for a window in a GrabMode. <br />
996 /// Details: This function can be used for following example scenarios: <br />
997 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
998 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
999 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
1001 /// <param name="DaliKey">The key code to grab.</param>
1002 /// <param name="GrabMode">The grab mode for the key.</param>
1003 /// <returns>True if the grab succeeds.</returns>
1004 /// <since_tizen> 3 </since_tizen>
1005 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
1007 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
1008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 /// Ungrabs the key specified by a key for a window.<br />
1014 /// 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 />
1016 /// <param name="DaliKey">The key code to ungrab.</param>
1017 /// <returns>True if the ungrab succeeds.</returns>
1018 /// <since_tizen> 3 </since_tizen>
1019 public bool UngrabKey(int DaliKey)
1021 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1027 /// Sets the keyboard repeat information.
1029 /// <param name="rate">The key repeat rate value in seconds.</param>
1030 /// <param name="delay">The key repeat delay value in seconds.</param>
1031 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1032 /// <since_tizen> 5 </since_tizen>
1033 public bool SetKeyboardRepeatInfo(float rate, float delay)
1035 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
1036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1041 /// Gets the keyboard repeat information.
1043 /// <param name="rate">The key repeat rate value in seconds.</param>
1044 /// <param name="delay">The key repeat delay value in seconds.</param>
1045 /// <returns>True if setting the keyboard repeat succeeds.</returns>
1046 /// <since_tizen> 5 </since_tizen>
1047 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
1049 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1055 /// Adds a layer to the stage.
1057 /// <param name="layer">Layer to add.</param>
1058 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1059 /// <since_tizen> 3 </since_tizen>
1060 public void AddLayer(Layer layer)
1066 /// Removes a layer from the stage.
1068 /// <param name="layer">Layer to remove.</param>
1069 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
1070 /// <since_tizen> 3 </since_tizen>
1071 public void RemoveLayer(Layer layer)
1077 /// Feeds a key event into the window.
1079 /// <param name="keyEvent">The key event to feed.</param>
1080 /// <since_tizen> 5 </since_tizen>
1081 public void FeedKey(Key keyEvent)
1083 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
1084 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1088 /// Allows at least one more render, even when paused.
1089 /// The window should be shown, not minimised.
1091 /// <since_tizen> 4 </since_tizen>
1092 public void RenderOnce()
1094 Interop.Window.RenderOnce(SwigCPtr);
1095 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1099 /// Sets whether the window is transparent or not.
1101 /// <param name="transparent">Whether the window is transparent or not.</param>
1102 /// <since_tizen> 5 </since_tizen>
1103 public void SetTransparency(bool transparent)
1105 Interop.Window.SetTransparency(SwigCPtr, transparent);
1106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1108 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1112 /// Sets parent window of the window.
1113 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1114 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1115 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1117 /// <param name="parent">The parent window.</param>
1118 /// <since_tizen> 6 </since_tizen>
1119 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1120 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1121 public void SetParent(Window parent)
1123 if (IsSupportedMultiWindow() == false)
1125 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1127 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1132 /// Sets parent window of the window.
1133 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1134 /// This function has the additional flag whether the child is located above or below of the parent.
1136 /// <param name="parent">The parent window.</param>
1137 /// <param name="belowParent">The flag is whether the child is located above or below of the parent.</param>
1138 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1139 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1140 [EditorBrowsable(EditorBrowsableState.Never)]
1141 public void SetParent(Window parent, bool belowParent)
1143 if (IsSupportedMultiWindow() == false)
1145 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1147 Interop.Window.SetParentWithStack(SwigCPtr, Window.getCPtr(parent), belowParent);
1148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1152 /// Unsets parent window of the window.
1153 /// After unsetting, the window is disconnected his parent window.
1155 /// <since_tizen> 6 </since_tizen>
1156 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1157 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1158 public void Unparent()
1160 if (IsSupportedMultiWindow() == false)
1162 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1164 Interop.Window.Unparent(SwigCPtr);
1165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169 /// Gets parent window of the window.
1171 /// <returns>The parent window of the window.</returns>
1172 /// <since_tizen> 6 </since_tizen>
1173 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1174 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1175 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1721: Property names should not match get methods")]
1176 public Window GetParent()
1178 if (IsSupportedMultiWindow() == false)
1180 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1182 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window;
1183 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1187 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1188 [EditorBrowsable(EditorBrowsableState.Never)]
1189 public void ObjectDump()
1191 Layer rootLayer = GetRootLayer();
1192 foreach (View view in rootLayer.Children)
1198 internal static bool IsInstalled()
1200 bool ret = Interop.Stage.IsInstalled();
1201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206 /// Adds an orientation to the list of available orientations.
1208 /// <param name="orientation">The available orientation to add</param>
1209 /// <since_tizen> 6 </since_tizen>
1210 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1212 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217 /// Removes an orientation from the list of available orientations.
1219 /// <param name="orientation">The available orientation to remove.</param>
1220 /// <since_tizen> 6 </since_tizen>
1221 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1223 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1228 /// Sets a preferred orientation.
1230 /// <param name="orientation">The preferred orientation.</param>
1231 /// <since_tizen> 6 </since_tizen>
1232 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1234 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 /// Gets the preferred orientation.
1241 /// <since_tizen> 6 </since_tizen>
1242 /// <returns>The preferred orientation if previously set, or none.</returns>
1243 public Window.WindowOrientation GetPreferredOrientation()
1245 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1251 /// Gets current orientation of the window.
1253 /// <since_tizen> 6 </since_tizen>
1254 /// <returns>The current window orientation if previously set, or none.</returns>
1255 [EditorBrowsable(EditorBrowsableState.Never)]
1256 public Window.WindowOrientation GetCurrentOrientation()
1258 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 /// Sets available orientations of the window.
1265 /// This API is for setting several orientations one time.
1267 /// <param name="orientations">The list of orientations.</param>
1268 /// <since_tizen> 6 </since_tizen>
1269 [EditorBrowsable(EditorBrowsableState.Never)]
1270 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1272 if (null == orientations)
1274 throw new ArgumentNullException(nameof(orientations));
1277 PropertyArray orientationArray = new PropertyArray();
1278 for (int i = 0; i < orientations.Count; i++)
1280 PropertyValue value = new PropertyValue((int)orientations[i]);
1281 orientationArray.PushBack(value);
1285 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray), orientations.Count);
1286 orientationArray.Dispose();
1287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1291 /// Get native window ID
1293 /// <returns>native window ID</returns>
1294 [EditorBrowsable(EditorBrowsableState.Never)]
1295 public int GetNativeId()
1297 int ret = Interop.Window.GetNativeId(SwigCPtr);
1298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1302 internal Any GetNativeHandle()
1304 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 internal void Add(Layer layer)
1313 throw new ArgumentNullException(nameof(layer));
1315 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1318 LayersChildren?.Add(layer);
1319 layer.SetWindow(this);
1322 internal void Remove(Layer layer)
1326 throw new ArgumentNullException(nameof(layer));
1328 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1331 LayersChildren?.Remove(layer);
1332 layer.SetWindow(null);
1335 internal Vector2 GetSize()
1337 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1338 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1343 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
1344 [EditorBrowsable(EditorBrowsableState.Never)]
1345 public RenderTaskList GetRenderTaskList()
1347 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1353 /// Queries the number of on-window layers.
1355 /// <returns>The number of layers.</returns>
1356 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1357 internal uint GetLayerCount()
1359 if (LayersChildren == null || LayersChildren.Count < 0)
1362 return (uint)LayersChildren.Count;
1365 internal Layer GetRootLayer()
1367 // Window.IsInstalled() is actually true only when called from event thread and
1368 // Core has been initialized, not when Stage is ready.
1369 if (rootLayer == null && Window.IsInstalled())
1371 rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1372 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1373 LayersChildren?.Add(rootLayer);
1374 rootLayer.SetWindow(this);
1379 internal void SetBackgroundColor(Vector4 color)
1381 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1385 internal Vector4 GetBackgroundColor()
1387 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal Vector2 GetDpi()
1394 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal ObjectRegistry GetObjectRegistry()
1401 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1408 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1412 internal RenderingBehaviorType GetRenderingBehavior()
1414 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1415 if (NDalicPINVOKE.SWIGPendingException.Pending)
1416 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1420 internal void SetWindowSize(Size2D size)
1424 throw new ArgumentNullException(nameof(size));
1426 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1427 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1429 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1430 // Resetting Window size should request a relayout of the tree.
1433 internal Size2D GetWindowSize()
1435 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), true);
1436 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1441 internal void SetPosition(Position2D position)
1443 if (null == position)
1445 throw new ArgumentNullException(nameof(position));
1447 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1448 Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
1450 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1451 // Setting Position of the window should request a relayout of the tree.
1454 internal Position2D GetPosition()
1456 var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
1457 Position2D ret = new Position2D(val.GetX(), val.GetY());
1459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1463 internal void SetPositionSize(Rectangle positionSize)
1465 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1467 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1469 // Setting Position of the window should request a relayout of the tree.
1473 /// Enables the floating mode of window.
1474 /// The floating mode is to support window is moved or resized by display server.
1475 /// For example, if the video-player window sets the floating mode,
1476 /// then display server changes its geometry and handles it like a popup.
1477 /// The way of handling floating mode window is decided by display server.
1478 /// A special display server(as a Tizen display server) supports this mode.
1480 /// <param name="enable">Enable floating mode or not.</param>
1481 [EditorBrowsable(EditorBrowsableState.Never)]
1482 public void EnableFloatingMode(bool enable)
1484 Interop.Window.EnableFloatingMode(SwigCPtr, enable);
1485 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1489 /// Requests to display server for the window is moved by display server.
1490 /// It can be work with setting window floating mode.
1492 [EditorBrowsable(EditorBrowsableState.Never)]
1493 public void RequestMoveToServer()
1495 Interop.Window.RequestMoveToServer(SwigCPtr);
1496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1500 /// Requests to display server for the window is resized by display server.
1501 /// It can be work with setting window floating mode.
1503 /// <param name="direction">It is indicated the window's side or edge for starting point.</param>
1504 [EditorBrowsable(EditorBrowsableState.Never)]
1505 public void RequestResizeToServer(ResizeDirection direction)
1507 Interop.Window.RequestResizeToServer(SwigCPtr, (int)direction);
1508 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1512 /// Includes input region.
1513 /// This function inlcudes input regions.
1514 /// It can be used multiple times and supports multiple regions.
1515 /// It means input region will be extended.
1516 /// This input is related to mouse and touch event.
1517 /// If device has touch screen, this function is useful.
1518 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1520 /// <param name="inputRegion">The included region to accept input events.</param>
1521 [EditorBrowsable(EditorBrowsableState.Never)]
1522 public void IncludeInputRegion(Rectangle inputRegion)
1524 Interop.Window.IncludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1525 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1529 /// This function excludes input regions.
1530 /// It can be used multiple times and supports multiple regions.
1531 /// It means input region will be reduced.
1532 /// Nofice, should be set input area by IncludeInputRegion() before this function is used.
1533 /// This input is related to mouse and touch event.
1534 /// If device has touch screen, this function is useful.
1535 /// Otherwise device does not have that, we can use it after connecting mouse to the device.
1537 /// <param name="inputRegion">The excluded region to except input events.</param>
1538 [EditorBrowsable(EditorBrowsableState.Never)]
1539 public void ExcludeInputRegion(Rectangle inputRegion)
1541 Interop.Window.ExcludeInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
1542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1546 /// Add FrameUpdateCallback
1548 [EditorBrowsable(EditorBrowsableState.Never)]
1549 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1551 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1555 /// Remove FrameUpdateCallback
1557 [EditorBrowsable(EditorBrowsableState.Never)]
1558 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1560 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1564 /// Dispose for Window
1566 [EditorBrowsable(EditorBrowsableState.Never)]
1567 protected override void Dispose(DisposeTypes type)
1574 if (type == DisposeTypes.Explicit)
1577 //Release your own managed resources here.
1578 //You should release all of your own disposable objects here.
1580 if (rootLayer != null)
1582 rootLayer.Dispose();
1585 localController?.Dispose();
1587 foreach (var layer in childLayers)
1595 childLayers.Clear();
1598 this.DisconnectNativeSignals();
1603 /// This will not be public opened.
1604 [EditorBrowsable(EditorBrowsableState.Never)]
1605 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1607 Interop.Window.DeleteWindow(swigCPtr);
1610 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1612 private static readonly object locker = new object();
1614 private static int key = 0;
1616 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1618 private struct internalHookCallbackType
1620 public FrameCallbackType userCallback;
1624 private static void OnInternalHookFrameCallback(int id)
1628 if (frameCallbackList.ContainsKey(id))
1630 if (frameCallbackList[id].userCallback != null)
1632 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1633 frameCallbackList.Remove(id);
1637 NUILog.Error($"found userCallback is NULL");
1638 frameCallbackList.Remove(id);
1644 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1646 if (null == callback)
1648 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1650 var assignedKey = 0;
1655 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1657 userCallback = callback,
1665 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1667 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1668 [EditorBrowsable(EditorBrowsableState.Never)]
1669 public delegate void FrameCallbackType(int frameId);
1672 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1673 /// A callback of the following type may be used:
1675 /// void MyFunction( int frameId )
1677 /// This callback will be deleted once it is called.
1679 /// Ownership of the callback is passed onto this class
1682 /// <param name="callback">The function to call</param>
1683 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1684 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1685 [EditorBrowsable(EditorBrowsableState.Never)]
1686 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
1688 var assignedKey = AddInterHookCallback(callback, frameId);
1689 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1691 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1695 /// Adds a callback that is called when the frame is displayed on the display.
1696 /// A callback of the following type may be used:
1698 /// void MyFunction( int frameId )
1700 /// This callback will be deleted once it is called.
1702 /// Ownership of the callback is passed onto this class
1705 /// <param name="callback">The function to call</param>
1706 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1707 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1708 [EditorBrowsable(EditorBrowsableState.Never)]
1709 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
1711 var assignedKey = AddInterHookCallback(callback, frameId);
1712 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1718 /// Search through this Window for a Layer with the given unique ID.
1720 /// <param name="id">The ID of the Layer to find.</param>
1721 /// <remarks>Hidden-API</remarks>
1722 /// <returns>A handle to the Layer if found, or an empty handle if not.</returns>
1723 [EditorBrowsable(EditorBrowsableState.Never)]
1724 public Layer FindLayerByID(uint id)
1726 Layer defaultLayer = this.GetDefaultLayer();
1727 IntPtr cPtr = Interop.Actor.FindChildById(defaultLayer.SwigCPtr, id);
1728 Layer ret = this.GetInstanceSafely<Layer>(cPtr);
1730 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1735 /// Get Native Window handle.
1737 /// How to get Native Window handle
1739 /// Window window = NUIApplication.GetDefaultWindow();
1740 /// var handle = window.NativeHandle;
1741 /// if(handle.IsInvalid == false)
1743 /// IntPtr nativeHandle = handle.DangerousGetHandle();
1744 /// // do something with nativeHandle
1749 /// <since_tizen> 9 </since_tizen>
1750 public SafeHandle NativeHandle
1754 return new NUI.SafeNativeWindowHandle(this);