[NUI] text: Add property for primary cursor (caret) position in TextField/TextEditor
authorali198724 <ali198724@gmail.com>
Tue, 8 Dec 2020 08:46:51 +0000 (10:46 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 15 Dec 2020 06:33:59 +0000 (15:33 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs

index 26acebd..9c5fd13 100755 (executable)
@@ -264,6 +264,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_VERTICAL_SCROLL_POSITION_get")]
             public static extern int VerticalScrollPositionGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_PRIMARY_CURSOR_POSITION_get")]
+            public static extern int PrimaryCursorPositionGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_ScrollBy")]
             public static extern void ScrollBy(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
index d6b9220..dc794eb 100755 (executable)
@@ -248,6 +248,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_ENABLE_EDITING_get")]
             public static extern int EnableEditingGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_PRIMARY_CURSOR_POSITION_get")]
+            public static extern int PrimaryCursorPositionGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectNone")]
             public static extern int SelectNone(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
index e59b309..d50fea5 100755 (executable)
@@ -1111,6 +1111,31 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Specify primary cursor (caret) position in text control.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int PrimaryCursorPosition
+        {
+            get
+            {
+                int temp;
+                using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition))
+                {
+                    propertyValue.Get(out temp);
+                }
+                return temp;
+            }
+            set
+            {
+                using (PropertyValue propertyValue = new PropertyValue(value))
+                {
+                    SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue);
+                    NotifyPropertyChanged();
+                }
+            }
+        }
+
+        /// <summary>
         /// The Placeholder property.
         /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
         /// </summary>
@@ -1440,6 +1465,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet();
             internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet();
             internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet();
+            internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet();
         }
 
         internal class InputStyle
index d42d27e..d638ded 100755 (executable)
@@ -1164,6 +1164,7 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
         /// Enable editing in text control.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
@@ -1185,6 +1186,31 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Specify primary cursor (caret) position in text control.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int PrimaryCursorPosition
+        {
+            get
+            {
+                int temp;
+                using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
+                {
+                    propertyValue.Get(out temp);
+                }
+                return temp;
+            }
+            set
+            {
+                using (PropertyValue propertyValue = new PropertyValue(value))
+                {
+                    SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
+                    NotifyPropertyChanged();
+                }
+            }
+        }
+
+        /// <summary>
         /// The Placeholder property.
         /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
         /// </summary>
@@ -1507,6 +1533,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
             internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
             internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
+            internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
         }
 
         internal class InputStyle