2 * Copyright(c) 2019 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;
21 using System.ComponentModel;
22 using System.Collections.Generic;
23 using System.Runtime.InteropServices;
24 using Tizen.NUI.BaseComponents;
29 /// The window class is used internally for drawing.<br />
30 /// The window has an orientation and indicator properties.<br />
32 /// <since_tizen> 3 </since_tizen>
33 public partial class Window : BaseHandle
35 private static readonly Window instance = Application.Instance?.GetWindow();
36 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
37 private Layer _rootLayer;
38 private string _windowTitle;
39 private List<Layer> _childLayers = new List<Layer>();
40 private LayoutController localController;
42 private bool IsSupportedMultiWindow()
44 bool isSupported = false;
45 Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
49 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Window.Window_SWIGUpcast(cPtr), cMemoryOwn)
51 if (Interop.Stage.Stage_IsInstalled())
53 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.Stage.Stage_GetCurrent());
55 localController = new LayoutController(this);
56 NUILog.Debug("layoutController id:" + localController.GetId() );
61 /// Creates a new Window.<br />
62 /// This creates an extra window in addition to the default main window<br />
64 /// <param name="windowPosition">The position and size of the Window.</param>
65 /// <param name="isTranslucent">Whether Window is translucent.</param>
66 /// <returns>A new Window.</returns>
67 /// <since_tizen> 6 </since_tizen>
68 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
69 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
70 public Window(Rectangle windowPosition = null , bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), "", isTranslucent), true)
72 if( IsSupportedMultiWindow() == false )
74 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 /// Creates a new Window with a specific name.<br />
81 /// This creates an extra window in addition to the default main window<br />
83 /// <param name="name">The name for extra window. </param>
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(string name, Rectangle windowPosition = null, bool isTranslucent = false) : this(Interop.Window.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTranslucent), true)
92 if (IsSupportedMultiWindow() == false)
94 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
96 this._windowTitle = name;
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
103 /// <since_tizen> 3 </since_tizen>
104 public enum WindowOrientation
107 /// Portrait orientation. The height of the display area is greater than the width.
109 /// <since_tizen> 3 </since_tizen>
112 /// Landscape orientation. A wide view area is needed.
114 /// <since_tizen> 3 </since_tizen>
117 /// Portrait inverse orientation.
119 /// <since_tizen> 3 </since_tizen>
120 PortraitInverse = 180,
122 /// Landscape inverse orientation.
124 /// <since_tizen> 3 </since_tizen>
125 LandscapeInverse = 270,
127 /// No orientation. It is for the preferred orientation
128 /// Especially, NoOrientationPreference only has the effect for the preferred orientation.
129 /// It is used to unset the preferred orientation with SetPreferredOrientation.
131 [EditorBrowsable(EditorBrowsableState.Never)]
132 NoOrientationPreference = -1
136 /// Enumeration for the key grab mode for platform-level APIs.
138 /// <since_tizen> 3 </since_tizen>
139 public enum KeyGrabMode
142 /// Grabs a key only when on the top of the grabbing-window stack mode.
146 /// Grabs a key together with the other client window(s) mode.
150 /// 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.
154 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
160 /// Enumeration for transition effect's state.
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public enum EffectStates
168 [EditorBrowsable(EditorBrowsableState.Never)]
171 /// Transition effect is started.
173 [EditorBrowsable(EditorBrowsableState.Never)]
176 /// Transition effect is ended.
178 [EditorBrowsable(EditorBrowsableState.Never)]
183 /// Enumeration for transition effect's type.
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public enum EffectTypes
191 [EditorBrowsable(EditorBrowsableState.Never)]
194 /// Window show effect.
196 [EditorBrowsable(EditorBrowsableState.Never)]
199 /// Window hide effect.
201 [EditorBrowsable(EditorBrowsableState.Never)]
206 /// Enumeration for opacity of the indicator.
208 internal enum IndicatorBackgroundOpacity
216 /// Enumeration for visible mode of the indicator.
218 internal enum IndicatorVisibleMode
226 /// The stage instance property (read-only).<br />
227 /// Gets the current window.<br />
229 /// <since_tizen> 3 </since_tizen>
230 public static Window Instance
239 /// Get Resource ID of window
241 internal int ResourceID
245 int ret = Interop.Window.GetResouceID(swigCPtr);
246 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 /// Gets or sets a window type.
254 /// <since_tizen> 3 </since_tizen>
255 public WindowType Type
259 WindowType ret = (WindowType)Interop.Window.GetType(swigCPtr);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 Interop.Window.SetType(swigCPtr, (int)value);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 /// Gets/Sets a window title.
273 /// <since_tizen> 4 </since_tizen>
282 _windowTitle = value;
283 SetClass(_windowTitle, "");
288 /// The rendering behavior of a Window.
290 /// <since_tizen> 5 </since_tizen>
291 public RenderingBehaviorType RenderingBehavior
295 return GetRenderingBehavior();
299 SetRenderingBehavior(value);
304 /// The window size property (read-only).
306 /// <since_tizen> 3 </since_tizen>
311 Size2D ret = GetSize();
317 /// The background color property.
319 /// <since_tizen> 3 </since_tizen>
320 public Color BackgroundColor
324 SetBackgroundColor(value);
328 Color ret = GetBackgroundColor();
334 /// The DPI property (read-only).<br />
335 /// Retrieves the DPI of the display device to which the Window is connected.<br />
337 /// <since_tizen> 3 </since_tizen>
347 /// The layer count property (read-only).<br />
348 /// Queries the number of on-Window layers.<br />
350 /// <since_tizen> 3 </since_tizen>
351 public uint LayerCount
355 return GetLayerCount();
360 /// Gets or sets a size of the window.
362 /// <since_tizen> 4 </since_tizen>
363 public Size2D WindowSize
367 return GetWindowSize();
371 SetWindowSize(value);
376 /// Gets or sets a position of the window.
378 /// <since_tizen> 4 </since_tizen>
379 public Position2D WindowPosition
383 return GetPosition();
392 /// Sets position and size of the window. This API guarantees that
393 /// both moving and resizing of window will appear on the screen at once.
395 [EditorBrowsable(EditorBrowsableState.Never)]
396 public Rectangle WindowPositionSize
400 Position2D position = GetPosition();
401 Size2D size = GetSize();
402 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
407 SetPositionSize(value);
411 internal static Vector4 DEFAULT_BACKGROUND_COLOR
415 global::System.IntPtr cPtr = Interop.Stage.Stage_DEFAULT_BACKGROUND_COLOR_get();
416 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
422 internal static Vector4 DEBUG_BACKGROUND_COLOR
426 global::System.IntPtr cPtr = Interop.Stage.Stage_DEBUG_BACKGROUND_COLOR_get();
427 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
428 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
433 internal List<Layer> LayersChildren
442 /// Get the LayoutController for this Window.
444 internal LayoutController LayoutController
448 return localController;
453 /// Feed a key-event into the window.
455 /// <param name="keyEvent">The key event to feed.</param>
456 /// <since_tizen> 4 </since_tizen>
457 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
458 public static void FeedKeyEvent(Key keyEvent)
460 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
461 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465 /// Sets whether the window accepts a focus or not.
467 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
468 /// <since_tizen> 3 </since_tizen>
469 public void SetAcceptFocus(bool accept)
471 Interop.Window.SetAcceptFocus(swigCPtr, accept);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 /// Returns whether the window accepts a focus or not.
478 /// <returns>True if the window accepts a focus, false otherwise.</returns>
479 /// <since_tizen> 3 </since_tizen>
480 public bool IsFocusAcceptable()
482 bool ret = Interop.Window.IsFocusAcceptable(swigCPtr);
483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489 /// Shows the window if it is hidden.
491 /// <since_tizen> 3 </since_tizen>
494 Interop.Window.Show(swigCPtr);
495 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 /// Hides the window if it is showing.
501 /// <since_tizen> 3 </since_tizen>
504 Interop.Window.Hide(swigCPtr);
505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509 /// Retrieves whether the window is visible or not.
511 /// <returns>True if the window is visible.</returns>
512 /// <since_tizen> 3 </since_tizen>
513 public bool IsVisible()
515 bool temp = Interop.Window.IsVisible(swigCPtr);
516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 /// Gets the count of supported auxiliary hints of the window.
523 /// <returns>The number of supported auxiliary hints.</returns>
524 /// <since_tizen> 3 </since_tizen>
525 public uint GetSupportedAuxiliaryHintCount()
527 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(swigCPtr);
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 /// Gets the supported auxiliary hint string of the window.
535 /// <param name="index">The index of the supported auxiliary hint lists.</param>
536 /// <returns>The auxiliary hint string of the index.</returns>
537 /// <since_tizen> 3 </since_tizen>
538 public string GetSupportedAuxiliaryHint(uint index)
540 string ret = Interop.Window.GetSupportedAuxiliaryHint(swigCPtr, index);
541 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546 /// Creates an auxiliary hint of the window.
548 /// <param name="hint">The auxiliary hint string.</param>
549 /// <param name="value">The value string.</param>
550 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
551 /// <since_tizen> 3 </since_tizen>
552 public uint AddAuxiliaryHint(string hint, string value)
554 uint ret = Interop.Window.AddAuxiliaryHint(swigCPtr, hint, value);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 /// Removes an auxiliary hint of the window.
562 /// <param name="id">The ID of the auxiliary hint.</param>
563 /// <returns>True if no error occurred, false otherwise.</returns>
564 /// <since_tizen> 3 </since_tizen>
565 public bool RemoveAuxiliaryHint(uint id)
567 bool ret = Interop.Window.RemoveAuxiliaryHint(swigCPtr, id);
568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
573 /// Changes a value of the auxiliary hint.
575 /// <param name="id">The auxiliary hint ID.</param>
576 /// <param name="value">The value string to be set.</param>
577 /// <returns>True if no error occurred, false otherwise.</returns>
578 /// <since_tizen> 3 </since_tizen>
579 public bool SetAuxiliaryHintValue(uint id, string value)
581 bool ret = Interop.Window.SetAuxiliaryHintValue(swigCPtr, id, value);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
587 /// Gets a value of the auxiliary hint.
589 /// <param name="id">The auxiliary hint ID.</param>
590 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
591 /// <since_tizen> 3 </since_tizen>
592 public string GetAuxiliaryHintValue(uint id)
594 string ret = Interop.Window.GetAuxiliaryHintValue(swigCPtr, id);
595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
600 /// Gets an ID of the auxiliary hint string.
602 /// <param name="hint">The auxiliary hint string.</param>
603 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
604 /// <since_tizen> 3 </since_tizen>
605 public uint GetAuxiliaryHintId(string hint)
607 uint ret = Interop.Window.GetAuxiliaryHintId(swigCPtr, hint);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613 /// Sets a region to accept input events.
615 /// <param name="inputRegion">The region to accept input events.</param>
616 /// <since_tizen> 3 </since_tizen>
617 public void SetInputRegion(Rectangle inputRegion)
619 Interop.Window.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 /// Sets a priority level for the specified notification window.
626 /// <param name="level">The notification window level.</param>
627 /// <returns>True if no error occurred, false otherwise.</returns>
628 /// <since_tizen> 3 </since_tizen>
629 public bool SetNotificationLevel(NotificationLevel level)
631 bool ret = Interop.Window.SetNotificationLevel(swigCPtr, (int)level);
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 /// Gets a priority level for the specified notification window.
639 /// <returns>The notification window level.</returns>
640 /// <since_tizen> 3 </since_tizen>
641 public NotificationLevel GetNotificationLevel()
643 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(swigCPtr);
644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649 /// Sets a transparent window's visual state to opaque. <br />
650 /// If a visual state of a transparent window is opaque, <br />
651 /// then the window manager could handle it as an opaque window when calculating visibility.
653 /// <param name="opaque">Whether the window's visual state is opaque.</param>
654 /// <remarks>This will have no effect on an opaque window. <br />
655 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
657 /// <since_tizen> 3 </since_tizen>
658 public void SetOpaqueState(bool opaque)
660 Interop.Window.SetOpaqueState(swigCPtr, opaque);
661 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Returns whether a transparent window's visual state is opaque or not.
667 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
668 /// <remarks> The return value has no meaning on an opaque window. </remarks>
669 /// <since_tizen> 3 </since_tizen>
670 public bool IsOpaqueState()
672 bool ret = Interop.Window.IsOpaqueState(swigCPtr);
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
678 /// Sets a window's screen off mode.
680 /// <param name="screenOffMode">The screen mode.</param>
681 /// <returns>True if no error occurred, false otherwise.</returns>
682 /// <since_tizen> 4 </since_tizen>
683 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
685 bool ret = Interop.Window.SetScreenOffMode(swigCPtr, (int)screenOffMode);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691 /// Gets the screen mode of the window.
693 /// <returns>The screen off mode.</returns>
694 /// <since_tizen> 4 </since_tizen>
695 public ScreenOffMode GetScreenOffMode()
697 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(swigCPtr);
698 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 /// Sets preferred brightness of the window.
705 /// <param name="brightness">The preferred brightness (0 to 100).</param>
706 /// <returns>True if no error occurred, false otherwise.</returns>
707 /// <since_tizen> 3 </since_tizen>
708 public bool SetBrightness(int brightness)
710 bool ret = Interop.Window.SetBrightness(swigCPtr, brightness);
711 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
716 /// Gets the preferred brightness of the window.
718 /// <returns>The preferred brightness.</returns>
719 /// <since_tizen> 3 </since_tizen>
720 public int GetBrightness()
722 int ret = Interop.Window.GetBrightness(swigCPtr);
723 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
728 /// Sets the window name and the class string.
730 /// <param name="name">The name of the window.</param>
731 /// <param name="klass">The class of the window.</param>
732 /// <since_tizen> 4 </since_tizen>
733 public void SetClass(string name, string klass)
735 Interop.Window.Window_SetClass(swigCPtr, name, klass);
736 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 /// Raises the window to the top of the window stack.
742 /// <since_tizen> 3 </since_tizen>
745 Interop.Window.Window_Raise(swigCPtr);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 /// Lowers the window to the bottom of the window stack.
752 /// <since_tizen> 3 </since_tizen>
755 Interop.Window.Window_Lower(swigCPtr);
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 /// Activates the window to the top of the window stack even it is iconified.
762 /// <since_tizen> 3 </since_tizen>
763 public void Activate()
765 Interop.Window.Window_Activate(swigCPtr);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 /// Gets the default ( root ) layer.
772 /// <returns>The root layer.</returns>
773 /// <since_tizen> 3 </since_tizen>
774 public Layer GetDefaultLayer()
776 return this.GetRootLayer();
780 /// Add a child view to window.
782 /// <param name="view">the child should be added to the window.</param>
783 /// <since_tizen> 3 </since_tizen>
784 public void Add(View view)
786 Interop.Actor.Actor_Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
789 view.InternalParent = this.GetRootLayer();
793 /// Remove a child view from window.
795 /// <param name="view">the child to be removed.</param>
796 /// <since_tizen> 3 </since_tizen>
797 public void Remove(View view)
799 Interop.Actor.Actor_Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
800 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
801 view.InternalParent = null;
805 /// Retrieves the layer at a specified depth.
807 /// <param name="depth">The layer's depth index.</param>
808 /// <returns>The layer found at the given depth.</returns>
809 /// <since_tizen> 3 </since_tizen>
810 public Layer GetLayer(uint depth)
812 if (depth < LayersChildren?.Count)
814 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
824 /// Destroy the window immediately.
826 [EditorBrowsable(EditorBrowsableState.Never)]
827 public void Destroy()
833 /// Keep rendering for at least the given amount of time.
835 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
836 /// <since_tizen> 3 </since_tizen>
837 public void KeepRendering(float durationSeconds)
839 Interop.Stage.Stage_KeepRendering(stageCPtr, durationSeconds);
840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
844 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
845 /// This function can be used for following example scenarios: <br />
846 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
848 /// <param name="DaliKey">The key code to grab.</param>
849 /// <returns>True if the grab succeeds.</returns>
850 /// <since_tizen> 3 </since_tizen>
851 public bool GrabKeyTopmost(int DaliKey)
853 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
854 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
859 /// Ungrabs the key specified by a key for the window.<br />
860 /// 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 />
862 /// <param name="DaliKey">The key code to ungrab.</param>
863 /// <returns>True if the ungrab succeeds.</returns>
864 /// <since_tizen> 3 </since_tizen>
865 public bool UngrabKeyTopmost(int DaliKey)
867 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
873 /// Grabs the key specified by a key for a window in a GrabMode. <br />
874 /// Details: This function can be used for following example scenarios: <br />
875 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
876 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
877 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
879 /// <param name="DaliKey">The key code to grab.</param>
880 /// <param name="GrabMode">The grab mode for the key.</param>
881 /// <returns>True if the grab succeeds.</returns>
882 /// <since_tizen> 3 </since_tizen>
883 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
885 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
886 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891 /// Ungrabs the key specified by a key for a window.<br />
892 /// 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 />
894 /// <param name="DaliKey">The key code to ungrab.</param>
895 /// <returns>True if the ungrab succeeds.</returns>
896 /// <since_tizen> 3 </since_tizen>
897 public bool UngrabKey(int DaliKey)
899 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
900 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
905 /// Sets the keyboard repeat information.
907 /// <param name="rate">The key repeat rate value in seconds.</param>
908 /// <param name="delay">The key repeat delay value in seconds.</param>
909 /// <returns>True if setting the keyboard repeat succeeds.</returns>
910 /// <since_tizen> 5 </since_tizen>
911 public bool SetKeyboardRepeatInfo(float rate, float delay)
913 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919 /// Gets the keyboard repeat information.
921 /// <param name="rate">The key repeat rate value in seconds.</param>
922 /// <param name="delay">The key repeat delay value in seconds.</param>
923 /// <returns>True if setting the keyboard repeat succeeds.</returns>
924 /// <since_tizen> 5 </since_tizen>
925 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
927 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
933 /// Adds a layer to the stage.
935 /// <param name="layer">Layer to add.</param>
936 /// <since_tizen> 3 </since_tizen>
937 public void AddLayer(Layer layer)
943 /// Removes a layer from the stage.
945 /// <param name="layer">Layer to remove.</param>
946 /// <since_tizen> 3 </since_tizen>
947 public void RemoveLayer(Layer layer)
953 /// Feeds a key event into the window.
955 /// <param name="keyEvent">The key event to feed.</param>
956 /// <since_tizen> 5 </since_tizen>
957 public void FeedKey(Key keyEvent)
959 Interop.Window.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
960 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
964 /// Allows at least one more render, even when paused.
965 /// The window should be shown, not minimised.
967 /// <since_tizen> 4 </since_tizen>
968 public void RenderOnce()
970 Interop.Window.Window_RenderOnce(swigCPtr);
971 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
975 /// Sets whether the window is transparent or not.
977 /// <param name="transparent">Whether the window is transparent or not.</param>
978 /// <since_tizen> 5 </since_tizen>
979 public void SetTransparency(bool transparent)
981 Interop.Window.SetTransparency(swigCPtr, transparent);
982 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
984 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
988 /// Sets parent window of the window.
989 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
990 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
991 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
993 /// <param name="parent">The parent window.</param>
994 /// <since_tizen> 6 </since_tizen>
995 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
996 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
997 public void SetParent(Window parent)
999 if (IsSupportedMultiWindow() == false)
1001 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1003 Interop.Window.SetParent(swigCPtr, Window.getCPtr(parent));
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1008 /// Unsets parent window of the window.
1009 /// After unsetting, the window is disconnected his parent window.
1011 /// <since_tizen> 6 </since_tizen>
1012 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1013 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1014 public void Unparent()
1016 if (IsSupportedMultiWindow() == false)
1018 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1020 Interop.Window.Unparent(swigCPtr);
1021 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1025 /// Gets parent window of the window.
1027 /// <returns>The parent window of the window.</returns>
1028 /// <since_tizen> 6 </since_tizen>
1029 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1030 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1031 public Window GetParent()
1033 if (IsSupportedMultiWindow() == false)
1035 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1037 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(swigCPtr)) as Window;
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1042 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1043 [EditorBrowsable(EditorBrowsableState.Never)]
1044 public void ObjectDump()
1046 Layer rootLayer = GetRootLayer();
1047 foreach (View view in rootLayer.Children)
1053 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1055 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1058 internal static bool IsInstalled()
1060 bool ret = Interop.Stage.Stage_IsInstalled();
1061 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1065 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
1067 Interop.WindowInternal.Window_ShowIndicator(swigCPtr, (int)visibleMode);
1068 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1071 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
1073 Interop.WindowInternal.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
1074 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1077 internal void RotateIndicator(Window.WindowOrientation orientation)
1079 Interop.WindowInternal.Window_RotateIndicator(swigCPtr, (int)orientation);
1080 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1084 /// Adds an orientation to the list of available orientations.
1086 /// <param name="orientation">The available orientation to add</param>
1087 /// <since_tizen> 6 </since_tizen>
1088 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1090 Interop.Window.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
1091 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1095 /// Removes an orientation from the list of available orientations.
1097 /// <param name="orientation">The available orientation to remove.</param>
1098 /// <since_tizen> 6 </since_tizen>
1099 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1101 Interop.Window.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
1102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1106 /// Sets a preferred orientation.
1108 /// <param name="orientation">The preferred orientation.</param>
1109 /// <since_tizen> 6 </since_tizen>
1110 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1112 Interop.Window.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
1113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1117 /// Gets the preferred orientation.
1119 /// <since_tizen> 6 </since_tizen>
1120 /// <returns>The preferred orientation if previously set, or none.</returns>
1121 public Window.WindowOrientation GetPreferredOrientation()
1123 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetPreferredOrientation(swigCPtr);
1124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1129 /// Gets current orientation of the window.
1131 /// <since_tizen> 6 </since_tizen>
1132 /// <returns>The current window orientation if previously set, or none.</returns>
1133 [EditorBrowsable(EditorBrowsableState.Never)]
1134 public Window.WindowOrientation GetCurrentOrientation()
1136 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.Window_GetCurrentOrientation(swigCPtr);
1137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1142 /// Sets available orientations of the window.
1143 /// This API is for setting several orientations one time.
1145 /// <param name="orientations">The list of orientations.</param>
1146 /// <since_tizen> 6 </since_tizen>
1147 [EditorBrowsable(EditorBrowsableState.Never)]
1148 public void SetAvailableOrientations( List<Window.WindowOrientation> orientations )
1150 PropertyArray orientationArray = new PropertyArray();
1151 for( int i = 0; i < orientations.Count; i++ )
1153 orientationArray.PushBack(new PropertyValue((int)orientations[i]));
1156 Interop.Window.Window_SetAvailableOrientations(swigCPtr, PropertyArray.getCPtr(orientationArray));
1157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1161 /// Get native window ID
1163 /// <returns>native window ID</returns>
1164 [EditorBrowsable(EditorBrowsableState.Never)]
1165 public int GetNativeId()
1167 int ret = Interop.Window.GetNativeId(swigCPtr);
1168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1172 internal Any GetNativeHandle()
1174 Any ret = new Any(Interop.WindowInternal.Window_GetNativeHandle(swigCPtr), true);
1175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1179 internal void Add(Layer layer)
1181 Interop.Window.Add(swigCPtr, Layer.getCPtr(layer));
1182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1184 LayersChildren?.Add(layer);
1185 layer.SetWindow(this);
1188 internal void Remove(Layer layer)
1190 Interop.Window.Remove(swigCPtr, Layer.getCPtr(layer));
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193 LayersChildren?.Remove(layer);
1194 layer.SetWindow(null);
1197 internal Vector2 GetSize()
1199 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1200 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1205 internal RenderTaskList GetRenderTaskList()
1207 RenderTaskList ret = new RenderTaskList(Interop.Stage.Stage_GetRenderTaskList(stageCPtr), true);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 /// Queries the number of on-window layers.
1215 /// <returns>The number of layers.</returns>
1216 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1217 internal uint GetLayerCount()
1219 if (LayersChildren == null || LayersChildren.Count < 0)
1222 return (uint) LayersChildren.Count;
1225 internal Layer GetRootLayer()
1227 // Window.IsInstalled() is actually true only when called from event thread and
1228 // Core has been initialized, not when Stage is ready.
1229 if (_rootLayer == null && Window.IsInstalled())
1231 _rootLayer = new Layer(Interop.Window.GetRootLayer(swigCPtr), true);
1232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233 LayersChildren?.Add(_rootLayer);
1234 _rootLayer.SetWindow(this);
1239 internal void SetBackgroundColor(Vector4 color)
1241 Interop.Window.SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 internal Vector4 GetBackgroundColor()
1247 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(swigCPtr), true);
1248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252 internal Vector2 GetDpi()
1254 Vector2 ret = new Vector2(Interop.Stage.Stage_GetDpi(stageCPtr), true);
1255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1259 internal ObjectRegistry GetObjectRegistry()
1261 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.Stage_GetObjectRegistry(stageCPtr), true);
1262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1266 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1268 Interop.Stage.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1272 internal RenderingBehaviorType GetRenderingBehavior()
1274 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.Stage_GetRenderingBehavior(stageCPtr);
1275 if (NDalicPINVOKE.SWIGPendingException.Pending)
1276 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1280 internal void SetWindowSize(Size2D size)
1282 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1283 Interop.Window.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1287 // Resetting Window size should request a relayout of the tree.
1290 internal Size2D GetWindowSize()
1292 var val = new Uint16Pair(Interop.Window.GetSize(swigCPtr), false);
1293 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1299 internal void SetPosition(Position2D position)
1301 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1302 Interop.Window.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305 // Setting Position of the window should request a relayout of the tree.
1308 internal Position2D GetPosition()
1310 var val = new Uint16Pair(Interop.Window.GetPosition(swigCPtr), true);
1311 Position2D ret = new Position2D(val.GetX(), val.GetY());
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1317 internal void SetPositionSize(Rectangle positionSize)
1319 Interop.Window.Window_SetPositionSize(swigCPtr, Rectangle.getCPtr(positionSize));
1321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1323 // Setting Position of the window should request a relayout of the tree.
1327 /// Dispose for Window
1329 [EditorBrowsable(EditorBrowsableState.Never)]
1330 protected override void Dispose(DisposeTypes type)
1337 if (type == DisposeTypes.Explicit)
1340 //Release your own managed resources here.
1341 //You should release all of your own disposable objects here.
1343 _rootLayer.Dispose();
1344 localController.Dispose();
1346 foreach(var layer in _childLayers)
1350 _childLayers.Clear();
1353 this.DisconnectNativeSignals();
1358 /// This will not be public opened.
1359 [EditorBrowsable(EditorBrowsableState.Never)]
1360 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1362 Interop.Window.delete_Window(swigCPtr);