11863363382a43f7ab7fce2f60bf257f6f379801
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / SWIG / events / popup-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 POPUP_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
20 using System;
21 using System.Runtime.InteropServices;
22
23 %}
24
25 %enddef
26
27
28 %define POPUP_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
29 %typemap(cscode) NameSpace::ClassName %{
30
31   public class OutsideTouchedEventArgs : EventArgs
32   {
33   }
34
35   public class ShowingEventArgs : EventArgs
36   {
37   }
38
39   public class ShownEventArgs : EventArgs
40   {
41   }
42
43   public class HidingEventArgs : EventArgs
44   {
45   }
46
47   public class HiddenEventArgs : EventArgs
48   {
49   }
50
51   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
52   private delegate void OutsideTouchedEventCallbackDelegate();
53   private DaliEventHandler<object,OutsideTouchedEventArgs> _popUpOutsideTouchedEventHandler;
54   private OutsideTouchedEventCallbackDelegate _popUpOutsideTouchedEventCallbackDelegate;
55
56   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
57   private delegate void ShowingEventCallbackDelegate();
58   private DaliEventHandler<object,ShowingEventArgs> _popUpShowingEventHandler;
59   private ShowingEventCallbackDelegate _popUpShowingEventCallbackDelegate;
60
61   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
62   private delegate void ShownEventCallbackDelegate();
63   private DaliEventHandler<object,ShownEventArgs> _popUpShownEventHandler;
64   private ShownEventCallbackDelegate _popUpShownEventCallbackDelegate;
65
66   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
67   private delegate void HidingEventCallbackDelegate();
68   private DaliEventHandler<object,HidingEventArgs> _popUpHidingEventHandler;
69   private HidingEventCallbackDelegate _popUpHidingEventCallbackDelegate;
70
71   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
72   private delegate void HiddenEventCallbackDelegate();
73   private DaliEventHandler<object,HiddenEventArgs> _popUpHiddenEventHandler;
74   private HiddenEventCallbackDelegate _popUpHiddenEventCallbackDelegate;
75
76   public event DaliEventHandler<object,OutsideTouchedEventArgs> OutsideTouched
77   {
78      add
79      {
80         lock(this)
81         {
82            // Restricted to only one listener
83            if (_popUpOutsideTouchedEventHandler == null)
84            {
85               _popUpOutsideTouchedEventHandler += value;
86
87               _popUpOutsideTouchedEventCallbackDelegate = new OutsideTouchedEventCallbackDelegate(OnOutsideTouched);
88               this.OutsideTouchedSignal().Connect(_popUpOutsideTouchedEventCallbackDelegate);
89            }
90         }
91      }
92
93      remove
94      {
95         lock(this)
96         {
97            if (_popUpOutsideTouchedEventHandler != null)
98            {
99               this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate);
100            }
101
102            _popUpOutsideTouchedEventHandler -= value;
103         }
104      }
105   }
106
107   // Callback for Popup OutsideTouchedSignal
108   private void OnOutsideTouched()
109   {
110      OutsideTouchedEventArgs e = new OutsideTouchedEventArgs();
111
112      if (_popUpOutsideTouchedEventHandler != null)
113      {
114         //here we send all data to user event handlers
115         _popUpOutsideTouchedEventHandler(this, e);
116      }
117   }
118
119   public event DaliEventHandler<object,ShowingEventArgs> Showing
120   {
121      add
122      {
123         lock(this)
124         {
125            // Restricted to only one listener
126            if (_popUpShowingEventHandler == null)
127            {
128               _popUpShowingEventHandler += value;
129
130               _popUpShowingEventCallbackDelegate = new ShowingEventCallbackDelegate(OnShowing);
131               this.ShowingSignal().Connect(_popUpShowingEventCallbackDelegate);
132            }
133         }
134      }
135
136      remove
137      {
138         lock(this)
139         {
140            if (_popUpShowingEventHandler != null)
141            {
142               this.ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate);
143            }
144
145            _popUpShowingEventHandler -= value;
146         }
147      }
148   }
149
150   // Callback for ShowingSignal
151   private void OnShowing()
152   {
153      ShowingEventArgs e = new ShowingEventArgs();
154
155      if (_popUpShowingEventHandler != null)
156      {
157         //here we send all data to user event handlers
158         _popUpShowingEventHandler(this, e);
159      }
160   }
161
162
163   public event DaliEventHandler<object,ShownEventArgs> Shown
164   {
165      add
166      {
167         lock(this)
168         {
169            // Restricted to only one listener
170            if (_popUpShownEventHandler == null)
171            {
172               _popUpShownEventHandler += value;
173
174               _popUpShownEventCallbackDelegate = new ShownEventCallbackDelegate(OnShown);
175               this.ShownSignal().Connect(_popUpShownEventCallbackDelegate);
176            }
177         }
178      }
179
180      remove
181      {
182         lock(this)
183         {
184            if (_popUpShownEventHandler != null)
185            {
186               this.ShownSignal().Disconnect(_popUpShownEventCallbackDelegate);
187            }
188
189            _popUpShownEventHandler -= value;
190         }
191      }
192   }
193
194   // Callback for ShownSignal
195   private void OnShown()
196   {
197      ShownEventArgs e = new ShownEventArgs();
198
199      if (_popUpShownEventHandler != null)
200      {
201         //here we send all data to user event handlers
202         _popUpShownEventHandler(this, e);
203      }
204   }
205
206   public event DaliEventHandler<object,HidingEventArgs> Hiding
207   {
208      add
209      {
210         lock(this)
211         {
212            // Restricted to only one listener
213            if (_popUpHidingEventHandler == null)
214            {
215               _popUpHidingEventHandler += value;
216
217               _popUpHidingEventCallbackDelegate = new HidingEventCallbackDelegate(OnHiding);
218               this.HidingSignal().Connect(_popUpHidingEventCallbackDelegate);
219            }
220         }
221      }
222
223      remove
224      {
225         lock(this)
226         {
227            if (_popUpHidingEventHandler != null)
228            {
229               this.HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
230            }
231
232            _popUpHidingEventHandler -= value;
233         }
234      }
235   }
236
237   // Callback for HidingSignal
238   private void OnHiding()
239   {
240      HidingEventArgs e = new HidingEventArgs();
241
242      if (_popUpHidingEventHandler != null)
243      {
244         //here we send all data to user event handlers
245         _popUpHidingEventHandler(this, e);
246      }
247   }
248
249   public event DaliEventHandler<object,HiddenEventArgs> Hidden
250   {
251      add
252      {
253         lock(this)
254         {
255            // Restricted to only one listener
256            if (_popUpHiddenEventHandler == null)
257            {
258               _popUpHiddenEventHandler += value;
259
260               _popUpHiddenEventCallbackDelegate = new HiddenEventCallbackDelegate(OnHidden);
261               this.HiddenSignal().Connect(_popUpHiddenEventCallbackDelegate);
262            }
263         }
264      }
265
266      remove
267      {
268         lock(this)
269         {
270            if (_popUpHiddenEventHandler != null)
271            {
272               this.HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
273            }
274
275            _popUpHiddenEventHandler -= value;
276         }
277      }
278   }
279
280   // Callback for HiddenSignal
281   private void OnHidden()
282   {
283      HiddenEventArgs e = new HiddenEventArgs();
284
285      if (_popUpHiddenEventHandler != null)
286      {
287         //here we send all data to user event handlers
288         _popUpHiddenEventHandler(this, e);
289      }
290   }
291
292 /* Properties earlier added by Ruby Script */
293
294   public Dali.Property.Map Title
295   {
296     get
297     {
298       Dali.Property.Map temp = new Dali.Property.Map();
299       GetProperty( Popup.Property.TITLE).Get(  temp );
300       return temp;
301     }
302     set
303     {
304       SetProperty( Popup.Property.TITLE, new Dali.Property.Value( value ) );
305     }
306   }
307   public Dali.Property.Map Content
308   {
309     get
310     {
311       Dali.Property.Map temp = new Dali.Property.Map();
312       GetProperty( Popup.Property.CONTENT).Get(  temp );
313       return temp;
314     }
315     set
316     {
317       SetProperty( Popup.Property.CONTENT, new Dali.Property.Value( value ) );
318     }
319   }
320   public Dali.Property.Map Footer
321   {
322     get
323     {
324       Dali.Property.Map temp = new Dali.Property.Map();
325       GetProperty( Popup.Property.FOOTER).Get(  temp );
326       return temp;
327     }
328     set
329     {
330       SetProperty( Popup.Property.FOOTER, new Dali.Property.Value( value ) );
331     }
332   }
333   public string DisplayState
334   {
335     get
336     {
337       string temp;
338       GetProperty( Popup.Property.DISPLAY_STATE).Get( out temp );
339       return temp;
340     }
341     set
342     {
343       SetProperty( Popup.Property.DISPLAY_STATE, new Dali.Property.Value( value ) );
344     }
345   }
346   public bool TouchTransparent
347   {
348     get
349     {
350       bool temp = false;
351       GetProperty( Popup.Property.TOUCH_TRANSPARENT).Get( ref temp );
352       return temp;
353     }
354     set
355     {
356       SetProperty( Popup.Property.TOUCH_TRANSPARENT, new Dali.Property.Value( value ) );
357     }
358   }
359   public bool TailVisibility
360   {
361     get
362     {
363       bool temp = false;
364       GetProperty( Popup.Property.TAIL_VISIBILITY).Get( ref temp );
365       return temp;
366     }
367     set
368     {
369       SetProperty( Popup.Property.TAIL_VISIBILITY, new Dali.Property.Value( value ) );
370     }
371   }
372   public Dali.CSharp.Position TailPosition
373   {
374     get
375     {
376       Vector3 temp = new Vector3(0.0f,0.0f,0.0f);
377       GetProperty( Popup.Property.TAIL_POSITION).Get(  temp );
378       Dali.CSharp.Position ret = new Dali.CSharp.Position(temp.x, temp.y, temp.z);
379       return ret;
380     }
381     set
382     {
383       SetProperty( Popup.Property.TAIL_POSITION, new Dali.Property.Value( value ) );
384     }
385   }
386   public string ContextualMode
387   {
388     get
389     {
390       string temp;
391       GetProperty( Popup.Property.CONTEXTUAL_MODE).Get( out temp );
392       return temp;
393     }
394     set
395     {
396       SetProperty( Popup.Property.CONTEXTUAL_MODE, new Dali.Property.Value( value ) );
397     }
398   }
399   public float AnimationDuration
400   {
401     get
402     {
403       float temp = 0.0f;
404       GetProperty( Popup.Property.ANIMATION_DURATION).Get( ref temp );
405       return temp;
406     }
407     set
408     {
409       SetProperty( Popup.Property.ANIMATION_DURATION, new Dali.Property.Value( value ) );
410     }
411   }
412   public string AnimationMode
413   {
414     get
415     {
416       string temp;
417       GetProperty( Popup.Property.ANIMATION_MODE).Get( out temp );
418       return temp;
419     }
420     set
421     {
422       SetProperty( Popup.Property.ANIMATION_MODE, new Dali.Property.Value( value ) );
423     }
424   }
425   public Dali.Property.Map EntryAnimation
426   {
427     get
428     {
429       Dali.Property.Map temp = new Dali.Property.Map();
430       GetProperty( Popup.Property.ENTRY_ANIMATION).Get(  temp );
431       return temp;
432     }
433     set
434     {
435       SetProperty( Popup.Property.ENTRY_ANIMATION, new Dali.Property.Value( value ) );
436     }
437   }
438   public Dali.Property.Map ExitAnimation
439   {
440     get
441     {
442       Dali.Property.Map temp = new Dali.Property.Map();
443       GetProperty( Popup.Property.EXIT_ANIMATION).Get(  temp );
444       return temp;
445     }
446     set
447     {
448       SetProperty( Popup.Property.EXIT_ANIMATION, new Dali.Property.Value( value ) );
449     }
450   }
451   public int AutoHideDelay
452   {
453     get
454     {
455       int temp = 0;
456       GetProperty( Popup.Property.AUTO_HIDE_DELAY).Get( ref temp );
457       return temp;
458     }
459     set
460     {
461       SetProperty( Popup.Property.AUTO_HIDE_DELAY, new Dali.Property.Value( value ) );
462     }
463   }
464   public bool BackingEnabled
465   {
466     get
467     {
468       bool temp = false;
469       GetProperty( Popup.Property.BACKING_ENABLED).Get( ref temp );
470       return temp;
471     }
472     set
473     {
474       SetProperty( Popup.Property.BACKING_ENABLED, new Dali.Property.Value( value ) );
475     }
476   }
477   public Dali.CSharp.Color BackingColor
478   {
479     get
480     {
481       Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
482       GetProperty( Popup.Property.BACKING_COLOR).Get(  temp );
483       Dali.CSharp.Color ret = new Dali.CSharp.Color(temp.r, temp.g, temp.b, temp.a);
484       return ret;
485     }
486     set
487     {
488       SetProperty( Popup.Property.BACKING_COLOR, new Dali.Property.Value( value ) );
489     }
490   }
491   public string PopupBackgroundImage
492   {
493     get
494     {
495       string temp;
496       GetProperty( Popup.Property.POPUP_BACKGROUND_IMAGE).Get( out temp );
497       return temp;
498     }
499     set
500     {
501       SetProperty( Popup.Property.POPUP_BACKGROUND_IMAGE, new Dali.Property.Value( value ) );
502     }
503   }
504   public string TailUpImage
505   {
506     get
507     {
508       string temp;
509       GetProperty( Popup.Property.TAIL_UP_IMAGE).Get( out temp );
510       return temp;
511     }
512     set
513     {
514       SetProperty( Popup.Property.TAIL_UP_IMAGE, new Dali.Property.Value( value ) );
515     }
516   }
517   public string TailDownImage
518   {
519     get
520     {
521       string temp;
522       GetProperty( Popup.Property.TAIL_DOWN_IMAGE).Get( out temp );
523       return temp;
524     }
525     set
526     {
527       SetProperty( Popup.Property.TAIL_DOWN_IMAGE, new Dali.Property.Value( value ) );
528     }
529   }
530   public string TailLeftImage
531   {
532     get
533     {
534       string temp;
535       GetProperty( Popup.Property.TAIL_LEFT_IMAGE).Get( out temp );
536       return temp;
537     }
538     set
539     {
540       SetProperty( Popup.Property.TAIL_LEFT_IMAGE, new Dali.Property.Value( value ) );
541     }
542   }
543   public string TailRightImage
544   {
545     get
546     {
547       string temp;
548       GetProperty( Popup.Property.TAIL_RIGHT_IMAGE).Get( out temp );
549       return temp;
550     }
551     set
552     {
553       SetProperty( Popup.Property.TAIL_RIGHT_IMAGE, new Dali.Property.Value( value ) );
554     }
555   }
556
557 /* Properties ends */
558
559 %}
560 %enddef
561
562 %define DALI_POPUP_EVENTHANDLER_PARAM( NameSpace, ClassName)
563   POPUP_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
564   POPUP_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
565 %enddef
566
567 namespace Dali
568 {
569   DALI_POPUP_EVENTHANDLER_PARAM( Dali::Toolkit, Popup);
570 }
571