[NUI] Reduce code duplication - refactor dispose codes (#1010)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / InputMethodContext.cs
index 11240ed..5d8acd2 100755 (executable)
@@ -22,576 +22,402 @@ using System.ComponentModel;
 namespace Tizen.NUI
 {
     /// <summary>
-    /// Specifically manages the input method framework which enables the virtual or hardware keyboards.
+    /// Specifically manages the input method framework (IMF) that enables the virtual or hardware keyboards.
     /// </summary>
-    /// <since_tizen> 3 </since_tizen>
+    /// <since_tizen> 5 </since_tizen>
     public class InputMethodContext : BaseHandle
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
-        internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
+        private ActivatedEventCallbackType _activatedEventCallback;
+        private EventReceivedEventCallbackType _eventReceivedEventCallback;
+        private StatusChangedEventCallbackType _statusChangedEventCallback;
+        private ResizedEventCallbackType _resizedEventCallback;
+        private LanguageChangedEventCallbackType _languageChangedEventCallback;
+        private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
+        private ContentReceivedCallbackType _contentReceivedEventCallback;
+
+        /// <summary>
+        /// Constructor.<br/>
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public InputMethodContext() : this(Interop.InputMethodContext.InputMethodContext_New(), true)
         {
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
         }
 
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
+        internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(Interop.InputMethodContext.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
         {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
         }
 
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void ActivatedEventCallbackType(IntPtr data);
+        private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
+        private delegate void StatusChangedEventCallbackType(bool statusChanged);
+        private delegate void ResizedEventCallbackType(int resized);
+        private delegate void LanguageChangedEventCallbackType(int languageChanged);
+        private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
+        private delegate void ContentReceivedCallbackType(string content, string description, string mimeType);
+
+        private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
+        private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> _eventReceivedEventHandler;
+        private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
+        private event EventHandler<ResizedEventArgs> _resizedEventHandler;
+        private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
+        private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
+        private event EventHandler<ContentReceivedEventArgs> _contentReceivedEventHandler;
 
         /// <summary>
-        /// Dispose
+        /// InputMethodContext activated.
         /// </summary>
-        /// <param name="type">Dispose Type</param>
-        /// <since_tizen> 3 </since_tizen>
-        /// Please DO NOT use! This will be deprecated!
-        /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void Dispose(DisposeTypes type)
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandler<ActivatedEventArgs> Activated
         {
-            if (disposed)
+            add
             {
-                return;
-            }
+                if (_activatedEventHandler == null)
+                {
+                    _activatedEventCallback = OnActivated;
+                    ActivatedSignal().Connect(_activatedEventCallback);
+                }
 
-            if (type == DisposeTypes.Explicit)
+                _activatedEventHandler += value;
+            }
+            remove
             {
-                //Called by User
-                //Release your own managed resources here.
-                //You should release all of your own disposable objects here.
+                _activatedEventHandler -= value;
 
+                if (_activatedEventHandler == null && _activatedEventCallback != null)
+                {
+                    ActivatedSignal().Disconnect(_activatedEventCallback);
+                }
             }
+        }
 
-            //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 (_keyboardTypeChangedEventCallback != null)
+        /// <summary>
+        /// InputMethodContext event received.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
+        {
+            add
             {
-                KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
-            }
+                if (_eventReceivedEventHandler == null)
+                {
+                    _eventReceivedEventCallback = OnEventReceived;
+                    EventReceivedSignal().Connect(_eventReceivedEventCallback);
+                }
 
-            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+                _eventReceivedEventHandler += value;
+            }
+            remove
             {
-                if (swigCMemOwn)
+                _eventReceivedEventHandler -= value;
+
+                if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
                 {
-                    swigCMemOwn = false;
-                    NDalicManualPINVOKE.delete_InputMethodContext(swigCPtr);
+                    EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
                 }
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
             }
-
-            base.Dispose(type);
         }
 
         /// <summary>
-        /// This structure is used to pass on data from the IMF regarding predictive text.
+        /// InputMethodContext status changed.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public class EventData : global::System.IDisposable
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandler<StatusChangedEventArgs> StatusChanged
         {
-            private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-            /// <summary>
-            /// swigCMemOwn
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected bool swigCMemOwn;
-
-            internal EventData(IntPtr cPtr, bool cMemoryOwn)
+            add
             {
-                swigCMemOwn = cMemoryOwn;
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-            }
+                if (_statusChangedEventHandler == null)
+                {
+                    _statusChangedEventCallback = OnStatusChanged;
+                    StatusChangedSignal().Connect(_statusChangedEventCallback);
+                }
 
-            internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
-            {
-                return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+                _statusChangedEventHandler += value;
             }
+            remove
+            {
+                _statusChangedEventHandler -= value;
 
-            //A Flag to check who called Dispose(). (By User or DisposeQueue)
-            private bool isDisposeQueued = false;
-            /// <summary>
-            /// A Flat to check if it is already disposed.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected bool disposed = false;
+                if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
+                {
+                    StatusChangedSignal().Disconnect(_statusChangedEventCallback);
+                }
+            }
+        }
 
-            /// <summary>
-            /// Dispose.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            ~EventData()
+        /// <summary>
+        /// InputMethodContext resized.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandler<ResizedEventArgs> Resized
+        {
+            add
             {
-                if (!isDisposeQueued)
+                if (_resizedEventHandler == null)
                 {
-                    isDisposeQueued = true;
-                    DisposeQueue.Instance.Add(this);
+                    _resizedEventCallback = OnResized;
+                    ResizedSignal().Connect(_resizedEventCallback);
                 }
-            }
 
-            /// <summary>
-            /// The dispose pattern.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            public void Dispose()
+                _resizedEventHandler += value;
+            }
+            remove
             {
-                //Throw excpetion if Dispose() is called in separate thread.
-                if (!Window.IsInstalled())
+                _resizedEventHandler -= value;
+
+                if (_resizedEventHandler == null && _resizedEventCallback != null)
                 {
-                    throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+                    ResizedSignal().Disconnect(_resizedEventCallback);
                 }
+            }
+        }
 
-                if (isDisposeQueued)
+        /// <summary>
+        /// InputMethodContext language changed.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandler<LanguageChangedEventArgs> LanguageChanged
+        {
+            add
+            {
+                if (_languageChangedEventHandler == null)
                 {
-                    Dispose(DisposeTypes.Implicit);
+                    _languageChangedEventCallback = OnLanguageChanged;
+                    LanguageChangedSignal().Connect(_languageChangedEventCallback);
                 }
-                else
+
+                _languageChangedEventHandler += value;
+            }
+            remove
+            {
+                _languageChangedEventHandler -= value;
+
+                if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
                 {
-                    Dispose(DisposeTypes.Explicit);
-                    System.GC.SuppressFinalize(this);
+                    LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
                 }
             }
+        }
 
