[NUI] Fix LineWrapMode issue
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
index 4abad84..6ddfd6b 100755 (executable)
@@ -1,30 +1,33 @@
-/** Copyright (c) 2017 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
+/*
+ * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 extern alias TizenSystemSettings;
 using TizenSystemSettings.Tizen.System;
 using System;
 using System.Globalization;
+using System.ComponentModel;
 namespace Tizen.NUI.BaseComponents
 {
 
     /// <summary>
-    /// A control which renders a short text string.<br>
-    /// Text labels are lightweight, non-editable and do not respond to user input.<br>
+    /// A control which renders a short text string.<br />
+    /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
     /// </summary>
+    /// <since_tizen> 3 </since_tizen>
     public class TextLabel : View
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
@@ -41,8 +44,9 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Dispose
+        /// Dispose.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         protected override void Dispose(DisposeTypes type)
         {
             if (disposed)
@@ -74,7 +78,7 @@ namespace Tizen.NUI.BaseComponents
             base.Dispose(type);
         }
 
-        internal class Property
+        internal new class Property
         {
             internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextLabel_Property_RENDERING_BACKEND_get();
             internal static readonly int TEXT = NDalicPINVOKE.TextLabel_Property_TEXT_get();
@@ -106,13 +110,13 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int AUTO_SCROLL_LOOP_DELAY = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
             internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextLabel_Property_LINE_COUNT_get();
             internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextLabel_Property_LINE_WRAP_MODE_get();
-            internal static readonly int TEXT_COLOR_ANIMATABLE = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_ANIMATABLE_get();
 
         }
 
         /// <summary>
         /// Creates the TextLabel control.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public TextLabel() : this(NDalicPINVOKE.TextLabel_New__SWIG_0(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -123,6 +127,7 @@ namespace Tizen.NUI.BaseComponents
         /// Creates the TextLabel control.
         /// </summary>
         /// <param name="text">The text to display</param>
+        /// <since_tizen> 3 </since_tizen>
         public TextLabel(string text) : this(NDalicPINVOKE.TextLabel_New__SWIG_1(text), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -133,8 +138,16 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// <summary>
+        /// Downcasts a handle to textLabel handle
+        /// </summary>
+        /// <param name="handle"></param>
+        /// <returns></returns>
+        /// <since_tizen> 3 </since_tizen>
+        /// Please do not use! this will be deprecated!
+        /// Instead please use as keyword.
+        [Obsolete("Please DO NOT use! This will be deprecated, instead please USE as keyword.")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public new static TextLabel DownCast(BaseHandle handle)
         {
             TextLabel ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
@@ -143,12 +156,13 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
         /// <summary>
-        /// TranslatableText property.<br>
-        /// The text can be set SID value.<br>
+        /// The TranslatableText property.<br />
+        /// The text can set the SID value.<br />
         /// </summary>
         /// <exception cref='ArgumentNullException'>
-        /// ResourceManager about multilingual is null
+        /// ResourceManager about multilingual is null.
         /// </exception>
+        /// <since_tizen> 4 </since_tizen>
         public string TranslatableText
         {
             get
@@ -185,9 +199,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Text property.<br>
-        /// The text to display in UTF-8 format.<br>
+        /// The Text property.<br />
+        /// The text to display in the UTF-8 format.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string Text
         {
             get
@@ -203,9 +218,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// FontFamily property.<br>
-        /// The requested font family to use.<br>
+        /// The FontFamily property.<br />
+        /// The requested font family to use.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string FontFamily
         {
             get
@@ -221,9 +237,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// FontStyle property.<br>
-        /// The requested font style to use.<br>
+        /// The FontStyle property.<br />
+        /// The requested font style to use.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap FontStyle
         {
             get
@@ -239,9 +256,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// PointSize property.<br>
-        /// The size of font in points.<br>
+        /// The PointSize property.<br />
+        /// The size of font in points.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float PointSize
         {
             get
@@ -257,9 +275,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// MultiLine property.<br>
-        /// The single-line or multi-line layout option.<br>
+        /// The MultiLine property.<br />
+        /// The single-line or multi-line layout option.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool MultiLine
         {
             get
@@ -275,9 +294,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// HorizontalAlignment property.<br>
-        /// The line horizontal alignment.<br>
+        /// The HorizontalAlignment property.<br />
+        /// The line horizontal alignment.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public HorizontalAlignment HorizontalAlignment
         {
             get
@@ -330,9 +350,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// VerticalAlignment property.<br>
-        /// The line vertical alignment.<br>
+        /// The VerticalAlignment property.<br />
+        /// The line vertical alignment.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public VerticalAlignment VerticalAlignment
         {
             get
@@ -386,9 +407,12 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// TextColor property.<br>
-        /// The color of the text.<br>
+        /// The TextColor property.<br />
+        /// The color of the text.<br />
+        /// Animation framework can be used to change the color of the text when not using mark up.<br />
+        /// Cannot animate the color when text is auto scrolling.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Color TextColor
         {
             get
@@ -404,9 +428,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// ShadowOffset property.<br>
-        /// The drop shadow offset 0 indicates no shadow.<br>
+        /// The ShadowOffset property.<br />
+        /// The drop shadow offset 0 indicates no shadow.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector2 ShadowOffset
         {
             get
@@ -422,9 +447,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// ShadowColor property.<br>
-        /// The color of a drop shadow.<br>
+        /// The ShadowColor property.<br />
+        /// The color of a drop shadow.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 ShadowColor
         {
             get
@@ -440,9 +466,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// UnderlineEnabled property.<br>
-        /// The underline enabled flag.<br>
+        /// The UnderlineEnabled property.<br />
+        /// The underline enabled flag.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool UnderlineEnabled
         {
             get
@@ -458,9 +485,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// UnderlineColor property.<br>
-        /// Overrides the underline height from font metrics.<br>
+        /// The UnderlineColor property.<br />
+        /// Overrides the underline height from font metrics.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 UnderlineColor
         {
             get
@@ -476,9 +504,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// UnderlineHeight property.<br>
-        /// Overrides the underline height from font metrics.<br>
+        /// The UnderlineHeight property.<br />
+        /// Overrides the underline height from font metrics.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float UnderlineHeight
         {
             get
@@ -494,9 +523,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// EnableMarkup property.<br>
-        /// Whether the mark-up processing is enabled.<br>
+        /// The EnableMarkup property.<br />
+        /// Whether the mark-up processing is enabled.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableMarkup
         {
             get
@@ -512,9 +542,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// EnableAutoScroll property.<br>
-        /// Starts or stops auto scrolling.<br>
+        /// The EnableAutoScroll property.<br />
+        /// Starts or stops auto scrolling.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableAutoScroll
         {
             get
@@ -530,9 +561,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// AutoScrollSpeed property.<br>
-        /// Sets the speed of scrolling in pixels per second.<br>
+        /// The AutoScrollSpeed property.<br />
+        /// Sets the speed of scrolling in pixels per second.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public int AutoScrollSpeed
         {
             get
@@ -548,9 +580,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// AutoScrollLoopCount property.<br>
-        /// Number of complete loops when scrolling enabled.<br>
+        /// The AutoScrollLoopCount property.<br />
+        /// Number of complete loops when scrolling enabled.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public int AutoScrollLoopCount
         {
             get
@@ -566,9 +599,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// AutoScrollGap property.<br>
-        /// Gap before scrolling wraps.<br>
+        /// The AutoScrollGap property.<br />
+        /// Gap before scrolling wraps.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float AutoScrollGap
         {
             get
@@ -584,9 +618,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// LineSpacing property.<br>
-        /// The default extra space between lines in points.<br>
+        /// The LineSpacing property.<br />
+        /// The default extra space between lines in points.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float LineSpacing
         {
             get
@@ -602,9 +637,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Underline property.<br>
-        /// The default underline parameters.<br>
+        /// The Underline property.<br />
+        /// The default underline parameters.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap Underline
         {
             get
@@ -620,9 +656,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Shadow property.<br>
-        /// The default shadow parameters.<br>
+        /// The Shadow property.<br />
+        /// The default shadow parameters.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap Shadow
         {
             get
@@ -638,9 +675,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Emboss property.<br>
-        /// The default emboss parameters.<br>
+        /// The Emboss property.<br />
+        /// The default emboss parameters.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string Emboss
         {
             get
@@ -656,15 +694,16 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Outline property.<br>
-        /// The default outline parameters.<br>
+        /// The Outline property.<br />
+        /// The default outline parameters.<br />
         /// </summary>
-        public string Outline
+        /// <since_tizen> 3 </since_tizen>
+        public PropertyMap Outline
         {
             get
             {
-                string temp;
-                GetProperty(TextLabel.Property.OUTLINE).Get(out temp);
+                PropertyMap temp = new PropertyMap();
+                GetProperty(TextLabel.Property.OUTLINE).Get(temp);
                 return temp;
             }
             set
@@ -674,9 +713,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// PixelSize property.<br>
-        /// The size of font in pixels.<br>
+        /// The PixelSize property.<br />
+        /// The size of font in pixels.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float PixelSize
         {
             get
@@ -692,9 +732,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Ellipsis property.<br>
-        /// Enable or disable the ellipsis.<br>
+        /// The Ellipsis property.<br />
+        /// Enable or disable the ellipsis.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool Ellipsis
         {
             get
@@ -710,9 +751,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// AutoScrollLoopDelay property.<br>
-        /// do something.<br>
+        /// The AutoScrollLoopDelay property.<br />
+        /// Do something.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float AutoScrollLoopDelay
         {
             get
@@ -728,9 +770,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// AutoScrollStopMode property.<br>
-        /// do something.<br>
+        /// The AutoScrollStopMode property.<br />
+        /// Do something.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public AutoScrollStopMode AutoScrollStopMode
         {
             get
@@ -757,8 +800,9 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// The line count of text.
+        /// The line count of the text.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public int LineCount
         {
             get
@@ -770,66 +814,25 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// LineWrapMode property.<br>
-        /// line wrap mode when the text lines over layout width.<br>
+        /// The LineWrapMode property.<br />
+        /// line wrap mode when the text lines over layout width.<br />
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public LineWrapMode LineWrapMode
         {
             get
             {
-                string temp;
+                int temp;
                 if(GetProperty(TextLabel.Property.LINE_WRAP_MODE).Get(out temp) == false)
                 {
                     NUILog.Error("LineWrapMode get error!");
                 }
-                switch (temp)
-                {
-                    case "WORD":
-                    return LineWrapMode.Word;
-                    case "CHARACTER":
-                    return LineWrapMode.Character;
-                    default:
-                    return LineWrapMode.Word;
-                }
-            }
-            set
-            {
-                string temp = "";
-                switch (value)
-                {
-                    case LineWrapMode.Word:
-                    {
-                        temp = "WRAP_MODE_WORD";
-                        break;
-                    }
-                    case LineWrapMode.Character:
-                    {
-                        temp = "WRAP_MODE_CHARACTER";
-                        break;
-                    }
-                }
-                SetProperty(TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp));
-            }
-        }
-
-        /// TextColorAnimatable property.<br>
-        /// The color of the text that can be animatated.<br>
-        /// Animation framework can be used to change the color of the text when not using mark up.<br>
-        /// Not possible when text is auto scrolling. <br>
-        /// </summary>
-        public Color TextColorAnimatable
-        {
-            get
-            {
-                Color animatableColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
-                GetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE).Get(animatableColor);
-                return animatableColor;
+                return (LineWrapMode)temp;
             }
             set
             {
-                SetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE, new Tizen.NUI.PropertyValue(value));
+                SetProperty(TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)value));
             }
         }
-
     }
-}
+}
\ No newline at end of file