1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.BaseComponents;
25 /// The window class is used internally for drawing.<br>
26 /// A Window has an orientation and indicator properties.<br>
28 public class Window : BaseHandle
30 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 private global::System.Runtime.InteropServices.HandleRef stageCPtr;
32 private Layer _rootLayer;
34 internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
36 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 if (NDalicPINVOKE.Stage_IsInstalled())
39 stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
43 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
45 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49 /// To make Window instance be disposed.
51 protected override void Dispose(DisposeTypes type)
58 if(type == DisposeTypes.Explicit)
61 //Release your own managed resources here.
62 //You should release all of your own disposable objects here.
65 //Release your own unmanaged resources here.
66 //You should not access any managed member here except static instance.
67 //because the execution order of Finalizes is non-deterministic.
69 if (swigCPtr.Handle != global::System.IntPtr.Zero)
74 NDalicPINVOKE.delete_Window(swigCPtr);
75 NDalicPINVOKE.delete_Stage(stageCPtr);
77 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
83 internal static Window GetCurrent()
85 Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true);
86 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 internal static bool IsInstalled()
92 bool ret = NDalicPINVOKE.Stage_IsInstalled();
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 [Obsolete("Please do not use! this will be internal method")]
98 public void SetAcceptFocus(bool accept)
100 NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 [Obsolete("Please do not use! this will be internal method")]
105 public bool IsFocusAcceptable()
107 return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
108 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112 /// Shows the window if it is hidden.
116 NDalicPINVOKE.Show(swigCPtr);
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 /// Hides the window if it is showing.
125 NDalicPINVOKE.Hide(swigCPtr);
126 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 /// Retrieves whether the window is visible or not.
132 /// <returns>true, if the windoe is visible</returns>
133 public bool IsVisible()
135 bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Gets the count of supported auxiliary hints of the window.
143 /// <returns>The number of supported auxiliary hints.</returns>
144 public uint GetSupportedAuxiliaryHintCount() {
145 uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr);
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 /// Gets the supported auxiliary hint string of the window.
153 /// <param name="index">The index of the supported auxiliary hint lists.</param>
154 /// <returns>The auxiliary hint string of the index.</returns>
155 public string GetSupportedAuxiliaryHint(uint index) {
156 string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index);
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 /// Creates an auxiliary hint of the window.
164 /// <param name="hint">The auxiliary hint string.</param>
165 /// <param name="value">The value string.</param>
166 /// <returns>The ID of created auxiliary hint, or 0 on failure.</returns>
167 public uint AddAuxiliaryHint(string hint, string value) {
168 uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 /// Removes an auxiliary hint of the window.
176 /// <param name="id">The ID of the auxiliary hint.</param>
177 /// <returns>True if no error occurred, false otherwise.</returns>
178 public bool RemoveAuxiliaryHint(uint id) {
179 bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id);
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 /// Changes a value of the auxiliary hint.
187 /// <param name="id">The auxiliary hint ID.</param>
188 /// <param name="value">The value string to be set.</param>
189 /// <returns>True if no error occurred, false otherwise.</returns>
190 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 public string GetAuxiliaryHintValue(uint id) {
202 string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id);
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 /// Gets an ID of the auxiliary hint string.
210 /// <param name="hint">The auxiliary hint string.</param>
211 /// <returns>The ID of auxiliary hint string, or 0 on failure.</returns>
212 public uint GetAuxiliaryHintId(string hint) {
213 uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint);
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 /// Sets a region to accept input events.
221 /// <param name="inputRegion">The region to accept input events.</param>
222 public void SetInputRegion(Rectangle inputRegion) {
223 NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion));
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 /// Gets/Sets a window type.
230 public WindowType Type
234 WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 NDalicPINVOKE.SetType(swigCPtr, (int)value);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 /// Sets a priority level for the specified notification window.
248 /// <param name="level">The notification window level.</param>
249 /// <returns>True if no error occurred, false otherwise.</returns>
250 public bool SetNotificationLevel(NotificationLevel level) {
251 bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 /// Gets a priority level for the specified notification window.
259 /// <returns>The notification window level.</returns>
260 public NotificationLevel GetNotificationLevel() {
261 NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 /// Sets a transparent window's visual state to opaque.
269 /// <param name="opaque">Whether the window's visual state is opaque.</param>
270 public void SetOpaqueState(bool opaque) {
271 NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque);
272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276 /// Returns whether a transparent window's visual state is opaque or not.
278 /// <returns>True if the window's visual state is opaque, false otherwise.</returns>
279 public bool IsOpaqueState() {
280 bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
286 /// Sets a window's screen mode.
288 /// <param name="screenMode">The screen mode.</param>
289 /// <returns>True if no error occurred, false otherwise.</returns>
290 public bool SetScreenMode(ScreenMode screenMode) {
291 bool ret = NDalicPINVOKE.SetScreenMode(swigCPtr, (int)screenMode);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297 /// Gets a screen mode of the window.
299 /// <returns>The screen mode.</returns>
300 public ScreenMode GetScreenMode() {
301 ScreenMode ret = (ScreenMode)NDalicPINVOKE.GetScreenMode(swigCPtr);
302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 /// Sets preferred brightness of the window.
309 /// <param name="brightness">The preferred brightness (0 to 100).</param>
310 /// <returns>True if no error occurred, false otherwise.</returns>
311 public bool SetBrightness(int brightness) {
312 bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
318 /// Gets preffered brightness of the window.
320 /// <returns>The preffered brightness.</returns>
321 public int GetBrightness() {
322 int ret = NDalicPINVOKE.GetBrightness(swigCPtr);
323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 public class FocusChangedEventArgs : EventArgs
329 public bool FocusGained
336 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
337 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
338 private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
339 private event EventHandler<FocusChangedEventArgs> _windowFocusChangedEventHandler;
341 public event EventHandler<FocusChangedEventArgs> FocusChanged
345 if (_windowFocusChangedEventHandler == null)
347 _windowFocusChangedEventCallback = OnWindowFocusedChanged;
348 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
351 _windowFocusChangedEventHandler += value;
355 _windowFocusChangedEventHandler -= value;
357 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null)
359 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
364 private void OnWindowFocusedChanged(bool focusGained)
366 FocusChangedEventArgs e = new FocusChangedEventArgs();
368 e.FocusGained = focusGained;
370 if (_windowFocusChangedEventHandler != null)
372 _windowFocusChangedEventHandler(this, e);
376 internal WindowFocusSignalType WindowFocusChangedSignal()
378 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383 internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
385 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
390 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393 internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403 internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
405 NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409 internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity)
411 NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415 internal void RotateIndicator(Window.WindowOrientation orientation)
417 NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
418 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 internal void SetClass(string name, string klass)
423 NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 /// Raises window to the top of Window stack.
432 NDalicPINVOKE.Window_Raise(swigCPtr);
433 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
437 /// Lowers window to the bottom of Window stack.
441 NDalicPINVOKE.Window_Lower(swigCPtr);
442 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 /// Activates window to the top of Window stack even it is iconified.
448 public void Activate()
450 NDalicPINVOKE.Window_Activate(swigCPtr);
451 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454 internal void AddAvailableOrientation(Window.WindowOrientation orientation)
456 NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
457 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460 internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
462 NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
463 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466 internal void SetPreferredOrientation(Window.WindowOrientation orientation)
468 NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
472 internal Window.WindowOrientation GetPreferredOrientation()
474 Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
479 internal DragAndDropDetector GetDragAndDropDetector()
481 DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
482 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 internal Any GetNativeHandle()
488 Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
489 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
493 internal WindowFocusSignalType FocusChangedSignal()
495 WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
496 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
501 /// Get default ( root ) layer.
503 /// <returns>The root layer</returns>
504 public Layer GetDefaultLayer()
506 return this.GetRootLayer();
509 internal void Add(Layer layer)
511 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
515 internal void Remove(Layer layer)
517 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 public void Add(View view)
523 NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view));
524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527 public void Remove(View view)
529 NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view));
530 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533 internal Vector2 GetSize()
535 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540 internal RenderTaskList GetRenderTaskList()
542 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true);
543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
548 /// Queries the number of on-window layers.
550 /// <returns>The number of layers.</returns>
551 /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
552 internal uint GetLayerCount()
554 uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 public Layer GetLayer(uint depth)
561 Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth), true);
562 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
566 internal Layer GetRootLayer()
568 if (_rootLayer == null)
569 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 internal void SetBackgroundColor(Vector4 color)
578 NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color));
579 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 internal Vector4 GetBackgroundColor()
584 Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true);
585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589 internal Vector2 GetDpi()
591 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596 internal ObjectRegistry GetObjectRegistry()
598 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true);
599 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
604 /// Keep rendering for at least the given amount of time.
606 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame</param>
607 public void KeepRendering(float durationSeconds)
609 NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds);
610 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613 internal KeyEventSignal KeyEventSignal()
615 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false);
616 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620 internal VoidSignal EventProcessingFinishedSignal()
622 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 internal TouchSignal TouchSignal()
629 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false);
630 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
634 private StageWheelSignal WheelEventSignal()
636 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false);
637 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641 internal VoidSignal ContextLostSignal()
643 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false);
644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648 internal VoidSignal ContextRegainedSignal()
650 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false);
651 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
655 internal VoidSignal SceneCreatedSignal()
657 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false);
658 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662 internal ResizedSignal ResizedSignal()
664 ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(stageCPtr), false);
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
669 internal static Vector4 DEFAULT_BACKGROUND_COLOR
673 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
674 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 internal static Vector4 DEBUG_BACKGROUND_COLOR
684 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
685 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691 private static readonly Window instance = Application.Instance.GetWindow();
694 /// Stage instance property (read-only).<br>
695 /// Gets the current Window.<br>
697 public static Window Instance
706 /// Grabs the key specified by a key for a window only when a window is the topmost window. <br>
707 /// This function can be used for following example scenarios: <br>
708 /// - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
710 /// <param name="DaliKey">The key code to grab</param>
711 /// <returns>true if the grab succeeds</returns>
712 public bool GrabKeyTopmost(int DaliKey)
714 bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
715 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
720 /// Ungrabs the key specified by a key for a window. <br>
721 /// 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>
723 /// <param name="DaliKey">The key code to ungrab</param>
724 /// <returns>true if the ungrab succeeds</returns>
725 public bool UngrabKeyTopmost(int DaliKey)
727 bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
728 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 /// Grabs the key specified by a key for a window in a GrabMode. <br>
734 /// Details: This function can be used for following example scenarios: <br>
735 /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app. <br>
736 /// - Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app. <br>
737 /// - Mobile - Using volume up/down as zoom up/down in camera apps. <br>
739 /// <param name="DaliKey">The key code to grab</param>
740 /// <param name="GrabMode">The grab mode for the key</param>
741 /// <returns>true if the grab succeeds</returns>
742 public bool GrabKey(int DaliKey, KeyGrabMode GrabMode)
744 bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode);
745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 /// Ungrabs the key specified by a key for a window. <br>
751 /// 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>
753 /// <param name="DaliKey">The key code to ungrab</param>
754 /// <returns>true if the ungrab succeeds</returns>
755 public bool UngrabKey(int DaliKey)
757 bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 internal System.IntPtr GetNativeWindowHandler()
764 System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr));
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
772 public enum WindowOrientation
776 PortraitInverse = 180,
777 LandscapeInverse = 270
781 /// Enumeration for key grab mode for platform-level APIs.
783 public enum KeyGrabMode
786 /// Grab a key only when on the top of the grabbing-window stack mode.
790 /// Grab a key together with the other client window(s) mode.
794 /// Grab 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.
798 /// Grab a key exclusively regardless of the grabbing-window's position on the window stack mode.
804 /// Enumeration for opacity of the indicator.
806 internal enum IndicatorBackgroundOpacity
814 /// Enumeration for visible mode of the indicator.
816 internal enum IndicatorVisibleMode
824 /// Touch event argument.
826 public class TouchEventArgs : EventArgs
828 private Touch _touch;
846 private event EventHandler<TouchEventArgs> _stageTouchHandler;
847 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
850 /// This is emitted when the screen is touched and when the touch ends.<br>
851 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
852 /// then when the last finger is lifted.<br>
853 /// An interrupted event will also be emitted (if it occurs).<br>
855 public event EventHandler<TouchEventArgs> TouchEvent
861 _stageTouchHandler += value;
862 _stageTouchCallbackDelegate = OnStageTouch;
863 this.TouchSignal().Connect(_stageTouchCallbackDelegate);
870 if (_stageTouchHandler != null)
872 this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
874 _stageTouchHandler -= value;
879 private void OnStageTouch(IntPtr data)
881 TouchEventArgs e = new TouchEventArgs();
885 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
888 if (_stageTouchHandler != null)
890 _stageTouchHandler(this, e);
895 /// Wheel event arguments.
897 public class WheelEventArgs : EventArgs
899 private Wheel _wheel;
917 private event EventHandler<WheelEventArgs> _stageWheelHandler;
918 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
921 /// Event emitted when wheel event is received.
923 public event EventHandler<WheelEventArgs> WheelEvent
927 if (_stageWheelHandler == null)
929 _stageWheelCallbackDelegate = OnStageWheel;
930 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
932 _stageWheelHandler += value;
936 _stageWheelHandler -= value;
937 if (_stageWheelHandler == null && WheelEventSignal().Empty() == false)
939 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
944 private void OnStageWheel(IntPtr data)
946 WheelEventArgs e = new WheelEventArgs();
950 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
953 if (_stageWheelHandler != null)
955 _stageWheelHandler(this, e);
960 /// Key event arguments.
962 public class KeyEventArgs : EventArgs
982 private event EventHandler<KeyEventArgs> _stageKeyHandler;
983 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
986 /// Event emitted when key event is received.
988 public event EventHandler<KeyEventArgs> KeyEvent
992 if (_stageKeyHandler == null)
994 _stageKeyCallbackDelegate = OnStageKey;
995 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
997 _stageKeyHandler += value;
1001 _stageKeyHandler -= value;
1002 if (_stageKeyHandler == null && KeyEventSignal().Empty() == false)
1004 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
1009 // Callback for Stage KeyEventsignal
1010 private void OnStageKey(IntPtr data)
1012 KeyEventArgs e = new KeyEventArgs();
1016 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
1019 if (_stageKeyHandler != null)
1021 //here we send all data to user event handlers
1022 _stageKeyHandler(this, e);
1027 private event EventHandler _stageEventProcessingFinishedEventHandler;
1028 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
1030 internal event EventHandler EventProcessingFinished
1034 if (_stageEventProcessingFinishedEventHandler == null)
1036 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
1037 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
1039 _stageEventProcessingFinishedEventHandler += value;
1044 _stageEventProcessingFinishedEventHandler -= value;
1045 if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false)
1047 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
1052 // Callback for Stage EventProcessingFinishedSignal
1053 private void OnEventProcessingFinished()
1055 if (_stageEventProcessingFinishedEventHandler != null)
1057 _stageEventProcessingFinishedEventHandler(this, null);
1062 private EventHandler _stageContextLostEventHandler;
1063 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
1065 internal event EventHandler ContextLost
1069 if (_stageContextLostEventHandler == null)
1071 _stageContextLostEventCallbackDelegate = OnContextLost;
1072 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
1074 _stageContextLostEventHandler += value;
1078 _stageContextLostEventHandler -= value;
1079 if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false)
1081 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
1086 // Callback for Stage ContextLostSignal
1087 private void OnContextLost()
1089 if (_stageContextLostEventHandler != null)
1091 _stageContextLostEventHandler(this, null);
1096 private EventHandler _stageContextRegainedEventHandler;
1097 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
1099 internal event EventHandler ContextRegained
1103 if (_stageContextRegainedEventHandler == null)
1105 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
1106 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
1108 _stageContextRegainedEventHandler += value;
1112 _stageContextRegainedEventHandler -= value;
1113 if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false)
1115 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
1120 // Callback for Stage ContextRegainedSignal
1121 private void OnContextRegained()
1123 if (_stageContextRegainedEventHandler != null)
1125 _stageContextRegainedEventHandler(this, null);
1130 private EventHandler _stageSceneCreatedEventHandler;
1131 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
1133 internal event EventHandler SceneCreated
1137 if (_stageSceneCreatedEventHandler == null)
1139 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
1140 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
1142 _stageSceneCreatedEventHandler += value;
1146 _stageSceneCreatedEventHandler -= value;
1147 if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false)
1149 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
1154 // Callback for Stage SceneCreatedSignal
1155 private void OnSceneCreated()
1157 if (_stageSceneCreatedEventHandler != null)
1159 _stageSceneCreatedEventHandler(this, null);
1163 public class ResizedEventArgs : EventArgs
1165 Uint16Pair _windowSize;
1167 public Uint16Pair WindowSize
1175 _windowSize = value;
1180 private WindowResizedEventCallbackType _windowResizedEventCallback;
1181 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1182 private delegate void WindowResizedEventCallbackType(Uint16Pair windowSize);
1183 private event EventHandler<ResizedEventArgs> _windowResizedEventHandler;
1185 public event EventHandler<ResizedEventArgs> Resized
1189 if (_windowResizedEventHandler == null)
1191 _windowResizedEventCallback = OnResized;
1192 ResizedSignal().Connect(_windowResizedEventCallback);
1195 _windowResizedEventHandler += value;
1199 _windowResizedEventHandler -= value;
1201 if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null)
1203 ResizedSignal().Disconnect(_windowResizedEventCallback);
1208 private void OnResized(Uint16Pair windowSize)
1210 ResizedEventArgs e = new ResizedEventArgs();
1211 e.WindowSize = windowSize;
1213 if (_windowResizedEventHandler != null)
1215 _windowResizedEventHandler(this, e);
1219 internal void SetWindowSize(Uint16Pair size)
1221 NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(size));
1222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 internal Uint16Pair GetWindowSize()
1227 Uint16Pair ret = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), true);
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 internal void SetPosition(Uint16Pair position)
1234 NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(position));
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238 internal Uint16Pair GetPosition()
1240 Uint16Pair ret = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true);
1241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246 /// Window size property (read-only).
1252 Size2D ret = GetSize();
1258 /// Background color property.
1260 public Color BackgroundColor
1264 SetBackgroundColor(value);
1268 Color ret = GetBackgroundColor();
1274 /// Dpi property (read-only).<br>
1275 /// Retrieves the DPI of the display device to which the Window is connected.<br>
1286 /// Layer count property (read-only).<br>
1287 /// Queries the number of on-Window layers.<br>
1289 public uint LayerCount
1293 return GetLayerCount();
1299 /// Add layer to the Stage.
1301 /// <param name="layer">Layer to add</param>
1302 public void AddLayer(Layer layer)
1304 NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
1305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1309 /// Remove layer from the Stage.
1311 /// <param name="layer">Layer to remove</param>
1312 public void RemoveLayer(Layer layer)
1314 NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
1315 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1318 [Obsolete("Please do not use! this will be deprecated")]
1319 public class WindowFocusChangedEventArgs : EventArgs
1321 public bool FocusGained
1328 private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2;
1329 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
1330 private delegate void WindowFocusChangedEventCallbackType2(bool focusGained);
1331 private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler2;
1333 [Obsolete("Please do not use! this will be deprecated")]
1334 public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
1338 if (_windowFocusChangedEventHandler2 == null)
1340 _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2;
1341 WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2);
1344 _windowFocusChangedEventHandler2 += value;
1348 _windowFocusChangedEventHandler2 -= value;
1350 if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null)
1352 WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2);
1357 private void OnWindowFocusedChanged2(bool focusGained)
1359 WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
1361 e.FocusGained = focusGained;
1363 if (_windowFocusChangedEventHandler2 != null)
1365 _windowFocusChangedEventHandler2(this, e);
1370 /// Gets/Sets a size of the window.
1372 public Uint16Pair WindowSize
1376 return GetWindowSize();
1380 SetWindowSize(value);
1385 /// Gets/Sets a position of the window.
1387 public Uint16Pair WindowPosition
1391 return GetPosition();