-            /// <summary>
-            /// Dispose.
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected virtual void Dispose(DisposeTypes type)
+        /// <summary>
+        /// InputMethodContext keyboard type changed.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
+        {
+            add
             {
-                if (disposed)
+                if (_keyboardTypeChangedEventHandler == null)
                 {
-                    return;
+                    _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
+                    KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
                 }
 
-                if (type == DisposeTypes.Explicit)
-                {
-                    //Called by User
-                    //Release your own managed resources here.
-                    //You should release all of your own disposable objects here.
+                _keyboardTypeChangedEventHandler += value;
+            }
+            remove
+            {
+                _keyboardTypeChangedEventHandler -= value;
 
+                if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
+                {
+                    KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
                 }
+            }
+        }
 
-                //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 != IntPtr.Zero)
+        /// <summary>
+        /// InputMethodContext content received.
+        /// </summary>
+        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<ContentReceivedEventArgs> ContentReceived
+        {
+            add
+            {
+                if (_contentReceivedEventHandler == null)
                 {
-                    if (swigCMemOwn)
-                    {
-                        swigCMemOwn = false;
-                        NDalicManualPINVOKE.delete_InputMethodContext_EventData(swigCPtr);
-                    }
-                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
+                    _contentReceivedEventCallback = OnContentReceived;
+                    ContentReceivedSignal().Connect(_contentReceivedEventCallback);
                 }
 
-                disposed = true;
+                _contentReceivedEventHandler += value;
             }
-
-            internal static EventData GetEventDataFromPtr(IntPtr cPtr)
+            remove
             {
-                EventData ret = new EventData(cPtr, false);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
+                _contentReceivedEventHandler -= value;
+
+                if (_contentReceivedEventHandler == null && _contentReceivedEventCallback != null)
+                {
+                    ContentReceivedSignal().Disconnect(_contentReceivedEventCallback);
+                }
             }
+        }
 
+        /// <summary>
+        /// The direction of the text.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public enum TextDirection
+        {
             /// <summary>
-            /// The default constructor.
+            /// Left to right.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            public EventData() : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_0(), true)
-            {
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            }
-
+            LeftToRight,
             /// <summary>
-            /// The constructor.
+            /// Right to left.
             /// </summary>
-            /// <param name="aEventName">The name of the event from the IMF.</param>
-            /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
-            /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
-            /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
-            /// <since_tizen> 3 </since_tizen>
-            public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
-            {
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            }
-
-            /// <summary>
-            /// The pre-edit or the commit string.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public string PredictiveString
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    string ret = NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
-            /// <summary>
-            /// The name of the event from the IMF.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public InputMethodContext.EventType EventName
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    InputMethodContext.EventType ret = (InputMethodContext.EventType)NDalicManualPINVOKE.InputMethodContext_EventData_eventName_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
-            /// <summary>
-            /// The start position from the current cursor position to start deleting characters.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public int CursorOffset
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    int ret = NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
-            /// <summary>
-            /// The number of characters to delete from the cursorOffset.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public int NumberOfChars
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    int ret = NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
+            RightToLeft
         }
 
         /// <summary>
-        /// Data required by the IMF from the callback.
+        /// Events that are generated by the IMF.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public class CallbackData : global::System.IDisposable
+        /// <since_tizen> 5 </since_tizen>
+        public enum EventType
         {
-            private global::System.Runtime.InteropServices.HandleRef swigCPtr;
             /// <summary>
-            /// swigCMemOwn
-            /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected bool swigCMemOwn;
-
-            internal IntPtr GetCallbackDataPtr()
-            {
-                return (IntPtr)swigCPtr;
-            }
-
-            internal CallbackData(IntPtr cPtr, bool cMemoryOwn)
-            {
-                swigCMemOwn = cMemoryOwn;
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-            }
-
-            internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CallbackData obj)
-            {
-                return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-            }
-
-            //A Flag to check who called Dispose(). (By User or DisposeQueue)
-            private bool isDisposeQueued = false;
-            /// <summary>
-            /// A Flat to check if it is already disposed.
+            /// No event.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected bool disposed = false;
-
-
+            /// <since_tizen> 5 </since_tizen>
+            Void,
             /// <summary>
-            /// Dispose.
+            /// Pre-edit changed.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            ~CallbackData()
-            {
-                if (!isDisposeQueued)
-                {
-                    isDisposeQueued = true;
-                    DisposeQueue.Instance.Add(this);
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            Preedit,
             /// <summary>
-            /// The dispose pattern.
+            /// Commit received.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            public void Dispose()
-            {
-                //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);
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            Commit,
             /// <summary>
-            /// Dispose.
+            /// An event to delete a range of characters from the string.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            protected virtual void Dispose(DisposeTypes type)
-            {
-                if (disposed)
-                {
-                    return;
-                }
-
-                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 != IntPtr.Zero)
-                {
-                    if (swigCMemOwn)
-                    {
-                        swigCMemOwn = false;
-                        NDalicManualPINVOKE.delete_InputMethodContext_CallbackData(swigCPtr);
-                    }
-                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
-                }
-
-                disposed = true;
-            }
-
-            internal static CallbackData GetCallbackDataFromPtr(IntPtr cPtr)
-            {
-                CallbackData ret = new CallbackData(cPtr, false);
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                return ret;
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            DeleteSurrounding,
             /// <summary>
-            /// The default constructor.
+            /// An event to query string and the cursor position.
             /// </summary>
-            /// <since_tizen> 3 </since_tizen>
-            public CallbackData() : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_0(), true)
-            {
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            GetSurrounding,
             /// <summary>
-            /// The constructor.
+            /// Private command sent from the input panel.
             /// </summary>
-            /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
-            /// <param name="aCursorPosition">The new position of the cursor.</param>
-            /// <param name="aCurrentText">The current text string.</param>
-            /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
-            /// <since_tizen> 3 </since_tizen>
-            public CallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
-            {
-                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            }
+            /// <since_tizen> 5 </since_tizen>
+            PrivateCommand
+        }
 
+        /// <summary>
+        /// Enumeration for the state of the input panel.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public enum State
+        {
             /// <summary>
-            /// The current text string.
+            /// Unknown state.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public string CurrentText
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    string ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            Default = 0,
             /// <summary>
-            /// The current text string.
+            /// Input panel is shown.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public int CursorPosition
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    int ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            Show,
             /// <summary>
-            /// If the cursor position needs to be updated.
+            /// Input panel is hidden.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public bool Update
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_CallbackData_update_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_update_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            Hide,
             /// <summary>
-            /// Flags if preedit reset is required.
+            /// Input panel in process of being shown.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public bool PreeditResetRequired
-            {
-                set
-                {
-                    NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_set(swigCPtr, value);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                }
-                get
-                {
-                    bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_get(swigCPtr);
-                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    return ret;
-                }
-            }
-
+            /// <since_tizen> 5 </since_tizen>
+            WillShow
         }
 
         /// <summary>
-        /// Destroy the context of the IMF.<br/>
+        /// Enumeration for the types of keyboard.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        public void DestroyContext()
+        public enum KeyboardType
         {
-            NDalicManualPINVOKE.InputMethodContext_Finalize(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            /// <summary>
+            /// Software keyboard (virtual keyboard) is default.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            SoftwareKeyboard,
+            /// <summary>
+            /// Hardware keyboard.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            HardwareKeyboard
         }
 
         /// <summary>
-        /// Destroy the context of the IMF.<br/>
+        /// Gets or sets whether the IM context allows to use the text prediction.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.InputMethodContext.Instance.DestroyContext()!
-        [Obsolete("Please do not use! This will be deprecated! Please use InputMethodContext.Instance.DestroyContext() instead!")]
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void Finalize()
+        public bool TextPrediction
         {
-            DestroyContext();
+            get
+            {
+                return IsTextPredictionAllowed();
+            }
+            set
+            {
+                AllowTextPrediction(value);
+            }
         }
 
         /// <summary>
-        /// Constructor.<br/>
+        /// Destroys the context of the IMF.<br/>
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        public InputMethodContext () : this (NDalicManualPINVOKE.InputMethodContext_New(), true) {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-        }
-  
-        internal InputMethodContext(InputMethodContext inputMethodContext) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(InputMethodContext.getCPtr(inputMethodContext)), true) {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        internal InputMethodContext Assign(InputMethodContext inputMethodContext) {
-            InputMethodContext ret = new InputMethodContext(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        internal static InputMethodContext DownCast(BaseHandle handle) {
-            InputMethodContext ret = new InputMethodContext(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
+        public void DestroyContext()
+        {
+            Interop.InputMethodContext.InputMethodContext_Finalize(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
         }
 
         /// <summary>
         /// Activates the IMF.<br/>
-        /// It means that the text editing is started somewhere.<br/>
-        /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
+        /// It means that the text editing has started.<br/>
+        /// If the hardware keyboard is not connected, then it shows the virtual keyboard.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void Activate()
         {
-            NDalicManualPINVOKE.InputMethodContext_Activate(swigCPtr);
+            Interop.InputMethodContext.InputMethodContext_Activate(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
         /// Deactivates the IMF.<br/>
-        /// It means that the text editing is finished somewhere.
+        /// It means that the text editing is complete.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void Deactivate()
         {
-            NDalicManualPINVOKE.InputMethodContext_Deactivate(swigCPtr);
+            Interop.InputMethodContext.InputMethodContext_Deactivate(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
-        /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
-        /// If true, then the keyboard will be restored (activated) after focus is regained.
+        /// Gets the restoration status, which controls if the keyboard is restored after the focus is lost and then regained.<br/>
+        /// If true, then the keyboard will be restored (activated) after the focus is regained.
         /// </summary>
         /// <returns>The restoration status.</returns>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public bool RestoreAfterFocusLost()
         {
-            bool ret = NDalicManualPINVOKE.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
+            bool ret = Interop.InputMethodContext.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -599,31 +425,31 @@ namespace Tizen.NUI
         /// <summary>
         /// Sets the status whether the IMF has to restore the keyboard after losing focus.
         /// </summary>
-        /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
-        /// <since_tizen> 3 </since_tizen>
+        /// <param name="toggle">True means that keyboard must be restored after the focus is lost and regained.</param>
+        /// <since_tizen> 5 </since_tizen>
         public void SetRestoreAfterFocusLost(bool toggle)
         {
-            NDalicManualPINVOKE.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
+            Interop.InputMethodContext.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
-        /// Sends a message reset to the preedit state or the IMF module.
+        /// Sends a message reset to the pre-edit state or the IMF module.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public new void Reset()
         {
-            NDalicManualPINVOKE.InputMethodContext_Reset(swigCPtr);
+            Interop.InputMethodContext.InputMethodContext_Reset(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
-        /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
+        /// Notifies the IMF context that the cursor position has changed, required for features such as auto-capitalization.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void NotifyCursorPosition()
         {
-            NDalicManualPINVOKE.InputMethodContext_NotifyCursorPosition(swigCPtr);
+            Interop.InputMethodContext.InputMethodContext_NotifyCursorPosition(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -631,10 +457,10 @@ namespace Tizen.NUI
         /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
         /// </summary>
         /// <param name="cursorPosition">The position of the cursor.</param>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void SetCursorPosition(uint cursorPosition)
         {
-            NDalicManualPINVOKE.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
+            Interop.InputMethodContext.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -642,10 +468,10 @@ namespace Tizen.NUI
         /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
         /// </summary>
         /// <returns>The current position of the cursor.</returns>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public uint GetCursorPosition()
         {
-            uint ret = NDalicManualPINVOKE.InputMethodContext_GetCursorPosition(swigCPtr);
+            uint ret = Interop.InputMethodContext.InputMethodContext_GetCursorPosition(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -654,10 +480,10 @@ namespace Tizen.NUI
         /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
         /// </summary>
         /// <param name="text">The text string surrounding the current cursor point.</param>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void SetSurroundingText(string text)
         {
-            NDalicManualPINVOKE.InputMethodContext_SetSurroundingText(swigCPtr, text);
+            Interop.InputMethodContext.InputMethodContext_SetSurroundingText(swigCPtr, text);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
@@ -665,10 +491,10 @@ namespace Tizen.NUI
         /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
         /// </summary>
         /// <returns>The surrounding text.</returns>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public string GetSurroundingText()
         {
-            string ret = NDalicManualPINVOKE.InputMethodContext_GetSurroundingText(swigCPtr);
+            string ret = Interop.InputMethodContext.InputMethodContext_GetSurroundingText(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -677,21 +503,21 @@ namespace Tizen.NUI
         /// Notifies the IMF context that text input is set to multiline or not.
         /// </summary>
         /// <param name="multiLine">True if multiline text input is used.</param>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public void NotifyTextInputMultiLine(bool multiLine)
         {
-            NDalicManualPINVOKE.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
+            Interop.InputMethodContext.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
-        /// Returns the text direction of the keyboard's current input language.
+        /// Returns the text direction of the current input language of the keyboard.
         /// </summary>
         /// <returns>The direction of the text.</returns>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 5 </since_tizen>
         public InputMethodContext.TextDirection GetTextDirection()
         {
-            InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)NDalicManualPINVOKE.InputMethodContext_GetTextDirection(swigCPtr);
+            InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)Interop.InputMethodContext.InputMethodContext_GetTextDirection(swigCPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -701,685 +527,943 @@ namespace Tizen.NUI
         /// The position is relative to whether the keyboard is visible or not.<br/>
         /// If the keyboard is not visible, then the position will be off the screen.<br/>
         /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
-        /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
+        /// the values then taken down. So ideally, GetInputMethodArea() must be called after Show().
         /// </summary>
-        /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
-        /// <since_tizen> 3 </since_tizen>
+        /// <returns>Rectangle which is keyboard panel x, y, width, and height.</returns>
+        /// <since_tizen> 5 </since_tizen>
         public Rectangle GetInputMethodArea()
         {
-            Rectangle ret = new Rectangle(NDalicManualPINVOKE.InputMethodContext_GetInputMethodArea(swigCPtr), true);
+            Rectangle ret = new Rectangle(Interop.InputMethodContext.InputMethodContext_GetInputMethodArea(swigCPtr), true);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
-        internal void ApplyOptions(InputMethodOptions options)
+        /// <summary>
+        /// Sets up the input panel specific data.
+        /// </summary>
+        /// <param name="text">The specific data to be set to the input panel.</param>
+        /// <since_tizen> 5 </since_tizen>
+        public void SetInputPanelUserData(string text)
         {
-            NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
+            Interop.InputMethodContext.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
-        /// Sets up the input-panel specific data.
+        /// Gets the specific data of the current active input panel.
         /// </summary>
-        /// <param name="text">The specific data to be set to the input panel.</param>
-        /// <since_tizen> 3 </since_tizen>
-        public void SetInputPanelUserData(string text)
+        /// <param name="text">The specific data to be received from the input panel.</param>
+        /// <since_tizen> 5 </since_tizen>
+        public void GetInputPanelUserData(out string text)
+        {
+            Interop.InputMethodContext.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Gets the state of the current active input panel.
+        /// </summary>
+        /// <returns>The state of the input panel.</returns>
+        /// <since_tizen> 5 </since_tizen>
+        public InputMethodContext.State GetInputPanelState()
+        {
+            InputMethodContext.State ret = (InputMethodContext.State)Interop.InputMethodContext.InputMethodContext_GetInputPanelState(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Sets the return key on the input panel to be visible or invisible.<br/>
+        /// The default value is true.
+        /// </summary>
+        /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
+        /// <since_tizen> 5 </since_tizen>
+        public void SetReturnKeyState(bool visible)
+        {
+            Interop.InputMethodContext.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Enables to show the input panel automatically when focused.
+        /// </summary>
+        /// <param name="enabled">If true, the input panel will be shown when focused.</param>
+        /// <since_tizen> 5 </since_tizen>
+        public void AutoEnableInputPanel(bool enabled)
+        {
+            Interop.InputMethodContext.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Shows the input panel.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void ShowInputPanel()
+        {
+            Interop.InputMethodContext.InputMethodContext_ShowInputPanel(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Hides the input panel.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public void HideInputPanel()
+        {
+            Interop.InputMethodContext.InputMethodContext_HideInputPanel(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Gets the keyboard type.<br/>
+        /// The default keyboard type is SoftwareKeyboard.
+        /// </summary>
+        /// <returns>The keyboard type.</returns>
+        /// <since_tizen> 5 </since_tizen>
+        public InputMethodContext.KeyboardType GetKeyboardType()
+        {
+            InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)Interop.InputMethodContext.InputMethodContext_GetKeyboardType(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Gets the current language locale of the input panel.<br/>
+        /// For example, en_US, en_GB, en_PH, fr_FR, and so on.
+        /// </summary>
+        /// <returns>The current language locale of the input panel.</returns>
+        /// <since_tizen> 5 </since_tizen>
+        public string GetInputPanelLocale()
+        {
+            string ret = Interop.InputMethodContext.InputMethodContext_GetInputPanelLocale(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Sets the allowed MIME Type to deliver to the input panel. <br/>
+        /// For example, string mimeType = "text/plain,image/png,image/gif,application/pdf";
+        /// </summary>
+        /// <param name="mimeType">The allowed MIME type.</param>
+        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetMIMEType(string mimeType)
+        {
+            Interop.InputMethodContext.InputMethodContext_SetMIMEType(swigCPtr, mimeType);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        internal InputMethodContext(InputMethodContext inputMethodContext) : this(Interop.InputMethodContext.new_InputMethodContext__SWIG_1(InputMethodContext.getCPtr(inputMethodContext)), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal InputMethodContext Assign(InputMethodContext inputMethodContext)
+        {
+            InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_Assign(swigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal static InputMethodContext DownCast(BaseHandle handle)
+        {
+            InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal void ApplyOptions(InputMethodOptions options)
+        {
+            Interop.InputMethodContext.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal void AllowTextPrediction(bool prediction)
+        {
+            Interop.InputMethodContext.InputMethodContext_AllowTextPrediction(swigCPtr, prediction);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal bool IsTextPredictionAllowed()
+        {
+            bool ret = Interop.InputMethodContext.InputMethodContext_IsTextPredictionAllowed(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal ActivatedSignalType ActivatedSignal()
+        {
+            ActivatedSignalType ret = new ActivatedSignalType(Interop.InputMethodContext.InputMethodContext_ActivatedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal KeyboardEventSignalType EventReceivedSignal()
+        {
+            KeyboardEventSignalType ret = new KeyboardEventSignalType(Interop.InputMethodContext.InputMethodContext_EventReceivedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal StatusSignalType StatusChangedSignal()
+        {
+            StatusSignalType ret = new StatusSignalType(Interop.InputMethodContext.InputMethodContext_StatusChangedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal KeyboardResizedSignalType ResizedSignal()
+        {
+            KeyboardResizedSignalType ret = new KeyboardResizedSignalType(Interop.InputMethodContext.InputMethodContext_ResizedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal LanguageChangedSignalType LanguageChangedSignal()
+        {
+            LanguageChangedSignalType ret = new LanguageChangedSignalType(Interop.InputMethodContext.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
+        {
+            KeyboardTypeSignalType ret = new KeyboardTypeSignalType(Interop.InputMethodContext.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal ContentReceivedSignalType ContentReceivedSignal()
         {
-            NDalicManualPINVOKE.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
+            ContentReceivedSignalType ret = new ContentReceivedSignalType(Interop.InputMethodContext.InputMethodContext_ContentReceivedSignal(swigCPtr), false);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// You can override it to clean-up your own resources.
+        /// </summary>
+        /// <param name="type">Dispose Type</param>
+        /// <since_tizen> 5 </since_tizen>
+        /// Please do not use! This will be deprecated!
+        /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            //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 (_keyboardTypeChangedEventCallback != null)
+            {
+                KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
+            }
+
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                if (swigCMemOwn)
+                {
+                    swigCMemOwn = false;
+                    Interop.InputMethodContext.delete_InputMethodContext(swigCPtr);
+                }
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
+            }
+
+            base.Dispose(type);
+        }
+
+        private void OnActivated(IntPtr data)
+        {
+            ActivatedEventArgs e = new ActivatedEventArgs();
+
+            if (data != null)
+            {
+                e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
+            }
+
+            if (_activatedEventHandler != null)
+            {
+                _activatedEventHandler(this, e);
+            }
+        }
+
+        private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
+        {
+            CallbackData callbackData = null;
+
+            EventReceivedEventArgs e = new EventReceivedEventArgs();
+
+            if (inputMethodContext != null)
+            {
+                e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
+            }
+            if (eventData != null)
+            {
+                e.EventData = EventData.GetEventDataFromPtr(eventData);
+            }
+
+            if (_eventReceivedEventHandler != null)
+            {
+                callbackData = _eventReceivedEventHandler(this, e);
+            }
+            if (callbackData != null)
+            {
+                return callbackData.GetCallbackDataPtr();
+            }
+            else
+            {
+                return new CallbackData().GetCallbackDataPtr();
+            }
         }
 
-        /// <summary>
-        /// Gets the specific data of the current active input panel.
-        /// </summary>
-        /// <param name="text">The specific data to be received from the input panel.</param>
-        /// <since_tizen> 4 </since_tizen>
-        public void GetInputPanelUserData(out string text)
+        private void OnStatusChanged(bool statusChanged)
         {
-            NDalicManualPINVOKE.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
+            StatusChangedEventArgs e = new StatusChangedEventArgs();
 
-        /// <summary>
-        /// Gets the state of the current active input panel.
-        /// </summary>
-        /// <returns>The state of the input panel.</returns>
-        /// <since_tizen> 3 </since_tizen>
-        public InputMethodContext.State GetInputPanelState()
-        {
-            InputMethodContext.State ret = (InputMethodContext.State)NDalicManualPINVOKE.InputMethodContext_GetInputPanelState(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
+            e.StatusChanged = statusChanged;
 
-        /// <summary>
-        /// Sets the return key on the input panel to be visible or invisible.<br/>
-        /// The default is true.
-        /// </summary>
-        /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
-        /// <since_tizen> 3 </since_tizen>
-        public void SetReturnKeyState(bool visible)
-        {
-            NDalicManualPINVOKE.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (_statusChangedEventHandler != null)
+            {
+                _statusChangedEventHandler(this, e);
+            }
         }
 
-        /// <summary>
-        /// Enables to show the input panel automatically when focused.
-        /// </summary>
-        /// <param name="enabled">If true, the input panel will be shown when focused.</param>
-        /// <since_tizen> 3 </since_tizen>
-        public void AutoEnableInputPanel(bool enabled)
+        private void OnResized(int resized)
         {
-            NDalicManualPINVOKE.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
+            ResizedEventArgs e = new ResizedEventArgs();
+            e.Resized = resized;
 
-        /// <summary>
-        /// Shows the input panel.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public void ShowInputPanel()
-        {
-            NDalicManualPINVOKE.InputMethodContext_ShowInputPanel(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (_resizedEventHandler != null)
+            {
+                _resizedEventHandler(this, e);
+            }
         }
 
-        /// <summary>
-        /// Hides the input panel.
-        /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public void HideInputPanel()
+        private void OnLanguageChanged(int languageChanged)
         {
-            NDalicManualPINVOKE.InputMethodContext_HideInputPanel(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
+            LanguageChangedEventArgs e = new LanguageChangedEventArgs();
+            e.LanguageChanged = languageChanged;
 
-        /// <summary>
-        /// Gets the keyboard type.<br/>
-        /// The default keyboard type is SoftwareKeyboard.
-        /// </summary>
-        /// <returns>The keyboard type.</returns>
-        /// <since_tizen> 4 </since_tizen>
-        public InputMethodContext.KeyboardType GetKeyboardType()
-        {
-            InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)NDalicManualPINVOKE.InputMethodContext_GetKeyboardType(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            if (_languageChangedEventHandler != null)
+            {
+                _languageChangedEventHandler(this, e);
+            }
         }
 
-        /// <summary>
-        /// Gets the current language locale of the input panel.<br/>
-        /// For example, en_US, en_GB, en_PH, fr_FR, ...
-        /// </summary>
-        /// <returns>The current language locale of the input panel.</returns>
-        /// <since_tizen> 4 </since_tizen>
-        public string GetInputPanelLocale()
+        private void OnKeyboardTypeChanged(KeyboardType type)
         {
-            string ret = NDalicManualPINVOKE.InputMethodContext_GetInputPanelLocale(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
+            KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
 
-        internal void AllowTextPrediction(bool prediction)
-        {
-            NDalicManualPINVOKE.InputMethodContext_AllowTextPrediction(swigCPtr, prediction);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
+            e.KeyboardType = type;
 
-        internal bool IsTextPredictionAllowed()
-        {
-            bool ret = NDalicManualPINVOKE.InputMethodContext_IsTextPredictionAllowed(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            if (_keyboardTypeChangedEventHandler != null)
+            {
+                _keyboardTypeChangedEventHandler(this, e);
+            }
         }
 
-        /// <summary>
-        /// Gets/Sets whether the IM context allow to use the text prediction.
-        /// </summary>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool TextPrediction
+        private void OnContentReceived(string content, string description, string mimeType)
         {
-            get
-            {
-                return IsTextPredictionAllowed();
-            }
-            set
+            ContentReceivedEventArgs e = new ContentReceivedEventArgs();
+            e.Content = content;
+            e.Description = description;
+            e.MimeType = mimeType;
+
+            if (_contentReceivedEventHandler != null)
             {
-                AllowTextPrediction(value);
+                _contentReceivedEventHandler(this, e);
             }
         }
 
         /// <summary>
-        /// InputMethodContext activated event arguments.
+        /// This structure is used to pass on data from the IMF regarding predictive text.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class ActivatedEventArgs : EventArgs
+        /// <since_tizen> 5 </since_tizen>
+        public class EventData : global::System.IDisposable
         {
             /// <summary>
-            /// InputMethodContext
+            /// The state if it owns memory
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public InputMethodContext InputMethodContext
+            /// <since_tizen> 5 </since_tizen>
+            protected bool swigCMemOwn;
+
+            /// <summary>
+            /// A flag to check if it is already disposed.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            protected bool disposed = false;
+
+            private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+            //A flag to check who called Dispose(). (By User or DisposeQueue)
+            private bool isDisposeQueued = false;
+
+            /// <summary>
+            /// The default constructor.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public EventData() : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_0(), true)
             {
-                get;
-                set;
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
-        }
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void ActivatedEventCallbackType(IntPtr data);
-        private ActivatedEventCallbackType _activatedEventCallback;
-        private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
+            /// <summary>
+            /// The constructor.
+            /// </summary>
+            /// <param name="aEventName">The name of the event from the IMF.</param>
+            /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
+            /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
+            /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
+            /// <since_tizen> 5 </since_tizen>
+            public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
+            {
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
 
-        /// <summary>
-        /// InputMethodContext activated.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandler<ActivatedEventArgs> Activated
-        {
-            add
+            internal EventData(IntPtr cPtr, bool cMemoryOwn)
             {
-                if (_activatedEventHandler == null)
+                swigCMemOwn = cMemoryOwn;
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            }
+
+            /// <summary>
+            /// Releases the resource.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            ~EventData()
+            {
+                if (!isDisposeQueued)
                 {
-                    _activatedEventCallback = OnActivated;
-                    ActivatedSignal().Connect(_activatedEventCallback);
+                    isDisposeQueued = true;
+                    DisposeQueue.Instance.Add(this);
                 }
+            }
 
-                _activatedEventHandler += value;
+            /// <summary>
+            /// The pre-edit or the commit string.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public string PredictiveString
+            {
+                set
+                {
+                    Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    string ret = Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
+                }
             }
-            remove
+
+            /// <summary>
+            /// The name of the event from the IMF.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public InputMethodContext.EventType EventName
             {
-                _activatedEventHandler -= value;
+                set
+                {
+                    Interop.InputMethodContext.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    InputMethodContext.EventType ret = (InputMethodContext.EventType)Interop.InputMethodContext.InputMethodContext_EventData_eventName_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
+                }
+            }
 
-                if (_activatedEventHandler == null && _activatedEventCallback != null)
+            /// <summary>
+            /// The start position from the current cursor position to start deleting characters.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public int CursorOffset
+            {
+                set
                 {
-                    ActivatedSignal().Disconnect(_activatedEventCallback);
+                    Interop.InputMethodContext.InputMethodContext_EventData_cursorOffset_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    int ret = Interop.InputMethodContext.InputMethodContext_EventData_cursorOffset_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
                 }
             }
-        }
 
-        private void OnActivated(IntPtr data)
-        {
-            ActivatedEventArgs e = new ActivatedEventArgs();
+            /// <summary>
+            /// The number of characters to delete from the cursorOffset.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public int NumberOfChars
+            {
+                set
+                {
+                    Interop.InputMethodContext.InputMethodContext_EventData_numberOfChars_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    int ret = Interop.InputMethodContext.InputMethodContext_EventData_numberOfChars_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
+                }
+            }
 
-            if (data != null)
+            /// <summary>
+            /// The dispose pattern.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public void Dispose()
             {
-                e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
+                //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);
+                }
             }
 
-            if (_activatedEventHandler != null)
+            internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
             {
-                _activatedEventHandler(this, e);
+                return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
             }
-        }
-
-        internal ActivatedSignalType ActivatedSignal()
-        {
-            ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.InputMethodContext_ActivatedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
 
-        /// <summary>
-        /// InputMethodContext event received event arguments.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class EventReceivedEventArgs : EventArgs
-        {
-            /// <summary>
-            /// InputMethodContext
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public InputMethodContext InputMethodContext
+            internal static EventData GetEventDataFromPtr(IntPtr cPtr)
             {
-                get;
-                set;
+                EventData ret = new EventData(cPtr, false);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
             }
 
             /// <summary>
-            /// EventData
+            /// You can override it to clean-up your own resources.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public EventData EventData
+            /// <since_tizen> 5 </since_tizen>
+            protected virtual void Dispose(DisposeTypes type)
             {
-                get;
-                set;
-            }
-        }
-
-        private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
-        private EventReceivedEventCallbackType _eventReceivedEventCallback;
-        private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> _eventReceivedEventHandler;
+                if (disposed)
+                {
+                    return;
+                }
 
-        /// <summary>
-        /// InputMethodContext event received.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
-        {
-            add
-            {
-                if (_eventReceivedEventHandler == null)
+                if (type == DisposeTypes.Explicit)
                 {
-                    _eventReceivedEventCallback = OnEventReceived;
-                    EventReceivedSignal().Connect(_eventReceivedEventCallback);
+                    //Called by User.
+                    //Release your own managed resources here.
+                    //You should release all of your own disposable objects here.
+
                 }
 
-                _eventReceivedEventHandler += value;
-            }
-            remove
-            {
-                _eventReceivedEventHandler -= value;
+                //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 (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
+                if (swigCPtr.Handle != IntPtr.Zero)
                 {
-                    EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
+                    if (swigCMemOwn)
+                    {
+                        swigCMemOwn = false;
+                        Interop.InputMethodContext.delete_InputMethodContext_EventData(swigCPtr);
+                    }
+                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
                 }
+
+                disposed = true;
             }
         }
 
-        private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
+        /// <summary>
+        /// Data required by the IMF from the callback.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public class CallbackData : global::System.IDisposable
         {
-            CallbackData callbackData = null;
+            /// <summary>
+            /// The state if it owns memory
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            protected bool swigCMemOwn;
 
-            EventReceivedEventArgs e = new EventReceivedEventArgs();
+            /// <summary>
+            /// A Flag to check if it is already disposed.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            protected bool disposed = false;
 
-            if (inputMethodContext != null)
-            {
-                e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
-            }
-            if (eventData != null)
-            {
-                e.EventData = EventData.GetEventDataFromPtr(eventData);
-            }
+            private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
-            if (_eventReceivedEventHandler != null)
-            {
-                callbackData = _eventReceivedEventHandler(this, e);
-            }
-            if (callbackData != null)
+            //A flag to check who called Dispose(). (By User or DisposeQueue)
+            private bool isDisposeQueued = false;
+
+            /// <summary>
+            /// The default constructor.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public CallbackData() : this(Interop.InputMethodContext.new_InputMethodContext_CallbackData__SWIG_0(), true)
             {
-                return callbackData.GetCallbackDataPtr();
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
-            else
+
+            /// <summary>
+            /// The constructor.
+            /// </summary>
+            /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
+            /// <param name="aCursorPosition">The new position of the cursor.</param>
+            /// <param name="aCurrentText">The current text string.</param>
+            /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
+            /// <since_tizen> 5 </since_tizen>
+            public CallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(Interop.InputMethodContext.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
             {
-                return new CallbackData().GetCallbackDataPtr();
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
-        }
-
-        internal KeyboardEventSignalType EventReceivedSignal()
-        {
-            KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
 
-        /// <summary>
-        /// InputMethodContext status changed event arguments.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class StatusChangedEventArgs : EventArgs
-        {
             /// <summary>
-            /// InputMethodContext status
+            /// Releases the resource.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public bool StatusChanged
+            /// <since_tizen> 5 </since_tizen>
+            ~CallbackData()
             {
-                get;
-                set;
+                if (!isDisposeQueued)
+                {
+                    isDisposeQueued = true;
+                    DisposeQueue.Instance.Add(this);
+                }
             }
-        }
-
-        private delegate void StatusChangedEventCallbackType(bool statusChanged);
-        private StatusChangedEventCallbackType _statusChangedEventCallback;
-        private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
 
-        /// <summary>
-        /// InputMethodContext status changed.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandler<StatusChangedEventArgs> StatusChanged
-        {
-            add
+            /// <summary>
+            /// The current text string.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public string CurrentText
             {
-                if (_statusChangedEventHandler == null)
+                set
                 {
-                    _statusChangedEventCallback = OnStatusChanged;
-                    StatusChangedSignal().Connect(_statusChangedEventCallback);
+                    Interop.InputMethodContext.InputMethodContext_CallbackData_currentText_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    string ret = Interop.InputMethodContext.InputMethodContext_CallbackData_currentText_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
                 }
-
-                _statusChangedEventHandler += value;
             }
-            remove
-            {
-                _statusChangedEventHandler -= value;
 
-                if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
+            /// <summary>
+            /// The current cursor position.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public int CursorPosition
+            {
+                set
                 {
-                    StatusChangedSignal().Disconnect(_statusChangedEventCallback);
+                    Interop.InputMethodContext.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    int ret = Interop.InputMethodContext.InputMethodContext_CallbackData_cursorPosition_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
                 }
             }
-        }
-
-        private void OnStatusChanged(bool statusChanged)
-        {
-            StatusChangedEventArgs e = new StatusChangedEventArgs();
-
-            e.StatusChanged = statusChanged;
 
-            if (_statusChangedEventHandler != null)
+            /// <summary>
+            /// The state if the cursor position needs to be updated.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public bool Update
             {
-                _statusChangedEventHandler(this, e);
+                set
+                {
+                    Interop.InputMethodContext.InputMethodContext_CallbackData_update_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    bool ret = Interop.InputMethodContext.InputMethodContext_CallbackData_update_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
+                }
             }
-        }
-
-        internal StatusSignalType StatusChangedSignal()
-        {
-            StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.InputMethodContext_StatusChangedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
 
-        /// <summary>
-        /// InputMethodContext resized event.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class ResizedEventArgs : EventArgs
-        {
             /// <summary>
-            /// resized.
+            /// Flags if the pre-edit reset is required.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public int Resized
+            /// <since_tizen> 5 </since_tizen>
+            public bool PreeditResetRequired
             {
-                get;
-                set;
+                set
+                {
+                    Interop.InputMethodContext.InputMethodContext_CallbackData_preeditResetRequired_set(swigCPtr, value);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                }
+                get
+                {
+                    bool ret = Interop.InputMethodContext.InputMethodContext_CallbackData_preeditResetRequired_get(swigCPtr);
+                    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                    return ret;
+                }
             }
-        }
-
-        private delegate void ResizedEventCallbackType(int resized);
-        private ResizedEventCallbackType _resizedEventCallback;
-        private event EventHandler<ResizedEventArgs> _resizedEventHandler;
 
-        /// <summary>
-        /// InputMethodContext resized.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandler<ResizedEventArgs> Resized
-        {
-            add
+            /// <summary>
+            /// The dispose pattern.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public void Dispose()
             {
-                if (_resizedEventHandler == null)
+                //Throw excpetion if Dispose() is called in separate thread.
+                if (!Window.IsInstalled())
                 {
-                    _resizedEventCallback = OnResized;
-                    ResizedSignal().Connect(_resizedEventCallback);
+                    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);
                 }
-
-                _resizedEventHandler += value;
             }
-            remove
-            {
-                _resizedEventHandler -= value;
 
-                if (_resizedEventHandler == null && _resizedEventCallback != null)
-                {
-                    ResizedSignal().Disconnect(_resizedEventCallback);
-                }
+            internal IntPtr GetCallbackDataPtr()
+            {
+                return (IntPtr)swigCPtr;
             }
-        }
 
-        private void OnResized(int resized)
-        {
-            ResizedEventArgs e = new ResizedEventArgs();
-            e.Resized = resized;
+            internal CallbackData(IntPtr cPtr, bool cMemoryOwn)
+            {
+                swigCMemOwn = cMemoryOwn;
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            }
 
-            if (_resizedEventHandler != null)
+            internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CallbackData obj)
             {
-                _resizedEventHandler(this, e);
+                return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
             }
-        }
 
-        internal KeyboardResizedSignalType ResizedSignal()
-        {
-            KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
+            internal static CallbackData GetCallbackDataFromPtr(IntPtr cPtr)
+            {
+                CallbackData ret = new CallbackData(cPtr, false);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
 
-        /// <summary>
-        /// InputMethodContext language changed event args.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class LanguageChangedEventArgs : EventArgs
-        {
             /// <summary>
-            /// language changed.
+            /// You can override it to clean-up your own resources.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public int LanguageChanged
+            /// <since_tizen> 5 </since_tizen>
+            protected virtual void Dispose(DisposeTypes type)
             {
-                get;
-                set;
-            }
-        }
-
-        private delegate void LanguageChangedEventCallbackType(int languageChanged);
-        private LanguageChangedEventCallbackType _languageChangedEventCallback;
-        private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
+                if (disposed)
+                {
+                    return;
+                }
 
-        /// <summary>
-        /// InputMethodContext language changed.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandler<LanguageChangedEventArgs> LanguageChanged
-        {
-            add
-            {
-                if (_languageChangedEventHandler == null)
+                if (type == DisposeTypes.Explicit)
                 {
-                    _languageChangedEventCallback = OnLanguageChanged;
-                    LanguageChangedSignal().Connect(_languageChangedEventCallback);
+                    //Called by User.
+                    //Release your own managed resources here.
+                    //You should release all of your own disposable objects here.
+
                 }
 
-                _languageChangedEventHandler += value;
-            }
-            remove
-            {
-                _languageChangedEventHandler -= value;
+                //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 (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
+                if (swigCPtr.Handle != IntPtr.Zero)
                 {
-                    LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
+                    if (swigCMemOwn)
+                    {
+                        swigCMemOwn = false;
+                        Interop.InputMethodContext.delete_InputMethodContext_CallbackData(swigCPtr);
+                    }
+                    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
                 }
-            }
-        }
-
-        private void OnLanguageChanged(int languageChanged)
-        {
-            LanguageChangedEventArgs e = new LanguageChangedEventArgs();
-            e.LanguageChanged = languageChanged;
 
-            if (_languageChangedEventHandler != null)
-            {
-                _languageChangedEventHandler(this, e);
+                disposed = true;
             }
         }
 
-        internal LanguageChangedSignalType LanguageChangedSignal()
-        {
-            LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
-        /// InputMethodContext keyboard type changed event arguments.
+        /// InputMethodContext activated event arguments.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public class KeyboardTypeChangedEventArgs : EventArgs
+        /// <since_tizen> 5 </since_tizen>
+        public class ActivatedEventArgs : EventArgs
         {
             /// <summary>
-            /// InputMethodContext keyboard type
+            /// The instance of InputMethodContext
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            public KeyboardType KeyboardType
+            /// <since_tizen> 5 </since_tizen>
+            public InputMethodContext InputMethodContext
             {
                 get;
                 set;
             }
         }
 
-        private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
-        private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
-        private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
-
         /// <summary>
-        /// InputMethodContext keyboard type changed.
+        /// InputMethodContext event receives event arguments.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
+        /// <since_tizen> 5 </since_tizen>
+        public class EventReceivedEventArgs : EventArgs
         {
-            add
+            /// <summary>
+            /// The instance of InputMethodContext
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public InputMethodContext InputMethodContext
             {
-                if (_keyboardTypeChangedEventHandler == null)
-                {
-                    _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
-                    KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
-                }
-
-                _keyboardTypeChangedEventHandler += value;
+                get;
+                set;
             }
-            remove
-            {
-                _keyboardTypeChangedEventHandler -= value;
 
-                if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
-                {
-                    KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
-                }
+            /// <summary>
+            /// The event data of IMF
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public EventData EventData
+            {
+                get;
+                set;
             }
         }
 
-        private void OnKeyboardTypeChanged(KeyboardType type)
+        /// <summary>
+        /// InputMethodContext status changed event arguments.
+        /// </summary>
+        /// <since_tizen> 5 </since_tizen>
+        public class StatusChangedEventArgs : EventArgs
         {
-            KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
-
-            e.KeyboardType = type;
-
-            if (_keyboardTypeChangedEventHandler != null)
+            /// <summary>
+            /// InputMethodContext status.
+            /// </summary>
+            /// <since_tizen> 5 </since_tizen>
+            public bool StatusChanged
             {
-                _keyboardTypeChangedEventHandler(this, e);
+                get;
+                set;
             }
         }
 
-        internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
-        {
-            KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
-        /// The direction of the text.
+        /// InputMethodContext resized event arguments.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public enum TextDirection
+        /// <since_tizen> 5 </since_tizen>
+        public class ResizedEventArgs : EventArgs
         {
             /// <summary>
-            /// Left to right.
-            /// </summary>
-            LeftToRight,
-            /// <summary>
-            /// Right to left.
+            /// The state if the IMF resized.
             /// </summary>
-            RightToLeft
+            /// <since_tizen> 5 </since_tizen>
+            public int Resized
+            {
+                get;
+                set;
+            }
         }
 
         /// <summary>
-        /// Events that are generated by the IMF.
+        /// InputMethodContext language changed event arguments.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public enum EventType
+        /// <since_tizen> 5 </since_tizen>
+        public class LanguageChangedEventArgs : EventArgs
         {
             /// <summary>
-            /// No event.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Void,
-            /// <summary>
-            /// Pre-Edit changed.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Preedit,
-            /// <summary>
-            /// Commit received.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Commit,
-            /// <summary>
-            /// An event to delete a range of characters from the string.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            DeleteSurrounding,
-            /// <summary>
-            /// An event to query string and the cursor position.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            GetSurrounding,
-            /// <summary>
-            /// Private command sent from the input panel.
+            /// Language changed.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            PrivateCommand
+            /// <since_tizen> 5 </since_tizen>
+            public int LanguageChanged
+            {
+                get;
+                set;
+            }
         }
 
         /// <summary>
-        /// Enumeration for the state of the input panel.
+        /// InputMethodContext keyboard type changed event arguments.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public enum State
+        /// <since_tizen> 5 </since_tizen>
+        public class KeyboardTypeChangedEventArgs : EventArgs
         {
             /// <summary>
-            /// Unknown state.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Default = 0,
-            /// <summary>
-            /// Input panel is shown.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Show,
-            /// <summary>
-            /// Input panel is hidden.
-            /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            Hide,
-            /// <summary>
-            /// Input panel in process of being shown.
+            /// InputMethodContext keyboard type.
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            WillShow
+            /// <since_tizen> 5 </since_tizen>
+            public KeyboardType KeyboardType
+            {
+                get;
+                set;
+            }
         }
 
         /// <summary>
-        /// Enumeration for the types of keyboard.
+        /// InputMethodContext content received event arguments.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public enum KeyboardType
+        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public class ContentReceivedEventArgs : EventArgs
         {
             /// <summary>
-            /// Software keyboard (virtual keyboard) is default.
+            /// The content, such as images, of input method
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            SoftwareKeyboard,
+            /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public string Content
+            {
+                get;
+                set;
+            }
             /// <summary>
-            /// Hardware keyboard.
+            /// The description of content
             /// </summary>
-            /// <since_tizen> 4 </since_tizen>
-            HardwareKeyboard
+            /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public string Description
+            {
+                get;
+                set;
+            }
+            /// <summary>
+            /// The mime type of content, such as jpg, png, and so on
+            /// </summary>
+            /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public string MimeType
+            {
+                get;
+                set;
+            }
         }
     }
 }