[ElmSharp] Mark ElmSharp API as API Level: preview
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / GestureLayer.cs
old mode 100755 (executable)
new mode 100644 (file)
index 6318a46..bde146f
@@ -1,10 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 using System;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
 
 namespace ElmSharp
 {
-    public class GestureLayer : EvasObject
+    /// <summary>
+    /// The GestureLayer is used to detect gestures.
+    /// Inherits Widget
+    /// </summary>
+    /// <since_tizen> preview </since_tizen>
+    public class GestureLayer : Widget
     {
         private readonly Interop.Elementary.GestureEventCallback _gestureCallback;
 
@@ -13,34 +34,106 @@ namespace ElmSharp
         // but all gestures share the callback and you don't want to desynchronize mapping
         private readonly List<NativeCallback> _handlers = new List<NativeCallback>();
 
+        /// <summary>
+        /// Creates and initializes a new instance of GestureLayer class.
+        /// </summary>
+        /// <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>
+        /// <since_tizen> preview </since_tizen>
         public GestureLayer(EvasObject parent) : base(parent)
         {
             _gestureCallback = new Interop.Elementary.GestureEventCallback(GestureCallbackHandler);
         }
 
+        /// <summary>
+        /// Enumeration for supported gesture types.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public enum GestureType
         {
+            /// <summary>
+            /// N fingers single taps
+            /// </summary>
             Tap = 1,
+
+            /// <summary>
+            /// N fingers single long-taps
+            /// </summary>
             LongTap,
+
+            /// <summary>
+            /// N fingers double-single taps
+            /// </summary>
             DoubleTap,
+
+            /// <summary>
+            /// N fingers triple-single taps
+            /// </summary>
             TripleTap,
+
+            /// <summary>
+            /// Reports momentum in the direction of move
+            /// </summary>
             Momentum,
+
+            /// <summary>
+            /// N fingers line gesture
+            /// </summary>
             Line,
+
+            /// <summary>
+            /// N fingers flick gesture
+            /// </summary>
             Flick,
+
+            /// <summary>
+            /// Zoom
+            /// </summary>
             Zoom,
+
+            /// <summary>
+            /// Rotate
+            /// </summary>
             Rotate,
         }
 
+        /// <summary>
+        /// Enumeration for gesture states.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public enum GestureState
         {
+            /// <summary>
+            /// Gesture not started
+            /// </summary>
             Undefined = -1,
+
+            /// <summary>
+            /// Gesture started
+            /// </summary>
             Start,
+
+            /// <summary>
+            /// Gesture is ongoing
+            /// </summary>
             Move,
+
+            /// <summary>
+            /// Gesture completed
+            /// </summary>
             End,
+
+            /// <summary>
+            /// Ongoing gesture is aborted
+            /// </summary>
             Abort,
         }
 
         #region Properties
+
+        /// <summary>
+        /// Sets or gets the repeat-events setting.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public bool HoldEvents
         {
             get
@@ -53,6 +146,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer continues enable of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public bool Continues
         {
             get
@@ -65,6 +162,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer finger-size for taps.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public int TapFingerSize
         {
             get
@@ -77,6 +178,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer long tap start timeout of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double LongTapTimeout
         {
             get
@@ -89,6 +194,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer double tap timeout of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double DoubleTapTimeout
         {
             get
@@ -101,6 +210,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer flick time limit (in ms) of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public int FlickTimeLimit
         {
             get
@@ -113,6 +226,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer line min length of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public int MinimumLineLength
         {
             get
@@ -125,6 +242,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets  the gesture layer line angular tolerance of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double LineAngularTolerance
         {
             get
@@ -137,6 +258,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer line distance tolerance of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public int LineDistanceTolerance
         {
             get
@@ -149,6 +274,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets step-value for rotate action.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double RotateStep
         {
             get
@@ -161,6 +290,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer rotate angular tolerance of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double RotateAngularTolerance
         {
             get
@@ -173,6 +306,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets control step value for zoom action.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double ZoomStep
         {
             get
@@ -185,6 +322,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer zoom distance tolerance of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public int ZoomDistanceTolerance
         {
             get
@@ -197,6 +338,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer zoom finger factor of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double ZoomFingerFactor
         {
             get
@@ -209,6 +354,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// Sets or gets the gesture layer zoom wheel factor of an object
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public double ZoomWheelFactor
         {
             get
@@ -220,13 +369,28 @@ namespace ElmSharp
                 Interop.Elementary.elm_gesture_layer_zoom_wheel_factor_set(Handle, value);
             }
         }
+
         #endregion Properties
 
+        /// <summary>
+        /// Attach a gesture layer widget to an Evas object (setting the widget's target).
+        /// A gesture layer's target may be any Evas object. This object will be used to listen to mouse and key events.
+        /// </summary>
+        /// <param name="target">The object to attach.</param>
+        /// <since_tizen> preview </since_tizen>
         public void Attach(EvasObject target)
         {
             Interop.Elementary.elm_gesture_layer_attach(Handle, target.Handle);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback.
+        /// When all callbacks for the gesture are set to null, it means this gesture is disabled.
+        /// </summary>
+        /// <param name="type">The gesture you want to track state of.</param>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetGestureCallback(GestureType type, GestureState state, Action<object> action)
         {
             lock (_handlers)
@@ -266,6 +430,10 @@ namespace ElmSharp
             }
         }
 
+        /// <summary>
+        /// clear the gesture state change callback.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public void ClearCallbacks()
         {
             lock (_handlers)
@@ -284,43 +452,92 @@ namespace ElmSharp
         }
 
         #region Typed callback setting methods
+
         // Following methods have been added for convenience, so the user will not have to convert Info structures himself
+        /// <summary>
+        /// Set the tap callback.
+        /// </summary>
+        /// <param name="type">The gesture you want to track state of.</param>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetTapCallback(GestureType type, GestureState state, Action<TapData> action)
         {
             SetCallback(type, state, action);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback with Momentum Gesture Type
+        /// </summary>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetMomentumCallback(GestureState state, Action<MomentumData> action)
         {
             SetCallback(GestureType.Momentum, state, action);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback with Line Gesture Type
+        /// </summary>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetLineCallback(GestureState state, Action<LineData> action)
         {
             SetCallback(GestureType.Line, state, action);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback with Flick Gesture Type
+        /// </summary>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetFlickCallback(GestureState state, Action<LineData> action)
         {
             SetCallback(GestureType.Flick, state, action);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback with Zoom Gesture Type
+        /// </summary>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetZoomCallback(GestureState state, Action<ZoomData> action)
         {
             SetCallback(GestureType.Zoom, state, action);
         }
 
+        /// <summary>
+        /// Set the gesture state change callback with Rotate Gesture Type
+        /// </summary>
+        /// <param name="state">The event the callback tracks (START, MOVE, END, ABORT).</param>
+        /// <param name="action">The callback itself.</param>
+        /// <since_tizen> preview </since_tizen>
         public void SetRotateCallback(GestureState state, Action<RotateData> action)
         {
             SetCallback(GestureType.Rotate, state, action);
         }
+
         #endregion Typed callback setting methods
 
+        /// <summary>
+        /// Call this function to construct a new gesture-layer object.
+        /// </summary>
+        /// <param name="parent">The gesture layer's parent widget.</param>
+        /// <returns></returns>
+        /// <since_tizen> preview </since_tizen>
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             return Interop.Elementary.elm_gesture_layer_add(parent);
         }
 
+        /// <summary>
+        /// clear the gesture state change callback.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         protected override void OnUnrealize()
         {
             ClearCallbacks();
@@ -352,180 +569,233 @@ namespace ElmSharp
                 case GestureType.LongTap:
                 case GestureType.DoubleTap:
                 case GestureType.TripleTap:
-                    action(Marshal.PtrToStructure(event_info, typeof(TapData)));
+                    action(Marshal.PtrToStructure<TapData>(event_info));
                     break;
+
                 case GestureType.Momentum:
-                    action(Marshal.PtrToStructure(event_info, typeof(MomentumData)));
+                    action(Marshal.PtrToStructure<MomentumData>(event_info));
                     break;
+
                 case GestureType.Line:
                 case GestureType.Flick:
-                    action(Marshal.PtrToStructure(event_info, typeof(LineData)));
+                    action(Marshal.PtrToStructure<LineData>(event_info));
                     break;
+
                 case GestureType.Zoom:
-                    action(Marshal.PtrToStructure(event_info, typeof(ZoomData)));
+                    action(Marshal.PtrToStructure<ZoomData>(event_info));
                     break;
+
                 case GestureType.Rotate:
-                    action(Marshal.PtrToStructure(event_info, typeof(RotateData)));
+                    action(Marshal.PtrToStructure<RotateData>(event_info));
                     break;
             }
         }
 
         #region Info structures
 
+        /// <summary>
+        /// The struct of TapData
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         [StructLayout(LayoutKind.Sequential)]
         public struct TapData
         {
             /// <summary>
             /// The x coordinate of the center point.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X;
 
             /// <summary>
             /// The y coordinate of the center point.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y;
 
-            #pragma warning disable 3003
+#pragma warning disable 3003
+
             /// <summary>
             /// The number of fingers tapped.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 FingersCount;
 
             /// <summary>
             /// The timestamp.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 Timestamp;
-            #pragma warning restore 3003
+
+#pragma warning restore 3003
         }
 
+        /// <summary>
+        /// The struct of MomentumData
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         [StructLayout(LayoutKind.Sequential)]
         public struct MomentumData
         {
             /// <summary>
             /// Final-swipe direction starting point on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X1;
 
             /// <summary>
             /// Final-swipe direction starting point on Y.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y1;
 
             /// <summary>
             /// Final-swipe direction ending point on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X2;
 
             /// <summary>
             /// Final-swipe direction ending point on Y
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y2;
 
-            #pragma warning disable 3003
+#pragma warning disable 3003
+
             /// <summary>
             /// Timestamp of start of final x-swipe.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 HorizontalSwipeTimestamp;
 
             /// <summary>
             /// Timestamp of start of final y-swipe.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 VerticalSwipeTimestamp;
 
             /// <summary>
             /// Momentum on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 HorizontalMomentum;
 
             /// <summary>
             /// Momentum on Y.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 VerticalMomentum;
 
             /// <summary>
             /// Number of fingers.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 FingersCount;
-            #pragma warning restore 3003
+
+#pragma warning restore 3003
         }
 
+        /// <summary>
+        /// The struct of LineData
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         [StructLayout(LayoutKind.Sequential)]
         public struct LineData
         {
             /// <summary>
             /// Final-swipe direction starting point on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X1;
 
             /// <summary>
             /// Final-swipe direction starting point on Y.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y1;
 
             /// <summary>
             /// Final-swipe direction ending point on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X2;
 
             /// <summary>
             /// Final-swipe direction ending point on Y
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y2;
 
-            #pragma warning disable 3003
+#pragma warning disable 3003
+
             /// <summary>
             /// Timestamp of start of final x-swipe.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 HorizontalSwipeTimestamp;
 
             /// <summary>
             /// Timestamp of start of final y-swipe.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 VerticalSwipeTimestamp;
 
             /// <summary>
             /// Momentum on X.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 HorizontalMomentum;
 
             /// <summary>
             /// Momentum on Y.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 VerticalMomentum;
 
             /// <summary>
             /// Number of fingers.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public UInt32 FingersCount;
-            #pragma warning restore 3003
+
+#pragma warning restore 3003
 
             /// <summary>
             /// Angle (direction) of lines.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public double Angle;
         }
 
+        /// <summary>
+        /// The struct of ZoomData
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         [StructLayout(LayoutKind.Sequential)]
         public struct ZoomData
         {
             /// <summary>
             /// The x coordinate of zoom center point reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X;
 
             /// <summary>
             /// The y coordinate of zoom center point reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y;
 
             /// <summary>
             /// The radius (distance) between fingers reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Radius;
 
             /// <summary>
             /// The zoom value. 1.0 means no zoom.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public double Zoom;
 
             /// <summary>
@@ -534,32 +804,41 @@ namespace ElmSharp
             private double Momentum;
         }
 
+        /// <summary>
+        /// The struct of RotateData
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         [StructLayout(LayoutKind.Sequential)]
         public struct RotateData
         {
             /// <summary>
             /// The x coordinate of rotation center point reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 X;
 
             /// <summary>
             /// The y coordinate of rotation center point reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Y;
 
             /// <summary>
             /// The radius (distance) between fingers reported to user.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public Int32 Radius;
 
             /// <summary>
             /// The start-angle.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public double BaseAngle;
 
             /// <summary>
             /// The rotation value. 0.0 means no rotation.
             /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public double Angle;
 
             /// <summary>
@@ -570,24 +849,40 @@ namespace ElmSharp
 
         #endregion Info structures
 
+        /// <summary>
+        /// Config is a static class, it provides gestureLayer's timeout information.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public static class Config
         {
+            /// <summary>
+            /// Sets or gets the duration for occurring long tap event of gesture layer.
+            /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public static double DefaultLongTapTimeout
             {
-                get {
+                get
+                {
                     return Interop.Elementary.elm_config_glayer_long_tap_start_timeout_get();
                 }
-                set {
+                set
+                {
                     Interop.Elementary.elm_config_glayer_long_tap_start_timeout_set(value);
                 }
             }
 
+            /// <summary>
+            /// Sets or gets the duration for occurring double tap event of gesture layer.
+            /// </summary>
+            /// <since_tizen> preview </since_tizen>
             public static double DefaultDoubleTapTimeout
             {
-                get {
+                get
+                {
                     return Interop.Elementary.elm_config_glayer_double_tap_timeout_get();
                 }
-                set {
+                set
+                {
                     Interop.Elementary.elm_config_glayer_double_tap_timeout_set(value);
                 }
             }
@@ -607,4 +902,4 @@ namespace ElmSharp
             }
         }
     }
-}
+}
\ No newline at end of file