nui 0.2.32 manual merge, mapping to dali 1.2.32
[platform/core/csapi/tizenfx.git] / NUISamples / Tizen.NUI / src / public / Stage.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Tizen.NUI
12 {
13
14     using System;
15     using System.Runtime.InteropServices;
16
17     /// <summary>
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.
26     /// </summary>
27     public class Stage : BaseHandle
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30
31         internal Stage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Stage_SWIGUpcast(cPtr), cMemoryOwn)
32         {
33             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34         }
35
36         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Stage obj)
37         {
38             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39         }
40
41         ~Stage()
42         {
43             DisposeQueue.Instance.Add(this);
44         }
45
46         /// <summary>
47         /// Dispose.
48         /// </summary>
49         public override void Dispose()
50         {
51             if (!Stage.IsInstalled())
52             {
53                 DisposeQueue.Instance.Add(this);
54                 return;
55             }
56
57             lock (this)
58             {
59                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
60                 {
61                     if (swigCMemOwn)
62                     {
63                         swigCMemOwn = false;
64                         NDalicPINVOKE.delete_Stage(swigCPtr);
65                     }
66                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
67                 }
68                 global::System.GC.SuppressFinalize(this);
69                 base.Dispose();
70             }
71         }
72
73         /// <summary>
74         /// Touch event argument.
75         /// </summary>
76         public class TouchEventArgs : EventArgs
77         {
78             private Touch _touch;
79
80             /// <summary>
81             /// Touch.
82             /// </summary>
83             public Touch Touch
84             {
85                 get
86                 {
87                     return _touch;
88                 }
89                 set
90                 {
91                     _touch = value;
92                 }
93             }
94         }
95
96         private event EventHandler<TouchEventArgs> _stageTouchHandler;
97         private EventCallbackDelegateType1 _stageTouchCallbackDelegate;
98
99         /// <summary>
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).
104         /// </summary>
105         public event EventHandler<TouchEventArgs> Touch
106         {
107             add
108             {
109                 if (_stageTouchHandler == null)
110                 {
111                     _stageTouchCallbackDelegate = OnStageTouch;
112                     TouchSignal().Connect(_stageTouchCallbackDelegate);
113                 }
114                 _stageTouchHandler += value;
115             }
116             remove
117             {
118                 _stageTouchHandler -= value;
119                 if (_stageTouchHandler == null && _stageTouchCallbackDelegate != null)
120                 {
121                     TouchSignal().Disconnect(_stageTouchCallbackDelegate);
122                 }
123             }
124         }
125
126         private void OnStageTouch(IntPtr data)
127         {
128             TouchEventArgs e = new TouchEventArgs();
129
130             if (data != null)
131             {
132                 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data);
133             }
134
135             if (_stageTouchHandler != null)
136             {
137                 _stageTouchHandler(this, e);
138             }
139         }
140
141         /// <summary>
142         /// Wheel event arguments.
143         /// </summary>
144         public class WheelEventArgs : EventArgs
145         {
146             private Wheel _wheel;
147
148             /// <summary>
149             /// Wheel.
150             /// </summary>
151             public Wheel Wheel
152             {
153                 get
154                 {
155                     return _wheel;
156                 }
157                 set
158                 {
159                     _wheel = value;
160                 }
161             }
162         }
163
164         private event EventHandler<WheelEventArgs> _stageWheelHandler;
165         private EventCallbackDelegateType1 _stageWheelCallbackDelegate;
166
167         /// <summary>
168         /// Event emitted when wheel event is received.
169         /// </summary>
170         public event EventHandler<WheelEventArgs> Wheel
171         {
172             add
173             {
174                 if (_stageWheelHandler == null)
175                 {
176                     _stageWheelCallbackDelegate = OnStageWheel;
177                     WheelEventSignal().Connect(_stageWheelCallbackDelegate);
178                 }
179                 _stageWheelHandler += value;
180             }
181             remove
182             {
183                 _stageWheelHandler -= value;
184                 if (_stageWheelHandler == null && _stageWheelCallbackDelegate != null)
185                 {
186                     WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
187                 }
188             }
189         }
190
191         private void OnStageWheel(IntPtr data)
192         {
193             WheelEventArgs e = new WheelEventArgs();
194
195             if (data != null)
196             {
197                 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data);
198             }
199
200             if (_stageWheelHandler != null)
201             {
202                 _stageWheelHandler(this, e);
203             }
204         }
205
206         /// <summary>
207         /// Key event arguments.
208         /// </summary>
209         public class KeyEventArgs : EventArgs
210         {
211             private Key _key;
212
213             /// <summary>
214             /// Key
215             /// </summary>
216             public Key Key
217             {
218                 get
219                 {
220                     return _key;
221                 }
222                 set
223                 {
224                     _key = value;
225                 }
226             }
227         }
228
229         private event EventHandler<KeyEventArgs> _stageKeyHandler;
230         private EventCallbackDelegateType1 _stageKeyCallbackDelegate;
231
232         /// <summary>
233         /// Event emitted when key event is received.
234         /// </summary>
235         public event EventHandler<KeyEventArgs> Key
236         {
237             add
238             {
239                 if (_stageKeyHandler == null)
240                 {
241                     _stageKeyCallbackDelegate = OnStageKey;
242                     KeyEventSignal().Connect(_stageKeyCallbackDelegate);
243                 }
244                 _stageKeyHandler += value;
245             }
246             remove
247             {
248                 _stageKeyHandler -= value;
249                 if (_stageKeyHandler == null && _stageKeyCallbackDelegate != null)
250                 {
251                     KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
252                 }
253             }
254         }
255
256         // Callback for Stage KeyEventsignal
257         private void OnStageKey(IntPtr data)
258         {
259             KeyEventArgs e = new KeyEventArgs();
260
261             if (data != null)
262             {
263                 e.Key = Tizen.NUI.Key.GetKeyFromPtr(data);
264             }
265
266             if (_stageKeyHandler != null)
267             {
268                 //here we send all data to user event handlers
269                 _stageKeyHandler(this, e);
270             }
271         }
272
273
274         private event EventHandler _stageEventProcessingFinishedEventHandler;
275         private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate;
276
277         internal event EventHandler EventProcessingFinished
278         {
279             add
280             {
281                 if (_stageEventProcessingFinishedEventHandler == null)
282                 {
283                     _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished;
284                     EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
285                 }
286                 _stageEventProcessingFinishedEventHandler += value;
287
288             }
289             remove
290             {
291                 _stageEventProcessingFinishedEventHandler -= value;
292                 if (_stageEventProcessingFinishedEventHandler == null && _stageEventProcessingFinishedEventCallbackDelegate != null)
293                 {
294                     EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
295                 }
296             }
297         }
298
299         // Callback for Stage EventProcessingFinishedSignal
300         private void OnEventProcessingFinished()
301         {
302             if (_stageEventProcessingFinishedEventHandler != null)
303             {
304                 _stageEventProcessingFinishedEventHandler(this, null);
305             }
306         }
307
308
309         private EventHandler _stageContextLostEventHandler;
310         private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate;
311
312         internal event EventHandler ContextLost
313         {
314             add
315             {
316                 if (_stageContextLostEventHandler == null)
317                 {
318                     _stageContextLostEventCallbackDelegate = OnContextLost;
319                     ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
320                 }
321                 _stageContextLostEventHandler += value;
322             }
323             remove
324             {
325                 _stageContextLostEventHandler -= value;
326                 if (_stageContextLostEventHandler == null && _stageContextLostEventCallbackDelegate != null)
327                 {
328                     ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
329                 }
330             }
331         }
332
333         // Callback for Stage ContextLostSignal
334         private void OnContextLost()
335         {
336             if (_stageContextLostEventHandler != null)
337             {
338                 _stageContextLostEventHandler(this, null);
339             }
340         }
341
342
343         private EventHandler _stageContextRegainedEventHandler;
344         private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate;
345
346         internal event EventHandler ContextRegained
347         {
348             add
349             {
350                 if (_stageContextRegainedEventHandler == null)
351                 {
352                     _stageContextRegainedEventCallbackDelegate = OnContextRegained;
353                     ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
354                 }
355                 _stageContextRegainedEventHandler += value;
356             }
357             remove
358             {
359                 _stageContextRegainedEventHandler -= value;
360                 if (_stageContextRegainedEventHandler == null && _stageContextRegainedEventCallbackDelegate != null)
361                 {
362                     this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
363                 }
364             }
365         }
366
367         // Callback for Stage ContextRegainedSignal
368         private void OnContextRegained()
369         {
370             if (_stageContextRegainedEventHandler != null)
371             {
372                 _stageContextRegainedEventHandler(this, null);
373             }
374         }
375
376
377         private EventHandler _stageSceneCreatedEventHandler;
378         private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate;
379
380         internal event EventHandler SceneCreated
381         {
382             add
383             {
384                 if (_stageSceneCreatedEventHandler == null)
385                 {
386                     _stageSceneCreatedEventCallbackDelegate = OnSceneCreated;
387                     SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
388                 }
389                 _stageSceneCreatedEventHandler += value;
390             }
391             remove
392             {
393                 _stageSceneCreatedEventHandler -= value;
394                 if (_stageSceneCreatedEventHandler == null && _stageSceneCreatedEventCallbackDelegate != null)
395                 {
396                     SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
397                 }
398             }
399         }
400
401         // Callback for Stage SceneCreatedSignal
402         private void OnSceneCreated()
403         {
404             if (_stageSceneCreatedEventHandler != null)
405             {
406                 _stageSceneCreatedEventHandler(this, null);
407             }
408         }
409
410         /// <summary>
411         /// Stage size property (read-only).
412         /// </summary>
413         public Size2D Size
414         {
415             get
416             {
417                 Size2D ret = GetSize();
418                 return ret;
419             }
420         }
421
422         /// <summary>
423         /// Background color property.
424         /// </summary>
425         public Color BackgroundColor
426         {
427             set
428             {
429                 SetBackgroundColor(value);
430             }
431             get
432             {
433                 Color ret = GetBackgroundColor();
434                 return ret;
435             }
436         }
437
438         /// <summary>
439         /// Dpi property (read-only).
440         /// Retrieves the DPI of the display device to which the stage is connected.
441         /// </summary>
442         public Vector2 Dpi
443         {
444             get
445             {
446                 return GetDpi();
447             }
448         }
449
450         /// <summary>
451         /// Layer count property (read-only).
452         /// Queries the number of on-stage layers.
453         /// </summary>
454         public uint LayerCount
455         {
456             get
457             {
458                 return GetLayerCount();
459             }
460         }
461
462         private static readonly Stage instance = Stage.GetCurrent();
463
464         /// <summary>
465         /// Stage instance property (read-only).
466         /// Gets the current Stage.
467         /// </summary>
468         public static Stage Instance
469         {
470             get
471             {
472                 return instance;
473             }
474         }
475
476         /// <summary>
477         /// Get default ( root ) layer.
478         /// </summary>
479         /// <returns>The root layer</returns>
480         public Layer GetDefaultLayer()
481         {
482             return this.GetRootLayer();
483         }
484
485         /// <summary>
486         /// Add layer to the Stage.
487         /// </summary>
488         /// <param name="layer">Layer to add</param>
489         public void AddLayer(Layer layer)
490         {
491             this.Add((Actor)layer);
492         }
493
494         /// <summary>
495         /// Remove layer from the Stage.
496         /// </summary>
497         /// <param name="layer">Layer to remove</param>
498         public void RemoveLayer(Layer layer)
499         {
500             this.Remove((Actor)layer);
501         }
502
503         internal static Vector4 DEFAULT_BACKGROUND_COLOR
504         {
505             get
506             {
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();
510                 return ret;
511             }
512         }
513
514         internal static Vector4 DEBUG_BACKGROUND_COLOR
515         {
516             get
517             {
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();
521                 return ret;
522             }
523         }
524
525         internal Stage() : this(NDalicPINVOKE.new_Stage__SWIG_0(), true)
526         {
527             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528         }
529
530         internal static Stage GetCurrent()
531         {
532             Stage ret = new Stage(NDalicPINVOKE.Stage_GetCurrent(), true);
533             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
534             return ret;
535         }
536
537         internal static bool IsInstalled()
538         {
539             bool ret = NDalicPINVOKE.Stage_IsInstalled();
540             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541             return ret;
542         }
543
544         internal Stage(Stage handle) : this(NDalicPINVOKE.new_Stage__SWIG_1(Stage.getCPtr(handle)), true)
545         {
546             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547         }
548
549         internal Stage Assign(Stage rhs)
550         {
551             Stage ret = new Stage(NDalicPINVOKE.Stage_Assign(swigCPtr, Stage.getCPtr(rhs)), false);
552             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553             return ret;
554         }
555
556         internal void Add(Actor actor)
557         {
558             NDalicPINVOKE.Stage_Add(swigCPtr, Actor.getCPtr(actor));
559             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560         }
561
562         internal void Remove(Actor actor)
563         {
564             NDalicPINVOKE.Stage_Remove(swigCPtr, Actor.getCPtr(actor));
565             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
566         }
567
568         internal Size2D GetSize()
569         {
570             Size2D ret = new Size2D(NDalicPINVOKE.Stage_GetSize(swigCPtr), true);
571             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572             return ret;
573         }
574
575         internal RenderTaskList GetRenderTaskList()
576         {
577             RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(swigCPtr), true);
578             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579             return ret;
580         }
581
582         internal uint GetLayerCount()
583         {
584             uint ret = NDalicPINVOKE.Stage_GetLayerCount(swigCPtr);
585             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586             return ret;
587         }
588
589         /// <summary>
590         /// Retrieves the layer at a specified depth.
591         /// </summary>
592         /// <param name="depth">The depth</param>
593         /// <returns>The layer found at the given depth</returns>
594         public Layer GetLayer(uint depth)
595         {
596             Layer ret = new Layer(NDalicPINVOKE.Stage_GetLayer(swigCPtr, depth), true);
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598             return ret;
599         }
600
601         internal Layer GetRootLayer()
602         {
603             Layer ret = new Layer(NDalicPINVOKE.Stage_GetRootLayer(swigCPtr), true);
604             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605             return ret;
606         }
607
608         internal void SetBackgroundColor(Color color)
609         {
610             NDalicPINVOKE.Stage_SetBackgroundColor(swigCPtr, Color.getCPtr(color));
611             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612         }
613
614         internal Color GetBackgroundColor()
615         {
616             Color ret = new Color(NDalicPINVOKE.Stage_GetBackgroundColor(swigCPtr), true);
617             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
618             return ret;
619         }
620
621         internal Vector2 GetDpi()
622         {
623             Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(swigCPtr), true);
624             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625             return ret;
626         }
627
628         internal ObjectRegistry GetObjectRegistry()
629         {
630             ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(swigCPtr), true);
631             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632             return ret;
633         }
634
635         /// <summary>
636         /// Keep rendering for at least the given amount of time.
637         /// </summary>
638         /// <param name="durationSeconds">Time to keep rendering, 0 means render at least one more frame</param>
639         public void KeepRendering(float durationSeconds)
640         {
641             NDalicPINVOKE.Stage_KeepRendering(swigCPtr, durationSeconds);
642             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643         }
644
645         internal KeyEventSignal KeyEventSignal()
646         {
647             KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(swigCPtr), false);
648             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649             return ret;
650         }
651
652         internal VoidSignal EventProcessingFinishedSignal()
653         {
654             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(swigCPtr), false);
655             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656             return ret;
657         }
658
659         internal TouchSignal TouchSignal()
660         {
661             TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(swigCPtr), false);
662             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
663             return ret;
664         }
665
666         internal StageWheelSignal WheelEventSignal()
667         {
668             StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(swigCPtr), false);
669             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670             return ret;
671         }
672
673         internal VoidSignal ContextLostSignal()
674         {
675             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(swigCPtr), false);
676             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677             return ret;
678         }
679
680         internal VoidSignal ContextRegainedSignal()
681         {
682             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(swigCPtr), false);
683             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684             return ret;
685         }
686
687         internal VoidSignal SceneCreatedSignal()
688         {
689             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(swigCPtr), false);
690             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691             return ret;
692         }
693
694     }
695
696 }