[Build] Add struct validation at GBS build-time (#1660)
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / GestureLayer.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.Runtime.InteropServices;
19 using System.Collections.Generic;
20
21 using Tizen.Internals;
22
23 namespace ElmSharp
24 {
25     /// <summary>
26     /// The GestureLayer is used to detect gestures.
27     /// Inherits Widget.
28     /// </summary>
29     /// <since_tizen> preview </since_tizen>
30     public class GestureLayer : Widget
31     {
32         private readonly Interop.Elementary.GestureEventCallback _gestureCallback;
33
34         // Important: don't remove items from _handlers list
35         // The list can grow up to (number of GestureType) * (number of GestureState)
36         // but all gestures share the callback and you don't want to desynchronize mapping
37         private readonly List<NativeCallback> _handlers = new List<NativeCallback>();
38
39         /// <summary>
40         /// Creates and initializes a new instance of the GestureLayer class.
41         /// </summary>
42         /// <param name="parent">The parent is a given container which will be attached by the GestureLayer as a child. It's the <see cref="EvasObject"/> type.</param>
43         /// <since_tizen> preview </since_tizen>
44         public GestureLayer(EvasObject parent) : base(parent)
45         {
46             _gestureCallback = new Interop.Elementary.GestureEventCallback(GestureCallbackHandler);
47         }
48
49         /// <summary>
50         /// Enumeration for the supported gesture types.
51         /// </summary>
52         /// <since_tizen> preview </since_tizen>
53         public enum GestureType
54         {
55             /// <summary>
56             /// N fingers single taps.
57             /// </summary>
58             Tap = 1,
59
60             /// <summary>
61             /// N fingers single long-taps.
62             /// </summary>
63             LongTap,
64
65             /// <summary>
66             /// N fingers double-single taps.
67             /// </summary>
68             DoubleTap,
69
70             /// <summary>
71             /// N fingers triple-single taps.
72             /// </summary>
73             TripleTap,
74
75             /// <summary>
76             /// Reports momentum in the direction of the move.
77             /// </summary>
78             Momentum,
79
80             /// <summary>
81             /// N fingers line gesture.
82             /// </summary>
83             Line,
84
85             /// <summary>
86             /// N fingers flick gesture.
87             /// </summary>
88             Flick,
89
90             /// <summary>
91             /// Zoom.
92             /// </summary>
93             Zoom,
94
95             /// <summary>
96             /// Rotate.
97             /// </summary>
98             Rotate,
99         }
100
101         /// <summary>
102         /// Enumeration for the gesture states.
103         /// </summary>
104         /// <since_tizen> preview </since_tizen>
105         public enum GestureState
106         {
107             /// <summary>
108             /// Gesture not started.
109             /// </summary>
110             Undefined = -1,
111
112             /// <summary>
113             /// Gesture started.
114             /// </summary>
115             Start,
116
117             /// <summary>
118             /// Gesture is ongoing.
119             /// </summary>
120             Move,
121
122             /// <summary>
123             /// Gesture completed.
124             /// </summary>
125             End,
126
127             /// <summary>
128             /// Ongoing gesture is aborted.
129             /// </summary>
130             Abort,
131         }
132
133         #region Properties
134
135         /// <summary>
136         /// Sets or gets the repeat-events setting.
137         /// </summary>
138         /// <since_tizen> preview </since_tizen>
139         public bool HoldEvents
140         {
141             get
142             {
143                 return Interop.Elementary.elm_gesture_layer_hold_events_get(Handle);
144             }
145             set
146             {
147                 Interop.Elementary.elm_gesture_layer_hold_events_set(Handle, value);
148             }
149         }
150
151         /// <summary>
152         /// Sets or gets the gesture layer to continue enable of an object.
153         /// </summary>
154         /// <since_tizen> preview </since_tizen>
155         public bool Continues
156         {
157             get
158             {
159                 return Interop.Elementary.elm_gesture_layer_continues_enable_get(Handle);
160             }
161             set
162             {
163                 Interop.Elementary.elm_gesture_layer_continues_enable_set(Handle, value);
164             }
165         }
166
167         /// <summary>
168         /// Sets or gets the gesture layer finger-size for taps.
169         /// </summary>
170         /// <since_tizen> preview </since_tizen>
171         public int TapFingerSize
172         {
173             get
174             {
175                 return Interop.Elementary.elm_gesture_layer_tap_finger_size_get(Handle);
176             }
177             set
178             {
179                 Interop.Elementary.elm_gesture_layer_tap_finger_size_set(Handle, value);
180             }
181         }
182
183         /// <summary>
184         /// Sets or gets the gesture layer long tap start timeout of an object.
185         /// </summary>
186         /// <since_tizen> preview </since_tizen>
187         public double LongTapTimeout
188         {
189             get
190             {
191                 return Interop.Elementary.elm_gesture_layer_long_tap_start_timeout_get(Handle);
192             }
193             set
194             {
195                 Interop.Elementary.elm_gesture_layer_long_tap_start_timeout_set(Handle, value);
196             }
197         }
198
199         /// <summary>
200         /// Sets or gets the gesture layer double tap timeout of an object.
201         /// </summary>
202         /// <since_tizen> preview </since_tizen>
203         public double DoubleTapTimeout
204         {
205             get
206             {
207                 return Interop.Elementary.elm_gesture_layer_double_tap_timeout_get(Handle);
208             }
209             set
210             {
211                 Interop.Elementary.elm_gesture_layer_double_tap_timeout_set(Handle, value);
212             }
213         }
214
215         /// <summary>
216         /// Sets or gets the gesture layer flick time limit (in ms) of an object.
217         /// </summary>
218         /// <since_tizen> preview </since_tizen>
219         public int FlickTimeLimit
220         {
221             get
222             {
223                 return (int)Interop.Elementary.elm_gesture_layer_flick_time_limit_ms_get(Handle);
224             }
225             set
226             {
227                 Interop.Elementary.elm_gesture_layer_flick_time_limit_ms_set(Handle, (UInt32)value);
228             }
229         }
230
231         /// <summary>
232         /// Sets or gets the gesture layer line minimum length of an object.
233         /// </summary>
234         /// <since_tizen> preview </since_tizen>
235         public int MinimumLineLength
236         {
237             get
238             {
239                 return Interop.Elementary.elm_gesture_layer_line_min_length_get(Handle);
240             }
241             set
242             {
243                 Interop.Elementary.elm_gesture_layer_line_min_length_set(Handle, value);
244             }
245         }
246
247         /// <summary>
248         /// Sets or gets the gesture layer line angular tolerance of an object.
249         /// </summary>
250         /// <since_tizen> preview </since_tizen>
251         public double LineAngularTolerance
252         {
253             get
254             {
255                 return Interop.Elementary.elm_gesture_layer_line_angular_tolerance_get(Handle);
256             }
257             set
258             {
259                 Interop.Elementary.elm_gesture_layer_line_angular_tolerance_set(Handle, value);
260             }
261         }
262
263         /// <summary>
264         /// Sets or gets the gesture layer line distance tolerance of an object.
265         /// </summary>
266         /// <since_tizen> preview </since_tizen>
267         public int LineDistanceTolerance
268         {
269             get
270             {
271                 return Interop.Elementary.elm_gesture_layer_line_distance_tolerance_get(Handle);
272             }
273             set
274             {
275                 Interop.Elementary.elm_gesture_layer_line_distance_tolerance_set(Handle, value);
276             }
277         }
278
279         /// <summary>
280         /// Sets or gets the step-value for the rotate action.
281         /// </summary>
282         /// <since_tizen> preview </since_tizen>
283         public double RotateStep
284         {
285             get
286             {
287                 return Interop.Elementary.elm_gesture_layer_rotate_step_get(Handle);
288             }
289             set
290             {
291                 Interop.Elementary.elm_gesture_layer_rotate_step_set(Handle, value);
292             }
293         }
294
295         /// <summary>
296         /// Sets or gets the gesture layer rotate angular tolerance of an object.
297         /// </summary>
298         /// <since_tizen> preview </since_tizen>
299         public double RotateAngularTolerance
300         {
301             get
302             {
303                 return Interop.Elementary.elm_gesture_layer_rotate_angular_tolerance_get(Handle);
304             }
305             set
306             {
307                 Interop.Elementary.elm_gesture_layer_rotate_angular_tolerance_set(Handle, value);
308             }
309         }
310
311         /// <summary>
312         /// Sets or gets the control step value for the zoom action.
313         /// </summary>
314         /// <since_tizen> preview </since_tizen>
315         public double ZoomStep
316         {
317             get
318             {
319                 return Interop.Elementary.elm_gesture_layer_zoom_step_get(Handle);
320             }
321             set
322             {
323                 Interop.Elementary.elm_gesture_layer_zoom_step_set(Handle, value);
324             }
325         }
326
327         /// <summary>
328         /// Sets or gets the gesture layer zoom distance tolerance of an object.
329         /// </summary>
330         /// <since_tizen> preview </since_tizen>
331         public int ZoomDistanceTolerance
332         {
333             get
334             {
335                 return Interop.Elementary.elm_gesture_layer_zoom_distance_tolerance_get(Handle);
336             }
337             set
338             {
339                 Interop.Elementary.elm_gesture_layer_zoom_distance_tolerance_set(Handle, value);
340             }
341         }
342
343         /// <summary>
344         /// Sets or gets the gesture layer zoom finger factor of an object.
345         /// </summary>
346         /// <since_tizen> preview </since_tizen>
347         public double ZoomFingerFactor
348         {
349             get
350             {
351                 return Interop.Elementary.elm_gesture_layer_zoom_finger_factor_get(Handle);
352             }
353             set
354             {
355                 Interop.Elementary.elm_gesture_layer_zoom_finger_factor_set(Handle, value);
356             }
357         }
358
359         /// <summary>
360         /// Sets or gets the gesture layer zoom wheel factor of an object.
361         /// </summary>
362         /// <since_tizen> preview </since_tizen>
363         public double ZoomWheelFactor
364         {
365             get
366             {
367                 return Interop.Elementary.elm_gesture_layer_zoom_wheel_factor_get(Handle);
368             }
369             set
370             {
371                 Interop.Elementary.elm_gesture_layer_zoom_wheel_factor_set(Handle, value);
372             }
373         }
374
375         #endregion Properties
376
377         /// <summary>
378         /// Attaches a gesture layer widget to an Evas object (setting the widget's target).
379         /// A gesture layer's target may be any Evas object. This object will be used to listen to mouse and key events.
380         /// </summary>
381         /// <param name="target">The object to attach.</param>
382         /// <since_tizen> preview </since_tizen>
383         public void Attach(EvasObject target)
384         {
385             Interop.Elementary.elm_gesture_layer_attach(Handle, target.Handle);
386         }
387
388         /// <summary>
389         /// Sets the gesture state change callback.
390         /// When all callbacks for the gesture are set to null, it means this gesture is disabled.
391         /// </summary>
392         /// <param name="type">The gesture you want to track state of.</param>
393         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
394         /// <param name="action">The callback itself.</param>
395         /// <since_tizen> preview </since_tizen>
396         public void SetGestureCallback(GestureType type, GestureState state, Action<object> action)
397         {
398             lock (_handlers)
399             {
400                 bool found = false;
401                 int i = 0;
402                 // if this (type, state) already exists in _handlers, we will reuse it
403                 foreach (var handler in _handlers)
404                 {
405                     if (handler.Type == type && handler.State == state)
406                     {
407                         found = true;
408                         break;
409                     }
410                     i++;
411                 }
412                 if (found)
413                 {
414                     // if we are changing null -> not-null, or not-null -> null, then inform the EFL
415                     if (_handlers[i].Action == null ^ action == null)
416                         Interop.Elementary.elm_gesture_layer_cb_set(Handle, type, state, action == null ? null : _gestureCallback, new IntPtr(i));
417                     // overwrite previous action
418                     _handlers[i].Action = action;
419                 }
420                 else
421                 {
422                     if (action == null)
423                     {
424                         // ignore unsetting a handler for event which was not registered yet?
425                         return;
426                     }
427                     // (type, state) was not found, so we are adding a new entry and registering the callback
428                     _handlers.Add(new NativeCallback(type, state, action));
429                     // callback is always the same, the event is recognised by the index in _handler list (the index is passed as data)
430                     Interop.Elementary.elm_gesture_layer_cb_set(Handle, type, state, _gestureCallback, new IntPtr(i));
431                 }
432             }
433         }
434
435         /// <summary>
436         /// Clears the gesture state change callback.
437         /// </summary>
438         /// <since_tizen> preview </since_tizen>
439         public void ClearCallbacks()
440         {
441             lock (_handlers)
442             {
443                 int i = 0;
444                 foreach (var handler in _handlers)
445                 {
446                     if (handler.Action != null)
447                     {
448                         Interop.Elementary.elm_gesture_layer_cb_set(Handle, handler.Type, handler.State, null, new IntPtr(i));
449                         handler.Action = null;
450                     }
451                     i++;
452                 }
453             }
454         }
455
456         #region Typed callback setting methods
457
458         // Following methods have been added for convenience, so the user will not have to convert Info structures himself
459         /// <summary>
460         /// Sets the tap callback.
461         /// </summary>
462         /// <param name="type">The gesture you want to track state of.</param>
463         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
464         /// <param name="action">The callback itself.</param>
465         /// <since_tizen> preview </since_tizen>
466         public void SetTapCallback(GestureType type, GestureState state, Action<TapData> action)
467         {
468             SetCallback(type, state, action);
469         }
470
471         /// <summary>
472         /// Sets the gesture state change callback with momentum gesture type.
473         /// </summary>
474         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
475         /// <param name="action">The callback itself.</param>
476         /// <since_tizen> preview </since_tizen>
477         public void SetMomentumCallback(GestureState state, Action<MomentumData> action)
478         {
479             SetCallback(GestureType.Momentum, state, action);
480         }
481
482         /// <summary>
483         /// Sets the gesture state change callback with line gesture type.
484         /// </summary>
485         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
486         /// <param name="action">The callback itself.</param>
487         /// <since_tizen> preview </since_tizen>
488         public void SetLineCallback(GestureState state, Action<LineData> action)
489         {
490             SetCallback(GestureType.Line, state, action);
491         }
492
493         /// <summary>
494         /// Sets the gesture state change callback with flick gesture type.
495         /// </summary>
496         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
497         /// <param name="action">The callback itself.</param>
498         /// <since_tizen> preview </since_tizen>
499         public void SetFlickCallback(GestureState state, Action<LineData> action)
500         {
501             SetCallback(GestureType.Flick, state, action);
502         }
503
504         /// <summary>
505         /// Sets the gesture state change callback with zoom gesture type.
506         /// </summary>
507         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
508         /// <param name="action">The callback itself.</param>
509         /// <since_tizen> preview </since_tizen>
510         public void SetZoomCallback(GestureState state, Action<ZoomData> action)
511         {
512             SetCallback(GestureType.Zoom, state, action);
513         }
514
515         /// <summary>
516         /// Sets the gesture state change callback with rotate gesture type.
517         /// </summary>
518         /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
519         /// <param name="action">The callback itself.</param>
520         /// <since_tizen> preview </since_tizen>
521         public void SetRotateCallback(GestureState state, Action<RotateData> action)
522         {
523             SetCallback(GestureType.Rotate, state, action);
524         }
525
526         #endregion Typed callback setting methods
527
528         /// <summary>
529         /// Calls this function to construct a new gesture-layer object.
530         /// </summary>
531         /// <param name="parent">The gesture layer's parent widget.</param>
532         /// <returns></returns>
533         /// <since_tizen> preview </since_tizen>
534         protected override IntPtr CreateHandle(EvasObject parent)
535         {
536             return Interop.Elementary.elm_gesture_layer_add(parent.Handle);
537         }
538
539         /// <summary>
540         /// Clears the gesture state change callback.
541         /// </summary>
542         /// <since_tizen> preview </since_tizen>
543         protected override void OnUnrealize()
544         {
545             ClearCallbacks();
546             base.OnUnrealize();
547         }
548
549         private void SetCallback<T>(GestureType type, GestureState state, Action<T> action)
550         {
551             if (action == null)
552                 SetGestureCallback(type, state, null);
553             else
554                 SetGestureCallback(type, state, new Action<object>((info) => action((T)info)));
555         }
556
557         private int GestureCallbackHandler(IntPtr data, IntPtr event_info)
558         {
559             // so EFL called our callback, lets use data to find the right Action to call
560             var handlerIndex = (int)data;
561             // thanks to the fact that we never remove item from _handlers, we don't need a lock here
562             if (handlerIndex < 0 || handlerIndex >= _handlers.Count)
563                 return 0;
564
565             var currentHandler = _handlers[handlerIndex];
566             Action<object> action = currentHandler.Action;
567             if (action == null)
568                 return 0;
569
570             // the interpretation of the event_info struct pointer depends on the GestureType
571             switch (currentHandler.Type)
572             {
573                 case GestureType.Tap:
574                 case GestureType.LongTap:
575                 case GestureType.DoubleTap:
576                 case GestureType.TripleTap:
577                     action(Marshal.PtrToStructure<TapData>(event_info));
578                     break;
579
580                 case GestureType.Momentum:
581                     action(Marshal.PtrToStructure<MomentumData>(event_info));
582                     break;
583
584                 case GestureType.Line:
585                 case GestureType.Flick:
586                     action(Marshal.PtrToStructure<LineData>(event_info));
587                     break;
588
589                 case GestureType.Zoom:
590                     action(Marshal.PtrToStructure<ZoomData>(event_info));
591                     break;
592
593                 case GestureType.Rotate:
594                     action(Marshal.PtrToStructure<RotateData>(event_info));
595                     break;
596             }
597             return 0;
598         }
599
600         #region Info structures
601
602         /// <summary>
603         /// The struct of TapData.
604         /// </summary>
605         /// <since_tizen> preview </since_tizen>
606         [NativeStruct("Elm_Gesture_Taps_Info", Include="Elementary.h", PkgConfig="elementary")]
607         [StructLayout(LayoutKind.Sequential)]
608         public struct TapData
609         {
610             /// <summary>
611             /// The X coordinate of the center point.
612             /// </summary>
613             /// <since_tizen> preview </since_tizen>
614             public Int32 X;
615
616             /// <summary>
617             /// The Y coordinate of the center point.
618             /// </summary>
619             /// <since_tizen> preview </since_tizen>
620             public Int32 Y;
621
622 #pragma warning disable 3003
623
624             /// <summary>
625             /// The number of fingers tapped.
626             /// </summary>
627             /// <since_tizen> preview </since_tizen>
628             public UInt32 FingersCount;
629
630             /// <summary>
631             /// The timestamp.
632             /// </summary>
633             /// <since_tizen> preview </since_tizen>
634             public UInt32 Timestamp;
635
636 #pragma warning restore 3003
637         }
638
639         /// <summary>
640         /// The struct of MomentumData.
641         /// </summary>
642         /// <since_tizen> preview </since_tizen>
643         [NativeStruct("Elm_Gesture_Momentum_Info", Include="Elementary.h", PkgConfig="elementary")]
644         [StructLayout(LayoutKind.Sequential)]
645         public struct MomentumData
646         {
647             /// <summary>
648             /// Final-swipe direction starting point on X.
649             /// </summary>
650             /// <since_tizen> preview </since_tizen>
651             public Int32 X1;
652
653             /// <summary>
654             /// Final-swipe direction starting point on Y.
655             /// </summary>
656             /// <since_tizen> preview </since_tizen>
657             public Int32 Y1;
658
659             /// <summary>
660             /// Final-swipe direction ending point on X.
661             /// </summary>
662             /// <since_tizen> preview </since_tizen>
663             public Int32 X2;
664
665             /// <summary>
666             /// Final-swipe direction ending point on Y.
667             /// </summary>
668             /// <since_tizen> preview </since_tizen>
669             public Int32 Y2;
670
671 #pragma warning disable 3003
672
673             /// <summary>
674             /// Timestamp of start of final X-swipe.
675             /// </summary>
676             /// <since_tizen> preview </since_tizen>
677             public UInt32 HorizontalSwipeTimestamp;
678
679             /// <summary>
680             /// Timestamp of start of final Y-swipe.
681             /// </summary>
682             /// <since_tizen> preview </since_tizen>
683             public UInt32 VerticalSwipeTimestamp;
684
685             /// <summary>
686             /// Momentum on X.
687             /// </summary>
688             /// <since_tizen> preview </since_tizen>
689             public Int32 HorizontalMomentum;
690
691             /// <summary>
692             /// Momentum on Y.
693             /// </summary>
694             /// <since_tizen> preview </since_tizen>
695             public Int32 VerticalMomentum;
696
697             /// <summary>
698             /// Number of fingers.
699             /// </summary>
700             /// <since_tizen> preview </since_tizen>
701             public UInt32 FingersCount;
702
703 #pragma warning restore 3003
704         }
705
706         /// <summary>
707         /// The struct of LineData.
708         /// </summary>
709         /// <since_tizen> preview </since_tizen>
710         [NativeStruct("Elm_Gesture_Line_Info", Include="Elementary.h", PkgConfig="elementary")]
711         [StructLayout(LayoutKind.Sequential)]
712         public struct LineData
713         {
714             /// <summary>
715             /// Final-swipe direction starting point on X.
716             /// </summary>
717             /// <since_tizen> preview </since_tizen>
718             public Int32 X1;
719
720             /// <summary>
721             /// Final-swipe direction starting point on Y.
722             /// </summary>
723             /// <since_tizen> preview </since_tizen>
724             public Int32 Y1;
725
726             /// <summary>
727             /// Final-swipe direction ending point on X.
728             /// </summary>
729             /// <since_tizen> preview </since_tizen>
730             public Int32 X2;
731
732             /// <summary>
733             /// Final-swipe direction ending point on Y.
734             /// </summary>
735             /// <since_tizen> preview </since_tizen>
736             public Int32 Y2;
737
738 #pragma warning disable 3003
739
740             /// <summary>
741             /// Timestamp of start of final X-swipe.
742             /// </summary>
743             /// <since_tizen> preview </since_tizen>
744             public UInt32 HorizontalSwipeTimestamp;
745
746             /// <summary>
747             /// Timestamp of start of final Y-swipe.
748             /// </summary>
749             /// <since_tizen> preview </since_tizen>
750             public UInt32 VerticalSwipeTimestamp;
751
752             /// <summary>
753             /// Momentum on X.
754             /// </summary>
755             /// <since_tizen> preview </since_tizen>
756             public Int32 HorizontalMomentum;
757
758             /// <summary>
759             /// Momentum on Y.
760             /// </summary>
761             /// <since_tizen> preview </since_tizen>
762             public Int32 VerticalMomentum;
763
764             /// <summary>
765             /// Number of fingers.
766             /// </summary>
767             /// <since_tizen> preview </since_tizen>
768             public UInt32 FingersCount;
769
770 #pragma warning restore 3003
771
772             /// <summary>
773             /// Angle (direction) of lines.
774             /// </summary>
775             /// <since_tizen> preview </since_tizen>
776             public double Angle;
777         }
778
779         /// <summary>
780         /// The struct of ZoomData.
781         /// </summary>
782         /// <since_tizen> preview </since_tizen>
783         [NativeStruct("Elm_Gesture_Zoom_Info", Include="Elementary.h", PkgConfig="elementary")]
784         [StructLayout(LayoutKind.Sequential)]
785         public struct ZoomData
786         {
787             /// <summary>
788             /// The X coordinate of zoom center point reported to the user.
789             /// </summary>
790             /// <since_tizen> preview </since_tizen>
791             public Int32 X;
792
793             /// <summary>
794             /// The Y coordinate of zoom center point reported to the user.
795             /// </summary>
796             /// <since_tizen> preview </since_tizen>
797             public Int32 Y;
798
799             /// <summary>
800             /// The radius (distance) between fingers reported to user.
801             /// </summary>
802             /// <since_tizen> preview </since_tizen>
803             public Int32 Radius;
804
805             /// <summary>
806             /// The zoom value. 1.0 means no zoom.
807             /// </summary>
808             /// <since_tizen> preview </since_tizen>
809             public double Zoom;
810
811             /// <summary>
812             /// Zoom momentum: zoom growth per second (NOT YET SUPPORTED).
813             /// </summary>
814             private double Momentum;
815         }
816
817         /// <summary>
818         /// The struct of RotateData.
819         /// </summary>
820         /// <since_tizen> preview </since_tizen>
821         [NativeStruct("Elm_Gesture_Rotate_Info", Include="Elementary.h", PkgConfig="elementary")]
822         [StructLayout(LayoutKind.Sequential)]
823         public struct RotateData
824         {
825             /// <summary>
826             /// The X coordinate of rotation center point reported to the user.
827             /// </summary>
828             /// <since_tizen> preview </since_tizen>
829             public Int32 X;
830
831             /// <summary>
832             /// The Y coordinate of rotation center point reported to the user.
833             /// </summary>
834             /// <since_tizen> preview </since_tizen>
835             public Int32 Y;
836
837             /// <summary>
838             /// The radius (distance) between fingers reported to user.
839             /// </summary>
840             /// <since_tizen> preview </since_tizen>
841             public Int32 Radius;
842
843             /// <summary>
844             /// The start-angle.
845             /// </summary>
846             /// <since_tizen> preview </since_tizen>
847             public double BaseAngle;
848
849             /// <summary>
850             /// The rotation value. 0.0 means no rotation.
851             /// </summary>
852             /// <since_tizen> preview </since_tizen>
853             public double Angle;
854
855             /// <summary>
856             /// Rotation momentum: rotation done per second (NOT YET SUPPORTED).
857             /// </summary>
858             private double Momentum;
859         }
860
861         #endregion Info structures
862
863         /// <summary>
864         /// Config is a static class, it provides gestureLayer's timeout information.
865         /// </summary>
866         /// <since_tizen> preview </since_tizen>
867         public static class Config
868         {
869             /// <summary>
870             /// Sets or gets the duration for occurring long tap event of gesture layer.
871             /// </summary>
872             /// <since_tizen> preview </since_tizen>
873             public static double DefaultLongTapTimeout
874             {
875                 get
876                 {
877                     return Interop.Elementary.elm_config_glayer_long_tap_start_timeout_get();
878                 }
879                 set
880                 {
881                     Interop.Elementary.elm_config_glayer_long_tap_start_timeout_set(value);
882                 }
883             }
884
885             /// <summary>
886             /// Sets or gets the duration for occurring double tap event of gesture layer.
887             /// </summary>
888             /// <since_tizen> preview </since_tizen>
889             public static double DefaultDoubleTapTimeout
890             {
891                 get
892                 {
893                     return Interop.Elementary.elm_config_glayer_double_tap_timeout_get();
894                 }
895                 set
896                 {
897                     Interop.Elementary.elm_config_glayer_double_tap_timeout_set(value);
898                 }
899             }
900         }
901
902         private class NativeCallback
903         {
904             public readonly GestureType Type;
905             public readonly GestureState State;
906             public Action<object> Action;
907
908             public NativeCallback(GestureType type, GestureState state, Action<object> action)
909             {
910                 Type = type;
911                 State = state;
912                 Action = action;
913             }
914         }
915     }
916 }