[NUI] Add TextFit in TextLabel (#898)
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 25 Jun 2019 05:18:52 +0000 (14:18 +0900)
committerGitHub <noreply@github.com>
Tue, 25 Jun 2019 05:18:52 +0000 (14:18 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs

index 3db9091cb4da108057d4733a628fe696083fa9c9..b398f60562f939ebf14dd64b7a36d274959bf187 100755 (executable)
@@ -160,6 +160,10 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_SWIGUpcast")]
             public static extern global::System.IntPtr TextLabel_SWIGUpcast(global::System.IntPtr jarg1);
 
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextLabel_Property_TEXT_FIT_get")]
+            public static extern int TextLabel_Property_TEXT_FIT_get();
+
         }
     }
 }
index a0311d9810e6c23863e49b2b4609888cfb16a9c6..820f38a306e51f123858219e3d0945e5cd712668 100755 (executable)
@@ -505,6 +505,24 @@ namespace Tizen.NUI.BaseComponents
             return temp;
         });
 
+        /// Only for XAML. No need of public API. Make hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty TextFitProperty = BindableProperty.Create(nameof(TextFit), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textLabel = (TextLabel)bindable;
+            if (newValue != null)
+            {
+                Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_FIT, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
+            }
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textLabel = (TextLabel)bindable;
+            PropertyMap temp = new PropertyMap();
+            Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_FIT).Get(temp);
+            return temp;
+        });
+
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
         private string textLabelSid = null;
         private bool systemlangTextFlag = false;
@@ -1211,6 +1229,30 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// The text fit parameters.<br />
+        /// The textFit map contains the following keys :<br />
+        /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
+        /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
+        /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
+        /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
+        /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
+        /// </summary>
+        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PropertyMap TextFit
+        {
+            get
+            {
+                return (PropertyMap)GetValue(TextFitProperty);
+            }
+            set
+            {
+                SetValue(TextFitProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
         /// <summary>
         /// Downcasts a handle to textLabel handle
         /// </summary>
@@ -1315,6 +1357,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get();
             internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
             internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
+            internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get();
         }
     }
 }