[NUI] Fix LineWrapMode issue
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextEditor.cs
index 17185e7..e4fd298 100755 (executable)
@@ -1,31 +1,34 @@
-/** 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;
-namespace Tizen.NUI.BaseComponents
-{
 
-    using System;
-    using System.Runtime.InteropServices;
-    using System.Globalization;
+using System;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.ComponentModel;
 
+namespace Tizen.NUI.BaseComponents
+{
     /// <summary>
     /// A control which provides a multi-line editable text editor.
     /// </summary>
+    /// <since_tizen> 3 </since_tizen>
     public class TextEditor : View
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
@@ -46,6 +49,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Dispose.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         protected override void Dispose(DisposeTypes type)
         {
             if (disposed)
@@ -85,6 +89,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the TextChanged signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class TextChangedEventArgs : EventArgs
         {
             private TextEditor _textEditor;
@@ -92,6 +97,7 @@ namespace Tizen.NUI.BaseComponents
             /// <summary>
             /// TextEditor - is the texteditor control which has the text contents changed.
             /// </summary>
+            /// <since_tizen> 3 </since_tizen>
             public TextEditor TextEditor
             {
                 get
@@ -112,8 +118,9 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// An event for the TextChanged signal which can be used to subscribe or unsubscribe the event handler
-        /// provided by the user. The TextChanged signal is emitted when the text changes.<br>
+        /// provided by the user. The TextChanged signal is emitted when the text changes.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandler<TextChangedEventArgs> TextChanged
         {
             add
@@ -153,6 +160,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the ScrollStateChanged signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class ScrollStateChangedEventArgs : EventArgs
         {
             private TextEditor _textEditor;
@@ -161,6 +169,7 @@ namespace Tizen.NUI.BaseComponents
             /// <summary>
             /// TextEditor - is the texteditor control which has the scroll state changed.
             /// </summary>
+            /// <since_tizen> 3 </since_tizen>
             public TextEditor TextEditor
             {
                 get
@@ -176,6 +185,7 @@ namespace Tizen.NUI.BaseComponents
             /// <summary>
             /// ScrollState - is the texteditor control scroll state.
             /// </summary>
+            /// <since_tizen> 3 </since_tizen>
             public ScrollState ScrollState
             {
                 get
@@ -196,8 +206,9 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// Event for the ScrollStateChanged signal which can be used to subscribe or unsubscribe the event handler
-        /// provided by the user. The ScrollStateChanged signal is emitted when the scroll state changes.<br>
+        /// provided by the user. The ScrollStateChanged signal is emitted when the scroll state changes.<br />
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandler<ScrollStateChangedEventArgs> ScrollStateChanged
         {
             add
@@ -313,6 +324,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Creates the TextEditor control.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public TextEditor() : this(NDalicPINVOKE.TextEditor_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -323,7 +335,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 textEditor 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 TextEditor DownCast(BaseHandle handle)
         {
             TextEditor ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as TextEditor;
@@ -353,12 +374,13 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// The TranslatableText property.<br>
-        /// The text can set the SID value.<br>
+        /// The TranslatableText property.<br />
+        /// The text can set the SID value.<br />
         /// </summary>
         /// <exception cref='ArgumentNullException'>
         /// ResourceManager about multilingual is null.
         /// </exception>
+        /// <since_tizen> 4 </since_tizen>
         public string TranslatableText
         {
             get
@@ -376,12 +398,13 @@ namespace Tizen.NUI.BaseComponents
             }
         }
         /// <summary>
-        /// The TranslatablePlaceholderText property.<br>
-        /// The text can set the SID value.<br>
+        /// The TranslatablePlaceholderText property.<br />
+        /// The text can set the SID value.<br />
         /// </summary>
         /// <exception cref='ArgumentNullException'>
         /// ResourceManager about multilingual is null.
         /// </exception>
+        /// <since_tizen> 4 </since_tizen>
         public string TranslatablePlaceholderText
         {
             get
@@ -428,8 +451,10 @@ namespace Tizen.NUI.BaseComponents
                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
             }
         }
+        /// <summary>
         /// The Text property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string Text
         {
             get
@@ -447,6 +472,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The TextColor property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 TextColor
         {
             get
@@ -464,6 +490,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The FontFamily property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string FontFamily
         {
             get
@@ -481,6 +508,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The FontStyle property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap FontStyle
         {
             get
@@ -498,6 +526,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The PointSize property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float PointSize
         {
             get
@@ -515,6 +544,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The HorizontalAlignment property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public HorizontalAlignment HorizontalAlignment
         {
             get
@@ -570,6 +600,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The ScrollThreshold property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float ScrollThreshold
         {
             get
@@ -587,6 +618,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The ScrollSpeed property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float ScrollSpeed
         {
             get
@@ -604,6 +636,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The PrimaryCursorColor property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 PrimaryCursorColor
         {
             get
@@ -621,6 +654,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SecondaryCursorColor property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 SecondaryCursorColor
         {
             get
@@ -638,6 +672,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The EnableCursorBlink property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableCursorBlink
         {
             get
@@ -655,6 +690,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The CursorBlinkInterval property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float CursorBlinkInterval
         {
             get
@@ -672,6 +708,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The CursorBlinkDuration property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float CursorBlinkDuration
         {
             get
@@ -689,6 +726,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The CursorWidth property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public int CursorWidth
         {
             get
@@ -706,6 +744,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The GrabHandleImage property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string GrabHandleImage
         {
             get
@@ -723,6 +762,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The GrabHandlePressedImage property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string GrabHandlePressedImage
         {
             get
@@ -740,6 +780,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandleImageLeft property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandleImageLeft
         {
             get
@@ -757,6 +798,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandleImageRight property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandleImageRight
         {
             get
@@ -774,6 +816,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandlePressedImageLeft property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandlePressedImageLeft
         {
             get
@@ -791,6 +834,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandlePressedImageRight property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandlePressedImageRight
         {
             get
@@ -808,6 +852,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandleMarkerImageLeft property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandleMarkerImageLeft
         {
             get
@@ -825,6 +870,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHandleMarkerImageRight property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap SelectionHandleMarkerImageRight
         {
             get
@@ -842,6 +888,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SelectionHighlightColor property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 SelectionHighlightColor
         {
             get
@@ -859,6 +906,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The DecorationBoundingBox property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Rectangle DecorationBoundingBox
         {
             get
@@ -876,6 +924,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The EnableMarkup property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableMarkup
         {
             get
@@ -893,6 +942,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputColor property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Vector4 InputColor
         {
             get
@@ -910,6 +960,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputFontFamily property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string InputFontFamily
         {
             get
@@ -927,6 +978,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputFontStyle property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap InputFontStyle
         {
             get
@@ -944,6 +996,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputPointSize property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float InputPointSize
         {
             get
@@ -961,6 +1014,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The LineSpacing property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float LineSpacing
         {
             get
@@ -978,6 +1032,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputLineSpacing property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float InputLineSpacing
         {
             get
@@ -995,6 +1050,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Underline property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap Underline
         {
             get
@@ -1012,6 +1068,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputUnderline property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string InputUnderline
         {
             get
@@ -1029,6 +1086,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Shadow property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public PropertyMap Shadow
         {
             get
@@ -1046,6 +1104,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputShadow property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string InputShadow
         {
             get
@@ -1063,6 +1122,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Emboss property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string Emboss
         {
             get
@@ -1080,6 +1140,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputEmboss property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string InputEmboss
         {
             get
@@ -1097,12 +1158,13 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Outline property.
         /// </summary>
-        public string Outline
+        /// <since_tizen> 3 </since_tizen>
+        public PropertyMap Outline
         {
             get
             {
-                string temp;
-                GetProperty(TextEditor.Property.OUTLINE).Get(out temp);
+                PropertyMap temp = new PropertyMap();
+                GetProperty(TextEditor.Property.OUTLINE).Get(temp);
                 return temp;
             }
             set
@@ -1114,6 +1176,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The InputOutline property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string InputOutline
         {
             get
@@ -1131,6 +1194,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SmoothScroll property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool SmoothScroll
         {
             get
@@ -1148,6 +1212,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The SmoothScrollDuration property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float SmoothScrollDuration
         {
             get
@@ -1165,6 +1230,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The EnableScrollBar property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableScrollBar
         {
             get
@@ -1182,6 +1248,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The ScrollBarShowDuration property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float ScrollBarShowDuration
         {
             get
@@ -1199,6 +1266,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The ScrollBarFadeDuration property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float ScrollBarFadeDuration
         {
             get
@@ -1216,6 +1284,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The PixelSize property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public float PixelSize
         {
             get
@@ -1233,6 +1302,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The line count of the text.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public int LineCount
         {
             get
@@ -1246,6 +1316,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The text to display when the TextEditor is empty and inactive.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public string PlaceholderText
         {
             get
@@ -1263,6 +1334,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Placeholder text color.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public Color PlaceholderTextColor
         {
             get
@@ -1280,6 +1352,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The EnableSelection property.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableSelection
         {
             get
@@ -1302,22 +1375,23 @@ namespace Tizen.NUI.BaseComponents
         /// The following example demonstrates how to set the placeholder property.
         /// <code>
         /// PropertyMap propertyMap = new PropertyMap();
-        /// propertyMap.Add("placeholderText", new PropertyValue("Setting Placeholder Text"));
-        /// propertyMap.Add("placeholderTextFocused", new PropertyValue("Setting Placeholder Text Focused"));
-        /// propertyMap.Add("placeholderColor", new PropertyValue(Color.Red));
-        /// propertyMap.Add("placeholderFontFamily", new PropertyValue("Arial"));
-        /// propertyMap.Add("placeholderPointSize", new PropertyValue(12.0f));
+        /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
+        /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
+        /// propertyMap.Add("color", new PropertyValue(Color.Red));
+        /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
+        /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
         ///
         /// PropertyMap fontStyleMap = new PropertyMap();
         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
-        /// propertyMap.Add("placeholderFontStyle", new PropertyValue(fontStyleMap));
+        /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
         ///
         /// TextEditor editor = new TextEditor();
         /// editor.Placeholder = propertyMap;
         /// </code>
         /// </example>
+        /// <since_tizen> 3 </since_tizen>
         public Tizen.NUI.PropertyMap Placeholder
         {
             get
@@ -1333,45 +1407,24 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// The LineWrapMode property.<br>
-        /// The line wrap mode when the text lines over the layout width.<br>
+        /// The LineWrapMode property.<br />
+        /// The line wrap mode when the text lines over the layout width.<br />
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public LineWrapMode LineWrapMode
         {
             get
             {
-                string temp;
+                int temp;
                 if(GetProperty(TextEditor.Property.LINE_WRAP_MODE).Get(out temp) == false)
                 {
                     NUILog.Error("LineWrapMode get error!");
                 }
-                switch (temp)
-                {
-                    case "WRAP_MODE_WORD":
-                    return LineWrapMode.Word;
-                    case "WRAP_MODE_CHARACTER":
-                    return LineWrapMode.Character;
-                    default:
-                    return LineWrapMode.Word;
-                }
+                return (LineWrapMode)temp;
             }
             set
             {
-                string temp = "";
-                switch (value)
-                {
-                    case LineWrapMode.Word:
-                    {
-                        temp = "WRAP_MODE_WORD";
-                        break;
-                    }
-                    case LineWrapMode.Character:
-                    {
-                        temp = "WRAP_MODE_CHARACTER";
-                        break;
-                    }
-                }
-                SetProperty(TextEditor.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp));
+                SetProperty(TextEditor.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)value));
             }
         }