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