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);
46 public override void Dispose()
48 if (!Stage.IsInstalled())
50 DisposeQueue.Instance.Add(this);
56 if (swigCPtr.Handle != global::System.IntPtr.Zero)
61 NDalicPINVOKE.delete_Stage(swigCPtr);
63 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
65 global::System.GC.SuppressFinalize(this);
71 /// Touch event argument
73 public class TouchEventArgs : EventArgs
93 private event EventHandler<TouchEventArgs> _stageTouchHandler;
94 private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
97 /// This is emitted when the screen is touched and when the touch ends.
98 /// If there are multiple touch points, then this will be emitted when the first touch occurs and
99 /// then when the last finger is lifted.
100 /// An interrupted event will also be emitted (if it occurs).
102 public event EventHandler<TouchEventArgs> Touch
106 if (_stageTouchHandler == null)
108 _stageTouchCallbackDelegate = OnStageTouch;
109 TouchSignal().Connect(_stageTouchCallbackDelegate);
111 _stageTouchHandler += value;
115 _stageTouchHandler -= value;
116 if (_stageTouchHandler == null && _stageTouchCallbackDelegate != null)
118 TouchSignal().Disconnect(_stageTouchCallbackDelegate);
123 private void OnStageTouch(IntPtr data)
125 TouchEventArgs e = new TouchEventArgs();
129 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
132 if (_stageTouchHandler != null)
134 _stageTouchHandler(this, e);
139 /// Wheel event arguments
141 public class WheelEventArgs : EventArgs
143 private Wheel _wheel;
161 private event EventHandler<WheelEventArgs> _stageWheelHandler;
162 private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
165 /// This is emitted when wheel event is received.
167 public event EventHandler<WheelEventArgs> Wheel
171 if (_stageWheelHandler == null)
173 _stageWheelCallbackDelegate = OnStageWheel;
174 WheelEventSignal().Connect(_stageWheelCallbackDelegate);
176 _stageWheelHandler += value;
180 _stageWheelHandler -= value;
181 if (_stageWheelHandler == null && _stageWheelCallbackDelegate != null)
183 WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
188 private void OnStageWheel(IntPtr data)
190 WheelEventArgs e = new WheelEventArgs();
194 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
197 if (_stageWheelHandler != null)
199 _stageWheelHandler(this, e);
204 /// Key event arguments.
206 public class KeyEventArgs : EventArgs
226 private event EventHandler<KeyEventArgs> _stageKeyHandler;
227 private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
230 /// This is emitted when key event is received.
232 public event EventHandler<KeyEventArgs> Key
236 if (_stageKeyHandler == null)
238 _stageKeyCallbackDelegate = OnStageKey;
239 KeyEventSignal().Connect(_stageKeyCallbackDelegate);
241 _stageKeyHandler += value;
245 _stageKeyHandler -= value;
246 if (_stageKeyHandler == null && _stageKeyCallbackDelegate != null)
248 KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
253 // Callback for Stage KeyEventsignal
254 private void OnStageKey(IntPtr data)
256 KeyEventArgs e = new KeyEventArgs();
260 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
263 if (_stageKeyHandler != null)
265 //here we send all data to user event handlers
266 _stageKeyHandler(this, e);
271 private event EventHandler _stageEventProcessingFinishedEventHandler;
272 private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
274 internal event EventHandler EventProcessingFinished
278 if (_stageEventProcessingFinishedEventHandler == null)
280 _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
281 EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
283 _stageEventProcessingFinishedEventHandler += value;
288 _stageEventProcessingFinishedEventHandler -= value;
289 if (_stageEventProcessingFinishedEventHandler == null && _stageEventProcessingFinishedEventCallbackDelegate != null)
291 EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
296 // Callback for Stage EventProcessingFinishedSignal
297 private void OnEventProcessingFinished()
299 if (_stageEventProcessingFinishedEventHandler != null)
301 _stageEventProcessingFinishedEventHandler(this, null);
306 private EventHandler _stageContextLostEventHandler;
307 private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
309 internal event EventHandler ContextLost
313 if (_stageContextLostEventHandler == null)
315 _stageContextLostEventCallbackDelegate = OnContextLost;
316 ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
318 _stageContextLostEventHandler += value;
322 _stageContextLostEventHandler -= value;
323 if (_stageContextLostEventHandler == null && _stageContextLostEventCallbackDelegate != null)
325 ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
330 // Callback for Stage ContextLostSignal
331 private void OnContextLost()
333 if (_stageContextLostEventHandler != null)
335 _stageContextLostEventHandler(this, null);
340 private EventHandler _stageContextRegainedEventHandler;
341 private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
343 internal event EventHandler ContextRegained
347 if (_stageContextRegainedEventHandler == null)
349 _stageContextRegainedEventCallbackDelegate = OnContextRegained;
350 ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
352 _stageContextRegainedEventHandler += value;
356 _stageContextRegainedEventHandler -= value;
357 if (_stageContextRegainedEventHandler == null && _stageContextRegainedEventCallbackDelegate != null)
359 this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
364 // Callback for Stage ContextRegainedSignal
365 private void OnContextRegained()
367 if (_stageContextRegainedEventHandler != null)
369 _stageContextRegainedEventHandler(this, null);
374 private EventHandler _stageSceneCreatedEventHandler;
375 private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
377 internal event EventHandler SceneCreated
381 if (_stageSceneCreatedEventHandler == null)
383 _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
384 SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
386 _stageSceneCreatedEventHandler += value;
390 _stageSceneCreatedEventHandler -= value;
391 if (_stageSceneCreatedEventHandler == null && _stageSceneCreatedEventCallbackDelegate != null)
393 SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
398 // Callback for Stage SceneCreatedSignal
399 private void OnSceneCreated()
401 if (_stageSceneCreatedEventHandler != null)
403 _stageSceneCreatedEventHandler(this, null);
414 Size2D ret = GetSize();
420 /// Background color.
422 public Color BackgroundColor
426 SetBackgroundColor(value);
430 Color ret = GetBackgroundColor();
449 public uint LayerCount
453 return GetLayerCount();
457 private static readonly Stage instance = Stage.GetCurrent();
462 public static Stage Instance
471 /// Get default ( root ) layer.
473 public Layer GetDefaultLayer()
475 return this.GetRootLayer();
479 /// Add layer to the Stage.
481 public void AddLayer(Layer layer)
483 this.Add((Actor)layer);
487 /// Remove layer from the Stage.
489 public void RemoveLayer(Layer layer)
491 this.Remove((Actor)layer);
494 internal static Vector4 DEFAULT_BACKGROUND_COLOR
498 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get();
499 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505 internal static Vector4 DEBUG_BACKGROUND_COLOR
509 global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get();
510 Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false);
511 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516 internal Stage() : this(NDalicPINVOKE.new_Stage__SWIG_0(), true)
518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 internal static Stage GetCurrent()
523 Stage ret = new Stage(NDalicPINVOKE.Stage_GetCurrent(), true);
524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528 internal static bool IsInstalled()
530 bool ret = NDalicPINVOKE.Stage_IsInstalled();
531 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535 internal Stage(Stage handle) : this(NDalicPINVOKE.new_Stage__SWIG_1(Stage.getCPtr(handle)), true)
537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540 internal Stage Assign(Stage rhs)
542 Stage ret = new Stage(NDalicPINVOKE.Stage_Assign(swigCPtr, Stage.getCPtr(rhs)), false);
543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal void Add(Actor actor)
549 NDalicPINVOKE.Stage_Add(swigCPtr, Actor.getCPtr(actor));
550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553 internal void Remove(Actor actor)
555 NDalicPINVOKE.Stage_Remove(swigCPtr, Actor.getCPtr(actor));
556 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 internal Size2D GetSize()
561 Size2D ret = new Size2D(NDalicPINVOKE.Stage_GetSize(swigCPtr), true);
562 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
566 internal RenderTaskList GetRenderTaskList()
568 RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(swigCPtr), true);
569 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
573 internal uint GetLayerCount()
575 uint ret = NDalicPINVOKE.Stage_GetLayerCount(swigCPtr);
576 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
581 /// Retrieves the layer at a specified depth.
583 public Layer GetLayer(uint depth)
585 Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(swigCPtr, depth), true);
586 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 internal Layer GetRootLayer()
592 Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(swigCPtr), true);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 internal void SetBackgroundColor(Color color)
599 NDalicPINVOKE.Stage_SetBackgroundColor(swigCPtr, Color.getCPtr(color));
600 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603 internal Color GetBackgroundColor()
605 Color ret = new Color(NDalicPINVOKE.Stage_GetBackgroundColor(swigCPtr), true);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610 internal Vector2 GetDpi()
612 Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(swigCPtr), true);
613 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617 internal ObjectRegistry GetObjectRegistry()
619 ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(swigCPtr), true);
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 /// Keep rendering for at least the given amount of time.
627 public void KeepRendering(float durationSeconds)
629 NDalicPINVOKE.Stage_KeepRendering(swigCPtr, durationSeconds);
630 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
633 internal KeyEventSignal KeyEventSignal()
635 KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(swigCPtr), false);
636 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
640 internal VoidSignal EventProcessingFinishedSignal()
642 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(swigCPtr), false);
643 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 internal TouchSignal TouchSignal()
649 TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(swigCPtr), false);
650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654 internal StageWheelSignal WheelEventSignal()
656 StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(swigCPtr), false);
657 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
661 internal VoidSignal ContextLostSignal()
663 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(swigCPtr), false);
664 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
668 internal VoidSignal ContextRegainedSignal()
670 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(swigCPtr), false);
671 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
675 internal VoidSignal SceneCreatedSignal()
677 VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(swigCPtr), false);
678 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();