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 internal 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;
60 internal static Window GetCurrent()
62 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
63 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 internal static bool IsInstalled()
69 bool ret = NDalicPINVOKE.Stage_IsInstalled();
70 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75 /// Sets whether the window accepts a focus or not.
77 /// <param name="accept">If a focus is accepted or not. The default is true.</param>
78 /// <since_tizen> 3 </since_tizen>
79 public void SetAcceptFocus(bool accept)
81 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 /// Returns whether the window accepts a focus or not.
88 /// <returns>True if the window accepts a focus, false otherwise.</returns>
89 /// <since_tizen> 3 </since_tizen>
90 public bool IsFocusAcceptable()
92 bool ret = NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// Shows the window if it is hidden.
101 /// <since_tizen> 3 </since_tizen>
104 NDalicPINVOKE.Show(swigCPtr);
105 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 /// Hides the window if it is showing.
111 /// <since_tizen> 3 </since_tizen>
114 NDalicPINVOKE.Hide(swigCPtr);
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 /// Retrieves whether the window is visible or not.
121 /// <returns>True if the window is visible.</returns>
122 /// <since_tizen> 3 </since_tizen>
123 public bool IsVisible()
125 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131 /// Gets the count of supported auxiliary hints of the window.
133 /// <returns>The number of supported auxiliary hints.</returns>
134 /// <since_tizen> 3 </since_tizen>
135 public uint GetSupportedAuxiliaryHintCount()
137 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 /// Gets the supported auxiliary hint string of the window.
145 /// <param name="index">The index of the supported auxiliary hint lists.</param>
146 /// <returns>The auxiliary hint string of the index.</returns>
147 /// <since_tizen> 3 </since_tizen>
148 public string GetSupportedAuxiliaryHint(uint index)
150 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 /// Creates an auxiliary hint of the window.
158 /// <param name="hint">The auxiliary hint string.</param>
159 /// <param name="value">The value string.</param>
160 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
161 /// <since_tizen> 3 </since_tizen>
162 public uint AddAuxiliaryHint(string hint, string value)
164 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 /// Removes an auxiliary hint of the window.
172 /// <param name="id">The ID of the auxiliary hint.</param>
173 /// <returns>True if no error occurred, false otherwise.</returns>
174 /// <since_tizen> 3 </since_tizen>
175 public bool RemoveAuxiliaryHint(uint id)
177 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// Changes a value of the auxiliary hint.
185 /// <param name="id">The auxiliary hint ID.</param>
186 /// <param name="value">The value string to be set.</param>
187 /// <returns>True if no error occurred, false otherwise.</returns>
188 /// <since_tizen> 3 </since_tizen>
189 public bool SetAuxiliaryHintValue(uint id, string value)
191 bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 /// Gets a value of the auxiliary hint.
199 /// <param name="id">The auxiliary hint ID.</param>
200 /// <returns>The string value of the auxiliary hint ID, or an empty string if none exists.</returns>
201 /// <since_tizen> 3 </since_tizen>
202 public string GetAuxiliaryHintValue(uint id)
204 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 /// Gets an ID of the auxiliary hint string.
212 /// <param name="hint">The auxiliary hint string.</param>
213 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
214 /// <since_tizen> 3 </since_tizen>
215 public uint GetAuxiliaryHintId(string hint)
217 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 /// Sets a region to accept input events.
225 /// <param name="inputRegion">The region to accept input events.</param>
226 /// <since_tizen> 3 </since_tizen>
227 public void SetInputRegion(Rectangle inputRegion)
229 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 /// Gets or sets a window type.
236 /// <since_tizen> 3 </since_tizen>
237 public WindowType Type
241 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 NDalicPINVOKE.SetType(swigCPtr, (int)value);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 /// Sets a priority level for the specified notification window.
255 /// <param name="level">The notification window level.</param>
256 /// <returns>True if no error occurred, false otherwise.</returns>
257 /// <since_tizen> 3 </since_tizen>
258 public bool SetNotificationLevel(NotificationLevel level)
260 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266 /// Gets a priority level for the specified notification window.
268 /// <returns>The notification window level.</returns>
269 /// <since_tizen> 3 </since_tizen>
270 public NotificationLevel GetNotificationLevel()
272 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278 /// Sets a transparent window's visual state to opaque. <br />
279 /// If a visual state of a transparent window is opaque, <br />
280 /// then the window manager could handle it as an opaque window when calculating visibility.
282 /// <param name="opaque">Whether the window's visual state is opaque.</param>
283 /// <remarks>This will have no effect on an opaque window. <br />
284 /// It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
286 /// <since_tizen> 3 </since_tizen>
287 public void SetOpaqueState(bool opaque)
289 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294 /// Returns whether a transparent window's visual state is opaque or not.
296 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
297 /// <remarks> The return value has no meaning on an opaque window. </remarks>
298 /// <since_tizen> 3 </since_tizen>
299 public bool IsOpaqueState()
301 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 /// Sets a window's screen off mode.
309 /// <param name="screenOffMode">The screen mode.</param>
310 /// <returns>True if no error occurred, false otherwise.</returns>
311 /// <since_tizen> 4 </since_tizen>
312 public bool SetScreenOffMode(ScreenOffMode screenOffMode)
314 bool ret = NDalicPINVOKE.SetScreenOffMode(swigCPtr, (int)screenOffMode);
315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320 /// Gets the screen mode of the window.
322 /// <returns>The screen off mode.</returns>
323 /// <since_tizen> 4 </since_tizen>
324 public ScreenOffMode GetScreenOffMode()
326 ScreenOffMode ret = (ScreenOffMode)NDalicPINVOKE.GetScreenOffMode(swigCPtr);
327 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 /// Sets preferred brightness of the window.
334 /// <param name="brightness">The preferred brightness (0 to 100).</param>
335 /// <returns>True if no error occurred, false otherwise.</returns>
336 /// <since_tizen> 3 </since_tizen>
337 public bool SetBrightness(int brightness)
339 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345 /// Gets the preferred brightness of the window.
347 /// <returns>The preferred brightness.</returns>
348 /// <since_tizen> 3 </since_tizen>
349 public int GetBrightness()
351 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 /// The focus changed event argument.
359 /// <since_tizen> 3 </since_tizen>
360 public class FocusChangedEventArgs : EventArgs
363 /// FocusGained flag.
365 /// <since_tizen> 3 </since_tizen>
366 public bool FocusGained
373 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
374 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
375 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
376 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
379 /// FocusChanged event.
381 /// <since_tizen> 3 </since_tizen>
382 public event EventHandler<FocusChangedEventArgs> FocusChanged
386 if (_windowFocusChangedEventHandler == null)
388 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
389 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
392 _windowFocusChangedEventHandler += value;
396 _windowFocusChangedEventHandler -= value;
398 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
400 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
405 private void OnWindowFocusedChanged(bool focusGained)
407 FocusChangedEventArgs e = new FocusChangedEventArgs();
409 e.FocusGained = focusGained;
411 if (_windowFocusChangedEventHandler != null)
413 _windowFocusChangedEventHandler(this, e);
418 /// Gets/Sets a window title.
420 /// <since_tizen> 4 </since_tizen>
429 _windowTitle = value;
430 SetClass(_windowTitle, "");
434 internal WindowFocusSignalType WindowFocusChangedSignal()
436 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
456 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
461 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
463 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
464 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
467 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
469 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473 internal void RotateIndicator(Window.WindowOrientation orientation)
475 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
476 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 /// Sets the window name and the class string.
482 /// <param name="name">The name of the window.</param>
483 /// <param name="klass">The class of the window.</param>
484 /// <since_tizen> 4 </since_tizen>
485 public void SetClass(string name, string klass)
487 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
492 /// Raises the window to the top of the window stack.
494 /// <since_tizen> 3 </since_tizen>
497 NDalicPINVOKE.Window_Raise(swigCPtr);
498 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
502 /// Lowers the window to the bottom of the window stack.
504 /// <since_tizen> 3 </since_tizen>
507 NDalicPINVOKE.Window_Lower(swigCPtr);
508 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512 /// Activates the window to the top of the window stack even it is iconified.
514 /// <since_tizen> 3 </since_tizen>
515 public void Activate()
517 NDalicPINVOKE.Window_Activate(swigCPtr);
518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
523 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
529 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
530 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
535 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 internal Window.WindowOrientation GetPreferredOrientation()
541 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546 internal DragAndDropDetector GetDragAndDropDetector()
548 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553 internal Any GetNativeHandle()
555 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
556 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 internal WindowFocusSignalType FocusChangedSignal()
562 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
563 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568 /// Gets the default ( root ) layer.
570 /// <returns>The root layer.</returns>
571 /// <since_tizen> 3 </since_tizen>
572 public Layer GetDefaultLayer()
574 return this.GetRootLayer();
577 internal void Add(Layer layer)
579 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
580 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 LayersChildren.Add(layer);
585 internal void Remove(Layer layer)
587 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
588 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 LayersChildren.Remove(layer);
594 /// Add a child view to window.
596 /// <param name="view">the child should be added to the window.</param>
597 /// <since_tizen> 3 </since_tizen>
598 public void Add(View view)
600 GetRootLayer()?.Add(view);
604 /// Remove a child view from window.
606 /// <param name="view">the child to be removed.</param>
607 /// <since_tizen> 3 </since_tizen>
608 public void Remove(View view)
610 GetRootLayer()?.Remove(view);
613 internal Vector2 GetSize()
615 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
616 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620 internal RenderTaskList GetRenderTaskList()
622 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628 /// Queries the number of on-window layers.
630 /// <returns>The number of layers.</returns>
631 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
632 internal uint GetLayerCount()
634 if (LayersChildren == null || LayersChildren.Count < 0)
637 return (uint) LayersChildren.Count;
641 /// Retrieves the layer at a specified depth.
643 /// <param name="depth">The layer's depth index.</param>
644 /// <returns>The layer found at the given depth.</returns>
645 /// <since_tizen> 3 </since_tizen>
646 public Layer GetLayer(uint depth)
648 if (depth < LayersChildren.Count)
650 Layer ret = LayersChildren[Convert.ToInt32(depth)];
659 internal Layer GetRootLayer()
661 // Window.IsInstalled() is actually true only when called from event thread and
662 // Core has been initialized, not when Stage is ready.
663 if (_rootLayer == null && Window.IsInstalled())
665 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
666 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 LayersChildren.Add(_rootLayer);
672 internal void SetBackgroundColor(Vector4 color)
674 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
678 internal Vector4 GetBackgroundColor()
680 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 internal Vector2 GetDpi()
687 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
688 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
692 internal ObjectRegistry GetObjectRegistry()
694 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Keep rendering for at least the given amount of time.
702 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame.</param>
703 /// <since_tizen> 3 </since_tizen>
704 public void KeepRendering(float durationSeconds)
706 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
710 internal KeyEventSignal KeyEventSignal()
712 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
713 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717 internal VoidSignal EventProcessingFinishedSignal()
719 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 internal TouchSignal TouchSignal()
726 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 internal TouchDataSignal TouchDataSignal()
733 TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
734 if (NDalicPINVOKE.SWIGPendingException.Pending)
735 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739 private StageWheelSignal WheelEventSignal()
741 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
742 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 private WheelSignal StageWheelEventSignal()
749 WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(Layer.getCPtr(this.GetRootLayer())), false);
750 if (NDalicPINVOKE.SWIGPendingException.Pending)
751 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 internal VoidSignal ContextLostSignal()
758 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
759 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 internal VoidSignal ContextRegainedSignal()
765 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 internal VoidSignal SceneCreatedSignal()
772 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal ResizedSignal ResizedSignal()
779 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
780 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
784 internal static Vector4 DEFAULT_BACKGROUND_COLOR
788 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
789 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
790 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795 internal static Vector4 DEBUG_BACKGROUND_COLOR
799 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
800 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
801 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
806 private static readonly Window instance = Application.Instance.GetWindow();
809 /// The stage instance property (read-only).<br />
810 /// Gets the current window.<br />
812 /// <since_tizen> 3 </since_tizen>
813 public static Window Instance
822 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
823 /// This function can be used for following example scenarios: <br />
824 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
826 /// <param name="DaliKey">The key code to grab.</param>
827 /// <returns>True if the grab succeeds.</returns>
828 /// <since_tizen> 3 </since_tizen>
829 public bool GrabKeyTopmost(int DaliKey)
831 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837 /// Ungrabs the key specified by a key for the window.<br />
838 /// 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 />
840 /// <param name="DaliKey">The key code to ungrab.</param>
841 /// <returns>True if the ungrab succeeds.</returns>
842 /// <since_tizen> 3 </since_tizen>
843 public bool UngrabKeyTopmost(int DaliKey)
845 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 /// Grabs the key specified by a key for a window in a GrabMode. <br />
852 /// Details: This function can be used for following example scenarios: <br />
853 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
854 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
855 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
857 /// <param name="DaliKey">The key code to grab.</param>
858 /// <param name="GrabMode">The grab mode for the key.</param>
859 /// <returns>True if the grab succeeds.</returns>
860 /// <since_tizen> 3 </since_tizen>
861 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
863 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
864 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
869 /// Ungrabs the key specified by a key for a window.<br />
870 /// 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 />
872 /// <param name="DaliKey">The key code to ungrab.</param>
873 /// <returns>True if the ungrab succeeds.</returns>
874 /// <since_tizen> 3 </since_tizen>
875 public bool UngrabKey(int DaliKey)
877 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
878 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
882 internal System.IntPtr GetNativeWindowHandler()
884 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
885 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
890 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
892 /// <since_tizen> 3 </since_tizen>
893 public enum WindowOrientation
896 /// Portrait orientation. The height of the display area is greater than the width.
898 /// <since_tizen> 3 </since_tizen>
901 /// Landscape orientation. A wide view area is needed.
903 /// <since_tizen> 3 </since_tizen>
906 /// Portrait inverse orientation.
908 /// <since_tizen> 3 </since_tizen>
909 PortraitInverse = 180,
911 /// Landscape inverse orientation.
913 /// <since_tizen> 3 </since_tizen>
914 LandscapeInverse = 270
918 /// Enumeration for the key grab mode for platform-level APIs.
920 /// <since_tizen> 3 </since_tizen>
921 public enum KeyGrabMode
924 /// Grabs a key only when on the top of the grabbing-window stack mode.
928 /// Grabs a key together with the other client window(s) mode.
932 /// 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.
936 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
942 /// Enumeration for opacity of the indicator.
944 internal enum IndicatorBackgroundOpacity
952 /// Enumeration for visible mode of the indicator.
954 internal enum IndicatorVisibleMode
962 /// The touch event argument.
964 /// <since_tizen> 3 </since_tizen>
965 public class TouchEventArgs : EventArgs
967 private Touch _touch;
972 /// <since_tizen> 3 </since_tizen>
987 private event EventHandler<TouchEventArgs> _rootLayerTouchDataEventHandler;
988 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
989 private delegate bool RootLayerTouchDataCallbackType(IntPtr view, IntPtr touchData);
990 private RootLayerTouchDataCallbackType _rootLayerTouchDataCallback;
992 /// This event is emitted when the screen is touched and when the touch ends.<br />
993 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
994 /// then when the last finger is lifted.<br />
995 /// An interrupted event will also be emitted (if it occurs).<br />
997 /// <since_tizen> 3 </since_tizen>
998 public event EventHandler<TouchEventArgs> TouchEvent
1002 if (_rootLayerTouchDataEventHandler == null)
1004 _rootLayerTouchDataCallback = OnWindowTouch;
1005 this.TouchDataSignal().Connect(_rootLayerTouchDataCallback);
1007 _rootLayerTouchDataEventHandler += value;
1011 _rootLayerTouchDataEventHandler -= value;
1012 if (_rootLayerTouchDataEventHandler == null && TouchSignal().Empty() == false)
1014 this.TouchDataSignal().Disconnect(_rootLayerTouchDataCallback);
1019 private bool OnWindowTouch(IntPtr view, IntPtr touchData)
1021 if (touchData == global::System.IntPtr.Zero)
1023 NUILog.Error("touchData should not be null!");
1027 TouchEventArgs e = new TouchEventArgs();
1029 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
1031 if (_rootLayerTouchDataEventHandler != null)
1033 _rootLayerTouchDataEventHandler(this, e);
1039 /// Wheel event arguments.
1041 /// <since_tizen> 3 </since_tizen>
1042 public class WheelEventArgs : EventArgs
1044 private Wheel _wheel;
1049 /// <since_tizen> 3 </since_tizen>
1063 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1065 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1066 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
1067 private WheelEventCallbackType _wheelEventCallback;
1070 /// This event is emitted when the wheel event is received.
1072 /// <since_tizen> 3 </since_tizen>
1073 public event EventHandler<WheelEventArgs> WheelEvent
1077 if (_stageWheelHandler == null)
1079 _wheelEventCallback = OnStageWheel;
1080 this.StageWheelEventSignal().Connect(_wheelEventCallback);
1082 _stageWheelHandler += value;
1086 _stageWheelHandler -= value;
1087 if (_stageWheelHandler == null && StageWheelEventSignal().Empty() == false)
1089 this.StageWheelEventSignal().Disconnect(_wheelEventCallback);
1094 private bool OnStageWheel(IntPtr rootLayer, IntPtr wheelEvent)
1096 if (wheelEvent == global::System.IntPtr.Zero)
1098 NUILog.Error("wheelEvent should not be null!");
1102 WheelEventArgs e = new WheelEventArgs();
1104 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
1106 if (_stageWheelHandler != null)
1108 _stageWheelHandler(this, e);
1114 /// Key event arguments.
1116 /// <since_tizen> 3 </since_tizen>
1117 public class KeyEventArgs : EventArgs
1124 /// <since_tizen> 3 </since_tizen>
1138 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1139 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1142 /// This event is emitted when the key event is received.
1144 /// <since_tizen> 3 </since_tizen>
1145 public event EventHandler<KeyEventArgs> KeyEvent
1149 if (_stageKeyHandler == null)
1151 _stageKeyCallbackDelegate = OnStageKey;
1152 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1154 _stageKeyHandler += value;
1158 _stageKeyHandler -= value;
1159 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1161 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1166 // Callback for Stage KeyEventsignal
1167 private void OnStageKey(IntPtr data)
1169 KeyEventArgs e = new KeyEventArgs();
1173 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1176 if (_stageKeyHandler != null)
1178 //here we send all data to user event handlers
1179 _stageKeyHandler(this, e);
1184 private event EventHandler _stageEventProcessingFinishedEventHandler;
1185 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1187 internal event EventHandler EventProcessingFinished
1191 if (_stageEventProcessingFinishedEventHandler == null)
1193 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1194 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1196 _stageEventProcessingFinishedEventHandler += value;
1201 _stageEventProcessingFinishedEventHandler -= value;
1202 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1204 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1209 // Callback for Stage EventProcessingFinishedSignal
1210 private void OnEventProcessingFinished()
1212 if (_stageEventProcessingFinishedEventHandler != null)
1214 _stageEventProcessingFinishedEventHandler(this, null);
1219 private EventHandler _stageContextLostEventHandler;
1220 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1222 internal event EventHandler ContextLost
1226 if (_stageContextLostEventHandler == null)
1228 _stageContextLostEventCallbackDelegate = OnContextLost;
1229 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1231 _stageContextLostEventHandler += value;
1235 _stageContextLostEventHandler -= value;
1236 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1238 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1243 // Callback for Stage ContextLostSignal
1244 private void OnContextLost()
1246 if (_stageContextLostEventHandler != null)
1248 _stageContextLostEventHandler(this, null);
1253 private EventHandler _stageContextRegainedEventHandler;
1254 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1256 internal event EventHandler ContextRegained
1260 if (_stageContextRegainedEventHandler == null)
1262 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1263 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1265 _stageContextRegainedEventHandler += value;
1269 _stageContextRegainedEventHandler -= value;
1270 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1272 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1277 // Callback for Stage ContextRegainedSignal
1278 private void OnContextRegained()
1280 if (_stageContextRegainedEventHandler != null)
1282 _stageContextRegainedEventHandler(this, null);
1287 private EventHandler _stageSceneCreatedEventHandler;
1288 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1290 internal event EventHandler SceneCreated
1294 if (_stageSceneCreatedEventHandler == null)
1296 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1297 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1299 _stageSceneCreatedEventHandler += value;
1303 _stageSceneCreatedEventHandler -= value;
1304 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1306 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1311 // Callback for Stage SceneCreatedSignal
1312 private void OnSceneCreated()
1314 if (_stageSceneCreatedEventHandler != null)
1316 _stageSceneCreatedEventHandler(this, null);
1321 /// This resized event arguments.
1323 /// <since_tizen> 3 </since_tizen>
1324 public class ResizedEventArgs : EventArgs
1329 /// This window size.
1331 /// <since_tizen> 4 </since_tizen>
1332 public Size2D WindowSize
1340 _windowSize = value;
1345 private WindowResizedEventCallbackType _windowResizedEventCallback;
1346 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1347 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1348 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1351 /// This event is emitted when the window resized.
1353 /// <since_tizen> 3 </since_tizen>
1354 public event EventHandler<ResizedEventArgs> Resized
1358 if (_windowResizedEventHandler == null)
1360 _windowResizedEventCallback = OnResized;
1361 ResizedSignal().Connect(_windowResizedEventCallback);
1364 _windowResizedEventHandler += value;
1368 _windowResizedEventHandler -= value;
1370 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1372 ResizedSignal().Disconnect(_windowResizedEventCallback);
1377 private void OnResized(IntPtr windowSize)
1379 ResizedEventArgs e = new ResizedEventArgs();
1380 var val = new Uint16Pair(windowSize, false);
1381 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1384 if (_windowResizedEventHandler != null)
1386 _windowResizedEventHandler(this, e);
1390 internal void SetWindowSize(Size2D size)
1392 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1393 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1398 internal Size2D GetWindowSize()
1400 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1401 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 internal void SetPosition(Position2D position)
1409 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1410 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1415 internal Position2D GetPosition()
1417 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1418 Position2D ret = new Position2D(val.GetX(), val.GetY());
1420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1425 /// Sets whether the window is transparent or not.
1427 /// <param name="transparent">Whether the window is transparent.</param>
1428 /// <since_tizen> 5 </since_tizen>
1429 public void SetTransparency(bool transparent) {
1430 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1431 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1435 /// The window size property (read-only).
1437 /// <since_tizen> 3 </since_tizen>
1442 Size2D ret = GetSize();
1448 /// The background color property.
1450 /// <since_tizen> 3 </since_tizen>
1451 public Color BackgroundColor
1455 SetBackgroundColor(value);
1459 Color ret = GetBackgroundColor();
1465 /// The DPI property (read-only).<br />
1466 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1468 /// <since_tizen> 3 </since_tizen>
1478 /// The layer count property (read-only).<br />
1479 /// Queries the number of on-Window layers.<br />
1481 /// <since_tizen> 3 </since_tizen>
1482 public uint LayerCount
1486 return GetLayerCount();
1492 /// Adds a layer to the stage.
1494 /// <param name="layer">Layer to add.</param>
1495 /// <since_tizen> 3 </since_tizen>
1496 public void AddLayer(Layer layer)
1498 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1501 LayersChildren.Add(layer);
1505 /// Removes a layer from the stage.
1507 /// <param name="layer">Layer to remove.</param>
1508 /// <since_tizen> 3 </since_tizen>
1509 public void RemoveLayer(Layer layer)
1511 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1514 LayersChildren.Remove(layer);
1518 /// Please do not use! this will be deprecated
1520 /// <since_tizen> 3 </since_tizen>
1521 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1523 "Window.Instance.FocusChanged = OnFocusChanged; " +
1524 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1525 [EditorBrowsable(EditorBrowsableState.Never)]
1526 public class WindowFocusChangedEventArgs : EventArgs
1529 /// Please do not use! this will be deprecated
1531 /// <since_tizen> 3 </since_tizen>
1532 public bool FocusGained
1539 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1540 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1541 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1542 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1545 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1547 /// <since_tizen> 3 </since_tizen>
1548 /// Please do not use! this will be deprecated!
1549 /// Instead please use FocusChanged.
1550 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1552 "Window.Instance.FocusChanged = OnFocusChanged; " +
1553 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1554 [EditorBrowsable(EditorBrowsableState.Never)]
1555 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1559 if (_windowFocusChangedEventHandler2 == null)
1561 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1562 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1565 _windowFocusChangedEventHandler2 += value;
1569 _windowFocusChangedEventHandler2 -= value;
1571 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1573 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1578 private void OnWindowFocusedChanged2(bool focusGained)
1580 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1582 e.FocusGained = focusGained;
1584 if (_windowFocusChangedEventHandler2 != null)
1586 _windowFocusChangedEventHandler2(this, e);
1591 /// Gets or sets a size of the window.
1593 /// <since_tizen> 4 </since_tizen>
1594 public Size2D WindowSize
1598 return GetWindowSize();
1602 SetWindowSize(value);
1607 /// Gets or sets a position of the window.
1609 /// <since_tizen> 4 </since_tizen>
1610 public Position2D WindowPosition
1614 return GetPosition();
1623 /// Feed a key-event into the window.
1625 /// <param name="keyEvent">The key event to feed.</param>
1626 /// <since_tizen> 5 </since_tizen>
1627 public void FeedKey(Key keyEvent)
1629 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1630 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1634 /// Feed a key-event into the window.
1636 /// <param name="keyEvent">The key event to feed.</param>
1637 /// <since_tizen> 4 </since_tizen>
1638 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
1639 public static void FeedKeyEvent(Key keyEvent)
1641 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1646 /// Allows at least one more render, even when paused.
1647 /// The window should be shown, not minimised.
1649 /// <since_tizen> 4 </since_tizen>
1650 public void RenderOnce()
1652 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1653 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1657 /// Contains and encapsulates Native Window handle.
1659 /// <since_tizen> 4 </since_tizen>
1660 public class SafeNativeWindowHandle : SafeHandle
1663 /// Contructor, Native window handle is set to handle.
1665 /// <since_tizen> 4 </since_tizen>
1666 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1668 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1671 /// Null check if the handle is valid or not.
1673 /// <since_tizen> 4 </since_tizen>
1674 public override bool IsInvalid
1678 return this.handle == IntPtr.Zero;
1682 /// Release handle itself.
1684 /// <returns>true when released successfully.</returns>
1685 /// <since_tizen> 4 </since_tizen>
1686 protected override bool ReleaseHandle()