Add HiddenInput for TextField
authorxb.teng <xb.teng@samsung.com>
Wed, 24 May 2017 15:40:12 +0000 (23:40 +0800)
committerxb.teng <xb.teng@samsung.com>
Wed, 24 May 2017 15:43:59 +0000 (23:43 +0800)
Change-Id: I1843c731eae1f223477a49bdac7f4f9f386d7984

src/Tizen.NUI/src/internal/ManualPINVOKE.cs [changed mode: 0644->0755]
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/NUIConstants.cs

old mode 100644 (file)
new mode 100755 (executable)
index 56da23b..6cbe612
@@ -584,5 +584,16 @@ namespace Tizen.NUI
         [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get")]
         public static extern int TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
 
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_MODE_get")]
+        public static extern int HIDDENINPUT_PROPERTY_MODE_get();
+
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get")]
+        public static extern int HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get();
+
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get")]
+        public static extern int HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get();
+
+        [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SHOW_DURATION_get")]
+        public static extern int HIDDENINPUT_PROPERTY_SHOW_DURATION_get();
     }
 }
index f34776c..4e735f5 100755 (executable)
@@ -705,31 +705,69 @@ namespace Tizen.NUI.BaseComponents
                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
             }
 
+            //A Flag to check who called Dispose(). (By User or DisposeQueue)
+            private bool isDisposeQueued = false;
+            //A Flat to check if it is already disposed.
+            protected bool disposed = false;
+
             ~Property()
             {
-                DisposeQueue.Instance.Add(this);
+                if (!isDisposeQueued)
+                {
+                    isDisposeQueued = true;
+                    DisposeQueue.Instance.Add(this);
+                }
             }
 
             public void Dispose()
             {
-                if (!Window.IsInstalled()) {
-                    DisposeQueue.Instance.Add(this);
+                //Throw excpetion if Dispose() is called in separate thread.
+                if (!Window.IsInstalled())
+                {
+                    throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+                }
+
+                if (isDisposeQueued)
+                {
+                    Dispose(DisposeTypes.Implicit);
+                }
+                else
+                {
+                    Dispose(DisposeTypes.Explicit);
+                    System.GC.SuppressFinalize(this);
+                }
+            }
+
+            protected virtual void Dispose(DisposeTypes type)
+            {
+                if (disposed)
+                {
                     return;
                 }
 
-                lock (this)
+                if (type == DisposeTypes.Explicit)
+                {
+                    //Called by User
+                    //Release your own managed resources here.
+                    //You should release all of your own disposable objects here.
+
+                }
+
+                //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 (swigCPtr.Handle != global::System.IntPtr.Zero)
                 {
-                    if (swigCPtr.Handle != global::System.IntPtr.Zero)
+                    if (swigCMemOwn)
                     {
-                        if (swigCMemOwn)
-                        {
-                            swigCMemOwn = false;
-                            NDalicPINVOKE.delete_View_Property(swigCPtr);
-                        }
-                        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+                        swigCMemOwn = false;
+                        NDalicPINVOKE.delete_View_Property(swigCPtr);
                     }
-                    global::System.GC.SuppressFinalize(this);
+                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
                 }
+
+                disposed = true;
             }
 
             internal static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
index fc8bc7f..a2edc24 100755 (executable)
@@ -881,6 +881,44 @@ namespace Tizen.NUI
     }
 
     /// <summary>
+    /// HiddenInput Property.
+    /// </summary>
+    public struct HiddenInputProperty
+    {
+        public static readonly int Mode = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_MODE_get();
+        public static readonly int SubstituteCharacter = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get();
+        public static readonly int SubstituteCount = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get();
+        public static readonly int ShowDuration = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SHOW_DURATION_get();
+    }
+
+    /// <summary>
+    /// The type for HiddenInput mode.
+    /// </summary>
+    public enum HiddenInputModeType
+    {
+        /// <summary>
+        /// Don't hide text.
+        /// </summary>
+        HideNone,
+        /// <summary>
+        /// Hide all the input text.
+        /// </summary>
+        HideAll,
+        /// <summary>
+        /// Hide n characters from start.
+        /// </summary>
+        HideCount,
+        /// <summary>
+        /// Show n characters from start.
+        /// </summary>
+        ShowCount,
+        /// <summary>
+        /// Show last character for the duration(use ShowDuration property to modify duration).
+        /// </summary>
+        ShowLastCharacter
+    }
+
+    /// <summary>
     /// ParentOrigin constants.
     /// </summary>
     public struct ParentOrigin