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