[NUI] Fix LineWrapMode issue
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextEditor.cs
index 9a9b184..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;
@@ -113,7 +118,7 @@ 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
@@ -155,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;
@@ -200,7 +206,7 @@ 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
@@ -329,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;
@@ -359,8 +374,8 @@ 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.
@@ -383,8 +398,8 @@ 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.
@@ -436,6 +451,7 @@ namespace Tizen.NUI.BaseComponents
                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
             }
         }
+        /// <summary>
         /// The Text property.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -1143,12 +1159,12 @@ namespace Tizen.NUI.BaseComponents
         /// The Outline property.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public string Outline
+        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
@@ -1336,7 +1352,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The EnableSelection property.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableSelection
         {
             get
@@ -1359,23 +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> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public Tizen.NUI.PropertyMap Placeholder
         {
             get
@@ -1391,49 +1407,27 @@ 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));
             }
         }
 
     }
 
-}
\ No newline at end of file
+}