2 * Copyright(c) 2018 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 using System.Runtime.InteropServices;
19 using Tizen.NUI.BaseComponents;
20 using System.ComponentModel;
21 using System.Collections.Generic;
26 /// The window class is used internally for drawing.<br />
27 /// The window has an orientation and indicator properties.<br />
29 /// <since_tizen> 3 </since_tizen>
30 public class Window : BaseHandle
32 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
34 private readonly global::System.Runtime.InteropServices.HandleRef rootLayoutCPtr;
35 private Layer _rootLayer;
36 private string _windowTitle;
38 private List<Layer> _childLayers = new List<Layer>();
39 internal List<Layer> LayersChildren
47 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
49 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
50 if (NDalicPINVOKE.Stage_IsInstalled())
52 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
53 // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
54 // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
55 // Currently without these measure specs the new layout added will always be the size of the window.
56 global::System.IntPtr rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout();
57 // Store HandleRef used by Add()
58 rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr);
59 Layer rootLayer = GetRootLayer();
60 // Add the root layout created above to the root layer.
61 NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr );
65 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
67 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
70 internal static Window GetCurrent()
72 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
73 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77 internal static bool IsInstalled()
79 bool ret = NDalicPINVOKE.Stage_IsInstalled();
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 /// Sets whether the window accepts a focus or not.
87 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
88 /// <since_tizen> 3 </since_tizen>
89 public void SetAcceptFocus(bool accept)
91 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 /// Returns whether the window accepts a focus or not.
98 /// <returns>True if the window accepts a focus, false otherwise.</returns>
99 /// <since_tizen> 3 </since_tizen>
100 public bool IsFocusAcceptable()
102 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 /// Shows the window if it is hidden.
111 /// <since_tizen> 3 </since_tizen>
114 NDalicPINVOKE.Show(swigCPtr);
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 /// Hides the window if it is showing.
121 /// <since_tizen> 3 </since_tizen>
124 NDalicPINVOKE.Hide(swigCPtr);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// Retrieves whether the window is visible or not.
131 /// <returns>True if the window is visible.</returns>
132 /// <since_tizen> 3 </since_tizen>
133 public bool IsVisible()
135 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Gets the count of supported auxiliary hints of the window.
143 /// <returns>The number of supported auxiliary hints.</returns>
144 /// <since_tizen> 3 </since_tizen>
145 public uint GetSupportedAuxiliaryHintCount()
147 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// Gets the supported auxiliary hint string of the window.
155 /// <param name="index">The index of the supported auxiliary hint lists.</param>
156 /// <returns>The auxiliary hint string of the index.</returns>
157 /// <since_tizen> 3 </since_tizen>
158 public string GetSupportedAuxiliaryHint(uint index)
160 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// Creates an auxiliary hint of the window.
168 /// <param name="hint">The auxiliary hint string.</param>
169 /// <param name="value">The value string.</param>
170 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
171 /// <since_tizen> 3 </since_tizen>
172 public uint AddAuxiliaryHint(string hint, string value)
174 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 /// Removes an auxiliary hint of the window.
182 /// <param name="id">The ID of the auxiliary hint.</param>
183 /// <returns>True if no error occurred, false otherwise.</returns>
184 /// <since_tizen> 3 </since_tizen>
185 public bool RemoveAuxiliaryHint(uint id)
187 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 /// Changes a value of the auxiliary hint.
195 /// <param name="id">The auxiliary hint ID.</param>
196 /// <param name="value">The value string to be set.</param>
197 /// <returns>True if no error occurred, false otherwise.</returns>
198 /// <since_tizen> 3 </since_tizen>
199 public bool SetAuxiliaryHintValue(uint id, string value)
201 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 /// Gets a value of the auxiliary hint.
209 /// <param name="id">The auxiliary hint ID.</param>
210 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
211 /// <since_tizen> 3 </since_tizen>
212 public string GetAuxiliaryHintValue(uint id)
214 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220 /// Gets an ID of the auxiliary hint string.
222 /// <param name="hint">The auxiliary hint string.</param>
223 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
224 /// <since_tizen> 3 </since_tizen>
225 public uint GetAuxiliaryHintId(string hint)
227 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 /// Sets a region to accept input events.
235 /// <param name="inputRegion">The region to accept input events.</param>
236 /// <since_tizen> 3 </since_tizen>
237 public void SetInputRegion(Rectangle inputRegion)
239 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
244 /// Gets or sets a window type.
246 /// <since_tizen> 3 </since_tizen>
247 public WindowType Type
251 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 NDalicPINVOKE.SetType(swigCPtr, (int)value);
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263 /// Sets a priority level for the specified notification window.
265 /// <param name="level">The notification window level.</param>
266 /// <returns>True if no error occurred, false otherwise.</returns>
267 /// <since_tizen> 3 </since_tizen>
268 public bool SetNotificationLevel(NotificationLevel level)
270 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 /// Gets a priority level for the specified notification window.
278 /// <returns>The notification window level.</returns>
279 /// <since_tizen> 3 </since_tizen>
280 public NotificationLevel GetNotificationLevel()
282 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 /// Sets a transparent window's visual state to opaque. <br />
289 /// If a visual state of a transparent window is opaque, <br />
290 /// then the window manager could handle it as an opaque window when calculating visibility.
292 /// <param name="opaque">Whether the window's visual state is opaque.</param>
293 /// <remarks>This will have no effect on an opaque window. <br />
294 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
296 /// <since_tizen> 3 </since_tizen>
297 public void SetOpaqueState(bool opaque)
299 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 /// Returns whether a transparent window's visual state is opaque or not.
306 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
307 /// <remarks> The return value has no meaning on an opaque window. </remarks>
308 /// <since_tizen> 3 </since_tizen>
309 public bool IsOpaqueState()
311 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
312 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 /// Sets a window's screen off mode.
319 /// <param name="screenOffMode">The screen mode.</param>
320 /// <returns>True if no error occurred, false otherwise.</returns>
321 /// <since_tizen> 4 </since_tizen>
322 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
324 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
325 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 /// Gets the screen mode of the window.
332 /// <returns>The screen off mode.</returns>
333 /// <since_tizen> 4 </since_tizen>
334 public ScreenOffMode GetScreenOffMode()
336 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 /// Sets preferred brightness of the window.
344 /// <param name="brightness">The preferred brightness (0 to 100).</param>
345 /// <returns>True if no error occurred, false otherwise.</returns>
346 /// <since_tizen> 3 </since_tizen>
347 public bool SetBrightness(int brightness)
349 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 /// Gets the preferred brightness of the window.
357 /// <returns>The preferred brightness.</returns>
358 /// <since_tizen> 3 </since_tizen>
359 public int GetBrightness()
361 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
362 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 /// The focus changed event argument.
369 /// <since_tizen> 3 </since_tizen>
370 public class FocusChangedEventArgs : EventArgs
373 /// FocusGained flag.
375 /// <since_tizen> 3 </since_tizen>
376 public bool FocusGained
383 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
384 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
385 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
386 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
389 /// FocusChanged event.
391 /// <since_tizen> 3 </since_tizen>
392 public event EventHandler<FocusChangedEventArgs> FocusChanged
396 if (_windowFocusChangedEventHandler == null)
398 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
399 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
402 _windowFocusChangedEventHandler += value;
406 _windowFocusChangedEventHandler -= value;
408 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
410 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
415 private void OnWindowFocusedChanged(bool focusGained)
417 FocusChangedEventArgs e = new FocusChangedEventArgs();
419 e.FocusGained = focusGained;
421 if (_windowFocusChangedEventHandler != null)
423 _windowFocusChangedEventHandler(this, e);
428 /// Gets/Sets a window title.
430 /// <since_tizen> 4 </since_tizen>
439 _windowTitle = value;
440 SetClass(_windowTitle, "");
445 /// The rendering behavior of a Window.
447 /// <since_tizen> 5 </since_tizen>
448 public RenderingBehaviorType RenderingBehavior
452 return GetRenderingBehavior();
456 SetRenderingBehavior(value);
460 internal WindowFocusSignalType WindowFocusChangedSignal()
462 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
463 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
472 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
474 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
482 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
484 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
489 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
490 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
493 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
495 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 internal void RotateIndicator(Window.WindowOrientation orientation)
501 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
506 /// Sets the window name and the class string.
508 /// <param name="name">The name of the window.</param>
509 /// <param name="klass">The class of the window.</param>
510 /// <since_tizen> 4 </since_tizen>
511 public void SetClass(string name, string klass)
513 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
514 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518 /// Raises the window to the top of the window stack.
520 /// <since_tizen> 3 </since_tizen>
523 NDalicPINVOKE.Window_Raise(swigCPtr);
524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528 /// Lowers the window to the bottom of the window stack.
530 /// <since_tizen> 3 </since_tizen>
533 NDalicPINVOKE.Window_Lower(swigCPtr);
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
538 /// Activates the window to the top of the window stack even it is iconified.
540 /// <since_tizen> 3 </since_tizen>
541 public void Activate()
543 NDalicPINVOKE.Window_Activate(swigCPtr);
544 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
549 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
555 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
556 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
561 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
562 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565 internal Window.WindowOrientation GetPreferredOrientation()
567 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572 internal DragAndDropDetector GetDragAndDropDetector()
574 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
575 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579 internal Any GetNativeHandle()
581 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586 internal WindowFocusSignalType FocusChangedSignal()
588 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
589 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
594 /// Gets the default ( root ) layer.
596 /// <returns>The root layer.</returns>
597 /// <since_tizen> 3 </since_tizen>
598 public Layer GetDefaultLayer()
600 return this.GetRootLayer();
603 internal void Add(Layer layer)
605 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 LayersChildren.Add(layer);
611 internal void Remove(Layer layer)
613 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
614 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 LayersChildren.Remove(layer);
620 /// Add a child view to window.
622 /// <param name="view">the child should be added to the window.</param>
623 /// <since_tizen> 3 </since_tizen>
624 public void Add(View view)
626 NDalicPINVOKE.Actor_Add( rootLayoutCPtr, View.getCPtr(view) );
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
629 view.InternalParent = this.GetRootLayer();
633 /// Remove a child view from window.
635 /// <param name="view">the child to be removed.</param>
636 /// <since_tizen> 3 </since_tizen>
637 public void Remove(View view)
639 NDalicPINVOKE.Actor_Remove( rootLayoutCPtr, View.getCPtr(view) );
640 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
641 view.InternalParent = null;
644 internal Vector2 GetSize()
646 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
647 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
651 internal RenderTaskList GetRenderTaskList()
653 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 /// Queries the number of on-window layers.
661 /// <returns>The number of layers.</returns>
662 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
663 internal uint GetLayerCount()
665 if (LayersChildren == null || LayersChildren.Count < 0)
668 return (uint) LayersChildren.Count;
672 /// Retrieves the layer at a specified depth.
674 /// <param name="depth">The layer's depth index.</param>
675 /// <returns>The layer found at the given depth.</returns>
676 /// <since_tizen> 3 </since_tizen>
677 public Layer GetLayer(uint depth)
679 if (depth < LayersChildren.Count)
681 Layer ret = LayersChildren[Convert.ToInt32(depth)];
690 internal Layer GetRootLayer()
692 // Window.IsInstalled() is actually true only when called from event thread and
693 // Core has been initialized, not when Stage is ready.
694 if (_rootLayer == null && Window.IsInstalled())
696 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698 LayersChildren.Add(_rootLayer);
703 internal void SetBackgroundColor(Vector4 color)
705 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
709 internal Vector4 GetBackgroundColor()
711 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
712 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
716 internal Vector2 GetDpi()
718 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723 internal ObjectRegistry GetObjectRegistry()
725 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
726 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 /// Keep rendering for at least the given amount of time.
733 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
734 /// <since_tizen> 3 </since_tizen>
735 public void KeepRendering(float durationSeconds)
737 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
738 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
741 internal void SetRenderingBehavior(RenderingBehaviorType renderingBehavior)
743 NDalicPINVOKE.Stage_SetRenderingBehavior(stageCPtr, (int)renderingBehavior);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal RenderingBehaviorType GetRenderingBehavior()
749 RenderingBehaviorType ret = (RenderingBehaviorType)NDalicPINVOKE.Stage_GetRenderingBehavior(stageCPtr);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 internal KeyEventSignal KeyEventSignal()
757 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 internal VoidSignal EventProcessingFinishedSignal()
764 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal TouchSignal TouchSignal()
771 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 internal TouchDataSignal TouchDataSignal()
778 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
779 if (NDalicPINVOKE.SWIGPendingException.Pending)
780 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 private StageWheelSignal WheelEventSignal()
786 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
792 private WheelSignal StageWheelEventSignal()
794 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
795 if (NDalicPINVOKE.SWIGPendingException.Pending)
796 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 internal VoidSignal ContextLostSignal()
803 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
804 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
808 internal VoidSignal ContextRegainedSignal()
810 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
811 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
815 internal VoidSignal SceneCreatedSignal()
817 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 internal ResizedSignal ResizedSignal()
824 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
825 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
829 internal static Vector4 DEFAULT_BACKGROUND_COLOR
833 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
834 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 internal static Vector4 DEBUG_BACKGROUND_COLOR
844 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
845 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 private static readonly Window instance = Application.Instance.GetWindow();
854 /// The stage instance property (read-only).<br />
855 /// Gets the current window.<br />
857 /// <since_tizen> 3 </since_tizen>
858 public static Window Instance
867 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
868 /// This function can be used for following example scenarios: <br />
869 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
871 /// <param name="DaliKey">The key code to grab.</param>
872 /// <returns>True if the grab succeeds.</returns>
873 /// <since_tizen> 3 </since_tizen>
874 public bool GrabKeyTopmost(int DaliKey)
876 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
877 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 /// Ungrabs the key specified by a key for the window.<br />
883 /// 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 />
885 /// <param name="DaliKey">The key code to ungrab.</param>
886 /// <returns>True if the ungrab succeeds.</returns>
887 /// <since_tizen> 3 </since_tizen>
888 public bool UngrabKeyTopmost(int DaliKey)
890 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
891 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
896 /// Grabs the key specified by a key for a window in a GrabMode. <br />
897 /// Details: This function can be used for following example scenarios: <br />
898 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
899 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
900 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
902 /// <param name="DaliKey">The key code to grab.</param>
903 /// <param name="GrabMode">The grab mode for the key.</param>
904 /// <returns>True if the grab succeeds.</returns>
905 /// <since_tizen> 3 </since_tizen>
906 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
908 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
909 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914 /// Ungrabs the key specified by a key for a window.<br />
915 /// 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 />
917 /// <param name="DaliKey">The key code to ungrab.</param>
918 /// <returns>True if the ungrab succeeds.</returns>
919 /// <since_tizen> 3 </since_tizen>
920 public bool UngrabKey(int DaliKey)
922 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
923 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
928 /// Sets the keyboard repeat information.
930 /// <param name="rate">The key repeat rate value in seconds.</param>
931 /// <param name="delay">The key repeat delay value in seconds.</param>
932 /// <returns>True if setting the keyboard repeat succeeds.</returns>
933 /// <since_tizen> 5 </since_tizen>
934 public bool SetKeyboardRepeatInfo(float rate, float delay)
936 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942 /// Gets the keyboard repeat information.
944 /// <param name="rate">The key repeat rate value in seconds.</param>
945 /// <param name="delay">The key repeat delay value in seconds.</param>
946 /// <returns>True if setting the keyboard repeat succeeds.</returns>
947 /// <since_tizen> 5 </since_tizen>
948 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
950 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 internal System.IntPtr GetNativeWindowHandler()
957 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
965 /// <since_tizen> 3 </since_tizen>
966 public enum WindowOrientation
969 /// Portrait orientation. The height of the display area is greater than the width.
971 /// <since_tizen> 3 </since_tizen>
974 /// Landscape orientation. A wide view area is needed.
976 /// <since_tizen> 3 </since_tizen>
979 /// Portrait inverse orientation.
981 /// <since_tizen> 3 </since_tizen>
982 PortraitInverse = 180,
984 /// Landscape inverse orientation.
986 /// <since_tizen> 3 </since_tizen>
987 LandscapeInverse = 270
991 /// Enumeration for the key grab mode for platform-level APIs.
993 /// <since_tizen> 3 </since_tizen>
994 public enum KeyGrabMode
997 /// Grabs a key only when on the top of the grabbing-window stack mode.
1001 /// Grabs a key together with the other client window(s) mode.
1005 /// 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.
1009 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
1015 /// Enumeration for opacity of the indicator.
1017 internal enum IndicatorBackgroundOpacity
1025 /// Enumeration for visible mode of the indicator.
1027 internal enum IndicatorVisibleMode
1035 /// The touch event argument.
1037 /// <since_tizen> 3 </since_tizen>
1038 public class TouchEventArgs : EventArgs
1040 private Touch _touch;
1045 /// <since_tizen> 3 </since_tizen>
1060 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
1061 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1062 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
1063 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
1065 /// This event is emitted when the screen is touched and when the touch ends.<br />
1066 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1067 /// then when the last finger is lifted.<br />
1068 /// An interrupted event will also be emitted (if it occurs).<br />
1070 /// <since_tizen> 3 </since_tizen>
1071 public event EventHandler<TouchEventArgs> TouchEvent
1075 if (_rootLayerTouchDataEventHandler == null)
1077 _rootLayerTouchDataCallback = OnWindowTouch;
1078 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
1080 _rootLayerTouchDataEventHandler += value;
1084 _rootLayerTouchDataEventHandler -= value;
1085 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
1087 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1092 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1094 if (touchData == global::System.IntPtr.Zero)
1096 NUILog.Error("touchData should not be null!");
1100 TouchEventArgs e = new TouchEventArgs();
1102 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1104 if (_rootLayerTouchDataEventHandler != null)
1106 _rootLayerTouchDataEventHandler(this, e);
1112 /// Wheel event arguments.
1114 /// <since_tizen> 3 </since_tizen>
1115 public class WheelEventArgs : EventArgs
1117 private Wheel _wheel;
1122 /// <since_tizen> 3 </since_tizen>
1136 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1138 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1139 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
1140 private WheelEventCallbackType _wheelEventCallback;
1143 /// This event is emitted when the wheel event is received.
1145 /// <since_tizen> 3 </since_tizen>
1146 public event EventHandler<WheelEventArgs> WheelEvent
1150 if (_stageWheelHandler == null)
1152 _wheelEventCallback = OnStageWheel;
1153 this.StageWheelEventSignal().Connect(_wheelEventCallback);
1155 _stageWheelHandler += value;
1159 _stageWheelHandler -= value;
1160 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
1162 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
1167 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1169 if (wheelEvent == global::System.IntPtr.Zero)
1171 NUILog.Error("wheelEvent should not be null!");
1175 WheelEventArgs e = new WheelEventArgs();
1177 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1179 if (_stageWheelHandler != null)
1181 _stageWheelHandler(this, e);
1187 /// Key event arguments.
1189 /// <since_tizen> 3 </since_tizen>
1190 public class KeyEventArgs : EventArgs
1197 /// <since_tizen> 3 </since_tizen>
1211 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1212 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1215 /// This event is emitted when the key event is received.
1217 /// <since_tizen> 3 </since_tizen>
1218 public event EventHandler<KeyEventArgs> KeyEvent
1222 if (_stageKeyHandler == null)
1224 _stageKeyCallbackDelegate = OnStageKey;
1225 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1227 _stageKeyHandler += value;
1231 _stageKeyHandler -= value;
1232 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1234 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1239 // Callback for Stage KeyEventsignal
1240 private void OnStageKey(IntPtr data)
1242 KeyEventArgs e = new KeyEventArgs();
1246 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1249 if (_stageKeyHandler != null)
1251 //here we send all data to user event handlers
1252 _stageKeyHandler(this, e);
1257 private event EventHandler _stageEventProcessingFinishedEventHandler;
1258 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1260 internal event EventHandler EventProcessingFinished
1264 if (_stageEventProcessingFinishedEventHandler == null)
1266 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1267 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1269 _stageEventProcessingFinishedEventHandler += value;
1274 _stageEventProcessingFinishedEventHandler -= value;
1275 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1277 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1282 // Callback for Stage EventProcessingFinishedSignal
1283 private void OnEventProcessingFinished()
1285 if (_stageEventProcessingFinishedEventHandler != null)
1287 _stageEventProcessingFinishedEventHandler(this, null);
1292 private EventHandler _stageContextLostEventHandler;
1293 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1295 internal event EventHandler ContextLost
1299 if (_stageContextLostEventHandler == null)
1301 _stageContextLostEventCallbackDelegate = OnContextLost;
1302 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1304 _stageContextLostEventHandler += value;
1308 _stageContextLostEventHandler -= value;
1309 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1311 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1316 // Callback for Stage ContextLostSignal
1317 private void OnContextLost()
1319 if (_stageContextLostEventHandler != null)
1321 _stageContextLostEventHandler(this, null);
1326 private EventHandler _stageContextRegainedEventHandler;
1327 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1329 internal event EventHandler ContextRegained
1333 if (_stageContextRegainedEventHandler == null)
1335 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1336 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1338 _stageContextRegainedEventHandler += value;
1342 _stageContextRegainedEventHandler -= value;
1343 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1345 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1350 // Callback for Stage ContextRegainedSignal
1351 private void OnContextRegained()
1353 if (_stageContextRegainedEventHandler != null)
1355 _stageContextRegainedEventHandler(this, null);
1360 private EventHandler _stageSceneCreatedEventHandler;
1361 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1363 internal event EventHandler SceneCreated
1367 if (_stageSceneCreatedEventHandler == null)
1369 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1370 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1372 _stageSceneCreatedEventHandler += value;
1376 _stageSceneCreatedEventHandler -= value;
1377 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1379 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1384 // Callback for Stage SceneCreatedSignal
1385 private void OnSceneCreated()
1387 if (_stageSceneCreatedEventHandler != null)
1389 _stageSceneCreatedEventHandler(this, null);
1394 /// This resized event arguments.
1396 /// <since_tizen> 3 </since_tizen>
1397 public class ResizedEventArgs : EventArgs
1402 /// This window size.
1404 /// <since_tizen> 4 </since_tizen>
1405 public Size2D WindowSize
1413 _windowSize = value;
1418 private WindowResizedEventCallbackType _windowResizedEventCallback;
1419 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1420 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1421 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1424 /// This event is emitted when the window resized.
1426 /// <since_tizen> 3 </since_tizen>
1427 public event EventHandler<ResizedEventArgs> Resized
1431 if (_windowResizedEventHandler == null)
1433 _windowResizedEventCallback = OnResized;
1434 ResizedSignal().Connect(_windowResizedEventCallback);
1437 _windowResizedEventHandler += value;
1441 _windowResizedEventHandler -= value;
1443 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1445 ResizedSignal().Disconnect(_windowResizedEventCallback);
1450 private void OnResized(IntPtr windowSize)
1452 ResizedEventArgs e = new ResizedEventArgs();
1453 var val = new Uint16Pair(windowSize, false);
1454 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1457 if (_windowResizedEventHandler != null)
1459 _windowResizedEventHandler(this, e);
1463 internal void SetWindowSize(Size2D size)
1465 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1466 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1468 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1471 internal Size2D GetWindowSize()
1473 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1474 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1480 internal void SetPosition(Position2D position)
1482 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1483 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1485 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1488 internal Position2D GetPosition()
1490 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1491 Position2D ret = new Position2D(val.GetX(), val.GetY());
1493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1498 /// Sets whether the window is transparent or not.
1500 /// <param name="transparent">Whether the window is transparent or not.</param>
1501 /// <since_tizen> 5 </since_tizen>
1502 public void SetTransparency(bool transparent) {
1503 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1508 /// The window size property (read-only).
1510 /// <since_tizen> 3 </since_tizen>
1515 Size2D ret = GetSize();
1521 /// The background color property.
1523 /// <since_tizen> 3 </since_tizen>
1524 public Color BackgroundColor
1528 SetBackgroundColor(value);
1532 Color ret = GetBackgroundColor();
1538 /// The DPI property (read-only).<br />
1539 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1541 /// <since_tizen> 3 </since_tizen>
1551 /// The layer count property (read-only).<br />
1552 /// Queries the number of on-Window layers.<br />
1554 /// <since_tizen> 3 </since_tizen>
1555 public uint LayerCount
1559 return GetLayerCount();
1565 /// Adds a layer to the stage.
1567 /// <param name="layer">Layer to add.</param>
1568 /// <since_tizen> 3 </since_tizen>
1569 public void AddLayer(Layer layer)
1571 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1574 LayersChildren.Add(layer);
1578 /// Removes a layer from the stage.
1580 /// <param name="layer">Layer to remove.</param>
1581 /// <since_tizen> 3 </since_tizen>
1582 public void RemoveLayer(Layer layer)
1584 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1587 LayersChildren.Remove(layer);
1591 /// Please do not use! this will be deprecated
1593 /// <since_tizen> 3 </since_tizen>
1594 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1596 "Window.Instance.FocusChanged = OnFocusChanged; " +
1597 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1598 [EditorBrowsable(EditorBrowsableState.Never)]
1599 public class WindowFocusChangedEventArgs : EventArgs
1602 /// Please do not use! this will be deprecated
1604 /// <since_tizen> 3 </since_tizen>
1605 public bool FocusGained
1612 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1613 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1614 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1615 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler2;
1618 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1620 /// <since_tizen> 3 </since_tizen>
1621 /// Please do not use! this will be deprecated!
1622 /// Instead please use FocusChanged.
1623 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1625 "Window.Instance.FocusChanged = OnFocusChanged; " +
1626 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1627 [EditorBrowsable(EditorBrowsableState.Never)]
1628 public event EventHandler<FocusChangedEventArgs> WindowFocusChanged
1632 if (_windowFocusChangedEventHandler2 == null)
1634 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1635 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1638 _windowFocusChangedEventHandler2 += value;
1642 _windowFocusChangedEventHandler2 -= value;
1644 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1646 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1651 private void OnWindowFocusedChanged2(bool focusGained)
1653 FocusChangedEventArgs e = new FocusChangedEventArgs();
1655 e.FocusGained = focusGained;
1657 if (_windowFocusChangedEventHandler2 != null)
1659 _windowFocusChangedEventHandler2(this, e);
1664 /// Gets or sets a size of the window.
1666 /// <since_tizen> 4 </since_tizen>
1667 public Size2D WindowSize
1671 return GetWindowSize();
1675 SetWindowSize(value);
1680 /// Gets or sets a position of the window.
1682 /// <since_tizen> 4 </since_tizen>
1683 public Position2D WindowPosition
1687 return GetPosition();
1696 /// Feeds a key event into the window.
1698 /// <param name="keyEvent">The key event to feed.</param>
1699 /// <since_tizen> 5 </since_tizen>
1700 public void FeedKey(Key keyEvent)
1702 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1703 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707 /// Feed a key-event into the window.
1709 /// <param name="keyEvent">The key event to feed.</param>
1710 /// <since_tizen> 4 </since_tizen>
1711 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
1712 public static void FeedKeyEvent(Key keyEvent)
1714 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1715 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1719 /// Allows at least one more render, even when paused.
1720 /// The window should be shown, not minimised.
1722 /// <since_tizen> 4 </since_tizen>
1723 public void RenderOnce()
1725 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1726 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1730 /// Contains and encapsulates Native Window handle.
1732 /// <since_tizen> 4 </since_tizen>
1733 public class SafeNativeWindowHandle : SafeHandle
1736 /// Contructor, Native window handle is set to handle.
1738 /// <since_tizen> 4 </since_tizen>
1739 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1741 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1744 /// Null check if the handle is valid or not.
1746 /// <since_tizen> 4 </since_tizen>
1747 public override bool IsInvalid
1751 return this.handle == IntPtr.Zero;
1755 /// Release handle itself.
1757 /// <returns>true when released successfully.</returns>
1758 /// <since_tizen> 4 </since_tizen>
1759 protected override bool ReleaseHandle()