DALi C# binding - EventHandler Support
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / application-event.i
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 %define APPLICATION_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19   %typemap(csimports) NameSpace::ClassName %{
20     using System;
21     using System.Runtime.InteropServices;
22
23     /**
24       * @brief Event arguments that passed via AUIApplicationInit signal
25       *
26       */
27     public class AUIApplicationInitEventArgs : EventArgs
28     {
29     private Application _application;
30
31       /**
32         * @brief Application - is the application that is being initialized
33         *
34         */
35     public Application Application
36       {
37         get
38         {
39           return _application;
40         }
41         set
42         {
43           _application = value;
44         }
45       }
46     }
47
48     /**
49       * @brief Event arguments that passed via AUIApplicationTerminate signal
50       *
51       */
52     public class AUIApplicationTerminateEventArgs : EventArgs
53     {
54     private Application _application;
55       /**
56         * @brief Application - is the application that is being Terminated
57         *
58         */
59     public Application Application
60       {
61         get
62         {
63           return _application;
64         }
65         set
66         {
67           _application = value;
68         }
69       }
70     }
71
72     /**
73       * @brief Event arguments that passed via AUIApplicationPause signal
74       *
75       */
76     public class AUIApplicationPauseEventArgs : EventArgs
77     {
78     private Application _application;
79       /**
80         * @brief Application - is the application that is being Paused
81         *
82         */
83     public Application Application
84       {
85         get
86         {
87           return _application;
88         }
89         set
90         {
91           _application = value;
92         }
93       }
94     }
95
96     /**
97       * @brief Event arguments that passed via AUIApplicationResume signal
98       *
99       */
100     public class AUIApplicationResumeEventArgs : EventArgs
101     {
102     private Application _application;
103       /**
104         * @brief Application - is the application that is being Resumed
105         *
106         */
107     public Application Application
108       {
109         get
110         {
111           return _application;
112         }
113         set
114         {
115           _application = value;
116         }
117       }
118     }
119
120     /**
121       * @brief Event arguments that passed via AUIApplicationReset signal
122       *
123       */
124     public class AUIApplicationResetEventArgs : EventArgs
125     {
126     private Application _application;
127       /**
128         * @brief Application - is the application that is being Reset
129         *
130         */
131     public Application Application
132       {
133         get
134         {
135           return _application;
136         }
137         set
138         {
139           _application = value;
140         }
141       }
142     }
143
144     /**
145       * @brief Event arguments that passed via AUIApplicationResize signal
146       *
147       */
148     public class AUIApplicationResizeEventArgs : EventArgs
149     {
150     private Application _application;
151       /**
152         * @brief Application - is the application that is being Resized
153         *
154         */
155     public Application Application
156       {
157         get
158         {
159           return _application;
160         }
161         set
162         {
163           _application = value;
164         }
165       }
166     }
167
168     /**
169       * @brief Event arguments that passed via AUIApplicationLanguageChanged signal
170       *
171       */
172     public class AUIApplicationLanguageChangedEventArgs : EventArgs
173     {
174     private Application _application;
175       /**
176         * @brief Application - is the application that is being affected with Device's language change
177         *
178         */
179     public Application Application
180       {
181         get
182         {
183           return _application;
184         }
185         set
186         {
187           _application = value;
188         }
189       }
190     }
191
192     /**
193       * @brief Event arguments that passed via AUIApplicationRegionChanged signal
194       *
195       */
196     public class AUIApplicationRegionChangedEventArgs : EventArgs
197     {
198     private Application _application;
199       /**
200         * @brief Application - is the application that is being affected with Device's region change
201         *
202         */
203     public Application Application
204       {
205         get
206         {
207           return _application;
208         }
209         set
210         {
211           _application = value;
212         }
213       }
214     }
215
216     /**
217       * @brief Event arguments that passed via AUIApplicationBatteryLow signal
218       *
219       */
220     public class AUIApplicationBatteryLowEventArgs : EventArgs
221     {
222     private Application _application;
223       /**
224         * @brief Application - is the application that is being affected when the battery level of the device is low
225         *
226         */
227     public Application Application
228       {
229         get
230         {
231           return _application;
232         }
233         set
234         {
235           _application = value;
236         }
237       }
238     }
239
240     /**
241       * @brief Event arguments that passed via AUIApplicationMemoryLow signal
242       *
243       */
244     public class AUIApplicationMemoryLowEventArgs : EventArgs
245     {
246     private Application _application;
247       /**
248         * @brief Application - is the application that is being affected when the memory level of the device is low
249         *
250         */
251     public Application Application
252       {
253         get
254         {
255           return _application;
256         }
257         set
258         {
259           _application = value;
260         }
261       }
262     }
263
264     /**
265       * @brief Event arguments that passed via AUIApplicationAppControl  signal
266       *
267       */
268     public class AUIApplicationAppControlEventArgs : EventArgs
269     {
270     private Application _application;
271     private IntPtr _voidp;
272       /**
273         * @brief Application - is the application that is receiving the launch request from another application
274         *
275         */
276     public Application Application
277       {
278         get
279         {
280           return _application;
281         }
282         set
283         {
284           _application = value;
285         }
286       }
287       /**
288         * @brief VoidP - contains the information about why the application is launched
289         *
290         */
291     public IntPtr VoidP
292       {
293         get
294         {
295           return _voidp;
296         }
297         set
298         {
299           _voidp = value;
300         }
301       }
302     }
303
304     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
305     public delegate void AUIApplicationInitEventHandler(object source, AUIApplicationInitEventArgs e);
306
307     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
308     public delegate void AUIApplicationTerminateEventHandler(object source, AUIApplicationTerminateEventArgs e);
309
310     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
311     public delegate void AUIApplicationPauseEventHandler(object source, AUIApplicationPauseEventArgs e);
312
313     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
314     public delegate void AUIApplicationResumeEventHandler(object source, AUIApplicationResumeEventArgs e);
315
316     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
317     public delegate void AUIApplicationResetEventHandler(object source, AUIApplicationResetEventArgs e);
318
319     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
320     public delegate void AUIApplicationResizeEventHandler(object source, AUIApplicationResizeEventArgs e);
321
322     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
323     public delegate void AUIApplicationLanguageChangedEventHandler(object source, AUIApplicationLanguageChangedEventArgs e);
324
325     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
326     public delegate void AUIApplicationRegionChangedEventHandler(object source, AUIApplicationRegionChangedEventArgs e);
327
328     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
329     public delegate void AUIApplicationBatteryLowEventHandler(object source, AUIApplicationBatteryLowEventArgs e);
330
331     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
332     public delegate void AUIApplicationMemoryLowEventHandler(object source, AUIApplicationMemoryLowEventArgs e);
333
334     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
335     public delegate void AUIApplicationAppControlEventHandler(object source, AUIApplicationAppControlEventArgs e);
336
337 %}
338
339 %enddef
340
341
342 %define APPLICATION_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
343   %typemap(cscode) NameSpace::ClassName %{
344     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
345     private delegate void AUIApplicationInitEventCallbackDelegate(IntPtr application);
346     private AUIApplicationInitEventHandler _applicationInitEventHandler;
347     private AUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
348
349
350     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
351     private delegate void AUIApplicationTerminateEventCallbackDelegate(IntPtr application);
352     private AUIApplicationTerminateEventHandler _applicationTerminateEventHandler;
353     private AUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
354
355
356     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
357     private delegate void AUIApplicationPauseEventCallbackDelegate(IntPtr application);
358     private AUIApplicationPauseEventHandler _applicationPauseEventHandler;
359     private AUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
360
361     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
362     private delegate void AUIApplicationResumeEventCallbackDelegate(IntPtr application);
363     private AUIApplicationResumeEventHandler _applicationResumeEventHandler;
364     private AUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
365
366     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
367     private delegate void AUIApplicationResetEventCallbackDelegate(IntPtr application);
368     private AUIApplicationResetEventHandler _applicationResetEventHandler;
369     private AUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
370
371     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
372     private delegate void AUIApplicationResizeEventCallbackDelegate(IntPtr application);
373     private AUIApplicationResizeEventHandler _applicationResizeEventHandler;
374     private AUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate;
375
376     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
377     private delegate void AUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
378     private AUIApplicationLanguageChangedEventHandler _applicationLanguageChangedEventHandler;
379     private AUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
380
381
382     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
383     private delegate void AUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
384     private AUIApplicationRegionChangedEventHandler _applicationRegionChangedEventHandler;
385     private AUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
386
387     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
388     private delegate void AUIApplicationBatteryLowEventCallbackDelegate(IntPtr application);
389     private AUIApplicationBatteryLowEventHandler _applicationBatteryLowEventHandler;
390     private AUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
391
392     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
393     private delegate void AUIApplicationMemoryLowEventCallbackDelegate(IntPtr application);
394     private AUIApplicationMemoryLowEventHandler _applicationMemoryLowEventHandler;
395     private AUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
396
397     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
398     private delegate void AUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
399     private AUIApplicationAppControlEventHandler _applicationAppControlEventHandler;
400     private AUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
401
402     /**
403       * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
404       * (in the type of AUIApplicationInitEventHandler) provided by the user.
405       * Initialized signal is emitted when application is initialised
406       */
407     public event AUIApplicationInitEventHandler Initialized
408     {
409       add
410       {
411         lock(this)
412         {
413           // Restricted to only one listener
414           if (_applicationInitEventHandler == null)
415           {
416             _applicationInitEventHandler += value;
417
418             _applicationInitEventCallbackDelegate = new AUIApplicationInitEventCallbackDelegate(OnApplicationInit);
419             this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
420           }
421         }
422       }
423
424       remove
425       {
426         lock(this)
427         {
428           if (_applicationInitEventHandler != null)
429           {
430             this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
431           }
432
433           _applicationInitEventHandler -= value;
434         }
435       }
436     }
437
438     // Callback for Application InitSignal
439     private void OnApplicationInit(IntPtr data)
440     {
441       AUIApplicationInitEventArgs e = new AUIApplicationInitEventArgs();
442
443       // Populate all members of "e" (AUIApplicationInitEventArgs) with real data
444       e.Application = Application.GetApplicationFromPtr(data);
445
446       if (_applicationInitEventHandler != null)
447       {
448         //here we send all data to user event handlers
449         _applicationInitEventHandler(this, e);
450       }
451     }
452
453     /**
454       * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
455       * (in the type of AUIApplicationTerminateEventHandler) provided by the user.
456       * Terminated signal is emitted when application is terminated
457       */
458     public event AUIApplicationTerminateEventHandler Terminated
459     {
460       add
461       {
462         lock(this)
463         {
464           // Restricted to only one listener
465           if (_applicationTerminateEventHandler == null)
466           {
467             _applicationTerminateEventHandler += value;
468
469             _applicationTerminateEventCallbackDelegate = new AUIApplicationTerminateEventCallbackDelegate(OnAUIApplicationTerminate);
470             this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
471           }
472         }
473       }
474
475       remove
476       {
477         lock(this)
478         {
479           if (_applicationTerminateEventHandler != null)
480           {
481             this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
482           }
483
484           _applicationTerminateEventHandler -= value;
485         }
486       }
487     }
488
489     // Callback for Application TerminateSignal
490     private void OnAUIApplicationTerminate(IntPtr data)
491     {
492       AUIApplicationTerminateEventArgs e = new AUIApplicationTerminateEventArgs();
493
494       // Populate all members of "e" (AUIApplicationTerminateEventArgs) with real data
495       e.Application = Application.GetApplicationFromPtr(data);
496
497       if (_applicationTerminateEventHandler != null)
498       {
499         //here we send all data to user event handlers
500         _applicationTerminateEventHandler(this, e);
501       }
502     }
503
504     /**
505       * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
506       * (in the type of AUIApplicationPauseEventHandler) provided by the user.
507       * Paused signal is emitted when application is paused
508       */
509     public event AUIApplicationPauseEventHandler Paused
510     {
511       add
512       {
513         lock(this)
514         {
515           // Restricted to only one listener
516           if (_applicationPauseEventHandler == null)
517           {
518             _applicationPauseEventHandler += value;
519
520             _applicationPauseEventCallbackDelegate = new AUIApplicationPauseEventCallbackDelegate(OnAUIApplicationPause);
521             this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
522           }
523         }
524       }
525
526       remove
527       {
528         lock(this)
529         {
530           if (_applicationPauseEventHandler != null)
531           {
532             this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
533           }
534
535           _applicationPauseEventHandler -= value;
536         }
537       }
538     }
539
540     // Callback for Application PauseSignal
541     private void OnAUIApplicationPause(IntPtr data)
542     {
543       AUIApplicationPauseEventArgs e = new AUIApplicationPauseEventArgs();
544
545       // Populate all members of "e" (AUIApplicationPauseEventArgs) with real data
546       e.Application = Application.GetApplicationFromPtr(data);
547
548       if (_applicationPauseEventHandler != null)
549       {
550         //here we send all data to user event handlers
551         _applicationPauseEventHandler(this, e);
552       }
553     }
554
555     /**
556       * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
557       * (in the type of AUIApplicationResumeEventHandler) provided by the user.
558       * Resumed signal is emitted when application is resumed
559       */
560     public event AUIApplicationResumeEventHandler Resumed
561     {
562       add
563       {
564         lock(this)
565         {
566           // Restricted to only one listener
567           if (_applicationResumeEventHandler == null)
568           {
569             _applicationResumeEventHandler += value;
570
571             _applicationResumeEventCallbackDelegate = new AUIApplicationResumeEventCallbackDelegate(OnAUIApplicationResume);
572             this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
573           }
574         }
575       }
576
577       remove
578       {
579         lock(this)
580         {
581           if (_applicationResumeEventHandler != null)
582           {
583             this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
584           }
585
586           _applicationResumeEventHandler -= value;
587         }
588       }
589     }
590
591     // Callback for Application ResumeSignal
592     private void OnAUIApplicationResume(IntPtr data)
593     {
594       AUIApplicationResumeEventArgs e = new AUIApplicationResumeEventArgs();
595
596       // Populate all members of "e" (AUIApplicationResumeEventArgs) with real data
597       e.Application = Application.GetApplicationFromPtr(data);
598
599       if (_applicationResumeEventHandler != null)
600       {
601         //here we send all data to user event handlers
602         _applicationResumeEventHandler(this, e);
603       }
604     }
605
606     /**
607       * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
608       * (in the type of AUIApplicationResetEventHandler) provided by the user.
609       * Reset signal is emitted when application is reset
610       */
611     public event AUIApplicationResetEventHandler Reset
612     {
613       add
614       {
615         lock(this)
616         {
617           // Restricted to only one listener
618           if (_applicationResetEventHandler == null)
619           {
620             _applicationResetEventHandler += value;
621
622             _applicationResetEventCallbackDelegate = new AUIApplicationResetEventCallbackDelegate(OnAUIApplicationReset);
623             this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
624           }
625         }
626       }
627
628       remove
629       {
630         lock(this)
631         {
632           if (_applicationResetEventHandler != null)
633           {
634             this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
635           }
636
637           _applicationResetEventHandler -= value;
638         }
639       }
640     }
641
642     // Callback for Application ResetSignal
643     private void OnAUIApplicationReset(IntPtr data)
644     {
645       AUIApplicationResetEventArgs e = new AUIApplicationResetEventArgs();
646
647       // Populate all members of "e" (AUIApplicationResetEventArgs) with real data
648       e.Application = Application.GetApplicationFromPtr(data);
649
650       if (_applicationResetEventHandler != null)
651       {
652         //here we send all data to user event handlers
653         _applicationResetEventHandler(this, e);
654       }
655     }
656
657     /**
658       * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler
659       * (in the type of AUIApplicationResizeEventHandler) provided by the user.
660       * Resized signal is emitted when application is resized
661       */
662     public event AUIApplicationResizeEventHandler Resized
663     {
664       add
665       {
666         lock(this)
667         {
668           // Restricted to only one listener
669           if (_applicationResizeEventHandler == null)
670           {
671             _applicationResizeEventHandler += value;
672
673             _applicationResizeEventCallbackDelegate = new AUIApplicationResizeEventCallbackDelegate(OnAUIApplicationResize);
674             this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate);
675           }
676         }
677       }
678
679       remove
680       {
681         lock(this)
682         {
683           if (_applicationResizeEventHandler != null)
684           {
685             this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
686           }
687
688           _applicationResizeEventHandler -= value;
689         }
690       }
691     }
692
693     // Callback for Application ResizeSignal
694     private void OnAUIApplicationResize(IntPtr data)
695     {
696       AUIApplicationResizeEventArgs e = new AUIApplicationResizeEventArgs();
697
698       // Populate all members of "e" (AUIApplicationResizeEventArgs) with real data
699       e.Application = Application.GetApplicationFromPtr(data);
700
701       if (_applicationResizeEventHandler != null)
702       {
703         //here we send all data to user event handlers
704         _applicationResizeEventHandler(this, e);
705       }
706     }
707
708     /**
709       * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
710       * (in the type of AUIApplicationLanguageChangedEventHandler) provided by the user.
711       * LanguageChanged signal is emitted when the region of the device is changed.
712       */
713     public event AUIApplicationLanguageChangedEventHandler LanguageChanged
714     {
715       add
716       {
717         lock(this)
718         {
719           // Restricted to only one listener
720           if (_applicationLanguageChangedEventHandler == null)
721           {
722             _applicationLanguageChangedEventHandler += value;
723
724             _applicationLanguageChangedEventCallbackDelegate = new AUIApplicationLanguageChangedEventCallbackDelegate(OnAUIApplicationLanguageChanged);
725             this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
726           }
727         }
728       }
729
730       remove
731       {
732         lock(this)
733         {
734           if (_applicationLanguageChangedEventHandler != null)
735           {
736             this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
737           }
738
739           _applicationLanguageChangedEventHandler -= value;
740         }
741       }
742     }
743
744     // Callback for Application LanguageChangedSignal
745     private void OnAUIApplicationLanguageChanged(IntPtr data)
746     {
747       AUIApplicationLanguageChangedEventArgs e = new AUIApplicationLanguageChangedEventArgs();
748
749       // Populate all members of "e" (AUIApplicationLanguageChangedEventArgs) with real data
750       e.Application = Application.GetApplicationFromPtr(data);
751
752       if (_applicationLanguageChangedEventHandler != null)
753       {
754         //here we send all data to user event handlers
755         _applicationLanguageChangedEventHandler(this, e);
756       }
757     }
758
759     /**
760       * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
761       * (in the type of AUIApplicationRegionChangedEventHandler) provided by the user.
762       * RegionChanged signal is emitted when the region of the device is changed.
763       */
764     public event AUIApplicationRegionChangedEventHandler RegionChanged
765     {
766       add
767       {
768         lock(this)
769         {
770           // Restricted to only one listener
771           if (_applicationRegionChangedEventHandler == null)
772           {
773             _applicationRegionChangedEventHandler += value;
774
775             _applicationRegionChangedEventCallbackDelegate = new AUIApplicationRegionChangedEventCallbackDelegate(OnAUIApplicationRegionChanged);
776             this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
777           }
778         }
779       }
780
781       remove
782       {
783         lock(this)
784         {
785           if (_applicationRegionChangedEventHandler != null)
786           {
787             this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
788           }
789
790           _applicationRegionChangedEventHandler -= value;
791         }
792       }
793     }
794
795     // Callback for Application RegionChangedSignal
796     private void OnAUIApplicationRegionChanged(IntPtr data)
797     {
798       AUIApplicationRegionChangedEventArgs e = new AUIApplicationRegionChangedEventArgs();
799
800       // Populate all members of "e" (AUIApplicationRegionChangedEventArgs) with real data
801       e.Application = Application.GetApplicationFromPtr(data);
802
803       if (_applicationRegionChangedEventHandler != null)
804       {
805         //here we send all data to user event handlers
806         _applicationRegionChangedEventHandler(this, e);
807       }
808     }
809
810     /**
811       * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
812       * (in the type of AUIApplicationBatteryLowEventHandler) provided by the user.
813       * BatteryLow signal is emitted when the battery level of the device is low.
814       */
815     public event AUIApplicationBatteryLowEventHandler BatteryLow
816     {
817       add
818       {
819         lock(this)
820         {
821           // Restricted to only one listener
822           if (_applicationBatteryLowEventHandler == null)
823           {
824             _applicationBatteryLowEventHandler += value;
825
826             _applicationBatteryLowEventCallbackDelegate = new AUIApplicationBatteryLowEventCallbackDelegate(OnAUIApplicationBatteryLow);
827             this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
828           }
829         }
830       }
831
832       remove
833       {
834         lock(this)
835         {
836           if (_applicationBatteryLowEventHandler != null)
837           {
838             this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
839           }
840
841           _applicationBatteryLowEventHandler -= value;
842         }
843       }
844     }
845
846     // Callback for Application BatteryLowSignal
847     private void OnAUIApplicationBatteryLow(IntPtr data)
848     {
849       AUIApplicationBatteryLowEventArgs e = new AUIApplicationBatteryLowEventArgs();
850
851       // Populate all members of "e" (AUIApplicationBatteryLowEventArgs) with real data
852       e.Application = Application.GetApplicationFromPtr(data);
853
854       if (_applicationBatteryLowEventHandler != null)
855       {
856         //here we send all data to user event handlers
857         _applicationBatteryLowEventHandler(this, e);
858       }
859     }
860
861     /**
862       * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
863       * (in the type of AUIApplicationMemoryLowEventHandler) provided by the user.
864       * MemoryLow signal is emitted when the memory level of the device is low.
865       */
866     public event AUIApplicationMemoryLowEventHandler MemoryLow
867     {
868       add
869       {
870         lock(this)
871         {
872           // Restricted to only one listener
873           if (_applicationMemoryLowEventHandler == null)
874           {
875             _applicationMemoryLowEventHandler += value;
876
877             _applicationMemoryLowEventCallbackDelegate = new AUIApplicationMemoryLowEventCallbackDelegate(OnAUIApplicationMemoryLow);
878             this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
879           }
880         }
881       }
882
883       remove
884       {
885         lock(this)
886         {
887           if (_applicationMemoryLowEventHandler != null)
888           {
889             this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
890           }
891
892           _applicationMemoryLowEventHandler -= value;
893         }
894       }
895     }
896
897     // Callback for Application MemoryLowSignal
898     private void OnAUIApplicationMemoryLow(IntPtr data)
899     {
900       AUIApplicationMemoryLowEventArgs e = new AUIApplicationMemoryLowEventArgs();
901
902       // Populate all members of "e" (AUIApplicationMemoryLowEventArgs) with real data
903       e.Application = Application.GetApplicationFromPtr(data);
904
905       if (_applicationMemoryLowEventHandler != null)
906       {
907         //here we send all data to user event handlers
908         _applicationMemoryLowEventHandler(this, e);
909       }
910     }
911
912     /**
913       * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
914       * (in the type of AUIApplicationAppControlEventHandler) provided by the user.
915       * AppControl signal is emitted when another application sends a launch request to the application.
916       */
917     public event AUIApplicationAppControlEventHandler AppControl
918     {
919       add
920       {
921         lock(this)
922         {
923           // Restricted to only one listener
924           if (_applicationAppControlEventHandler == null)
925           {
926             _applicationAppControlEventHandler += value;
927
928             _applicationAppControlEventCallbackDelegate = new AUIApplicationAppControlEventCallbackDelegate(OnAUIApplicationAppControl);
929             this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
930           }
931         }
932       }
933
934       remove
935       {
936         lock(this)
937         {
938           if (_applicationAppControlEventHandler != null)
939           {
940             this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
941           }
942
943           _applicationAppControlEventHandler -= value;
944         }
945       }
946     }
947
948     // Callback for Application AppControlSignal
949     private void OnAUIApplicationAppControl(IntPtr application, IntPtr voidp)
950     {
951       AUIApplicationAppControlEventArgs e = new AUIApplicationAppControlEventArgs();
952
953       // Populate all members of "e" (AUIApplicationAppControlEventArgs) with real data
954       e.Application = Application.GetApplicationFromPtr(application);
955       e.VoidP = voidp;
956
957       if (_applicationAppControlEventHandler != null)
958       {
959         //here we send all data to user event handlers
960         _applicationAppControlEventHandler(this, e);
961       }
962     }
963
964     private static  Application instance; // singleton
965
966     public delegate void InitDelegate();
967
968     public delegate void TerminateDelegate();
969
970     public delegate void PauseDelegate();
971
972     public delegate void ResumeDelegate();
973
974     public delegate void ResizeDelegate();
975
976     public delegate void AppControlDelegate();
977
978     public delegate void LanguageChangedDelegate();
979
980     public delegate void RegionChangedDelegate();
981
982     public delegate void BatteryLowDelegate();
983
984     public delegate void MemoryLowDelegate();
985
986     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
987     internal delegate void InitDelegateInternal();
988
989     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
990     internal delegate void TerminateDelegateInternal();
991
992     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
993     internal delegate void PauseDelegateInternal();
994
995     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
996     internal delegate void ResumeDelegateInternal();
997
998     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
999     internal delegate void ResizeDelegateInternal();
1000
1001     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1002     internal delegate void AppControlDelegateInternal();
1003
1004     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1005     internal delegate void LanguageChangedDelegateInternal();
1006
1007     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1008     internal delegate void RegionChangedDelegateInternal();
1009
1010     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1011     internal delegate void BatteryLowDelegateInternal();
1012
1013     [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1014     internal delegate void MemoryLowDelegateInternal();
1015
1016     static void Initialize()
1017     {
1018       //        instance.InitDelegate();
1019     }
1020
1021     public static Application GetApplicationFromPtr(global::System.IntPtr cPtr) {
1022       Application ret = new Application(cPtr, false);
1023       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1024       return ret;
1025     }
1026
1027     internal void SetupDelegates() {
1028       InitDelegateInternal initializeCallback = new InitDelegateInternal( Initialize );
1029       System.Console.WriteLine( "InitSignal connection count");
1030
1031       this.InitSignal().Connect( initializeCallback );
1032       //Console.WriteLine( "InitSignal connection count = " + app.InitSignal().GetConnectionCount() );
1033     }
1034
1035     public static Application NewApplication() {
1036       Application ret = New(1);
1037       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1038
1039       // we've got an application now connect the signals
1040       ret.SetupDelegates();
1041       // set the singleton
1042
1043       return ret;
1044     }
1045
1046     %}
1047     %enddef
1048
1049 %define DALI_APPLICATION_EVENTHANDLER_PARAM( NameSpace, ClassName)
1050   APPLICATION_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
1051   APPLICATION_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
1052   %enddef
1053
1054   namespace Dali
1055 {
1056   DALI_APPLICATION_EVENTHANDLER_PARAM( Dali, Application);
1057 }
1058
1059