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 global::System.Runtime.InteropServices.HandleRef rootLayoutCPtr;
35 private global::System.IntPtr rootLayoutIntPtr;
36 private Layer _rootLayer;
37 private string _windowTitle;
39 private List<Layer> _childLayers = new List<Layer>();
40 internal List<Layer> LayersChildren
48 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
50 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
51 if (NDalicPINVOKE.Stage_IsInstalled())
53 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
54 // Create a root layout (AbsoluteLayout) that is invisible to the user but enables layouts added to the Window
55 // Enables layouts added to the Window to have a parent layout. As parent layout is needed to store measure spec properties.
56 // Currently without these measure specs the new layout added will always be the size of the window.
57 rootLayoutIntPtr = NDalicManualPINVOKE.Window_NewRootLayout();
58 // Store HandleRef used by Add()
59 rootLayoutCPtr = new global::System.Runtime.InteropServices.HandleRef(this, rootLayoutIntPtr);
60 Layer rootLayer = GetRootLayer();
61 // Add the root layout created above to the root layer.
62 NDalicPINVOKE.Actor_Add( Layer.getCPtr(rootLayer), rootLayoutCPtr );
66 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
68 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
71 internal static Window GetCurrent()
73 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
74 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 internal static bool IsInstalled()
80 bool ret = NDalicPINVOKE.Stage_IsInstalled();
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 /// Sets whether the window accepts a focus or not.
88 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
89 /// <since_tizen> 3 </since_tizen>
90 public void SetAcceptFocus(bool accept)
92 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// Returns whether the window accepts a focus or not.
99 /// <returns>True if the window accepts a focus, false otherwise.</returns>
100 /// <since_tizen> 3 </since_tizen>
101 public bool IsFocusAcceptable()
103 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
110 /// Shows the window if it is hidden.
112 /// <since_tizen> 3 </since_tizen>
115 NDalicPINVOKE.Show(swigCPtr);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 /// Hides the window if it is showing.
122 /// <since_tizen> 3 </since_tizen>
125 NDalicPINVOKE.Hide(swigCPtr);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 /// Retrieves whether the window is visible or not.
132 /// <returns>True if the window is visible.</returns>
133 /// <since_tizen> 3 </since_tizen>
134 public bool IsVisible()
136 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// Gets the count of supported auxiliary hints of the window.
144 /// <returns>The number of supported auxiliary hints.</returns>
145 /// <since_tizen> 3 </since_tizen>
146 public uint GetSupportedAuxiliaryHintCount()
148 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Gets the supported auxiliary hint string of the window.
156 /// <param name="index">The index of the supported auxiliary hint lists.</param>
157 /// <returns>The auxiliary hint string of the index.</returns>
158 /// <since_tizen> 3 </since_tizen>
159 public string GetSupportedAuxiliaryHint(uint index)
161 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 /// Creates an auxiliary hint of the window.
169 /// <param name="hint">The auxiliary hint string.</param>
170 /// <param name="value">The value string.</param>
171 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
172 /// <since_tizen> 3 </since_tizen>
173 public uint AddAuxiliaryHint(string hint, string value)
175 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// Removes an auxiliary hint of the window.
183 /// <param name="id">The ID of the auxiliary hint.</param>
184 /// <returns>True if no error occurred, false otherwise.</returns>
185 /// <since_tizen> 3 </since_tizen>
186 public bool RemoveAuxiliaryHint(uint id)
188 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194 /// Changes a value of the auxiliary hint.
196 /// <param name="id">The auxiliary hint ID.</param>
197 /// <param name="value">The value string to be set.</param>
198 /// <returns>True if no error occurred, false otherwise.</returns>
199 /// <since_tizen> 3 </since_tizen>
200 public bool SetAuxiliaryHintValue(uint id, string value)
202 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 /// Gets a value of the auxiliary hint.
210 /// <param name="id">The auxiliary hint ID.</param>
211 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
212 /// <since_tizen> 3 </since_tizen>
213 public string GetAuxiliaryHintValue(uint id)
215 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 /// Gets an ID of the auxiliary hint string.
223 /// <param name="hint">The auxiliary hint string.</param>
224 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
225 /// <since_tizen> 3 </since_tizen>
226 public uint GetAuxiliaryHintId(string hint)
228 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 /// Sets a region to accept input events.
236 /// <param name="inputRegion">The region to accept input events.</param>
237 /// <since_tizen> 3 </since_tizen>
238 public void SetInputRegion(Rectangle inputRegion)
240 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245 /// Gets or sets a window type.
247 /// <since_tizen> 3 </since_tizen>
248 public WindowType Type
252 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258 NDalicPINVOKE.SetType(swigCPtr, (int)value);
259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264 /// Sets a priority level for the specified notification window.
266 /// <param name="level">The notification window level.</param>
267 /// <returns>True if no error occurred, false otherwise.</returns>
268 /// <since_tizen> 3 </since_tizen>
269 public bool SetNotificationLevel(NotificationLevel level)
271 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 /// Gets a priority level for the specified notification window.
279 /// <returns>The notification window level.</returns>
280 /// <since_tizen> 3 </since_tizen>
281 public NotificationLevel GetNotificationLevel()
283 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289 /// Sets a transparent window's visual state to opaque. <br />
290 /// If a visual state of a transparent window is opaque, <br />
291 /// then the window manager could handle it as an opaque window when calculating visibility.
293 /// <param name="opaque">Whether the window's visual state is opaque.</param>
294 /// <remarks>This will have no effect on an opaque window. <br />
295 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
297 /// <since_tizen> 3 </since_tizen>
298 public void SetOpaqueState(bool opaque)
300 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 /// Returns whether a transparent window's visual state is opaque or not.
307 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
308 /// <remarks> The return value has no meaning on an opaque window. </remarks>
309 /// <since_tizen> 3 </since_tizen>
310 public bool IsOpaqueState()
312 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318 /// Sets a window's screen off mode.
320 /// <param name="screenOffMode">The screen mode.</param>
321 /// <returns>True if no error occurred, false otherwise.</returns>
322 /// <since_tizen> 4 </since_tizen>
323 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
325 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
331 /// Gets the screen mode of the window.
333 /// <returns>The screen off mode.</returns>
334 /// <since_tizen> 4 </since_tizen>
335 public ScreenOffMode GetScreenOffMode()
337 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 /// Sets preferred brightness of the window.
345 /// <param name="brightness">The preferred brightness (0 to 100).</param>
346 /// <returns>True if no error occurred, false otherwise.</returns>
347 /// <since_tizen> 3 </since_tizen>
348 public bool SetBrightness(int brightness)
350 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356 /// Gets the preferred brightness of the window.
358 /// <returns>The preferred brightness.</returns>
359 /// <since_tizen> 3 </since_tizen>
360 public int GetBrightness()
362 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 /// The focus changed event argument.
370 /// <since_tizen> 3 </since_tizen>
371 public class FocusChangedEventArgs : EventArgs
374 /// FocusGained flag.
376 /// <since_tizen> 3 </since_tizen>
377 public bool FocusGained
384 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
385 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
386 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
387 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
390 /// FocusChanged event.
392 /// <since_tizen> 3 </since_tizen>
393 public event EventHandler<FocusChangedEventArgs> FocusChanged
397 if (_windowFocusChangedEventHandler == null)
399 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
400 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
403 _windowFocusChangedEventHandler += value;
407 _windowFocusChangedEventHandler -= value;
409 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
411 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
416 private void OnWindowFocusedChanged(bool focusGained)
418 FocusChangedEventArgs e = new FocusChangedEventArgs();
420 e.FocusGained = focusGained;
422 if (_windowFocusChangedEventHandler != null)
424 _windowFocusChangedEventHandler(this, e);
429 /// Gets/Sets a window title.
431 /// <since_tizen> 4 </since_tizen>
440 _windowTitle = value;
441 SetClass(_windowTitle, "");
445 internal WindowFocusSignalType WindowFocusChangedSignal()
447 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
452 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
454 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
462 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
472 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
474 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
478 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
480 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
484 internal void RotateIndicator(Window.WindowOrientation orientation)
486 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
487 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
491 /// Sets the window name and the class string.
493 /// <param name="name">The name of the window.</param>
494 /// <param name="klass">The class of the window.</param>
495 /// <since_tizen> 4 </since_tizen>
496 public void SetClass(string name, string klass)
498 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503 /// Raises the window to the top of the window stack.
505 /// <since_tizen> 3 </since_tizen>
508 NDalicPINVOKE.Window_Raise(swigCPtr);
509 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
513 /// Lowers the window to the bottom of the window stack.
515 /// <since_tizen> 3 </since_tizen>
518 NDalicPINVOKE.Window_Lower(swigCPtr);
519 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 /// Activates the window to the top of the window stack even it is iconified.
525 /// <since_tizen> 3 </since_tizen>
526 public void Activate()
528 NDalicPINVOKE.Window_Activate(swigCPtr);
529 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
534 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
535 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
538 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
540 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
541 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
544 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
546 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
547 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
550 internal Window.WindowOrientation GetPreferredOrientation()
552 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
553 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557 internal DragAndDropDetector GetDragAndDropDetector()
559 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 internal Any GetNativeHandle()
566 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
567 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
571 internal WindowFocusSignalType FocusChangedSignal()
573 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
574 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579 /// Gets the default ( root ) layer.
581 /// <returns>The root layer.</returns>
582 /// <since_tizen> 3 </since_tizen>
583 public Layer GetDefaultLayer()
585 return this.GetRootLayer();
588 internal void Add(Layer layer)
590 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
591 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
593 LayersChildren.Add(layer);
596 internal void Remove(Layer layer)
598 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
599 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 LayersChildren.Remove(layer);
605 /// Add a child view to window.
607 /// <param name="view">the child should be added to the window.</param>
608 /// <since_tizen> 3 </since_tizen>
609 public void Add(View view)
611 NDalicPINVOKE.Actor_Add( rootLayoutCPtr, View.getCPtr(view) );
612 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613 this.GetRootLayer().AddViewToLayerList(view); // Maintain the children list in the Layer
614 view.InternalParent = this.GetRootLayer();
618 /// Remove a child view from window.
620 /// <param name="view">the child to be removed.</param>
621 /// <since_tizen> 3 </since_tizen>
622 public void Remove(View view)
624 NDalicPINVOKE.Actor_Remove( rootLayoutCPtr, View.getCPtr(view) );
625 this.GetRootLayer().RemoveViewFromLayerList(view); // Maintain the children list in the Layer
626 view.InternalParent = null;
629 internal Vector2 GetSize()
631 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 internal RenderTaskList GetRenderTaskList()
638 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
639 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 /// Queries the number of on-window layers.
646 /// <returns>The number of layers.</returns>
647 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
648 internal uint GetLayerCount()
650 if (LayersChildren == null || LayersChildren.Count < 0)
653 return (uint) LayersChildren.Count;
657 /// Retrieves the layer at a specified depth.
659 /// <param name="depth">The layer's depth index.</param>
660 /// <returns>The layer found at the given depth.</returns>
661 /// <since_tizen> 3 </since_tizen>
662 public Layer GetLayer(uint depth)
664 if (depth < LayersChildren.Count)
666 Layer ret = LayersChildren[Convert.ToInt32(depth)];
675 internal Layer GetRootLayer()
677 // Window.IsInstalled() is actually true only when called from event thread and
678 // Core has been initialized, not when Stage is ready.
679 if (_rootLayer == null && Window.IsInstalled())
681 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
682 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
683 LayersChildren.Add(_rootLayer);
688 internal void SetBackgroundColor(Vector4 color)
690 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
691 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
694 internal Vector4 GetBackgroundColor()
696 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
701 internal Vector2 GetDpi()
703 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
708 internal ObjectRegistry GetObjectRegistry()
710 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
711 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
716 /// Keep rendering for at least the given amount of time.
718 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
719 /// <since_tizen> 3 </since_tizen>
720 public void KeepRendering(float durationSeconds)
722 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
723 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
726 internal KeyEventSignal KeyEventSignal()
728 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
729 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 internal VoidSignal EventProcessingFinishedSignal()
735 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
736 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal TouchSignal TouchSignal()
742 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 internal TouchDataSignal TouchDataSignal()
749 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 private StageWheelSignal WheelEventSignal()
757 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 private WheelSignal StageWheelEventSignal()
765 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
766 if (NDalicPINVOKE.SWIGPendingException.Pending)
767 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
772 internal VoidSignal ContextLostSignal()
774 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 internal VoidSignal ContextRegainedSignal()
781 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
782 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 internal VoidSignal SceneCreatedSignal()
788 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 internal ResizedSignal ResizedSignal()
795 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
796 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 internal static Vector4 DEFAULT_BACKGROUND_COLOR
804 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
805 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
806 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811 internal static Vector4 DEBUG_BACKGROUND_COLOR
815 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
816 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 private static readonly Window instance = Application.Instance.GetWindow();
825 /// The stage instance property (read-only).<br />
826 /// Gets the current window.<br />
828 /// <since_tizen> 3 </since_tizen>
829 public static Window Instance
838 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
839 /// This function can be used for following example scenarios: <br />
840 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
842 /// <param name="DaliKey">The key code to grab.</param>
843 /// <returns>True if the grab succeeds.</returns>
844 /// <since_tizen> 3 </since_tizen>
845 public bool GrabKeyTopmost(int DaliKey)
847 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
848 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853 /// Ungrabs the key specified by a key for the window.<br />
854 /// 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 />
856 /// <param name="DaliKey">The key code to ungrab.</param>
857 /// <returns>True if the ungrab succeeds.</returns>
858 /// <since_tizen> 3 </since_tizen>
859 public bool UngrabKeyTopmost(int DaliKey)
861 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
862 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
867 /// Grabs the key specified by a key for a window in a GrabMode. <br />
868 /// Details: This function can be used for following example scenarios: <br />
869 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
870 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
871 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
873 /// <param name="DaliKey">The key code to grab.</param>
874 /// <param name="GrabMode">The grab mode for the key.</param>
875 /// <returns>True if the grab succeeds.</returns>
876 /// <since_tizen> 3 </since_tizen>
877 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
879 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
880 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
885 /// Ungrabs the key specified by a key for a window.<br />
886 /// 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 />
888 /// <param name="DaliKey">The key code to ungrab.</param>
889 /// <returns>True if the ungrab succeeds.</returns>
890 /// <since_tizen> 3 </since_tizen>
891 public bool UngrabKey(int DaliKey)
893 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
894 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
899 /// Sets keyboard repeat information.
901 /// <param name="rate">The key repeat rate value in seconds</param>
902 /// <param name="delay">The key repeat delay value in seconds</param>
903 /// <returns>True if setting the keyboard repeat succeeds.</returns>
904 /// <since_tizen> 5 </since_tizen>
905 public bool SetKeyboardRepeatInfo(float rate, float delay)
907 bool ret = NDalicManualPINVOKE.SetKeyboardRepeatInfo(rate, delay);
908 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
913 /// Gets keyboard repeat information.
915 /// <param name="rate">The key repeat rate value in seconds</param>
916 /// <param name="delay">The key repeat delay value in seconds</param>
917 /// <returns>True if setting the keyboard repeat succeeds.</returns>
918 /// <since_tizen> 5 </since_tizen>
919 public bool GetKeyboardRepeatInfo(out float rate, out float delay)
921 bool ret = NDalicManualPINVOKE.GetKeyboardRepeatInfo(out rate, out delay);
922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 internal System.IntPtr GetNativeWindowHandler()
928 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
934 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
936 /// <since_tizen> 3 </since_tizen>
937 public enum WindowOrientation
940 /// Portrait orientation. The height of the display area is greater than the width.
942 /// <since_tizen> 3 </since_tizen>
945 /// Landscape orientation. A wide view area is needed.
947 /// <since_tizen> 3 </since_tizen>
950 /// Portrait inverse orientation.
952 /// <since_tizen> 3 </since_tizen>
953 PortraitInverse = 180,
955 /// Landscape inverse orientation.
957 /// <since_tizen> 3 </since_tizen>
958 LandscapeInverse = 270
962 /// Enumeration for the key grab mode for platform-level APIs.
964 /// <since_tizen> 3 </since_tizen>
965 public enum KeyGrabMode
968 /// Grabs a key only when on the top of the grabbing-window stack mode.
972 /// Grabs a key together with the other client window(s) mode.
976 /// 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.
980 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
986 /// Enumeration for opacity of the indicator.
988 internal enum IndicatorBackgroundOpacity
996 /// Enumeration for visible mode of the indicator.
998 internal enum IndicatorVisibleMode
1006 /// The touch event argument.
1008 /// <since_tizen> 3 </since_tizen>
1009 public class TouchEventArgs : EventArgs
1011 private Touch _touch;
1016 /// <since_tizen> 3 </since_tizen>
1031 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
1032 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1033 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
1034 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
1036 /// This event is emitted when the screen is touched and when the touch ends.<br />
1037 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1038 /// then when the last finger is lifted.<br />
1039 /// An interrupted event will also be emitted (if it occurs).<br />
1041 /// <since_tizen> 3 </since_tizen>
1042 public event EventHandler<TouchEventArgs> TouchEvent
1046 if (_rootLayerTouchDataEventHandler == null)
1048 _rootLayerTouchDataCallback = OnWindowTouch;
1049 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
1051 _rootLayerTouchDataEventHandler += value;
1055 _rootLayerTouchDataEventHandler -= value;
1056 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
1058 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1063 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1065 if (touchData == global::System.IntPtr.Zero)
1067 NUILog.Error("touchData should not be null!");
1071 TouchEventArgs e = new TouchEventArgs();
1073 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1075 if (_rootLayerTouchDataEventHandler != null)
1077 _rootLayerTouchDataEventHandler(this, e);
1083 /// Wheel event arguments.
1085 /// <since_tizen> 3 </since_tizen>
1086 public class WheelEventArgs : EventArgs
1088 private Wheel _wheel;
1093 /// <since_tizen> 3 </since_tizen>
1107 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1109 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1110 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
1111 private WheelEventCallbackType _wheelEventCallback;
1114 /// This event is emitted when the wheel event is received.
1116 /// <since_tizen> 3 </since_tizen>
1117 public event EventHandler<WheelEventArgs> WheelEvent
1121 if (_stageWheelHandler == null)
1123 _wheelEventCallback = OnStageWheel;
1124 this.StageWheelEventSignal().Connect(_wheelEventCallback);
1126 _stageWheelHandler += value;
1130 _stageWheelHandler -= value;
1131 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
1133 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
1138 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1140 if (wheelEvent == global::System.IntPtr.Zero)
1142 NUILog.Error("wheelEvent should not be null!");
1146 WheelEventArgs e = new WheelEventArgs();
1148 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1150 if (_stageWheelHandler != null)
1152 _stageWheelHandler(this, e);
1158 /// Key event arguments.
1160 /// <since_tizen> 3 </since_tizen>
1161 public class KeyEventArgs : EventArgs
1168 /// <since_tizen> 3 </since_tizen>
1182 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1183 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1186 /// This event is emitted when the key event is received.
1188 /// <since_tizen> 3 </since_tizen>
1189 public event EventHandler<KeyEventArgs> KeyEvent
1193 if (_stageKeyHandler == null)
1195 _stageKeyCallbackDelegate = OnStageKey;
1196 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1198 _stageKeyHandler += value;
1202 _stageKeyHandler -= value;
1203 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1205 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1210 // Callback for Stage KeyEventsignal
1211 private void OnStageKey(IntPtr data)
1213 KeyEventArgs e = new KeyEventArgs();
1217 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1220 if (_stageKeyHandler != null)
1222 //here we send all data to user event handlers
1223 _stageKeyHandler(this, e);
1228 private event EventHandler _stageEventProcessingFinishedEventHandler;
1229 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1231 internal event EventHandler EventProcessingFinished
1235 if (_stageEventProcessingFinishedEventHandler == null)
1237 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1238 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1240 _stageEventProcessingFinishedEventHandler += value;
1245 _stageEventProcessingFinishedEventHandler -= value;
1246 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1248 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1253 // Callback for Stage EventProcessingFinishedSignal
1254 private void OnEventProcessingFinished()
1256 if (_stageEventProcessingFinishedEventHandler != null)
1258 _stageEventProcessingFinishedEventHandler(this, null);
1263 private EventHandler _stageContextLostEventHandler;
1264 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1266 internal event EventHandler ContextLost
1270 if (_stageContextLostEventHandler == null)
1272 _stageContextLostEventCallbackDelegate = OnContextLost;
1273 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1275 _stageContextLostEventHandler += value;
1279 _stageContextLostEventHandler -= value;
1280 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1282 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1287 // Callback for Stage ContextLostSignal
1288 private void OnContextLost()
1290 if (_stageContextLostEventHandler != null)
1292 _stageContextLostEventHandler(this, null);
1297 private EventHandler _stageContextRegainedEventHandler;
1298 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1300 internal event EventHandler ContextRegained
1304 if (_stageContextRegainedEventHandler == null)
1306 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1307 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1309 _stageContextRegainedEventHandler += value;
1313 _stageContextRegainedEventHandler -= value;
1314 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1316 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1321 // Callback for Stage ContextRegainedSignal
1322 private void OnContextRegained()
1324 if (_stageContextRegainedEventHandler != null)
1326 _stageContextRegainedEventHandler(this, null);
1331 private EventHandler _stageSceneCreatedEventHandler;
1332 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1334 internal event EventHandler SceneCreated
1338 if (_stageSceneCreatedEventHandler == null)
1340 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1341 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1343 _stageSceneCreatedEventHandler += value;
1347 _stageSceneCreatedEventHandler -= value;
1348 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1350 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1355 // Callback for Stage SceneCreatedSignal
1356 private void OnSceneCreated()
1358 if (_stageSceneCreatedEventHandler != null)
1360 _stageSceneCreatedEventHandler(this, null);
1365 /// This resized event arguments.
1367 /// <since_tizen> 3 </since_tizen>
1368 public class ResizedEventArgs : EventArgs
1373 /// This window size.
1375 /// <since_tizen> 4 </since_tizen>
1376 public Size2D WindowSize
1384 _windowSize = value;
1389 private WindowResizedEventCallbackType _windowResizedEventCallback;
1390 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1391 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1392 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1395 /// This event is emitted when the window resized.
1397 /// <since_tizen> 3 </since_tizen>
1398 public event EventHandler<ResizedEventArgs> Resized
1402 if (_windowResizedEventHandler == null)
1404 _windowResizedEventCallback = OnResized;
1405 ResizedSignal().Connect(_windowResizedEventCallback);
1408 _windowResizedEventHandler += value;
1412 _windowResizedEventHandler -= value;
1414 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1416 ResizedSignal().Disconnect(_windowResizedEventCallback);
1421 private void OnResized(IntPtr windowSize)
1423 ResizedEventArgs e = new ResizedEventArgs();
1424 var val = new Uint16Pair(windowSize, false);
1425 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1428 if (_windowResizedEventHandler != null)
1430 _windowResizedEventHandler(this, e);
1434 internal void SetWindowSize(Size2D size)
1436 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1437 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1442 internal Size2D GetWindowSize()
1444 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1445 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1451 internal void SetPosition(Position2D position)
1453 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1454 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1459 internal Position2D GetPosition()
1461 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1462 Position2D ret = new Position2D(val.GetX(), val.GetY());
1464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1469 /// Sets whether the window is transparent or not.
1471 /// <param name="transparent">Whether the window is transparent.</param>
1472 /// <since_tizen> 5 </since_tizen>
1473 public void SetTransparency(bool transparent) {
1474 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1479 /// The window size property (read-only).
1481 /// <since_tizen> 3 </since_tizen>
1486 Size2D ret = GetSize();
1492 /// The background color property.
1494 /// <since_tizen> 3 </since_tizen>
1495 public Color BackgroundColor
1499 SetBackgroundColor(value);
1503 Color ret = GetBackgroundColor();
1509 /// The DPI property (read-only).<br />
1510 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1512 /// <since_tizen> 3 </since_tizen>
1522 /// The layer count property (read-only).<br />
1523 /// Queries the number of on-Window layers.<br />
1525 /// <since_tizen> 3 </since_tizen>
1526 public uint LayerCount
1530 return GetLayerCount();
1536 /// Adds a layer to the stage.
1538 /// <param name="layer">Layer to add.</param>
1539 /// <since_tizen> 3 </since_tizen>
1540 public void AddLayer(Layer layer)
1542 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1545 LayersChildren.Add(layer);
1549 /// Removes a layer from the stage.
1551 /// <param name="layer">Layer to remove.</param>
1552 /// <since_tizen> 3 </since_tizen>
1553 public void RemoveLayer(Layer layer)
1555 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1556 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1558 LayersChildren.Remove(layer);
1562 /// Please do not use! this will be deprecated
1564 /// <since_tizen> 3 </since_tizen>
1565 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1567 "Window.Instance.FocusChanged = OnFocusChanged; " +
1568 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1569 [EditorBrowsable(EditorBrowsableState.Never)]
1570 public class WindowFocusChangedEventArgs : EventArgs
1573 /// Please do not use! this will be deprecated
1575 /// <since_tizen> 3 </since_tizen>
1576 public bool FocusGained
1583 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1584 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1585 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1586 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1589 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1591 /// <since_tizen> 3 </since_tizen>
1592 /// Please do not use! this will be deprecated!
1593 /// Instead please use FocusChanged.
1594 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1596 "Window.Instance.FocusChanged = OnFocusChanged; " +
1597 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1598 [EditorBrowsable(EditorBrowsableState.Never)]
1599 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1603 if (_windowFocusChangedEventHandler2 == null)
1605 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1606 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1609 _windowFocusChangedEventHandler2 += value;
1613 _windowFocusChangedEventHandler2 -= value;
1615 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1617 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1622 private void OnWindowFocusedChanged2(bool focusGained)
1624 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1626 e.FocusGained = focusGained;
1628 if (_windowFocusChangedEventHandler2 != null)
1630 _windowFocusChangedEventHandler2(this, e);
1635 /// Gets or sets a size of the window.
1637 /// <since_tizen> 4 </since_tizen>
1638 public Size2D WindowSize
1642 return GetWindowSize();
1646 SetWindowSize(value);
1651 /// Gets or sets a position of the window.
1653 /// <since_tizen> 4 </since_tizen>
1654 public Position2D WindowPosition
1658 return GetPosition();
1667 /// Feed a key-event into the window.
1669 /// <param name="keyEvent">The key event to feed.</param>
1670 /// <since_tizen> 5 </since_tizen>
1671 public void FeedKey(Key keyEvent)
1673 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1678 /// Feed a key-event into the window.
1680 /// <param name="keyEvent">The key event to feed.</param>
1681 /// <since_tizen> 4 </since_tizen>
1682 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
1683 public static void FeedKeyEvent(Key keyEvent)
1685 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1690 /// Allows at least one more render, even when paused.
1691 /// The window should be shown, not minimised.
1693 /// <since_tizen> 4 </since_tizen>
1694 public void RenderOnce()
1696 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1701 /// Contains and encapsulates Native Window handle.
1703 /// <since_tizen> 4 </since_tizen>
1704 public class SafeNativeWindowHandle : SafeHandle
1707 /// Contructor, Native window handle is set to handle.
1709 /// <since_tizen> 4 </since_tizen>
1710 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1712 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1715 /// Null check if the handle is valid or not.
1717 /// <since_tizen> 4 </since_tizen>
1718 public override bool IsInvalid
1722 return this.handle == IntPtr.Zero;
1726 /// Release handle itself.
1728 /// <returns>true when released successfully.</returns>
1729 /// <since_tizen> 4 </since_tizen>
1730 protected override bool ReleaseHandle()