[NUI] Add source type to TapGesture.
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 1 Jun 2021 02:02:01 +0000 (11:02 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 23 Jun 2021 08:25:09 +0000 (17:25 +0900)
This is similar to MouseButton in TouchEvent.

Now, you can see from which input the tap was made.

src/Tizen.NUI/src/internal/Interop/Interop.TapGesture.cs
src/Tizen.NUI/src/public/Events/TapGesture.cs

index ddac5db..a2c3b07 100755 (executable)
@@ -62,6 +62,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TapGesture_localPoint_get")]
             public static extern global::System.IntPtr LocalPointGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TapGesture_sourceType_get")]
+            public static extern int SourceTypeGet(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
     }
 }
index e2b4747..ff385a8 100755 (executable)
@@ -87,6 +87,20 @@ namespace Tizen.NUI
             }
         }
 
+        /// <summary>
+        /// The gesture source type of touches property (read-only).
+        /// If you tap with a mouse button, this will tell you which mouse input you tapped.
+        /// Primary(Left), Secondary(Right). Tertiary(Wheel).
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public GestureSourceType SourceType
+        {
+            get
+            {
+                return sourceType;
+            }
+        }
+
         private uint numberOfTaps
         {
             set
@@ -149,6 +163,16 @@ namespace Tizen.NUI
             }
         }
 
+        private GestureSourceType sourceType
+        {
+            get
+            {
+                GestureSourceType ret = (GestureSourceType)Interop.TapGesture.SourceTypeGet(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGesture obj)
         {
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
@@ -173,4 +197,32 @@ namespace Tizen.NUI
             Interop.TapGesture.DeleteTapGesture(swigCPtr);
         }
     }
+
+    /// <summary>
+    /// Gesture source type.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public enum GestureSourceType
+    {
+        /// <summary>
+        /// invalid data.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        Invalid = -1,
+        /// <summary>
+        /// Primary.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        Primary = 1,
+        /// <summary>
+        /// Secondary.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        Secondary = 3,
+        /// <summary>
+        /// Third (tertiary)
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        Tertiary = 2,
+    }
 }