[NUI] Add API for consuming keyEvent in Widget (#4002)
authortscholb <scholb.kim@samsung.com>
Mon, 21 Mar 2022 08:47:56 +0000 (17:47 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 22 Mar 2022 08:34:14 +0000 (17:34 +0900)
When a widget consumes a keyEvent, the WidgetView must also consume that keyEvent.
the API called SetUsingKeyEvent() allows the WidgetApplication to set this flag.

src/Tizen.NUI/src/internal/Interop/Interop.WidgetImpl.cs
src/Tizen.NUI/src/internal/Widget/WidgetImpl.cs
src/Tizen.NUI/src/public/Widget/Widget.cs

index a6c2cd6..fecc0ab 100755 (executable)
@@ -78,6 +78,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WidgetImpl_SetContentInfo")]
             public static extern void SetContentInfo(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WidgetImpl_SetUsingKeyEvent")]
+            public static extern void SetUsingKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WidgetImpl_SetImpl")]
             public static extern void SetImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
index 8f077a6..b2850db 100755 (executable)
@@ -274,7 +274,11 @@ namespace Tizen.NUI
             Interop.WidgetImpl.SetContentInfo(SwigCPtr, contentInfo);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
-
+        public void SetUsingKeyEvent(bool flag)
+        {
+            Interop.WidgetImpl.SetUsingKeyEvent(SwigCPtr, flag);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
         internal void SetImpl(SWIGTYPE_p_Dali__Widget__Impl impl)
         {
             Interop.WidgetImpl.SetImpl(SwigCPtr, SWIGTYPE_p_Dali__Widget__Impl.getCPtr(impl));
index 80fd555..ce65cb5 100755 (executable)
@@ -82,6 +82,16 @@ namespace Tizen.NUI
             widgetImpl.SetContentInfo(contentInfo);
         }
 
+        /// <summary>
+        /// Set the flag that widget is using keyEvent
+        /// </summary>
+        /// <param name="flag"> The flag that widget is using keyEvent. </param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetUsingKeyEvent(bool flag)
+        {
+            widgetImpl.SetUsingKeyEvent(flag);
+        }
+
         internal System.IntPtr GetIntPtr()
         {
             return SwigCPtr.Handle;