[NUI] Add KeyInputFocus property to View (#1969)
authorSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Thu, 3 Sep 2020 06:40:28 +0000 (15:40 +0900)
committerGitHub <noreply@github.com>
Thu, 3 Sep 2020 06:40:28 +0000 (15:40 +0900)
- KeyInputFocus is to receive key events to View.
- This property is originally public on DALi package,
 so to use it in NUI app, it should be supplied even as hidden API.

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs

index 0612f57..306985a 100755 (executable)
@@ -244,6 +244,23 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The KeyInputFocus, type bool.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool KeyInputFocus
+        {
+            get
+            {
+                return (bool)GetValue(KeyInputFocusProperty);
+            }
+            set
+            {
+                SetValue(KeyInputFocusProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
         /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
         /// </summary>
         /// <remarks>
@@ -2124,7 +2141,7 @@ namespace Tizen.NUI.BaseComponents
                     value.Owner.Layout = new AbsoluteLayout();
 
                     // Copy Margin and Padding to replacement LayoutGroup.
-                    if (value.Owner.Layout != null) 
+                    if (value.Owner.Layout != null)
                     {
                         value.Owner.Layout.Margin = value.Margin;
                         value.Owner.Layout.Padding = value.Padding;
index ceb3236..c1fda12 100755 (executable)
@@ -47,6 +47,26 @@ namespace Tizen.NUI.BaseComponents
         });
 
         /// <summary>
+        /// KeyInputFocusProperty
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty KeyInputFocusProperty = BindableProperty.Create("KeyInputFocus", typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var view = (View)bindable;
+            if (newValue != null)
+            {
+                Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.KEY_INPUT_FOCUS, new Tizen.NUI.PropertyValue((bool)newValue));
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var view = (View)bindable;
+            bool temp = false;
+            Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.KEY_INPUT_FOCUS).Get(out temp);
+            return temp;
+        });
+
+        /// <summary>
         /// BackgroundColorProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -135,7 +155,7 @@ namespace Tizen.NUI.BaseComponents
                 map.Add(ImageVisualProperty.URL, new PropertyValue(url))
                    .Add(Visual.Property.CornerRadius, new PropertyValue(view.backgroundExtraData.CornerRadius))
                    .Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(view._backgroundImageSynchronosLoading));
-                
+
                 if (view.backgroundExtraData.BackgroundImageBorder != null)
                 {
                     map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch))
index bdd95d9..afdc48b 100755 (executable)
@@ -150,6 +150,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int UP_FOCUSABLE_VIEW_ID = Interop.ViewProperty.View_Property_UP_FOCUSABLE_ACTOR_ID_get();
             internal static readonly int DOWN_FOCUSABLE_VIEW_ID = Interop.ViewProperty.View_Property_DOWN_FOCUSABLE_ACTOR_ID_get();
             internal static readonly int STYLE_NAME = Interop.ViewProperty.View_Property_STYLE_NAME_get();
+            internal static readonly int KEY_INPUT_FOCUS = Interop.ViewProperty.View_Property_KEY_INPUT_FOCUS_get();
             internal static readonly int BACKGROUND = Interop.ViewProperty.View_Property_BACKGROUND_get();
             internal static readonly int SIBLING_ORDER = Interop.ActorProperty.Actor_Property_SIBLING_ORDER_get();
             internal static readonly int OPACITY = Interop.ActorProperty.Actor_Property_OPACITY_get();