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