1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
15 using System.Runtime.InteropServices;
18 /// The Stage is a top-level object used for displaying a tree of Actors.
19 /// Stage is a top-level object that represents the entire screen.
20 /// It is used for displaying a hierarchy of actors managed by the scene graph structure,
21 /// which means an actor inherits a position relative to its parent,
22 /// and can be moved in relation to this point.
23 /// The stage instance is a singleton object (the only instance of its class during the
24 /// lifetime of the program). You can get it using a static function.
25 /// To display the contents of an actor, it must be added to a stage.
27 public class Stage : BaseHandle
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 internal Stage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Stage_SWIGUpcast(cPtr), cMemoryOwn)
33 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stage obj)
38 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 DisposeQueue.Instance.Add(this);
49 public override void Dispose()
51 if (!Stage.IsInstalled())
53 DisposeQueue.Instance.Add(this);
59 if (swigCPtr.Handle != global::System.IntPtr.Zero)
64 NDalicPINVOKE.delete_Stage(swigCPtr);
66 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
68 global::System.GC.SuppressFinalize(this);
74 /// Touch event argument.
76 public class TouchEventArgs : EventArgs
96 private event EventHandler<TouchEventArgs> _stageTouchHandler;
97 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
100 /// This is emitted when the screen is touched and when the touch ends.
101 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
102 /// then when the last finger is lifted.
103 /// An interrupted event will also be emitted (if it occurs).
105 public event EventHandler<TouchEventArgs> Touch
109 if (_stageTouchHandler == null)
111 _stageTouchCallbackDelegate = OnStageTouch;
112 TouchSignal().Connect(_stageTouchCallbackDelegate);
114 _stageTouchHandler += value;
118 _stageTouchHandler -= value;
119 if (_stageTouchHandler == null && _stageTouchCallbackDelegate != null)
121 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
126 private void OnStageTouch(IntPtr data)
128 TouchEventArgs e = new TouchEventArgs();
132 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
135 if (_stageTouchHandler != null)
137 _stageTouchHandler(this, e);
142 /// Wheel event arguments.
144 public class WheelEventArgs : EventArgs
146 private Wheel _wheel;
164 private event EventHandler<WheelEventArgs> _stageWheelHandler;
165 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
168 /// Event emitted when wheel event is received.
170 public event EventHandler<WheelEventArgs> Wheel
174 if (_stageWheelHandler == null)
176 _stageWheelCallbackDelegate = OnStageWheel;
177 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
179 _stageWheelHandler += value;
183 _stageWheelHandler -= value;
184 if (_stageWheelHandler == null && _stageWheelCallbackDelegate != null)
186 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
191 private void OnStageWheel(IntPtr data)
193 WheelEventArgs e = new WheelEventArgs();
197 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
200 if (_stageWheelHandler != null)
202 _stageWheelHandler(this, e);
207 /// Key event arguments.
209 public class KeyEventArgs : EventArgs
229 private event EventHandler<KeyEventArgs> _stageKeyHandler;
230 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
233 /// Event emitted when key event is received.
235 public event EventHandler<KeyEventArgs> Key
239 if (_stageKeyHandler == null)
241 _stageKeyCallbackDelegate = OnStageKey;
242 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
244 _stageKeyHandler += value;
248 _stageKeyHandler -= value;
249 if (_stageKeyHandler == null && _stageKeyCallbackDelegate != null)
251 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
256 // Callback for Stage KeyEventsignal
257 private void OnStageKey(IntPtr data)
259 KeyEventArgs e = new KeyEventArgs();
263 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
266 if (_stageKeyHandler != null)
268 //here we send all data to user event handlers
269 _stageKeyHandler(this, e);
274 private event EventHandler _stageEventProcessingFinishedEventHandler;
275 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
277 internal event EventHandler EventProcessingFinished
281 if (_stageEventProcessingFinishedEventHandler == null)
283 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
284 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
286 _stageEventProcessingFinishedEventHandler += value;
291 _stageEventProcessingFinishedEventHandler -= value;
292 if (_stageEventProcessingFinishedEventHandler == null && _stageEventProcessingFinishedEventCallbackDelegate != null)
294 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
299 // Callback for Stage EventProcessingFinishedSignal
300 private void OnEventProcessingFinished()
302 if (_stageEventProcessingFinishedEventHandler != null)
304 _stageEventProcessingFinishedEventHandler(this, null);
309 private EventHandler _stageContextLostEventHandler;
310 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
312 internal event EventHandler ContextLost
316 if (_stageContextLostEventHandler == null)
318 _stageContextLostEventCallbackDelegate = OnContextLost;
319 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
321 _stageContextLostEventHandler += value;
325 _stageContextLostEventHandler -= value;
326 if (_stageContextLostEventHandler == null && _stageContextLostEventCallbackDelegate != null)
328 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
333 // Callback for Stage ContextLostSignal
334 private void OnContextLost()
336 if (_stageContextLostEventHandler != null)
338 _stageContextLostEventHandler(this, null);
343 private EventHandler _stageContextRegainedEventHandler;
344 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
346 internal event EventHandler ContextRegained
350 if (_stageContextRegainedEventHandler == null)
352 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
353 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
355 _stageContextRegainedEventHandler += value;
359 _stageContextRegainedEventHandler -= value;
360 if (_stageContextRegainedEventHandler == null && _stageContextRegainedEventCallbackDelegate != null)
362 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
367 // Callback for Stage ContextRegainedSignal
368 private void OnContextRegained()
370 if (_stageContextRegainedEventHandler != null)
372 _stageContextRegainedEventHandler(this, null);
377 private EventHandler _stageSceneCreatedEventHandler;
378 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
380 internal event EventHandler SceneCreated
384 if (_stageSceneCreatedEventHandler == null)
386 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
387 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
389 _stageSceneCreatedEventHandler += value;
393 _stageSceneCreatedEventHandler -= value;
394 if (_stageSceneCreatedEventHandler == null && _stageSceneCreatedEventCallbackDelegate != null)
396 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
401 // Callback for Stage SceneCreatedSignal
402 private void OnSceneCreated()
404 if (_stageSceneCreatedEventHandler != null)
406 _stageSceneCreatedEventHandler(this, null);
411 /// Stage size property (read-only).
417 Size2D ret = GetSize();
423 /// Background color property.
425 public Color BackgroundColor
429 SetBackgroundColor(value);
433 Color ret = GetBackgroundColor();
439 /// Dpi property (read-only).
440 /// Retrieves the DPI of the display device to which the stage is connected.
451 /// Layer count property (read-only).
452 /// Queries the number of on-stage layers.
454 public uint LayerCount
458 return GetLayerCount();
462 private static readonly Stage instance = Stage.GetCurrent();
465 /// Stage instance property (read-only).
466 /// Gets the current Stage.
468 public static Stage Instance
477 /// Get default ( root ) layer.
479 /// <returns>The root layer</returns>
480 public Layer GetDefaultLayer()
482 return this.GetRootLayer();
486 /// Add layer to the Stage.
488 /// <param name="layer">Layer to add</param>
489 public void AddLayer(Layer layer)
491 this.Add((Actor)layer);
495 /// Remove layer from the Stage.
497 /// <param name="layer">Layer to remove</param>
498 public void RemoveLayer(Layer layer)
500 this.Remove((Actor)layer);
503 internal static Vector4 DEFAULT_BACKGROUND_COLOR
507 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
508 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
509 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514 internal static Vector4 DEBUG_BACKGROUND_COLOR
518 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
519 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
520 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
525 internal Stage() : this(NDalicPINVOKE.new_Stage__SWIG_0(), true)
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 internal static Stage GetCurrent()
532 Stage ret = new Stage(NDalicPINVOKE.Stage_GetCurrent(), true);
533 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
537 internal static bool IsInstalled()
539 bool ret = NDalicPINVOKE.Stage_IsInstalled();
540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
544 internal Stage(Stage handle) : this(NDalicPINVOKE.new_Stage__SWIG_1(Stage.getCPtr(handle)), true)
546 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
549 internal Stage Assign(Stage rhs)
551 Stage ret = new Stage(NDalicPINVOKE.Stage_Assign(swigCPtr, Stage.getCPtr(rhs)), false);
552 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
556 internal void Add(Actor actor)
558 NDalicPINVOKE.Stage_Add(swigCPtr, Actor.getCPtr(actor));
559 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
562 internal void Remove(Actor actor)
564 NDalicPINVOKE.Stage_Remove(swigCPtr, Actor.getCPtr(actor));
565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568 internal Size2D GetSize()
570 Size2D ret = new Size2D(NDalicPINVOKE.Stage_GetSize(swigCPtr), true);
571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575 internal RenderTaskList GetRenderTaskList()
577 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(swigCPtr), true);
578 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 internal uint GetLayerCount()
584 uint ret = NDalicPINVOKE.Stage_GetLayerCount(swigCPtr);
585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 /// Retrieves the layer at a specified depth.
592 /// <param name="depth">The depth</param>
593 /// <returns>The layer found at the given depth</returns>
594 public Layer GetLayer(uint depth)
596 Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(swigCPtr, depth), true);
597 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 internal Layer GetRootLayer()
603 Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(swigCPtr), true);
604 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 internal void SetBackgroundColor(Color color)
610 NDalicPINVOKE.Stage_SetBackgroundColor(swigCPtr, Color.getCPtr(color));
611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
614 internal Color GetBackgroundColor()
616 Color ret = new Color(NDalicPINVOKE.Stage_GetBackgroundColor(swigCPtr), true);
617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621 internal Vector2 GetDpi()
623 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(swigCPtr), true);
624 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628 internal ObjectRegistry GetObjectRegistry()
630 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(swigCPtr), true);
631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 /// Keep rendering for at least the given amount of time.
638 /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame</param>
639 public void KeepRendering(float durationSeconds)
641 NDalicPINVOKE.Stage_KeepRendering(swigCPtr, durationSeconds);
642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645 internal KeyEventSignal KeyEventSignal()
647 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(swigCPtr), false);
648 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
652 internal VoidSignal EventProcessingFinishedSignal()
654 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(swigCPtr), false);
655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 internal TouchSignal TouchSignal()
661 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(swigCPtr), false);
662 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
666 internal StageWheelSignal WheelEventSignal()
668 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(swigCPtr), false);
669 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673 internal VoidSignal ContextLostSignal()
675 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(swigCPtr), false);
676 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 internal VoidSignal ContextRegainedSignal()
682 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(swigCPtr), false);
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 internal VoidSignal SceneCreatedSignal()
689 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(swigCPtr), false);
690 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();