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 private StageWheelSignal WheelEventSignal()
733 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 internal VoidSignal ContextLostSignal()
740 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
741 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 internal VoidSignal ContextRegainedSignal()
747 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
748 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
752 internal VoidSignal SceneCreatedSignal()
754 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
755 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 internal ResizedSignal ResizedSignal()
761 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false);
762 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
766 internal static Vector4 DEFAULT_BACKGROUND_COLOR
770 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
771 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 internal static Vector4 DEBUG_BACKGROUND_COLOR
781 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
782 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
783 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
788 private static readonly Window instance = Application.Instance.GetWindow();
791 /// The stage instance property (read-only).<br />
792 /// Gets the current window.<br />
794 /// <since_tizen> 3 </since_tizen>
795 public static Window Instance
804 /// Grabs the key specified by a key for a window only when a window is the topmost window.<br />
805 /// This function can be used for following example scenarios: <br />
806 /// - Mobile - Using volume up or down as zoom up or down in camera apps.<br />
808 /// <param name="DaliKey">The key code to grab.</param>
809 /// <returns>True if the grab succeeds.</returns>
810 /// <since_tizen> 3 </since_tizen>
811 public bool GrabKeyTopmost(int DaliKey)
813 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
819 /// Ungrabs the key specified by a key for the window.<br />
820 /// 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 />
822 /// <param name="DaliKey">The key code to ungrab.</param>
823 /// <returns>True if the ungrab succeeds.</returns>
824 /// <since_tizen> 3 </since_tizen>
825 public bool UngrabKeyTopmost(int DaliKey)
827 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
833 /// Grabs the key specified by a key for a window in a GrabMode. <br />
834 /// Details: This function can be used for following example scenarios: <br />
835 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br />
836 /// - Mobile - When a user presses the Home key, the homescreen appears regardless of the current foreground app. <br />
837 /// - Mobile - Using the volume up or down as zoom up or down in camera apps. <br />
839 /// <param name="DaliKey">The key code to grab.</param>
840 /// <param name="GrabMode">The grab mode for the key.</param>
841 /// <returns>True if the grab succeeds.</returns>
842 /// <since_tizen> 3 </since_tizen>
843 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
845 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
846 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 /// Ungrabs the key specified by a key for a window.<br />
852 /// 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 />
854 /// <param name="DaliKey">The key code to ungrab.</param>
855 /// <returns>True if the ungrab succeeds.</returns>
856 /// <since_tizen> 3 </since_tizen>
857 public bool UngrabKey(int DaliKey)
859 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
860 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 internal System.IntPtr GetNativeWindowHandler()
866 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
867 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
872 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
874 /// <since_tizen> 3 </since_tizen>
875 public enum WindowOrientation
878 /// Portrait orientation. The height of the display area is greater than the width.
880 /// <since_tizen> 3 </since_tizen>
883 /// Landscape orientation. A wide view area is needed.
885 /// <since_tizen> 3 </since_tizen>
888 /// Portrait inverse orientation.
890 /// <since_tizen> 3 </since_tizen>
891 PortraitInverse = 180,
893 /// Landscape inverse orientation.
895 /// <since_tizen> 3 </since_tizen>
896 LandscapeInverse = 270
900 /// Enumeration for the key grab mode for platform-level APIs.
902 /// <since_tizen> 3 </since_tizen>
903 public enum KeyGrabMode
906 /// Grabs a key only when on the top of the grabbing-window stack mode.
910 /// Grabs a key together with the other client window(s) mode.
914 /// 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.
918 /// Grabs a key exclusively regardless of the grabbing-window's position on the window stack mode.
924 /// Enumeration for opacity of the indicator.
926 internal enum IndicatorBackgroundOpacity
934 /// Enumeration for visible mode of the indicator.
936 internal enum IndicatorVisibleMode
944 /// The touch event argument.
946 /// <since_tizen> 3 </since_tizen>
947 public class TouchEventArgs : EventArgs
949 private Touch _touch;
954 /// <since_tizen> 3 </since_tizen>
968 private event EventHandler<TouchEventArgs> _stageTouchHandler;
969 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
972 /// This event is emitted when the screen is touched and when the touch ends.<br />
973 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
974 /// then when the last finger is lifted.<br />
975 /// An interrupted event will also be emitted (if it occurs).<br />
977 /// <since_tizen> 3 </since_tizen>
978 public event EventHandler<TouchEventArgs> TouchEvent
984 _stageTouchHandler += value;
985 _stageTouchCallbackDelegate = OnStageTouch;
986 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
993 if (_stageTouchHandler != null)
995 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
997 _stageTouchHandler -= value;
1002 private void OnStageTouch(IntPtr data)
1004 TouchEventArgs e = new TouchEventArgs();
1008 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
1011 if (_stageTouchHandler != null)
1013 _stageTouchHandler(this, e);
1018 /// Wheel event arguments.
1020 /// <since_tizen> 3 </since_tizen>
1021 public class WheelEventArgs : EventArgs
1023 private Wheel _wheel;
1028 /// <since_tizen> 3 </since_tizen>
1042 private event EventHandler<WheelEventArgs> _stageWheelHandler;
1043 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
1046 /// This event is emitted when the wheel event is received.
1048 /// <since_tizen> 3 </since_tizen>
1049 public event EventHandler<WheelEventArgs> WheelEvent
1053 if (_stageWheelHandler == null)
1055 _stageWheelCallbackDelegate = OnStageWheel;
1056 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
1058 _stageWheelHandler += value;
1062 _stageWheelHandler -= value;
1063 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
1065 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
1070 private void OnStageWheel(IntPtr data)
1072 WheelEventArgs e = new WheelEventArgs();
1076 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
1079 if (_stageWheelHandler != null)
1081 _stageWheelHandler(this, e);
1086 /// Key event arguments.
1088 /// <since_tizen> 3 </since_tizen>
1089 public class KeyEventArgs : EventArgs
1096 /// <since_tizen> 3 </since_tizen>
1110 private event EventHandler<KeyEventArgs> _stageKeyHandler;
1111 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
1114 /// This event is emitted when the key event is received.
1116 /// <since_tizen> 3 </since_tizen>
1117 public event EventHandler<KeyEventArgs> KeyEvent
1121 if (_stageKeyHandler == null)
1123 _stageKeyCallbackDelegate = OnStageKey;
1124 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
1126 _stageKeyHandler += value;
1130 _stageKeyHandler -= value;
1131 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1133 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1138 // Callback for Stage KeyEventsignal
1139 private void OnStageKey(IntPtr data)
1141 KeyEventArgs e = new KeyEventArgs();
1145 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1148 if (_stageKeyHandler != null)
1150 //here we send all data to user event handlers
1151 _stageKeyHandler(this, e);
1156 private event EventHandler _stageEventProcessingFinishedEventHandler;
1157 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1159 internal event EventHandler EventProcessingFinished
1163 if (_stageEventProcessingFinishedEventHandler == null)
1165 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1166 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1168 _stageEventProcessingFinishedEventHandler += value;
1173 _stageEventProcessingFinishedEventHandler -= value;
1174 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1176 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1181 // Callback for Stage EventProcessingFinishedSignal
1182 private void OnEventProcessingFinished()
1184 if (_stageEventProcessingFinishedEventHandler != null)
1186 _stageEventProcessingFinishedEventHandler(this, null);
1191 private EventHandler _stageContextLostEventHandler;
1192 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1194 internal event EventHandler ContextLost
1198 if (_stageContextLostEventHandler == null)
1200 _stageContextLostEventCallbackDelegate = OnContextLost;
1201 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1203 _stageContextLostEventHandler += value;
1207 _stageContextLostEventHandler -= value;
1208 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1210 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1215 // Callback for Stage ContextLostSignal
1216 private void OnContextLost()
1218 if (_stageContextLostEventHandler != null)
1220 _stageContextLostEventHandler(this, null);
1225 private EventHandler _stageContextRegainedEventHandler;
1226 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1228 internal event EventHandler ContextRegained
1232 if (_stageContextRegainedEventHandler == null)
1234 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1235 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1237 _stageContextRegainedEventHandler += value;
1241 _stageContextRegainedEventHandler -= value;
1242 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1244 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1249 // Callback for Stage ContextRegainedSignal
1250 private void OnContextRegained()
1252 if (_stageContextRegainedEventHandler != null)
1254 _stageContextRegainedEventHandler(this, null);
1259 private EventHandler _stageSceneCreatedEventHandler;
1260 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1262 internal event EventHandler SceneCreated
1266 if (_stageSceneCreatedEventHandler == null)
1268 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1269 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1271 _stageSceneCreatedEventHandler += value;
1275 _stageSceneCreatedEventHandler -= value;
1276 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1278 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1283 // Callback for Stage SceneCreatedSignal
1284 private void OnSceneCreated()
1286 if (_stageSceneCreatedEventHandler != null)
1288 _stageSceneCreatedEventHandler(this, null);
1293 /// This resized event arguments.
1295 /// <since_tizen> 3 </since_tizen>
1296 public class ResizedEventArgs : EventArgs
1301 /// This window size.
1303 /// <since_tizen> 4 </since_tizen>
1304 public Size2D WindowSize
1312 _windowSize = value;
1317 private WindowResizedEventCallbackType _windowResizedEventCallback;
1318 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1319 private delegate void WindowResizedEventCallbackType(IntPtr windowSize);
1320 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1323 /// This event is emitted when the window resized.
1325 /// <since_tizen> 3 </since_tizen>
1326 public event EventHandler<ResizedEventArgs> Resized
1330 if (_windowResizedEventHandler == null)
1332 _windowResizedEventCallback = OnResized;
1333 ResizedSignal().Connect(_windowResizedEventCallback);
1336 _windowResizedEventHandler += value;
1340 _windowResizedEventHandler -= value;
1342 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1344 ResizedSignal().Disconnect(_windowResizedEventCallback);
1349 private void OnResized(IntPtr windowSize)
1351 ResizedEventArgs e = new ResizedEventArgs();
1352 var val = new Uint16Pair(windowSize, false);
1353 e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight());
1356 if (_windowResizedEventHandler != null)
1358 _windowResizedEventHandler(this, e);
1362 internal void SetWindowSize(Size2D size)
1364 var val = new Uint16Pair((uint)size.Width, (uint)size.Height);
1365 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val));
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370 internal Size2D GetWindowSize()
1372 var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false);
1373 Size2D ret = new Size2D(val.GetWidth(), val.GetHeight());
1375 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1379 internal void SetPosition(Position2D position)
1381 var val = new Uint16Pair((uint)position.X, (uint)position.Y);
1382 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val));
1384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1387 internal Position2D GetPosition()
1389 var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1390 Position2D ret = new Position2D(val.GetX(), val.GetY());
1392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1397 /// Sets whether the window is transparent or not.
1399 /// <param name="transparent">Whether the window is transparent.</param>
1400 /// <since_tizen> 5 </since_tizen>
1401 public void SetTransparency(bool transparent) {
1402 NDalicManualPINVOKE.SetTransparency(swigCPtr, transparent);
1403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1407 /// The window size property (read-only).
1409 /// <since_tizen> 3 </since_tizen>
1414 Size2D ret = GetSize();
1420 /// The background color property.
1422 /// <since_tizen> 3 </since_tizen>
1423 public Color BackgroundColor
1427 SetBackgroundColor(value);
1431 Color ret = GetBackgroundColor();
1437 /// The DPI property (read-only).<br />
1438 /// Retrieves the DPI of the display device to which the Window is connected.<br />
1440 /// <since_tizen> 3 </since_tizen>
1450 /// The layer count property (read-only).<br />
1451 /// Queries the number of on-Window layers.<br />
1453 /// <since_tizen> 3 </since_tizen>
1454 public uint LayerCount
1458 return GetLayerCount();
1464 /// Adds a layer to the stage.
1466 /// <param name="layer">Layer to add.</param>
1467 /// <since_tizen> 3 </since_tizen>
1468 public void AddLayer(Layer layer)
1470 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1471 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1473 LayersChildren.Add(layer);
1477 /// Removes a layer from the stage.
1479 /// <param name="layer">Layer to remove.</param>
1480 /// <since_tizen> 3 </since_tizen>
1481 public void RemoveLayer(Layer layer)
1483 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1484 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1486 LayersChildren.Remove(layer);
1490 /// Please do not use! this will be deprecated
1492 /// <since_tizen> 3 </since_tizen>
1493 [Obsolete("Please do not use! This will be deprecated! Please use FocusChangedEventArgs instead! " +
1495 "Window.Instance.FocusChanged = OnFocusChanged; " +
1496 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1497 [EditorBrowsable(EditorBrowsableState.Never)]
1498 public class WindowFocusChangedEventArgs : EventArgs
1501 /// Please do not use! this will be deprecated
1503 /// <since_tizen> 3 </since_tizen>
1504 public bool FocusGained
1511 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1512 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1513 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1514 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1517 /// Please do not use! this will be deprecated. Please use 'FocusChanged' event instead.
1519 /// <since_tizen> 3 </since_tizen>
1520 /// Please do not use! this will be deprecated!
1521 /// Instead please use FocusChanged.
1522 [Obsolete("Please do not use! This will be deprecated! Please use FocusChanged instead! " +
1524 "Window.Instance.FocusChanged = OnFocusChanged; " +
1525 "private void OnFocusChanged(object source, Window.FocusChangedEventArgs args) {...}")]
1526 [EditorBrowsable(EditorBrowsableState.Never)]
1527 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1531 if (_windowFocusChangedEventHandler2 == null)
1533 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1534 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1537 _windowFocusChangedEventHandler2 += value;
1541 _windowFocusChangedEventHandler2 -= value;
1543 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1545 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1550 private void OnWindowFocusedChanged2(bool focusGained)
1552 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1554 e.FocusGained = focusGained;
1556 if (_windowFocusChangedEventHandler2 != null)
1558 _windowFocusChangedEventHandler2(this, e);
1563 /// Gets or sets a size of the window.
1565 /// <since_tizen> 4 </since_tizen>
1566 public Size2D WindowSize
1570 return GetWindowSize();
1574 SetWindowSize(value);
1579 /// Gets or sets a position of the window.
1581 /// <since_tizen> 4 </since_tizen>
1582 public Position2D WindowPosition
1586 return GetPosition();
1595 /// Feed a key-event into the window.
1597 /// <param name="keyEvent">The key event to feed.</param>
1598 /// <since_tizen> 5 </since_tizen>
1599 public void FeedKey(Key keyEvent)
1601 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1602 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1606 /// Feed a key-event into the window.
1608 /// <param name="keyEvent">The key event to feed.</param>
1609 /// <since_tizen> 4 </since_tizen>
1610 [Obsolete("Please do not use! This will be deprecated! Please use FeedKey(Key keyEvent) instead!")]
1611 public void FeedKeyEvent(Key keyEvent)
1613 NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent));
1614 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1618 /// Allows at least one more render, even when paused.
1619 /// The window should be shown, not minimised.
1621 /// <since_tizen> 4 </since_tizen>
1622 public void RenderOnce()
1624 NDalicManualPINVOKE.Window_RenderOnce(swigCPtr);
1625 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1629 /// Contains and encapsulates Native Window handle.
1631 /// <since_tizen> 4 </since_tizen>
1632 public class SafeNativeWindowHandle : SafeHandle
1635 /// Contructor, Native window handle is set to handle.
1637 /// <since_tizen> 4 </since_tizen>
1638 public SafeNativeWindowHandle() : base(IntPtr.Zero, false)
1640 SetHandle(Tizen.NUI.Window.Instance.GetNativeWindowHandler());
1643 /// Null check if the handle is valid or not.
1645 /// <since_tizen> 4 </since_tizen>
1646 public override bool IsInvalid
1650 return this.handle == IntPtr.Zero;
1654 /// Release handle itself.
1656 /// <returns>true when released successfully.</returns>
1657 /// <since_tizen> 4 </since_tizen>
1658 protected override bool ReleaseHandle()