[NUI] Implement missing properties for LottieAnimationView.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextUtils.cs
index 59129ce..7988a3f 100755 (executable)
  *
  */
 
+extern alias TizenSystemSettings;
+using TizenSystemSettings.Tizen.System;
 using System;
 using System.ComponentModel;
-using System.Collections.Generic;
-using Tizen.NUI.Binding;
 
 namespace Tizen.NUI.BaseComponents
 {
@@ -33,11 +33,6 @@ namespace Tizen.NUI.BaseComponents
         {
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RendererParameters obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
-        }
-
         /// <summary>
         /// Dispose
         /// </summary>
@@ -674,11 +669,6 @@ namespace Tizen.NUI.BaseComponents
         {
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EmbeddedItemInfo obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
-        }
-
         /// <summary>
         /// Dispose
         /// </summary>
@@ -850,11 +840,6 @@ namespace Tizen.NUI.BaseComponents
         {
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ShadowParameters obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
-        }
-
         /// <summary>
         /// Dispose
         /// </summary>
@@ -1097,6 +1082,145 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
-    }
 
+#if PROFILE_TV
+        private const float FontSizeScaleSmall = 0.8f;
+        private const float FontSizeScaleNormal = 1.0f;
+        private const float FontSizeScaleLarge = 1.5f;
+        private const float FontSizeScaleHuge = 1.9f;
+        private const float FontSizeScaleGiant = 2.5f;
+#elif PROFILE_WEARABLE
+        // The following values from 'system-settings/libutil/sstu.c'
+        private const float FontSizeScaleSmall = 0.9f;
+        private const float FontSizeScaleNormal = 1.0f;
+        private const float FontSizeScaleLarge = 1.1f;
+        private const float FontSizeScaleHuge = 1.9f;
+        private const float FontSizeScaleGiant = 2.5f;
+#else   // PROFILE_MOBILE and etc
+        // The following values from 'system-settings/libutil/sstu.c'
+        private const float FontSizeScaleSmall = 0.8f;
+        private const float FontSizeScaleNormal = 1.0f;
+        private const float FontSizeScaleLarge = 1.5f;
+        private const float FontSizeScaleHuge = 1.9f;
+        private const float FontSizeScaleGiant = 2.5f;
+#endif
+
+        /// <summary>
+        /// It returns a float value according to SystemSettingsFontSize.
+        /// The returned value can be used for FontSizeScale property.
+        /// <param name="systemSettingsFontSize">The SystemSettingsFontSize enum value.</param>
+        /// <returns> A float value for FontSizeScale property. </returns>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static float GetFontSizeScale(SystemSettingsFontSize systemSettingsFontSize)
+        {
+            float ret = FontSizeScaleNormal;
+
+            switch (systemSettingsFontSize)
+            {
+                case SystemSettingsFontSize.Small:
+                    ret = FontSizeScaleSmall;
+                    break;
+                case SystemSettingsFontSize.Normal:
+                    ret = FontSizeScaleNormal;
+                    break;
+                case SystemSettingsFontSize.Large:
+                    ret = FontSizeScaleLarge;
+                    break;
+                case SystemSettingsFontSize.Huge:
+                    ret = FontSizeScaleHuge;
+                    break;
+                case SystemSettingsFontSize.Giant:
+                    ret = FontSizeScaleGiant;
+                    break;
+            }
+
+            return ret;
+        }
+
+        /// <summary>
+        /// Copy the previously selected text from the text control into the clipboard.
+        /// </summary>
+        /// <param name="textEditor">The textEditor control from which the text is copied.</param>
+        /// <returns>The copied text.</returns>
+        /// <since_tizen> 9 </since_tizen>
+        public static string CopyToClipboard(TextEditor textEditor)
+        {
+            string copiedText = Interop.TextEditor.CopyText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return copiedText;
+        }
+
+        /// <summary>
+        /// Copy the previously selected text from the text control into the clipboard.
+        /// </summary>
+        /// <param name="textField">The textField control from which the text is copied.</param>
+        /// <returns>The copied text.</returns>
+        /// <since_tizen> 9 </since_tizen>
+        public static string CopyToClipboard(TextField textField)
+        {
+            string copiedText = Interop.TextField.CopyText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return copiedText;
+        }
+
+        /// <summary>
+        /// Cut the previously selected text from the text control into the clipboard.
+        /// </summary>
+        /// <param name="textEditor">The textEditor control from which the text is cut.</param>
+        /// <returns>The cut text.</returns>
+        /// <since_tizen> 9 </since_tizen>
+        public static string CutToClipboard(TextEditor textEditor)
+        {
+            string cutText = Interop.TextEditor.CutText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return cutText;
+        }
+
+        /// <summary>
+        /// Cut the previously selected text from the text control into the clipboard.
+        /// </summary>
+        /// <param name="textField">The textField control from which the text is cut.</param>
+        /// <returns>The cut text.</returns>
+        /// <since_tizen> 9 </since_tizen>
+        public static string CutToClipboard(TextField textField)
+        {
+            string cutText = Interop.TextField.CutText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return cutText;
+        }
+
+        /// <summary>
+        /// Paste the most recently copied/cut text item from the clipboard into the text control.
+        /// </summary>
+        /// <remarks>
+        /// The pasted text will be inserted in the current cursor position and if the text control has no focus,
+        /// the text will be appended to the last cursor position and the text control will gain focus.
+        /// If some text inside the text control is selected, it will be replaced by the pasted text.
+        /// </remarks>
+        /// <param name="textEditor">The textEditor control into which the text is pasted.</param>
+        /// <since_tizen> 9 </since_tizen>
+        public static void PasteTo(TextEditor textEditor)
+        {
+            Interop.TextEditor.PasteText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Paste the most recently copied/cut text item from the clipboard into the text control.
+        /// </summary>
+        /// <remarks>
+        /// The pasted text will be inserted in the current cursor position and if the text control has no focus,
+        /// the text will be appended to the last cursor position and the text control will gain focus.
+        /// If some text inside the text control is selected, it will be replaced by the pasted text.
+        /// </remarks>
+        /// <param name="textField">The textField control into which the text is pasted.</param>
+        /// <since_tizen> 9 </since_tizen>
+        public static void PasteTo(TextField textField)
+        {
+            Interop.TextField.PasteText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+    }
 }