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