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 global::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.Upcast(cPtr), cMemoryOwn)
51 if (Interop.Stage.IsInstalled())
53 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, Interop.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.New(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.New(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 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState instead!")]
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public enum EffectStates
169 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.None instead!")]
170 [EditorBrowsable(EditorBrowsableState.Never)]
173 /// Transition effect is started.
175 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.Start instead!")]
176 [EditorBrowsable(EditorBrowsableState.Never)]
179 /// Transition effect is ended.
181 [Obsolete("Please do not use! This will be removed. Please use Window.EffectState.End instead!")]
182 [EditorBrowsable(EditorBrowsableState.Never)]
187 /// Enumeration for transition effect's state.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public enum EffectState
195 [EditorBrowsable(EditorBrowsableState.Never)]
198 /// Transition effect is started.
200 [EditorBrowsable(EditorBrowsableState.Never)]
203 /// Transition effect is ended.
205 [EditorBrowsable(EditorBrowsableState.Never)]
210 /// Enumeration for transition effect's type.
212 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType instead!")]
213 [EditorBrowsable(EditorBrowsableState.Never)]
214 public enum EffectTypes
219 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.None instead!")]
220 [EditorBrowsable(EditorBrowsableState.Never)]
223 /// Window show effect.
225 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Show instead!")]
226 [EditorBrowsable(EditorBrowsableState.Never)]
229 /// Window hide effect.
231 [Obsolete("Please do not use! This will be removed. Please use Window.EffectType.Hide instead!")]
232 [EditorBrowsable(EditorBrowsableState.Never)]
237 /// Enumeration for transition effect's type.
239 [EditorBrowsable(EditorBrowsableState.Never)]
240 public enum EffectType
245 [EditorBrowsable(EditorBrowsableState.Never)]
248 /// Window show effect.
250 [EditorBrowsable(EditorBrowsableState.Never)]
253 /// Window hide effect.
255 [EditorBrowsable(EditorBrowsableState.Never)]
260 /// The stage instance property (read-only).<br />
261 /// Gets the current window.<br />
263 /// <since_tizen> 3 </since_tizen>
264 public static Window Instance
273 /// Gets or sets a window type.
275 /// <since_tizen> 3 </since_tizen>
276 public WindowType Type
280 WindowType ret = (WindowType)Interop.Window.GetType(SwigCPtr);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
286 Interop.Window.SetType(SwigCPtr, (int)value);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 /// Gets/Sets a window title.
294 /// <since_tizen> 4 </since_tizen>
303 _windowTitle = value;
304 SetClass(_windowTitle, "");
309 /// The rendering behavior of a Window.
311 /// <since_tizen> 5 </since_tizen>
312 public RenderingBehaviorType RenderingBehavior
316 return GetRenderingBehavior();
320 SetRenderingBehavior(value);
325 /// The window size property (read-only).
327 /// <since_tizen> 3 </since_tizen>
332 Size2D ret = GetSize();
338 /// The background color property.
340 /// <since_tizen> 3 </since_tizen>
341 public Color BackgroundColor
345 SetBackgroundColor(value);
349 Color ret = GetBackgroundColor();
355 /// The DPI property (read-only).<br />
356 /// Retrieves the DPI of the display device to which the Window is connected.<br />
358 /// <since_tizen> 3 </since_tizen>
368 /// The layer count property (read-only).<br />
369 /// Queries the number of on-Window layers.<br />
371 /// <since_tizen> 3 </since_tizen>
372 public uint LayerCount
376 return GetLayerCount();
381 /// Gets or sets a size of the window.
383 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
384 /// <since_tizen> 4 </since_tizen>
385 public Size2D WindowSize
389 return GetWindowSize();
393 SetWindowSize(value);
398 /// Gets or sets a position of the window.
400 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
401 /// <since_tizen> 4 </since_tizen>
402 public Position2D WindowPosition
406 return GetPosition();
415 /// Sets position and size of the window. This API guarantees that
416 /// both moving and resizing of window will appear on the screen at once.
418 [EditorBrowsable(EditorBrowsableState.Never)]
419 public Rectangle WindowPositionSize
423 Position2D position = GetPosition();
424 Size2D size = GetSize();
425 Rectangle ret = new Rectangle(position.X, position.Y, size.Width, size.Height);
431 SetPositionSize(value);
435 internal static Vector4 DEFAULT_BACKGROUND_COLOR
439 global::System.IntPtr cPtr = Interop.Stage.DefaultBackgroundColorGet();
440 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 internal static Vector4 DEBUG_BACKGROUND_COLOR
450 global::System.IntPtr cPtr = Interop.Stage.DebugBackgroundColorGet();
451 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 internal List<Layer> LayersChildren
466 /// Get the LayoutController for this Window.
468 internal LayoutController LayoutController
472 return localController;
477 /// Feed a key-event into the window.
479 /// <param name="keyEvent">The key event to feed.</param>
480 /// <since_tizen> 4 </since_tizen>
481 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
482 public static void FeedKeyEvent(Key keyEvent)
484 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
485 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489 /// Sets whether the window accepts a focus or not.
491 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
492 /// <since_tizen> 3 </since_tizen>
493 public void SetAcceptFocus(bool accept)
495 Interop.Window.SetAcceptFocus(SwigCPtr, accept);
496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
500 /// Returns whether the window accepts a focus or not.
502 /// <returns>True if the window accepts a focus, false otherwise.</returns>
503 /// <since_tizen> 3 </since_tizen>
504 public bool IsFocusAcceptable()
506 bool ret = Interop.Window.IsFocusAcceptable(SwigCPtr);
507 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
513 /// Shows the window if it is hidden.
515 /// <since_tizen> 3 </since_tizen>
518 Interop.Window.Show(SwigCPtr);
519 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 /// Hides the window if it is showing.
525 /// <since_tizen> 3 </since_tizen>
528 Interop.Window.Hide(SwigCPtr);
529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 /// Retrieves whether the window is visible or not.
535 /// <returns>True if the window is visible.</returns>
536 /// <since_tizen> 3 </since_tizen>
537 public bool IsVisible()
539 bool temp = Interop.Window.IsVisible(SwigCPtr);
540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545 /// Gets the count of supported auxiliary hints of the window.
547 /// <returns>The number of supported auxiliary hints.</returns>
548 /// <since_tizen> 3 </since_tizen>
549 public uint GetSupportedAuxiliaryHintCount()
551 uint ret = Interop.Window.GetSupportedAuxiliaryHintCount(SwigCPtr);
552 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557 /// Gets the supported auxiliary hint string of the window.
559 /// <param name="index">The index of the supported auxiliary hint lists.</param>
560 /// <returns>The auxiliary hint string of the index.</returns>
561 /// <since_tizen> 3 </since_tizen>
562 public string GetSupportedAuxiliaryHint(uint index)
564 string ret = Interop.Window.GetSupportedAuxiliaryHint(SwigCPtr, index);
565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
570 /// Creates an auxiliary hint of the window.
572 /// <param name="hint">The auxiliary hint string.</param>
573 /// <param name="value">The value string.</param>
574 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
575 /// <since_tizen> 3 </since_tizen>
576 public uint AddAuxiliaryHint(string hint, string value)
578 uint ret = Interop.Window.AddAuxiliaryHint(SwigCPtr, hint, value);
579 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584 /// Removes an auxiliary hint of the window.
586 /// <param name="id">The ID of the auxiliary hint.</param>
587 /// <returns>True if no error occurred, false otherwise.</returns>
588 /// <since_tizen> 3 </since_tizen>
589 public bool RemoveAuxiliaryHint(uint id)
591 bool ret = Interop.Window.RemoveAuxiliaryHint(SwigCPtr, id);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// Changes a value of the auxiliary hint.
599 /// <param name="id">The auxiliary hint ID.</param>
600 /// <param name="value">The value string to be set.</param>
601 /// <returns>True if no error occurred, false otherwise.</returns>
602 /// <since_tizen> 3 </since_tizen>
603 public bool SetAuxiliaryHintValue(uint id, string value)
605 bool ret = Interop.Window.SetAuxiliaryHintValue(SwigCPtr, id, value);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 /// Gets a value of the auxiliary hint.
613 /// <param name="id">The auxiliary hint ID.</param>
614 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
615 /// <since_tizen> 3 </since_tizen>
616 public string GetAuxiliaryHintValue(uint id)
618 string ret = Interop.Window.GetAuxiliaryHintValue(SwigCPtr, id);
619 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 /// Gets an ID of the auxiliary hint string.
626 /// <param name="hint">The auxiliary hint string.</param>
627 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
628 /// <since_tizen> 3 </since_tizen>
629 public uint GetAuxiliaryHintId(string hint)
631 uint ret = Interop.Window.GetAuxiliaryHintId(SwigCPtr, hint);
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637 /// Sets a region to accept input events.
639 /// <param name="inputRegion">The region to accept input events.</param>
640 /// <since_tizen> 3 </since_tizen>
641 public void SetInputRegion(Rectangle inputRegion)
643 Interop.Window.SetInputRegion(SwigCPtr, Rectangle.getCPtr(inputRegion));
644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648 /// Sets a priority level for the specified notification window.
650 /// <param name="level">The notification window level.</param>
651 /// <returns>True if no error occurred, false otherwise.</returns>
652 /// <since_tizen> 3 </since_tizen>
653 public bool SetNotificationLevel(NotificationLevel level)
655 bool ret = Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
656 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
661 /// Gets a priority level for the specified notification window.
663 /// <returns>The notification window level.</returns>
664 /// <since_tizen> 3 </since_tizen>
665 public NotificationLevel GetNotificationLevel()
667 NotificationLevel ret = (NotificationLevel)Interop.Window.GetNotificationLevel(SwigCPtr);
668 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673 /// Sets a transparent window's visual state to opaque. <br />
674 /// If a visual state of a transparent window is opaque, <br />
675 /// then the window manager could handle it as an opaque window when calculating visibility.
677 /// <param name="opaque">Whether the window's visual state is opaque.</param>
678 /// <remarks>This will have no effect on an opaque window. <br />
679 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
681 /// <since_tizen> 3 </since_tizen>
682 public void SetOpaqueState(bool opaque)
684 Interop.Window.SetOpaqueState(SwigCPtr, opaque);
685 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
689 /// Returns whether a transparent window's visual state is opaque or not.
691 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
692 /// <remarks> The return value has no meaning on an opaque window. </remarks>
693 /// <since_tizen> 3 </since_tizen>
694 public bool IsOpaqueState()
696 bool ret = Interop.Window.IsOpaqueState(SwigCPtr);
697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
702 /// Sets a window's screen off mode.
704 /// <param name="screenOffMode">The screen mode.</param>
705 /// <returns>True if no error occurred, false otherwise.</returns>
706 /// <since_tizen> 4 </since_tizen>
707 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
709 bool ret = Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 /// Gets the screen mode of the window.
717 /// <returns>The screen off mode.</returns>
718 /// <since_tizen> 4 </since_tizen>
719 public ScreenOffMode GetScreenOffMode()
721 ScreenOffMode ret = (ScreenOffMode)Interop.Window.GetScreenOffMode(SwigCPtr);
722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
727 /// Sets preferred brightness of the window.
729 /// <param name="brightness">The preferred brightness (0 to 100).</param>
730 /// <returns>True if no error occurred, false otherwise.</returns>
731 /// <since_tizen> 3 </since_tizen>
732 public bool SetBrightness(int brightness)
734 bool ret = Interop.Window.SetBrightness(SwigCPtr, brightness);
735 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 /// Gets the preferred brightness of the window.
742 /// <returns>The preferred brightness.</returns>
743 /// <since_tizen> 3 </since_tizen>
744 public int GetBrightness()
746 int ret = Interop.Window.GetBrightness(SwigCPtr);
747 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
752 /// Sets the window name and the class string.
754 /// <param name="name">The name of the window.</param>
755 /// <param name="klass">The class of the window.</param>
756 /// <since_tizen> 4 </since_tizen>
757 public void SetClass(string name, string klass)
759 Interop.Window.SetClass(SwigCPtr, name, klass);
760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 /// Raises the window to the top of the window stack.
766 /// <since_tizen> 3 </since_tizen>
769 Interop.Window.Raise(SwigCPtr);
770 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
774 /// Lowers the window to the bottom of the window stack.
776 /// <since_tizen> 3 </since_tizen>
779 Interop.Window.Lower(SwigCPtr);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 /// Activates the window to the top of the window stack even it is iconified.
786 /// <since_tizen> 3 </since_tizen>
787 public void Activate()
789 Interop.Window.Activate(SwigCPtr);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
794 /// Gets the default ( root ) layer.
796 /// <returns>The root layer.</returns>
797 /// <since_tizen> 3 </since_tizen>
798 public Layer GetDefaultLayer()
800 return this.GetRootLayer();
804 /// Add a child view to window.
806 /// <param name="view">the child should be added to the window.</param>
807 /// <since_tizen> 3 </since_tizen>
808 public void Add(View view)
810 Interop.Actor.Add(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
815 view.InternalParent = this.GetRootLayer();
820 /// Remove a child view from window.
822 /// <param name="view">the child to be removed.</param>
823 /// <since_tizen> 3 </since_tizen>
824 public void Remove(View view)
826 Interop.Actor.Remove(Layer.getCPtr(GetRootLayer()), View.getCPtr(view));
827 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
830 view.InternalParent = null;
835 /// Retrieves the layer at a specified depth.
837 /// <param name="depth">The layer's depth index.</param>
838 /// <returns>The layer found at the given depth.</returns>
839 /// <since_tizen> 3 </since_tizen>
840 public Layer GetLayer(uint depth)
842 if (depth < LayersChildren?.Count)
844 Layer ret = LayersChildren?[Convert.ToInt32(depth)];
854 /// Destroy the window immediately.
856 [EditorBrowsable(EditorBrowsableState.Never)]
857 public void Destroy()
863 /// Keep rendering for at least the given amount of time.
865 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
866 /// <since_tizen> 3 </since_tizen>
867 public void KeepRendering(float durationSeconds)
869 Interop.Stage.KeepRendering(stageCPtr, durationSeconds);
870 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
874 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
875 /// This function can be used for following example scenarios: <br />
876 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
878 /// <param name="DaliKey">The key code to grab.</param>
879 /// <returns>True if the grab succeeds.</returns>
880 /// <since_tizen> 3 </since_tizen>
881 public bool GrabKeyTopmost(int DaliKey)
883 bool ret = Interop.Window.GrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
884 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
889 /// Ungrabs the key specified by a key for the window.<br />
890 /// 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 />
892 /// <param name="DaliKey">The key code to ungrab.</param>
893 /// <returns>True if the ungrab succeeds.</returns>
894 /// <since_tizen> 3 </since_tizen>
895 public bool UngrabKeyTopmost(int DaliKey)
897 bool ret = Interop.Window.UngrabKeyTopmost(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
898 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
903 /// Grabs the key specified by a key for a window in a GrabMode. <br />
904 /// Details: This function can be used for following example scenarios: <br />
905 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
906 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
907 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
909 /// <param name="DaliKey">The key code to grab.</param>
910 /// <param name="GrabMode">The grab mode for the key.</param>
911 /// <returns>True if the grab succeeds.</returns>
912 /// <since_tizen> 3 </since_tizen>
913 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
915 bool ret = Interop.Window.GrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey, (int)GrabMode);
916 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921 /// Ungrabs the key specified by a key for a window.<br />
922 /// 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 />
924 /// <param name="DaliKey">The key code to ungrab.</param>
925 /// <returns>True if the ungrab succeeds.</returns>
926 /// <since_tizen> 3 </since_tizen>
927 public bool UngrabKey(int DaliKey)
929 bool ret = Interop.Window.UngrabKey(HandleRef.ToIntPtr(this.SwigCPtr), DaliKey);
930 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 /// Sets the keyboard repeat information.
937 /// <param name="rate">The key repeat rate value in seconds.</param>
938 /// <param name="delay">The key repeat delay value in seconds.</param>
939 /// <returns>True if setting the keyboard repeat succeeds.</returns>
940 /// <since_tizen> 5 </since_tizen>
941 public bool SetKeyboardRepeatInfo(float rate, float delay)
943 bool ret = Interop.Window.SetKeyboardRepeatInfo(rate, delay);
944 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949 /// Gets the keyboard repeat information.
951 /// <param name="rate">The key repeat rate value in seconds.</param>
952 /// <param name="delay">The key repeat delay value in seconds.</param>
953 /// <returns>True if setting the keyboard repeat succeeds.</returns>
954 /// <since_tizen> 5 </since_tizen>
955 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
957 bool ret = Interop.Window.GetKeyboardRepeatInfo(out rate, out delay);
958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 /// Adds a layer to the stage.
965 /// <param name="layer">Layer to add.</param>
966 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
967 /// <since_tizen> 3 </since_tizen>
968 public void AddLayer(Layer layer)
974 /// Removes a layer from the stage.
976 /// <param name="layer">Layer to remove.</param>
977 /// <exception cref="ArgumentNullException"> Thrown when layer is null. </exception>
978 /// <since_tizen> 3 </since_tizen>
979 public void RemoveLayer(Layer layer)
985 /// Feeds a key event into the window.
987 /// <param name="keyEvent">The key event to feed.</param>
988 /// <since_tizen> 5 </since_tizen>
989 public void FeedKey(Key keyEvent)
991 Interop.Window.FeedKeyEvent(Key.getCPtr(keyEvent));
992 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
996 /// Allows at least one more render, even when paused.
997 /// The window should be shown, not minimised.
999 /// <since_tizen> 4 </since_tizen>
1000 public void RenderOnce()
1002 Interop.Window.RenderOnce(SwigCPtr);
1003 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007 /// Sets whether the window is transparent or not.
1009 /// <param name="transparent">Whether the window is transparent or not.</param>
1010 /// <since_tizen> 5 </since_tizen>
1011 public void SetTransparency(bool transparent)
1013 Interop.Window.SetTransparency(SwigCPtr, transparent);
1014 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1016 // Setting transparency of the window should request a relayout of the tree in the case the window changes from fully transparent.
1020 /// Sets parent window of the window.
1021 /// After setting that, these windows do together when raise-up, lower and iconified/deiconified.
1022 /// Initially, the window is located on top of the parent. The window can go below parent by calling Lower().
1023 /// If parent's window stack is changed by calling Raise() or Lower(), child windows are located on top of the parent again.
1025 /// <param name="parent">The parent window.</param>
1026 /// <since_tizen> 6 </since_tizen>
1027 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1028 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1029 public void SetParent(Window parent)
1031 if (IsSupportedMultiWindow() == false)
1033 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1035 Interop.Window.SetParent(SwigCPtr, Window.getCPtr(parent));
1036 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1040 /// Unsets parent window of the window.
1041 /// After unsetting, the window is disconnected his parent window.
1043 /// <since_tizen> 6 </since_tizen>
1044 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1045 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1046 public void Unparent()
1048 if (IsSupportedMultiWindow() == false)
1050 NUILog.Error("Fail to create window. because this device does not support opengles.surfaceless_context.");
1052 Interop.Window.Unparent(SwigCPtr);
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1057 /// Gets parent window of the window.
1059 /// <returns>The parent window of the window.</returns>
1060 /// <since_tizen> 6 </since_tizen>
1061 /// <feature> http://tizen.org/feature/opengles.surfaceless_context </feature>
1062 /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
1063 public Window GetParent()
1065 if (IsSupportedMultiWindow() == false)
1067 NUILog.Error("This device does not support surfaceless_context. So Window cannot be created. ");
1069 Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Window.GetParent(SwigCPtr)) as Window;
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1074 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
1075 [EditorBrowsable(EditorBrowsableState.Never)]
1076 public void ObjectDump()
1078 Layer rootLayer = GetRootLayer();
1079 foreach (View view in rootLayer.Children)
1085 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
1087 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1090 internal static bool IsInstalled()
1092 bool ret = Interop.Stage.IsInstalled();
1093 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1098 /// Adds an orientation to the list of available orientations.
1100 /// <param name="orientation">The available orientation to add</param>
1101 /// <since_tizen> 6 </since_tizen>
1102 public void AddAvailableOrientation(Window.WindowOrientation orientation)
1104 Interop.Window.AddAvailableOrientation(SwigCPtr, (int)orientation);
1105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1109 /// Removes an orientation from the list of available orientations.
1111 /// <param name="orientation">The available orientation to remove.</param>
1112 /// <since_tizen> 6 </since_tizen>
1113 public void RemoveAvailableOrientation(Window.WindowOrientation orientation)
1115 Interop.Window.RemoveAvailableOrientation(SwigCPtr, (int)orientation);
1116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1120 /// Sets a preferred orientation.
1122 /// <param name="orientation">The preferred orientation.</param>
1123 /// <since_tizen> 6 </since_tizen>
1124 public void SetPreferredOrientation(Window.WindowOrientation orientation)
1126 Interop.Window.SetPreferredOrientation(SwigCPtr, (int)orientation);
1127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1131 /// Gets the preferred orientation.
1133 /// <since_tizen> 6 </since_tizen>
1134 /// <returns>The preferred orientation if previously set, or none.</returns>
1135 public Window.WindowOrientation GetPreferredOrientation()
1137 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetPreferredOrientation(SwigCPtr);
1138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1143 /// Gets current orientation of the window.
1145 /// <since_tizen> 6 </since_tizen>
1146 /// <returns>The current window orientation if previously set, or none.</returns>
1147 [EditorBrowsable(EditorBrowsableState.Never)]
1148 public Window.WindowOrientation GetCurrentOrientation()
1150 Window.WindowOrientation ret = (Window.WindowOrientation)Interop.Window.GetCurrentOrientation(SwigCPtr);
1151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1156 /// Sets available orientations of the window.
1157 /// This API is for setting several orientations one time.
1159 /// <param name="orientations">The list of orientations.</param>
1160 /// <since_tizen> 6 </since_tizen>
1161 [EditorBrowsable(EditorBrowsableState.Never)]
1162 public void SetAvailableOrientations(List<Window.WindowOrientation> orientations)
1164 PropertyArray orientationArray = new PropertyArray();
1165 if (null != orientations)
1167 for (int i = 0; i < orientations.Count; i++)
1169 PropertyValue value = new PropertyValue((int)orientations[i]);
1170 orientationArray.PushBack(value);
1174 Interop.Window.SetAvailableOrientations(SwigCPtr, PropertyArray.getCPtr(orientationArray));
1175 for (uint i = 0; i < orientationArray.Count(); i++)
1177 orientationArray[i].Dispose();
1179 orientationArray.Dispose();
1180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1184 /// Get native window ID
1186 /// <returns>native window ID</returns>
1187 [EditorBrowsable(EditorBrowsableState.Never)]
1188 public int GetNativeId()
1190 int ret = Interop.Window.GetNativeId(SwigCPtr);
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1195 internal Any GetNativeHandle()
1197 Any ret = new Any(Interop.WindowInternal.WindowGetNativeHandle(SwigCPtr), true);
1198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1202 internal void Add(Layer layer)
1206 throw new ArgumentNullException(nameof(layer));
1208 Interop.Window.Add(SwigCPtr, Layer.getCPtr(layer));
1209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1211 LayersChildren?.Add(layer);
1212 layer.SetWindow(this);
1215 internal void Remove(Layer layer)
1219 throw new ArgumentNullException(nameof(layer));
1221 Interop.Window.Remove(SwigCPtr, Layer.getCPtr(layer));
1222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1224 LayersChildren?.Remove(layer);
1225 layer.SetWindow(null);
1228 internal Vector2 GetSize()
1230 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), false);
1231 Vector2 ret = new Vector2(val.GetWidth(), val.GetHeight());
1233 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1237 internal RenderTaskList GetRenderTaskList()
1239 RenderTaskList ret = new RenderTaskList(Interop.Stage.GetRenderTaskList(stageCPtr), true);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 /// Queries the number of on-window layers.
1247 /// <returns>The number of layers.</returns>
1248 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
1249 internal uint GetLayerCount()
1251 if (LayersChildren == null || LayersChildren.Count < 0)
1254 return (uint)LayersChildren.Count;
1257 internal Layer GetRootLayer()
1259 // Window.IsInstalled() is actually true only when called from event thread and
1260 // Core has been initialized, not when Stage is ready.
1261 if (_rootLayer == null && Window.IsInstalled())
1263 _rootLayer = new Layer(Interop.Window.GetRootLayer(SwigCPtr), true);
1264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 LayersChildren?.Add(_rootLayer);
1266 _rootLayer.SetWindow(this);
1271 internal void SetBackgroundColor(Vector4 color)
1273 Interop.Window.SetBackgroundColor(SwigCPtr, Vector4.getCPtr(color));
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1277 internal Vector4 GetBackgroundColor()
1279 Vector4 ret = new Vector4(Interop.Window.GetBackgroundColor(SwigCPtr), true);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284 internal Vector2 GetDpi()
1286 Vector2 ret = new Vector2(Interop.Stage.GetDpi(stageCPtr), true);
1287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1291 internal ObjectRegistry GetObjectRegistry()
1293 ObjectRegistry ret = new ObjectRegistry(Interop.Stage.GetObjectRegistry(stageCPtr), true);
1294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1298 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
1300 Interop.Stage.SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
1301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1304 internal RenderingBehaviorType GetRenderingBehavior()
1306 RenderingBehaviorType ret = (RenderingBehaviorType)Interop.Stage.GetRenderingBehavior(stageCPtr);
1307 if (NDalicPINVOKE.SWIGPendingException.Pending)
1308 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1312 internal void SetWindowSize(Size2D size)
1316 throw new ArgumentNullException(nameof(size));
1318 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1319 Interop.Window.SetSize(SwigCPtr, Uint16Pair.getCPtr(val));
1321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322 // Resetting Window size should request a relayout of the tree.
1325 internal Size2D GetWindowSize()
1327 var val = new Uint16Pair(Interop.Window.GetSize(SwigCPtr), false);
1328 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1334 internal void SetPosition(Position2D position)
1336 if (null == position)
1338 throw new ArgumentNullException(nameof(position));
1340 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1341 Interop.Window.SetPosition(SwigCPtr, Uint16Pair.getCPtr(val));
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1344 // Setting Position of the window should request a relayout of the tree.
1347 internal Position2D GetPosition()
1349 var val = new Uint16Pair(Interop.Window.GetPosition(SwigCPtr), true);
1350 Position2D ret = new Position2D(val.GetX(), val.GetY());
1352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356 internal void SetPositionSize(Rectangle positionSize)
1358 Interop.Window.SetPositionSize(SwigCPtr, Rectangle.getCPtr(positionSize));
1360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1362 // Setting Position of the window should request a relayout of the tree.
1366 /// Add FrameUpdateCallback
1368 [EditorBrowsable(EditorBrowsableState.Never)]
1369 public void AddFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1371 frameUpdateCallback?.AddFrameUpdateCallback(stageCPtr, Layer.getCPtr(GetRootLayer()));
1375 /// Remove FrameUpdateCallback
1377 [EditorBrowsable(EditorBrowsableState.Never)]
1378 public void RemoveFrameUpdateCallback(FrameUpdateCallbackInterface frameUpdateCallback)
1380 frameUpdateCallback?.RemoveFrameUpdateCallback(stageCPtr);
1384 /// Dispose for Window
1386 [EditorBrowsable(EditorBrowsableState.Never)]
1387 protected override void Dispose(DisposeTypes type)
1394 if (type == DisposeTypes.Explicit)
1397 //Release your own managed resources here.
1398 //You should release all of your own disposable objects here.
1400 if (_rootLayer != null)
1402 _rootLayer.Dispose();
1405 localController?.Dispose();
1407 foreach (var layer in _childLayers)
1415 _childLayers.Clear();
1418 this.DisconnectNativeSignals();
1423 /// This will not be public opened.
1424 [EditorBrowsable(EditorBrowsableState.Never)]
1425 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1427 Interop.Window.DeleteWindow(swigCPtr);
1430 private static Dictionary<int, internalHookCallbackType> frameCallbackList = new Dictionary<int, internalHookCallbackType>();
1432 private static readonly object locker = new object();
1434 private static int key = 0;
1436 private static FrameCallbackType internalHookFrameCallback = OnInternalHookFrameCallback;
1438 private struct internalHookCallbackType
1440 public FrameCallbackType userCallback;
1444 private static void OnInternalHookFrameCallback(int id)
1448 if (frameCallbackList.ContainsKey(id))
1450 if (frameCallbackList[id].userCallback != null)
1452 frameCallbackList[id].userCallback.Invoke(frameCallbackList[id].frameId);
1453 frameCallbackList.Remove(id);
1457 NUILog.Error($"found userCallback is NULL");
1458 frameCallbackList.Remove(id);
1464 private int AddInterHookCallback(FrameCallbackType callback, int frameId)
1466 if (null == callback)
1468 throw new ArgumentNullException(nameof(callback), "FrameCallbackType should not be null");
1470 var assignedKey = 0;
1475 frameCallbackList.Add(assignedKey, new internalHookCallbackType()
1477 userCallback = callback,
1485 /// Type of callback which is called when the frame rendering is done by graphics driver or when the frame is displayed on display.
1487 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1488 [EditorBrowsable(EditorBrowsableState.Never)]
1489 public delegate void FrameCallbackType(int frameId);
1492 /// Adds a callback that is called when the frame rendering is done by the graphics driver.
1493 /// A callback of the following type may be used:
1495 /// void MyFunction( int frameId )
1497 /// This callback will be deleted once it is called.
1499 /// Ownership of the callback is passed onto this class
1502 /// <param name="callback">The function to call</param>
1503 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1504 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1505 [EditorBrowsable(EditorBrowsableState.Never)]
1506 public void AddFrameRenderedCallback(FrameCallbackType callback, int frameId)
1508 var assignedKey = AddInterHookCallback(callback, frameId);
1509 Interop.WindowInternal.AddFrameRenderedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1511 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1515 /// Adds a callback that is called when the frame is displayed on the display.
1516 /// A callback of the following type may be used:
1518 /// void MyFunction( int frameId )
1520 /// This callback will be deleted once it is called.
1522 /// Ownership of the callback is passed onto this class
1525 /// <param name="callback">The function to call</param>
1526 /// <param name="frameId">The Id to specify the frame. It will be passed when the callback is called.</param>
1527 /// <exception cref="ArgumentNullException">This exception can occur by the callback is null.</exception>
1528 [EditorBrowsable(EditorBrowsableState.Never)]
1529 public void AddFramePresentedCallback(FrameCallbackType callback, int frameId)
1531 var assignedKey = AddInterHookCallback(callback, frameId);
1532 Interop.WindowInternal.AddFramePresentedCallback(SwigCPtr, new HandleRef(this, Marshal.GetFunctionPointerForDelegate<Delegate>(internalHookFrameCallback)), assignedKey);
1534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();