2 * Copyright(c) 2017 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 Layer _rootLayer;
35 private string _windowTitle;
37 private List<Layer> _childLayers = new List<Layer>();
38 private List<Layer> LayersChildren
46 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
48 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
49 if (NDalicPINVOKE.Stage_IsInstalled())
51 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
55 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
57 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
61 /// To make the window instance be disposed.
63 /// Please DO NOT use! This will be deprecated!
64 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, IMFManager, TtsPlayer, Window) is not required.
65 /// Because it is Sigletone, so it is alive for one thread until the NUI is terminated, so it never be disposed.
66 /// <since_tizen> 3 </since_tizen>
67 [Obsolete("Please do not use! This will be deprecated!")]
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 protected override void Dispose(DisposeTypes type)
76 if (type == DisposeTypes.Explicit)
79 //Release your own managed resources here.
80 //You should release all of your own disposable objects here.
83 //Release your own unmanaged resources here.
84 //You should not access any managed member here except static instance.
85 //because the execution order of Finalizes is non-deterministic.
87 if (_windowFocusChangedEventCallback != null)
89 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
92 if (_stageTouchCallbackDelegate != null)
94 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
97 if (_stageWheelCallbackDelegate != null)
99 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
102 if (_stageKeyCallbackDelegate != null)
104 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
107 if (_stageEventProcessingFinishedEventCallbackDelegate != null)
109 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
112 if (_stageContextLostEventCallbackDelegate != null)
114 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
117 if (_stageContextRegainedEventCallbackDelegate != null)
119 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
122 if (_stageSceneCreatedEventCallbackDelegate != null)
124 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
127 if (_windowResizedEventCallback != null)
129 ResizedSignal().Disconnect(_windowResizedEventCallback);
132 if (_windowFocusChangedEventCallback2 != null)
134 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
137 if (swigCPtr.Handle != global::System.IntPtr.Zero)
142 NDalicPINVOKE.delete_Window(swigCPtr);
143 NDalicPINVOKE.delete_Stage(stageCPtr);
145 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
151 internal static Window GetCurrent()
153 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 internal static bool IsInstalled()
160 bool ret = NDalicPINVOKE.Stage_IsInstalled();
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// Sets whether the window accepts a focus or not.
168 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
169 /// <since_tizen> 3 </since_tizen>
170 public void SetAcceptFocus(bool accept)
172 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 /// Returns whether the window accepts a focus or not.
179 /// <returns>True if the window accepts a focus, false otherwise.</returns>
180 /// <since_tizen> 3 </since_tizen>
181 public bool IsFocusAcceptable()
183 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 /// Shows the window if it is hidden.
192 /// <since_tizen> 3 </since_tizen>
195 NDalicPINVOKE.Show(swigCPtr);
196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 /// Hides the window if it is showing.
202 /// <since_tizen> 3 </since_tizen>
205 NDalicPINVOKE.Hide(swigCPtr);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 /// Retrieves whether the window is visible or not.
212 /// <returns>True if the window is visible.</returns>
213 /// <since_tizen> 3 </since_tizen>
214 public bool IsVisible()
216 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 /// Gets the count of supported auxiliary hints of the window.
224 /// <returns>The number of supported auxiliary hints.</returns>
225 /// <since_tizen> 3 </since_tizen>
226 public uint GetSupportedAuxiliaryHintCount()
228 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 /// Gets the supported auxiliary hint string of the window.
236 /// <param name="index">The index of the supported auxiliary hint lists.</param>
237 /// <returns>The auxiliary hint string of the index.</returns>
238 /// <since_tizen> 3 </since_tizen>
239 public string GetSupportedAuxiliaryHint(uint index)
241 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 /// Creates an auxiliary hint of the window.
249 /// <param name="hint">The auxiliary hint string.</param>
250 /// <param name="value">The value string.</param>
251 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
252 /// <since_tizen> 3 </since_tizen>
253 public uint AddAuxiliaryHint(string hint, string value)
255 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 /// Removes an auxiliary hint of the window.
263 /// <param name="id">The ID of the auxiliary hint.</param>
264 /// <returns>True if no error occurred, false otherwise.</returns>
265 /// <since_tizen> 3 </since_tizen>
266 public bool RemoveAuxiliaryHint(uint id)
268 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274 /// Changes a value of the auxiliary hint.
276 /// <param name="id">The auxiliary hint ID.</param>
277 /// <param name="value">The value string to be set.</param>
278 /// <returns>True if no error occurred, false otherwise.</returns>
279 /// <since_tizen> 3 </since_tizen>
280 public bool SetAuxiliaryHintValue(uint id, string value)
282 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288 /// Gets a value of the auxiliary hint.
290 /// <param name="id">The auxiliary hint ID.</param>
291 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
292 /// <since_tizen> 3 </since_tizen>
293 public string GetAuxiliaryHintValue(uint id)
295 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 /// Gets an ID of the auxiliary hint string.
303 /// <param name="hint">The auxiliary hint string.</param>
304 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
305 /// <since_tizen> 3 </since_tizen>
306 public uint GetAuxiliaryHintId(string hint)
308 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314 /// Sets a region to accept input events.
316 /// <param name="inputRegion">The region to accept input events.</param>
317 /// <since_tizen> 3 </since_tizen>
318 public void SetInputRegion(Rectangle inputRegion)
320 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 /// Gets or sets a window type.
327 /// <since_tizen> 3 </since_tizen>
328 public WindowType Type
332 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 NDalicPINVOKE.SetType(swigCPtr, (int)value);
339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
344 /// Sets a priority level for the specified notification window.
346 /// <param name="level">The notification window level.</param>
347 /// <returns>True if no error occurred, false otherwise.</returns>
348 /// <since_tizen> 3 </since_tizen>
349 public bool SetNotificationLevel(NotificationLevel level)
351 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 /// Gets a priority level for the specified notification window.
359 /// <returns>The notification window level.</returns>
360 /// <since_tizen> 3 </since_tizen>
361 public NotificationLevel GetNotificationLevel()
363 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369 /// Sets a transparent window's visual state to opaque.
371 /// <param name="opaque">Whether the window's visual state is opaque.</param>
372 /// <since_tizen> 3 </since_tizen>
373 public void SetOpaqueState(bool opaque)
375 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380 /// Returns whether a transparent window's visual state is opaque or not.
382 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
383 /// <since_tizen> 3 </since_tizen>
384 public bool IsOpaqueState()
386 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 /// Sets a window's screen off mode.
394 /// <param name="screenOffMode">The screen mode.</param>
395 /// <returns>True if no error occurred, false otherwise.</returns>
396 /// <since_tizen> 4 </since_tizen>
397 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
399 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 /// Gets the screen mode of the window.
407 /// <returns>The screen off mode.</returns>
408 /// <since_tizen> 4 </since_tizen>
409 public ScreenOffMode GetScreenOffMode()
411 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 /// Sets preferred brightness of the window.
419 /// <param name="brightness">The preferred brightness (0 to 100).</param>
420 /// <returns>True if no error occurred, false otherwise.</returns>
421 /// <since_tizen> 3 </since_tizen>
422 public bool SetBrightness(int brightness)
424 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// Gets the preferred brightness of the window.
432 /// <returns>The preferred brightness.</returns>
433 /// <since_tizen> 3 </since_tizen>
434 public int GetBrightness()
436 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442 /// The focus changed event argument.
444 /// <since_tizen> 3 </since_tizen>
445 public class FocusChangedEventArgs : EventArgs
448 /// FocusGained flag.
450 /// <since_tizen> 3 </since_tizen>
451 public bool FocusGained
458 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
459 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
460 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
461 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
464 /// FocusChanged event.
466 /// <since_tizen> 3 </since_tizen>
467 public event EventHandler<FocusChangedEventArgs> FocusChanged
471 if (_windowFocusChangedEventHandler == null)
473 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
474 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
477 _windowFocusChangedEventHandler += value;
481 _windowFocusChangedEventHandler -= value;
483 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
485 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
490 private void OnWindowFocusedChanged(bool focusGained)
492 FocusChangedEventArgs e = new FocusChangedEventArgs();
494 e.FocusGained = focusGained;
496 if (_windowFocusChangedEventHandler != null)
498 _windowFocusChangedEventHandler(this, e);
503 /// Gets/Sets a window title.
505 /// <since_tizen> 4 </since_tizen>
514 _windowTitle = value;
515 SetClass(_windowTitle, "");
519 internal WindowFocusSignalType WindowFocusChangedSignal()
521 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
522 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
526 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
533 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
548 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
554 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558 internal void RotateIndicator(Window.WindowOrientation orientation)
560 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
561 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
565 /// Sets the window name and the class string.
567 /// <param name="name">The name of the window.</param>
568 /// <param name="klass">The class of the window.</param>
569 /// <since_tizen> 4 </since_tizen>
570 public void SetClass(string name, string klass)
572 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
577 /// Raises the window to the top of the window stack.
579 /// <since_tizen> 3 </since_tizen>
582 NDalicPINVOKE.Window_Raise(swigCPtr);
583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
587 /// Lowers the window to the bottom of the window stack.
589 /// <since_tizen> 3 </since_tizen>
592 NDalicPINVOKE.Window_Lower(swigCPtr);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// Activates the window to the top of the window stack even it is iconified.
599 /// <since_tizen> 3 </since_tizen>
600 public void Activate()
602 NDalicPINVOKE.Window_Activate(swigCPtr);
603 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
608 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
614 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
620 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
621 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 internal Window.WindowOrientation GetPreferredOrientation()
626 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 internal DragAndDropDetector GetDragAndDropDetector()
633 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
634 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
638 internal Any GetNativeHandle()
640 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
641 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645 internal WindowFocusSignalType FocusChangedSignal()
647 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
648 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
653 /// Gets the default ( root ) layer.
655 /// <returns>The root layer.</returns>
656 /// <since_tizen> 3 </since_tizen>
657 public Layer GetDefaultLayer()
659 return this.GetRootLayer();
662 internal void Add(Layer layer)
664 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 LayersChildren.Add(layer);
670 internal void Remove(Layer layer)
672 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 LayersChildren.Remove(layer);
679 /// Add a child view to window.
681 /// <param name="view">the child should be added to the window.</param>
682 /// <since_tizen> 3 </since_tizen>
683 public void Add(View view)
685 GetRootLayer()?.Add(view);
689 /// Remove a child view from window.
691 /// <param name="view">the child to be removed.</param>
692 /// <since_tizen> 3 </since_tizen>
693 public void Remove(View view)
695 GetRootLayer()?.Remove(view);
698 internal Vector2 GetSize()
700 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
701 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
705 internal RenderTaskList GetRenderTaskList()
707 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
708 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
713 /// Queries the number of on-window layers.
715 /// <returns>The number of layers.</returns>
716 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
717 internal uint GetLayerCount()
719 if (LayersChildren == null || LayersChildren.Count < 0)
722 return (uint) LayersChildren.Count;
726 /// Retrieves the layer at a specified depth.
728 /// <param name="depth">The layer's depth index.</param>
729 /// <returns>The layer found at the given depth.</returns>
730 /// <since_tizen> 3 </since_tizen>
731 public Layer GetLayer(uint depth)
733 IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth);
734 Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
736 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal Layer GetRootLayer()
742 // Window.IsInstalled() is actually true only when called from event thread and
743 // Core has been initialized, not when Stage is ready.
744 if (_rootLayer == null && Window.IsInstalled())
746 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
747 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 LayersChildren.Add(_rootLayer);
753 internal void SetBackgroundColor(Vector4 color)
755 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 internal Vector4 GetBackgroundColor()
761 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
762 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
766 internal Vector2 GetDpi()
768 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
769 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
773 internal ObjectRegistry GetObjectRegistry()
775 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
776 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
781 /// Keep rendering for at least the given amount of time.
783 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
784 /// <since_tizen> 3 </since_tizen>
785 public void KeepRendering(float durationSeconds)
787 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
788 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 internal KeyEventSignal KeyEventSignal()
793 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
794 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
798 internal VoidSignal EventProcessingFinishedSignal()
800 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
801 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
805 internal TouchSignal TouchSignal()
807 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 private StageWheelSignal WheelEventSignal()
814 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
815 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
819 internal VoidSignal ContextLostSignal()
821 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
822 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
826 internal VoidSignal ContextRegainedSignal()
828 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
829 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 internal VoidSignal SceneCreatedSignal()
835 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
836 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
840 internal ResizedSignal ResizedSignal()
842 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
847 internal static Vector4 DEFAULT_BACKGROUND_COLOR
851 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
852 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
853 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
858 internal static Vector4 DEBUG_BACKGROUND_COLOR
862 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
863 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 private static readonly Window instance = Application.Instance.GetWindow();
872 /// The stage instance property (read-only).<br />
873 /// Gets the current window.<br />
875 /// <since_tizen> 3 </since_tizen>
876 public static Window Instance
885 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
886 /// This function can be used for following example scenarios: <br />
887 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
889 /// <param name="DaliKey">The key code to grab.</param>
890 /// <returns>True if the grab succeeds.</returns>
891 /// <since_tizen> 3 </since_tizen>
892 public bool GrabKeyTopmost(int DaliKey)
894 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
895 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
900 /// Ungrabs the key specified by a key for the window.<br />
901 /// 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 />
903 /// <param name="DaliKey">The key code to ungrab.</param>
904 /// <returns>True if the ungrab succeeds.</returns>
905 /// <since_tizen> 3 </since_tizen>
906 public bool UngrabKeyTopmost(int DaliKey)
908 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
909 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
914 /// Grabs the key specified by a key for a window in a GrabMode. <br />
915 /// Details: This function can be used for following example scenarios: <br />
916 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
917 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
918 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
920 /// <param name="DaliKey">The key code to grab.</param>
921 /// <param name="GrabMode">The grab mode for the key.</param>
922 /// <returns>True if the grab succeeds.</returns>
923 /// <since_tizen> 3 </since_tizen>
924 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
926 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
927 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932 /// Ungrabs the key specified by a key for a window.<br />
933 /// 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 />
935 /// <param name="DaliKey">The key code to ungrab.</param>
936 /// <returns>True if the ungrab succeeds.</returns>
937 /// <since_tizen> 3 </since_tizen>
938 public bool UngrabKey(int DaliKey)
940 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
941 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
945 internal System.IntPtr GetNativeWindowHandler()
947 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
948 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
953 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
955 /// <since_tizen> 3 </since_tizen>
956 public enum WindowOrientation
959 /// Portrait orientation. The height of the display area is greater than the width.
961 /// <since_tizen> 3 </since_tizen>
964 /// Landscape orientation. A wide view area is needed.
966 /// <since_tizen> 3 </since_tizen>
969 /// Portrait inverse orientation.
971 /// <since_tizen> 3 </since_tizen>
972 PortraitInverse = 180,
974 /// Landscape inverse orientation.
976 /// <since_tizen> 3 </since_tizen>
977 LandscapeInverse = 270
981 /// Enumeration for the key grab mode for platform-level APIs.
983 /// <since_tizen> 3 </since_tizen>
984 public enum KeyGrabMode
987 /// Grabs a key only when on the top of the grabbing-window stack mode.
991 /// Grabs a key together with the other client window(s) mode.
995 /// 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.
999 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
1005 /// Enumeration for opacity of the indicator.
1007 internal enum IndicatorBackgroundOpacity
1015 /// Enumeration for visible mode of the indicator.
1017 internal enum IndicatorVisibleMode
1025 /// The touch event argument.
1027 /// <since_tizen> 3 </since_tizen>
1028 public class TouchEventArgs : EventArgs
1030 private Touch _touch;
1035 /// <since_tizen> 3 </since_tizen>
1049 private event EventHandler<TouchEventArgs> _stageTouchHandler;
1050 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
1053 /// This event is emitted when the screen is touched and when the touch ends.<br />
1054 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
1055 /// then when the last finger is lifted.<br />
1056 /// An interrupted event will also be emitted (if it occurs).<br />
1058 /// <since_tizen> 3 </since_tizen>
1059 public event EventHandler<TouchEventArgs> TouchEvent
1065 _stageTouchHandler += value;
1066 _stageTouchCallbackDelegate = OnStageTouch;
1067 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
1074 if (_stageTouchHandler != null)
1076 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
1078 _stageTouchHandler -= value;
1083 private void OnStageTouch(IntPtr data)
1085 TouchEventArgs e = new TouchEventArgs();
1089 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1092 if (_stageTouchHandler != null)
1094 _stageTouchHandler(this, e);
1099 /// Wheel event arguments.
1101 /// <since_tizen> 3 </since_tizen>
1102 public class WheelEventArgs : EventArgs
1104 private Wheel _wheel;
1109 /// <since_tizen> 3 </since_tizen>
1123 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1124 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1127 /// This event is emitted when the wheel event is received.
1129 /// <since_tizen> 3 </since_tizen>
1130 public event EventHandler<WheelEventArgs> WheelEvent
1134 if (_stageWheelHandler == null)
1136 _stageWheelCallbackDelegate = OnStageWheel;
1137 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1139 _stageWheelHandler += value;
1143 _stageWheelHandler -= value;
1144 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1146 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1151 private void OnStageWheel(IntPtr data)
1153 WheelEventArgs e = new WheelEventArgs();
1157 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1160 if (_stageWheelHandler != null)
1162 _stageWheelHandler(this, e);
1167 /// Key event arguments.
1169 /// <since_tizen> 3 </since_tizen>
1170 public class KeyEventArgs : EventArgs
1177 /// <since_tizen> 3 </since_tizen>
1191 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1192 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1195 /// This event is emitted when the key event is received.
1197 /// <since_tizen> 3 </since_tizen>
1198 public event EventHandler<KeyEventArgs> KeyEvent
1202 if (_stageKeyHandler == null)
1204 _stageKeyCallbackDelegate = OnStageKey;
1205 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1207 _stageKeyHandler += value;
1211 _stageKeyHandler -= value;
1212 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1214 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1219 // Callback for Stage KeyEventsignal
1220 private void OnStageKey(IntPtr data)
1222 KeyEventArgs e = new KeyEventArgs();
1226 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1229 if (_stageKeyHandler != null)
1231 //here we send all data to user event handlers
1232 _stageKeyHandler(this, e);
1237 private event EventHandler _stageEventProcessingFinishedEventHandler;
1238 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1240 internal event EventHandler EventProcessingFinished
1244 if (_stageEventProcessingFinishedEventHandler == null)
1246 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1247 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1249 _stageEventProcessingFinishedEventHandler += value;
1254 _stageEventProcessingFinishedEventHandler -= value;
1255 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1257 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1262 // Callback for Stage EventProcessingFinishedSignal
1263 private void OnEventProcessingFinished()
1265 if (_stageEventProcessingFinishedEventHandler != null)
1267 _stageEventProcessingFinishedEventHandler(this, null);
1272 private EventHandler _stageContextLostEventHandler;
1273 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1275 internal event EventHandler ContextLost
1279 if (_stageContextLostEventHandler == null)
1281 _stageContextLostEventCallbackDelegate = OnContextLost;
1282 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1284 _stageContextLostEventHandler += value;
1288 _stageContextLostEventHandler -= value;
1289 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1291 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1296 // Callback for Stage ContextLostSignal
1297 private void OnContextLost()
1299 if (_stageContextLostEventHandler != null)
1301 _stageContextLostEventHandler(this, null);
1306 private EventHandler _stageContextRegainedEventHandler;
1307 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1309 internal event EventHandler ContextRegained
1313 if (_stageContextRegainedEventHandler == null)
1315 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1316 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1318 _stageContextRegainedEventHandler += value;
1322 _stageContextRegainedEventHandler -= value;
1323 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1325 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1330 // Callback for Stage ContextRegainedSignal
1331 private void OnContextRegained()
1333 if (_stageContextRegainedEventHandler != null)
1335 _stageContextRegainedEventHandler(this, null);
1340 private EventHandler _stageSceneCreatedEventHandler;
1341 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1343 internal event EventHandler SceneCreated
1347 if (_stageSceneCreatedEventHandler == null)
1349 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1350 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1352 _stageSceneCreatedEventHandler += value;
1356 _stageSceneCreatedEventHandler -= value;
1357 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1359 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1364 // Callback for Stage SceneCreatedSignal
1365 private void OnSceneCreated()
1367 if (_stageSceneCreatedEventHandler != null)
1369 _stageSceneCreatedEventHandler(this, null);
1374 /// This resized event arguments.
1376 /// <since_tizen> 3 </since_tizen>
1377 public class ResizedEventArgs : EventArgs
1382 /// This window size.
1384 /// <since_tizen> 4 </since_tizen>
1385 public Size2D WindowSize
1393 _windowSize = value;
1398 private WindowResizedEventCallbackType _windowResizedEventCallback;
1399 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1400 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1401 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1404 /// This event is emitted when the window resized.
1406 /// <since_tizen> 3 </since_tizen>
1407 public event EventHandler<ResizedEventArgs> Resized
1411 if (_windowResizedEventHandler == null)
1413 _windowResizedEventCallback = OnResized;
1414 ResizedSignal().Connect(_windowResizedEventCallback);
1417 _windowResizedEventHandler += value;
1421 _windowResizedEventHandler -= value;
1423 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1425 ResizedSignal().Disconnect(_windowResizedEventCallback);
1430 private void OnResized(IntPtr windowSize)
1432 ResizedEventArgs e = new ResizedEventArgs();
1433 var val = new Uint16Pair(windowSize, false);
1434 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1437 if (_windowResizedEventHandler != null)
1439 _windowResizedEventHandler(this, e);
1443 internal void SetWindowSize(Size2D size)
1445 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1446 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1451 internal Size2D GetWindowSize()
1453 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1454 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1456 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1460 internal void SetPosition(Position2D position)
1462 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1463 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1468 internal Position2D GetPosition()
1470 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1471 Position2D ret = new Position2D(val.GetX(), val.GetY());
1473 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1478 /// Sets whether the window is transparent or not.
1480 /// <param name="transparent">Whether the window is transparent.</param>
1481 /// <since_tizen> 5 </since_tizen>
1482 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1483 [EditorBrowsable(EditorBrowsableState.Never)]
1484 public void SetTransparency(bool transparent) {
1485 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1486 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1490 /// The window size property (read-only).
1492 /// <since_tizen> 3 </since_tizen>
1497 Size2D ret = GetSize();
1503 /// The background color property.
1505 /// <since_tizen> 3 </since_tizen>
1506 public Color BackgroundColor
1510 SetBackgroundColor(value);
1514 Color ret = GetBackgroundColor();
1520 /// The DPI property (read-only).<br />
1521 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1523 /// <since_tizen> 3 </since_tizen>
1533 /// The layer count property (read-only).<br />
1534 /// Queries the number of on-Window layers.<br />
1536 /// <since_tizen> 3 </since_tizen>
1537 public uint LayerCount
1541 return GetLayerCount();
1547 /// Adds a layer to the stage.
1549 /// <param name="layer">Layer to add.</param>
1550 /// <since_tizen> 3 </since_tizen>
1551 public void AddLayer(Layer layer)
1553 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1556 LayersChildren.Add(layer);
1560 /// Removes a layer from the stage.
1562 /// <param name="layer">Layer to remove.</param>
1563 /// <since_tizen> 3 </since_tizen>
1564 public void RemoveLayer(Layer layer)
1566 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1567 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1569 LayersChildren.Remove(layer);
1573 /// Please do not use! this will be deprecated
1575 /// <since_tizen> 3 </since_tizen>
1576 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1578 "Window.Instance.FocusChanged = OnFocusChanged; " +
1579 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1580 [EditorBrowsable(EditorBrowsableState.Never)]
1581 public class WindowFocusChangedEventArgs : EventArgs
1584 /// Please do not use! this will be deprecated
1586 /// <since_tizen> 3 </since_tizen>
1587 public bool FocusGained
1594 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1595 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1596 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1597 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1600 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1602 /// <since_tizen> 3 </since_tizen>
1603 /// Please do not use! this will be deprecated!
1604 /// Instead please use FocusChanged.
1605 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1607 "Window.Instance.FocusChanged = OnFocusChanged; " +
1608 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1609 [EditorBrowsable(EditorBrowsableState.Never)]
1610 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1614 if (_windowFocusChangedEventHandler2 == null)
1616 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1617 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1620 _windowFocusChangedEventHandler2 += value;
1624 _windowFocusChangedEventHandler2 -= value;
1626 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1628 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1633 private void OnWindowFocusedChanged2(bool focusGained)
1635 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1637 e.FocusGained = focusGained;
1639 if (_windowFocusChangedEventHandler2 != null)
1641 _windowFocusChangedEventHandler2(this, e);
1646 /// Gets or sets a size of the window.
1648 /// <since_tizen> 4 </since_tizen>
1649 public Size2D WindowSize
1653 return GetWindowSize();
1657 SetWindowSize(value);
1662 /// Gets or sets a position of the window.
1664 /// <since_tizen> 4 </since_tizen>
1665 public Position2D WindowPosition
1669 return GetPosition();
1678 /// Feed a key-event into the window.
1680 /// <since_tizen> 4 </since_tizen>
1681 public static void FeedKeyEvent(Key keyEvent)
1683 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1688 /// Allows at least one more render, even when paused.
1689 /// The window should be shown, not minimised.
1691 /// <since_tizen> 4 </since_tizen>
1692 public void RenderOnce()
1694 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1699 /// Contains and encapsulates Native Window handle.
1701 /// <since_tizen> 4 </since_tizen>
1702 public class SafeNativeWindowHandle : SafeHandle
1705 /// Contructor, Native window handle is set to handle.
1707 /// <since_tizen> 4 </since_tizen>
1708 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1710 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1713 /// Null check if the handle is valid or not.
1715 /// <since_tizen> 4 </since_tizen>
1716 public override bool IsInvalid
1720 return this.handle == IntPtr.Zero;
1724 /// Release handle itself.
1726 /// <returns>true when released successfully.</returns>
1727 /// <since_tizen> 4 </since_tizen>
1728 protected override bool ReleaseHandle()