[NUI-Text] Add more scroll functinality to texteditor
authorali198724 <ali198724@gmail.com>
Thu, 5 Nov 2020 18:40:21 +0000 (20:40 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 8 Dec 2020 06:23:12 +0000 (15:23 +0900)
1- add Horizontal_Scroll_position property (float)
2- add VerticalScrollPosition property (float)
3- add ScrollBy function (take Vector2)

src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs

index e45dfce..8d6abab 100755 (executable)
@@ -258,6 +258,15 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_ENABLE_EDITING_get")]
             public static extern int TextEditor_Property_ENABLE_EDITING_get();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_HORIZONTAL_SCROLL_POSITION_get")]
+            public static extern int TextEditor_Property_HORIZONTAL_SCROLL_POSITION_get();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_VERTICAL_SCROLL_POSITION_get")]
+            public static extern int TextEditor_Property_VERTICAL_SCROLL_POSITION_get();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_ScrollBy")]
+            public static extern void TextEditor_ScrollBy(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
         }
     }
 }
\ No newline at end of file
index 1f42520..aa3fde9 100755 (executable)
@@ -1039,6 +1039,7 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
         /// Enable editing in text control.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
@@ -1060,6 +1061,56 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Specify horizontal scroll position in text control.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int HorizontalScrollPosition
+        {
+            get
+            {
+                int temp;
+                using (PropertyValue propertyValue = GetProperty(TextEditor.Property.HORIZONTAL_SCROLL_POSITION))
+                {
+                    propertyValue.Get(out temp);
+                }
+                return temp;
+            }
+            set
+            {
+                using (PropertyValue propertyValue = new PropertyValue(value))
+                {
+                    SetProperty(TextEditor.Property.HORIZONTAL_SCROLL_POSITION, propertyValue);
+                    NotifyPropertyChanged();
+                }
+            }
+        }
+
+        /// <summary>
+        /// Specify vertical scroll position in text control.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public int VerticalScrollPosition
+        {
+            get
+            {
+                int temp;
+                using (PropertyValue propertyValue = GetProperty(TextEditor.Property.VERTICAL_SCROLL_POSITION))
+                {
+                    propertyValue.Get(out temp);
+                }
+                return temp;
+            }
+            set
+            {
+                using (PropertyValue propertyValue = new PropertyValue(value))
+                {
+                    SetProperty(TextEditor.Property.VERTICAL_SCROLL_POSITION, propertyValue);
+                    NotifyPropertyChanged();
+                }
+            }
+        }
+
+        /// <summary>
         /// The Placeholder property.
         /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
         /// </summary>
@@ -1192,6 +1243,17 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Scroll the text control by specific amount..
+        /// </summary>
+        /// <param name="scroll">The amount (in pixels) of scrolling in horizontal &amp; vertical directions.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void ScrollBy(Vector2 scroll)
+        {
+            Interop.TextEditor.TextEditor_ScrollBy(swigCPtr, Vector2.getCPtr(scroll));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Get the InputMethodContext instance.
         /// </summary>
         /// <returns>The InputMethodContext instance.</returns>
@@ -1376,6 +1438,8 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SELECTED_TEXT_END = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_END_get();
             internal static readonly int ENABLE_EDITING = Interop.TextEditor.TextEditor_Property_ENABLE_EDITING_get();
             internal static readonly int SELECTED_TEXT = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_get();
+            internal static readonly int HORIZONTAL_SCROLL_POSITION = Interop.TextEditor.TextEditor_Property_HORIZONTAL_SCROLL_POSITION_get();
+            internal static readonly int VERTICAL_SCROLL_POSITION = Interop.TextEditor.TextEditor_Property_VERTICAL_SCROLL_POSITION_get();
         }
 
         internal class InputStyle