[ElmSharp] Mark ElmSharp API as API Level: preview
[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 GestureLayer class.
39         /// </summary>
40         /// <param name="parent">The parent is a given container which will be attached by GestureLayer as a child. It's <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 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 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 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 continues 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 min 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 step-value for 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 control step value for 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         /// Attach 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         /// Set 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         /// clear 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         /// Set 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         /// Set 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         /// Set 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         /// Set 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         /// Set 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         /// Set 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         /// Call 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);
535         }
536
537         /// <summary>
538         /// clear 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 void 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;
562             Action<object> action = _handlers[handlerIndex].Action;
563             if (action == null)
564                 return;
565             // the interpretation of the event_info struct pointer depends on the GestureType
566             switch (_handlers[handlerIndex].Type)
567             {
568                 case GestureType.Tap:
569                 case GestureType.LongTap:
570                 case GestureType.DoubleTap:
571                 case GestureType.TripleTap:
572                     action(Marshal.PtrToStructure<TapData>(event_info));
573                     break;
574
575                 case GestureType.Momentum:
576                     action(Marshal.PtrToStructure<MomentumData>(event_info));
577                     break;
578
579                 case GestureType.Line:
580                 case GestureType.Flick:
581                     action(Marshal.PtrToStructure<LineData>(event_info));
582                     break;
583
584                 case GestureType.Zoom:
585                     action(Marshal.PtrToStructure<ZoomData>(event_info));
586                     break;
587
588                 case GestureType.Rotate:
589                     action(Marshal.PtrToStructure<RotateData>(event_info));
590                     break;
591             }
592         }
593
594         #region Info structures
595
596         /// <summary>
597         /// The struct of TapData
598         /// </summary>
599         /// <since_tizen> preview </since_tizen>
600         [StructLayout(LayoutKind.Sequential)]
601         public struct TapData
602         {
603             /// <summary>
604             /// The x coordinate of the center point.
605             /// </summary>
606             /// <since_tizen> preview </since_tizen>
607             public Int32 X;
608
609             /// <summary>
610             /// The y coordinate of the center point.
611             /// </summary>
612             /// <since_tizen> preview </since_tizen>
613             public Int32 Y;
614
615 #pragma warning disable 3003
616
617             /// <summary>
618             /// The number of fingers tapped.
619             /// </summary>
620             /// <since_tizen> preview </since_tizen>
621             public UInt32 FingersCount;
622
623             /// <summary>
624             /// The timestamp.
625             /// </summary>
626             /// <since_tizen> preview </since_tizen>
627             public UInt32 Timestamp;
628
629 #pragma warning restore 3003
630         }
631
632         /// <summary>
633         /// The struct of MomentumData
634         /// </summary>
635         /// <since_tizen> preview </since_tizen>
636         [StructLayout(LayoutKind.Sequential)]
637         public struct MomentumData
638         {
639             /// <summary>
640             /// Final-swipe direction starting point on X.
641             /// </summary>
642             /// <since_tizen> preview </since_tizen>
643             public Int32 X1;
644
645             /// <summary>
646             /// Final-swipe direction starting point on Y.
647             /// </summary>
648             /// <since_tizen> preview </since_tizen>
649             public Int32 Y1;
650
651             /// <summary>
652             /// Final-swipe direction ending point on X.
653             /// </summary>
654             /// <since_tizen> preview </since_tizen>
655             public Int32 X2;
656
657             /// <summary>
658             /// Final-swipe direction ending point on Y
659             /// </summary>
660             /// <since_tizen> preview </since_tizen>
661             public Int32 Y2;
662
663 #pragma warning disable 3003
664
665             /// <summary>
666             /// Timestamp of start of final x-swipe.
667             /// </summary>
668             /// <since_tizen> preview </since_tizen>
669             public UInt32 HorizontalSwipeTimestamp;
670
671             /// <summary>
672             /// Timestamp of start of final y-swipe.
673             /// </summary>
674             /// <since_tizen> preview </since_tizen>
675             public UInt32 VerticalSwipeTimestamp;
676
677             /// <summary>
678             /// Momentum on X.
679             /// </summary>
680             /// <since_tizen> preview </since_tizen>
681             public Int32 HorizontalMomentum;
682
683             /// <summary>
684             /// Momentum on Y.
685             /// </summary>
686             /// <since_tizen> preview </since_tizen>
687             public Int32 VerticalMomentum;
688
689             /// <summary>
690             /// Number of fingers.
691             /// </summary>
692             /// <since_tizen> preview </since_tizen>
693             public UInt32 FingersCount;
694
695 #pragma warning restore 3003
696         }
697
698         /// <summary>
699         /// The struct of LineData
700         /// </summary>
701         /// <since_tizen> preview </since_tizen>
702         [StructLayout(LayoutKind.Sequential)]
703         public struct LineData
704         {
705             /// <summary>
706             /// Final-swipe direction starting point on X.
707             /// </summary>
708             /// <since_tizen> preview </since_tizen>
709             public Int32 X1;
710
711             /// <summary>
712             /// Final-swipe direction starting point on Y.
713             /// </summary>
714             /// <since_tizen> preview </since_tizen>
715             public Int32 Y1;
716
717             /// <summary>
718             /// Final-swipe direction ending point on X.
719             /// </summary>
720             /// <since_tizen> preview </since_tizen>
721             public Int32 X2;
722
723             /// <summary>
724             /// Final-swipe direction ending point on Y
725             /// </summary>
726             /// <since_tizen> preview </since_tizen>
727             public Int32 Y2;
728
729 #pragma warning disable 3003
730
731             /// <summary>
732             /// Timestamp of start of final x-swipe.
733             /// </summary>
734             /// <since_tizen> preview </since_tizen>
735             public UInt32 HorizontalSwipeTimestamp;
736
737             /// <summary>
738             /// Timestamp of start of final y-swipe.
739             /// </summary>
740             /// <since_tizen> preview </since_tizen>
741             public UInt32 VerticalSwipeTimestamp;
742
743             /// <summary>
744             /// Momentum on X.
745             /// </summary>
746             /// <since_tizen> preview </since_tizen>
747             public Int32 HorizontalMomentum;
748
749             /// <summary>
750             /// Momentum on Y.
751             /// </summary>
752             /// <since_tizen> preview </since_tizen>
753             public Int32 VerticalMomentum;
754
755             /// <summary>
756             /// Number of fingers.
757             /// </summary>
758             /// <since_tizen> preview </since_tizen>
759             public UInt32 FingersCount;
760
761 #pragma warning restore 3003
762
763             /// <summary>
764             /// Angle (direction) of lines.
765             /// </summary>
766             /// <since_tizen> preview </since_tizen>
767             public double Angle;
768         }
769
770         /// <summary>
771         /// The struct of ZoomData
772         /// </summary>
773         /// <since_tizen> preview </since_tizen>
774         [StructLayout(LayoutKind.Sequential)]
775         public struct ZoomData
776         {
777             /// <summary>
778             /// The x coordinate of zoom center point reported to user.
779             /// </summary>
780             /// <since_tizen> preview </since_tizen>
781             public Int32 X;
782
783             /// <summary>
784             /// The y coordinate of zoom center point reported to user.
785             /// </summary>
786             /// <since_tizen> preview </since_tizen>
787             public Int32 Y;
788
789             /// <summary>
790             /// The radius (distance) between fingers reported to user.
791             /// </summary>
792             /// <since_tizen> preview </since_tizen>
793             public Int32 Radius;
794
795             /// <summary>
796             /// The zoom value. 1.0 means no zoom.
797             /// </summary>
798             /// <since_tizen> preview </since_tizen>
799             public double Zoom;
800
801             /// <summary>
802             /// Zoom momentum: zoom growth per second (NOT YET SUPPORTED).
803             /// </summary>
804             private double Momentum;
805         }
806
807         /// <summary>
808         /// The struct of RotateData
809         /// </summary>
810         /// <since_tizen> preview </since_tizen>
811         [StructLayout(LayoutKind.Sequential)]
812         public struct RotateData
813         {
814             /// <summary>
815             /// The x coordinate of rotation center point reported to user.
816             /// </summary>
817             /// <since_tizen> preview </since_tizen>
818             public Int32 X;
819
820             /// <summary>
821             /// The y coordinate of rotation center point reported to user.
822             /// </summary>
823             /// <since_tizen> preview </since_tizen>
824             public Int32 Y;
825
826             /// <summary>
827             /// The radius (distance) between fingers reported to user.
828             /// </summary>
829             /// <since_tizen> preview </since_tizen>
830             public Int32 Radius;
831
832             /// <summary>
833             /// The start-angle.
834             /// </summary>
835             /// <since_tizen> preview </since_tizen>
836             public double BaseAngle;
837
838             /// <summary>
839             /// The rotation value. 0.0 means no rotation.
840             /// </summary>
841             /// <since_tizen> preview </since_tizen>
842             public double Angle;
843
844             /// <summary>
845             /// Rotation momentum: rotation done per second (NOT YET SUPPORTED).
846             /// </summary>
847             private double Momentum;
848         }
849
850         #endregion Info structures
851
852         /// <summary>
853         /// Config is a static class, it provides gestureLayer's timeout information.
854         /// </summary>
855         /// <since_tizen> preview </since_tizen>
856         public static class Config
857         {
858             /// <summary>
859             /// Sets or gets the duration for occurring long tap event of gesture layer.
860             /// </summary>
861             /// <since_tizen> preview </since_tizen>
862             public static double DefaultLongTapTimeout
863             {
864                 get
865                 {
866                     return Interop.Elementary.elm_config_glayer_long_tap_start_timeout_get();
867                 }
868                 set
869                 {
870                     Interop.Elementary.elm_config_glayer_long_tap_start_timeout_set(value);
871                 }
872             }
873
874             /// <summary>
875             /// Sets or gets the duration for occurring double tap event of gesture layer.
876             /// </summary>
877             /// <since_tizen> preview </since_tizen>
878             public static double DefaultDoubleTapTimeout
879             {
880                 get
881                 {
882                     return Interop.Elementary.elm_config_glayer_double_tap_timeout_get();
883                 }
884                 set
885                 {
886                     Interop.Elementary.elm_config_glayer_double_tap_timeout_set(value);
887                 }
888             }
889         }
890
891         private class NativeCallback
892         {
893             public readonly GestureType Type;
894             public readonly GestureState State;
895             public Action<object> Action;
896
897             public NativeCallback(GestureType type, GestureState state, Action<object> action)
898             {
899                 Type = type;
900                 State = state;
901                 Action = action;
902             }
903         }
904     }
905 }