Revert "[NUI] Refractor ImfManager to InputMethodContext (#229)" (#243)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextField.cs
index ceae20a..2ef6b2f 100755 (executable)
@@ -1,29 +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.Runtime.InteropServices;
+using System.Globalization;
+using System.ComponentModel;
+
 namespace Tizen.NUI.BaseComponents
 {
-
-    using System;
-    using System.Runtime.InteropServices;
-    using System.Globalization;
     /// <summary>
     /// A control which provides a single line editable text field.
     /// </summary>
+    /// <since_tizen> 3 </since_tizen>
     public class TextField : View
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
@@ -44,6 +48,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Dispose.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         protected override void Dispose(DisposeTypes type)
         {
             if (disposed)
@@ -52,7 +57,7 @@ namespace Tizen.NUI.BaseComponents
                 return;
             }
 
-            if(type == DisposeTypes.Explicit)
+            if (type == DisposeTypes.Explicit)
             {
                 //Called by User
                 //Release your own managed resources here.
@@ -62,15 +67,17 @@ namespace Tizen.NUI.BaseComponents
             //Release your own unmanaged resources here.
             //You should not access any managed member here except static instance.
             //because the execution order of Finalizes is non-deterministic.
-
-            if (_textFieldMaxLengthReachedCallbackDelegate != null)
+            if (this != null)
             {
-                this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
-            }
+                if (_textFieldMaxLengthReachedCallbackDelegate != null)
+                {
+                    this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
+                }
 
-            if (_textFieldTextChangedCallbackDelegate != null)
-            {
-                TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+                if (_textFieldTextChangedCallbackDelegate != null)
+                {
+                    TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+                }
             }
 
             if (swigCPtr.Handle != global::System.IntPtr.Zero)
@@ -89,6 +96,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The TextChanged event arguments.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class TextChangedEventArgs : EventArgs
         {
             private TextField _textField;
@@ -113,6 +121,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The MaxLengthReached event arguments.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class MaxLengthReachedEventArgs : EventArgs
         {
             private TextField _textField;
@@ -278,7 +287,8 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextField_Property_PIXEL_SIZE_get();
             internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SELECTION_get();
             internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextField_Property_PLACEHOLDER_get();
-
+            internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextField_Property_ELLIPSIS_get();
+            internal static readonly int ENABLE_SHIFT_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SHIFT_SELECTION_get();
         }
 
         internal class InputStyle
@@ -312,14 +322,6 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        [Obsolete("Please do not use! this will be deprecated")]
-        public new static TextField DownCast(BaseHandle handle)
-        {
-            TextField ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as TextField;
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         internal TextFieldSignal TextChangedSignal()
         {
             TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_TextChangedSignal(swigCPtr), false);
@@ -348,8 +350,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.
@@ -372,8 +374,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.
@@ -425,6 +427,7 @@ namespace Tizen.NUI.BaseComponents
                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
             }
         }
+        /// <summary>
         /// The Text property.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
@@ -1296,12 +1299,12 @@ namespace Tizen.NUI.BaseComponents
         /// The Outline property.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        public string Outline
+        public PropertyMap Outline
         {
             get
             {
-                string temp;
-                GetProperty(TextField.Property.OUTLINE).Get(out temp);
+                PropertyMap temp = new PropertyMap();
+                GetProperty(TextField.Property.OUTLINE).Get(temp);
                 return temp;
             }
             set
@@ -1367,7 +1370,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// The Enable selection property.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public bool EnableSelection
         {
             get
@@ -1390,23 +1393,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));
         ///
         /// TextField field = new TextField();
         /// field.Placeholder = propertyMap;
         /// </code>
         /// </example>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public Tizen.NUI.PropertyMap Placeholder
         {
             get
@@ -1421,6 +1424,46 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
-    }
+        /// <summary>
+        /// The Ellipsis property.<br />
+        /// Enable or disable the ellipsis.<br />
+        /// Placeholder PropertyMap is used to add ellipsis to placeholder text.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public bool Ellipsis
+        {
+            get
+            {
+                bool temp = false;
+                GetProperty(TextField.Property.ELLIPSIS).Get(out temp);
+                return temp;
+            }
+            set
+            {
+                SetProperty(TextField.Property.ELLIPSIS, new Tizen.NUI.PropertyValue(value));
+            }
+        }
+
+        /// <summary>
+        /// Enables Text selection using Shift key.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public bool EnableShiftSelection
+        {
+            get
+            {
+                // mShiftSelectionFlag( true )
+                bool temp = true;
+                GetProperty(TextField.Property.ENABLE_SHIFT_SELECTION).Get(out temp);
+                return temp;
+            }
+            set
+            {
+                SetProperty(TextField.Property.ENABLE_SHIFT_SELECTION, new Tizen.NUI.PropertyValue(value));
+            }
+        }
 
-}
\ No newline at end of file
+
+
+    }
+}