[NUI] Add input source type to Gesture.
authorjoogab.yun <joogab.yun@samsung.com>
Wed, 26 Oct 2022 01:57:10 +0000 (10:57 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 10 Nov 2022 01:25:11 +0000 (10:25 +0900)
This is similar to MouseButton in TouchEvent.
Now, you can see from which input the gesture was made.

https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-core/+/283368/
https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-csharp-binder/+/283369/

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

index ca1a2da..0fd9b51 100755 (executable)
@@ -48,6 +48,12 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Gesture_time_get")]
             public static extern uint TimeGet(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Gesture_sourceType_get")]
+            public static extern int SourceTypeGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Gesture_sourceData_get")]
+            public static extern int SourceDataGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Gesture_SWIGUpcast")]
             public static extern global::System.IntPtr Upcast(global::System.IntPtr jarg1);
         }
index a2c3b07..93c52f3 100755 (executable)
@@ -63,8 +63,6 @@ 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 7d491e2..8671df6 100755 (executable)
@@ -108,6 +108,52 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// This is the value of which source the gesture was started with. (ex : mouse)
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum SourceType
+        {
+            /// <summary>
+            /// invalid data.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Invalid,
+            /// <summary>
+            /// Mouse.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Mouse,
+        }
+
+        /// <summary>
+        /// This is the data of source type
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public enum SourceDataType
+        {
+            /// <summary>
+            /// invalid data.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            Invalid = -1,
+            /// <summary>
+            /// Primary(Left) mouse button.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            MousePrimary = 1,
+            /// <summary>
+            /// Secondary(Right) mouse button.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            MouseSecondary = 3,
+            /// <summary>
+            /// Tertiary(Third) mouse button.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            MouseTertiary = 2,
+        }        
+
+        /// <summary>
         /// The gesture type.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -143,6 +189,32 @@ namespace Tizen.NUI
             }
         }
 
+        /// <summary>
+        /// This is the property of which source type the gesture (read-only).
+        /// If you started the gesture with the mouse, it will tell you what type of mouse it is.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Gesture.SourceType Source
+        {
+            get
+            {
+                return sourceType;
+            }
+        }
+
+        /// <summary>
+        /// This is a property of the source type data (read-only).
+        /// If you started the gesture with the mouse, it will tell you which mouse button you started the gesture with.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Gesture.SourceDataType SourceData
+        {
+            get
+            {
+                return sourceDataType;
+            }
+        }
+
         private Gesture.GestureType type
         {
             set
@@ -188,6 +260,26 @@ namespace Tizen.NUI
             }
         }
 
+        private Gesture.SourceType sourceType
+        {
+            get
+            {
+                Gesture.SourceType ret = (Gesture.SourceType)Interop.Gesture.SourceTypeGet(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
+        private Gesture.SourceDataType sourceDataType
+        {
+            get
+            {
+                Gesture.SourceDataType ret = (Gesture.SourceDataType)Interop.Gesture.SourceDataGet(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
         internal static Gesture GetGestureFromPtr(global::System.IntPtr cPtr)
         {
             Gesture ret = new Gesture(cPtr, false);
@@ -202,4 +294,5 @@ namespace Tizen.NUI
             Interop.Gesture.DeleteGesture(swigCPtr);
         }
     }
+
 }
index 739e8a6..7104511 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 
 namespace Tizen.NUI
@@ -89,15 +90,17 @@ 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.
+        /// If you touch with a mouse button, this will tell you which mouse input you touched.
         /// Primary(Left), Secondary(Right). Tertiary(Wheel).
+        /// Deprecated. This api will be deleted without notice. Please do not use it.
         /// </summary>
+        [Obsolete("This property will be deleted without notice. Please do not use it. Use Gesture.SourceData instead.")]
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public GestureSourceType SourceType
+        public new GestureSourceType SourceType
         {
             get
             {
-                return sourceType;
+                return (GestureSourceType)SourceData;
             }
         }
 
@@ -163,16 +166,6 @@ namespace Tizen.NUI
             }
         }
 
-        private GestureSourceType sourceType
-        {
-            get
-            {
-                GestureSourceType ret = (GestureSourceType)Interop.TapGesture.SourceTypeGet(SwigCPtr);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
-            }
-        }
-
         /// <summary>
         /// Gets the TapGesture from the pointer.
         /// </summary>
@@ -195,7 +188,9 @@ namespace Tizen.NUI
 
     /// <summary>
     /// Gesture source type.
+    /// Deprecated. This value will be deleted without notice. Please do not use it.
     /// </summary>
+    [Obsolete("This enum will be deleted without notice. Please do not use it.")]
     [EditorBrowsable(EditorBrowsableState.Never)]
     public enum GestureSourceType
     {
@@ -220,4 +215,5 @@ namespace Tizen.NUI
         [EditorBrowsable(EditorBrowsableState.Never)]
         Tertiary = 2,
     }
+
 }