{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- internal ImfManager(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;
+
+ /// <summary>
+ /// Constructor.<br/>
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public ImfManager() : this(NDalicManualPINVOKE.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(ImfManager obj)
+ internal ImfManager(ImfManager imfManager) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(ImfManager.getCPtr(imfManager)), true)
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- /// <summary>
- /// Gets the singleton of the ImfManager object.
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- public static ImfManager Instance
+ internal ImfManager(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
{
- get
- {
- return new ImfManager();
- }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ActivatedEventCallbackType(IntPtr data);
+ private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
+ private delegate void StatusChangedEventCallbackType(bool statusChanged);
+ private delegate void ResizedEventCallbackType(int resized);
+ private delegate void LanguageChangedEventCallbackType(int languageChanged);
+ private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
+
/// <summary>
- /// Dispose.
+ /// ImfManager 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, ImfManager, TtsPlayer, Window) is not required.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void Dispose(DisposeTypes type)
+ /// <since_tizen> 4 </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>
+ /// ImfManager event received.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> 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.
+ /// ImfManager status changed.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public class ImfEventData : global::System.IDisposable
+ /// <since_tizen> 4 </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 ImfEventData(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(ImfEventData obj)
- {
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ _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;
-
- /// <summary>
- /// Dispose.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ~ImfEventData()
+ remove
{
- if (!isDisposeQueued)
+ _statusChangedEventHandler -= value;
+
+ if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
{
- isDisposeQueued = true;
- DisposeQueue.Instance.Add(this);
+ StatusChangedSignal().Disconnect(_statusChangedEventCallback);
}
}
+ }
- /// <summary>
- /// The dispose pattern.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public void Dispose()
+ /// <summary>
+ /// ImfManager resized.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public event EventHandler<ResizedEventArgs> Resized
+ {
+ add
{
- //Throw excpetion if Dispose() is called in separate thread.
- if (!Window.IsInstalled())
+ if (_resizedEventHandler == null)
{
- throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+ _resizedEventCallback = OnResized;
+ ResizedSignal().Connect(_resizedEventCallback);
}
- if (isDisposeQueued)
- {
- Dispose(DisposeTypes.Implicit);
- }
- else
+ _resizedEventHandler += value;
+ }
+ remove
+ {
+ _resizedEventHandler -= value;
+
+ if (_resizedEventHandler == null && _resizedEventCallback != null)
{
- Dispose(DisposeTypes.Explicit);
- System.GC.SuppressFinalize(this);
+ ResizedSignal().Disconnect(_resizedEventCallback);
}
}
+ }
- /// <summary>
- /// Dispose.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- protected virtual void Dispose(DisposeTypes type)
+ /// <summary>
+ /// ImfManager language changed.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public event EventHandler<LanguageChangedEventArgs> LanguageChanged
+ {
+ add
{
- if (disposed)
+ if (_languageChangedEventHandler == null)
{
- return;
+ _languageChangedEventCallback = OnLanguageChanged;
+ LanguageChangedSignal().Connect(_languageChangedEventCallback);
}
- if (type == DisposeTypes.Explicit)
- {
- //Called by User
- //Release your own managed resources here.
- //You should release all of your own disposable objects here.
+ _languageChangedEventHandler += value;
+ }
+ remove
+ {
+ _languageChangedEventHandler -= value;
+ if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
+ {
+ LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
}
+ }
+ }
- //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>
+ /// ImfManager keyboard type changed.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
+ {
+ add
+ {
+ if (_keyboardTypeChangedEventHandler == null)
{
- if (swigCMemOwn)
- {
- swigCMemOwn = false;
- NDalicManualPINVOKE.delete_InputMethodContext_EventData(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
+ _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
+ KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
}
- disposed = true;
+ _keyboardTypeChangedEventHandler += value;
}
-
- internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
+ remove
{
- ImfEventData ret = new ImfEventData(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ _keyboardTypeChangedEventHandler -= value;
+
+ if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
+ {
+ KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
+ }
}
+ }
+ private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
+ private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
+ private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
+ private event EventHandler<ResizedEventArgs> _resizedEventHandler;
+ private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
+ private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
+
+ /// <summary>
+ /// The direction of the text.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public enum TextDirection
+ {
/// <summary>
- /// The default constructor.
+ /// Left to right.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ImfEventData() : 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 ImfEventData(ImfManager.ImfEvent 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();
- }
+ RightToLeft
+ }
+ /// <summary>
+ /// Events that are generated by the IMF.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public enum ImfEvent
+ {
/// <summary>
- /// The pre-edit or the commit string.
+ /// No event.
/// </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;
- }
- }
-
+ Void,
/// <summary>
- /// The name of the event from the IMF.
+ /// Pre-Edit changed.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public ImfManager.ImfEvent EventName
- {
- set
- {
- NDalicManualPINVOKE.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get
- {
- ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.InputMethodContext_EventData_eventName_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
+ Preedit,
/// <summary>
- /// The start position from the current cursor position to start deleting characters.
+ /// Commit received.
/// </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;
- }
- }
-
+ Commit,
/// <summary>
- /// The number of characters to delete from the cursorOffset.
+ /// An event to delete a range of characters from the string.
/// </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;
- }
- }
-
+ 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.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ PrivateCommand
}
/// <summary>
- /// Data required by the IMF from the callback.
+ /// Enumeration for the state of the input panel.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public class ImfCallbackData : global::System.IDisposable
+ public enum State
{
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- /// <summary>
- /// swigCMemOwn
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- protected bool swigCMemOwn;
-
- internal IntPtr GetImfCallbackDataPtr()
- {
- return (IntPtr)swigCPtr;
- }
-
- internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
- {
- swigCMemOwn = cMemoryOwn;
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- }
-
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData 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.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- protected bool disposed = false;
-
-
- /// <summary>
- /// Dispose.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ~ImfCallbackData()
- {
- if (!isDisposeQueued)
- {
- isDisposeQueued = true;
- DisposeQueue.Instance.Add(this);
- }
- }
-
- /// <summary>
- /// The dispose pattern.
- /// </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);
- }
- }
-
- /// <summary>
- /// Dispose.
- /// </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 ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
- {
- ImfCallbackData ret = new ImfCallbackData(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <summary>
- /// The default constructor.
+ /// Unknown state.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public ImfCallbackData() : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_0(), true)
- {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
+ /// <since_tizen> 4 </since_tizen>
+ Default = 0,
/// <summary>
- /// The constructor.
+ /// Input panel is shown.
/// </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 ImfCallbackData(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> 4 </since_tizen>
+ Show,
/// <summary>
- /// The current text string.
+ /// Input panel is hidden.
/// </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;
- }
- }
-
+ Hide,
/// <summary>
- /// The current text string.
+ /// Input panel in process of being 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;
- }
- }
+ WillShow
+ }
+ /// <summary>
+ /// Enumeration for the types of keyboard.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public enum KeyboardType
+ {
/// <summary>
- /// If the cursor position needs to be updated.
+ /// Software keyboard (virtual keyboard) is default.
/// </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;
- }
- }
-
+ SoftwareKeyboard,
/// <summary>
- /// Flags if preedit reset is required.
+ /// Hardware keyboard.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public bool PreeditResetRequired
+ HardwareKeyboard
+ }
+
+ /// <summary>
+ /// Gets the singleton of the ImfManager object.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public static ImfManager Instance
+ {
+ get
{
- 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;
- }
+ return new ImfManager();
}
+ }
+ /// <summary>
+ /// Retrieves a handle to the instance of the ImfManager.
+ /// </summary>
+ /// <returns>A handle to the ImfManager.</returns>
+ /// <since_tizen> 3 </since_tizen>
+ public static ImfManager Get()
+ {
+ return new ImfManager();
}
/// <summary>
/// </summary>
/// <since_tizen> 4 </since_tizen>
/// Please do not use! This will be deprecated, instead please USE Tizen.NUI.ImfManager.Instance.DestroyContext()!
- #pragma warning disable 0465
+#pragma warning disable 0465
[Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")]
[EditorBrowsable(EditorBrowsableState.Never)]
public void Finalize()
{
DestroyContext();
}
- #pragma warning restore 0465
-
- /// <summary>
- /// Retrieves a handle to the instance of the ImfManager.
- /// </summary>
- /// <returns>A handle to the ImfManager.</returns>
- /// <since_tizen> 3 </since_tizen>
- public static ImfManager Get()
- {
- return new ImfManager();
- }
-
- /// <summary>
- /// Constructor.<br/>
- /// </summary>
- /// <since_tizen> 5 </since_tizen>
- public ImfManager () : this (NDalicManualPINVOKE.InputMethodContext_New(), true) {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- }
-
- internal ImfManager(ImfManager imfManager) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(ImfManager.getCPtr(imfManager)), true) {
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
- internal ImfManager Assign(ImfManager imfManager) {
- ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, ImfManager.getCPtr(imfManager)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal static ImfManager DownCast(BaseHandle handle) {
- ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
+#pragma warning restore 0465
/// <summary>
/// Activates the IMF.<br/>
return ret;
}
- internal void ApplyOptions(InputMethodOptions options)
- {
- NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
-
/// <summary>
/// Sets up the input-panel specific data.
/// </summary>
return ret;
}
- /// <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()
+ /// <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()
+ {
+ string ret = NDalicManualPINVOKE.InputMethodContext_GetInputPanelLocale(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal ImfManager Assign(ImfManager imfManager)
+ {
+ ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, ImfManager.getCPtr(imfManager)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal static ImfManager DownCast(BaseHandle handle)
+ {
+ ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal void ApplyOptions(InputMethodOptions options)
+ {
+ NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj)
+ {
+ 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;
+ }
+
+ internal KeyboardEventSignalType EventReceivedSignal()
+ {
+ KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
+ 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;
+ }
+
+ internal KeyboardResizedSignalType ResizedSignal()
+ {
+ KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal LanguageChangedSignalType LanguageChangedSignal()
+ {
+ LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
+ {
+ KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Dispose.
+ /// </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, ImfManager, TtsPlayer, Window) is not required.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override 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 (_keyboardTypeChangedEventCallback != null)
+ {
+ KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
+ }
+
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ if (swigCMemOwn)
+ {
+ swigCMemOwn = false;
+ NDalicManualPINVOKE.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.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
+ }
+
+ if (_activatedEventHandler != null)
+ {
+ _activatedEventHandler(this, e);
+ }
+ }
+
+ private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
+ {
+ ImfCallbackData imfCallbackData = null;
+
+ EventReceivedEventArgs e = new EventReceivedEventArgs();
+
+ if (imfManager != null)
+ {
+ e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
+ }
+ if (imfEventData != null)
+ {
+ e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
+ }
+
+ if (_eventReceivedEventHandler != null)
+ {
+ imfCallbackData = _eventReceivedEventHandler(this, e);
+ }
+ if (imfCallbackData != null)
+ {
+ return imfCallbackData.GetImfCallbackDataPtr();
+ }
+ else
+ {
+ return new ImfCallbackData().GetImfCallbackDataPtr();
+ }
+ }
+
+ private void OnStatusChanged(bool statusChanged)
+ {
+ StatusChangedEventArgs e = new StatusChangedEventArgs();
+
+ e.StatusChanged = statusChanged;
+
+ if (_statusChangedEventHandler != null)
+ {
+ _statusChangedEventHandler(this, e);
+ }
+ }
+
+ private void OnResized(int resized)
+ {
+ ResizedEventArgs e = new ResizedEventArgs();
+ e.Resized = resized;
+
+ if (_resizedEventHandler != null)
+ {
+ _resizedEventHandler(this, e);
+ }
+ }
+
+ private void OnLanguageChanged(int languageChanged)
+ {
+ LanguageChangedEventArgs e = new LanguageChangedEventArgs();
+ e.LanguageChanged = languageChanged;
+
+ if (_languageChangedEventHandler != null)
+ {
+ _languageChangedEventHandler(this, e);
+ }
+ }
+
+ 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();
+
+ e.KeyboardType = type;
+
+ if (_keyboardTypeChangedEventHandler != null)
+ {
+ _keyboardTypeChangedEventHandler(this, e);
+ }
}
/// <summary>
- /// ImfManager 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> 3 </since_tizen>
+ public class ImfEventData : global::System.IDisposable
{
/// <summary>
- /// ImfManager
+ /// swigCMemOwn
/// </summary>
- /// <since_tizen> 4 </since_tizen>
- public ImfManager ImfManager
- {
- get;
- set;
- }
- }
+ /// <since_tizen> 3 </since_tizen>
+ protected bool swigCMemOwn;
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void ActivatedEventCallbackType(IntPtr data);
- private ActivatedEventCallbackType _activatedEventCallback;
- private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
+ /// <summary>
+ /// A Flat to check if it is already disposed.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool disposed = false;
- /// <summary>
- /// ImfManager activated.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public event EventHandler<ActivatedEventArgs> Activated
- {
- add
+ 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> 3 </since_tizen>
+ public ImfEventData() : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_0(), true)
{
- if (_activatedEventHandler == null)
- {
- _activatedEventCallback = OnActivated;
- ActivatedSignal().Connect(_activatedEventCallback);
- }
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
- _activatedEventHandler += value;
+ /// <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> 3 </since_tizen>
+ public ImfEventData(ImfManager.ImfEvent 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();
}
- remove
+
+ internal ImfEventData(IntPtr cPtr, bool cMemoryOwn)
{
- _activatedEventHandler -= value;
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ }
- if (_activatedEventHandler == null && _activatedEventCallback != null)
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ ~ImfEventData()
+ {
+ if (!isDisposeQueued)
{
- ActivatedSignal().Disconnect(_activatedEventCallback);
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
}
}
- }
-
- private void OnActivated(IntPtr data)
- {
- ActivatedEventArgs e = new ActivatedEventArgs();
- if (data != null)
+ /// <summary>
+ /// The pre-edit or the commit string.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public string PredictiveString
{
- e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
+ 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;
+ }
}
- if (_activatedEventHandler != null)
+ /// <summary>
+ /// The name of the event from the IMF.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public ImfManager.ImfEvent EventName
{
- _activatedEventHandler(this, e);
+ set
+ {
+ NDalicManualPINVOKE.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ get
+ {
+ ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.InputMethodContext_EventData_eventName_get(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
}
- }
- internal ActivatedSignalType ActivatedSignal()
- {
- ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.InputMethodContext_ActivatedSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <summary>
- /// ImfManager event received event arguments.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public class EventReceivedEventArgs : EventArgs
- {
/// <summary>
- /// ImfManager
+ /// The start position from the current cursor position to start deleting characters.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public ImfManager ImfManager
+ public int CursorOffset
{
- get;
- set;
+ 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>
- /// ImfEventData
+ /// The number of characters to delete from the cursorOffset.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public ImfEventData ImfEventData
+ public int NumberOfChars
{
- get;
- set;
+ 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;
+ }
}
- }
- private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
- private EventReceivedEventCallbackType _eventReceivedEventCallback;
- private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
-
- /// <summary>
- /// ImfManager event received.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
- {
- add
+ /// <summary>
+ /// The dispose pattern.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public void Dispose()
{
- if (_eventReceivedEventHandler == null)
+ //Throw excpetion if Dispose() is called in separate thread.
+ if (!Window.IsInstalled())
{
- _eventReceivedEventCallback = OnEventReceived;
- EventReceivedSignal().Connect(_eventReceivedEventCallback);
+ throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
}
- _eventReceivedEventHandler += value;
+ if (isDisposeQueued)
+ {
+ Dispose(DisposeTypes.Implicit);
+ }
+ else
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
+ }
}
- remove
+
+ internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
{
- _eventReceivedEventHandler -= value;
+ ImfEventData ret = new ImfEventData(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ /// <summary>
+ /// Dispose.
+ /// </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.
+
+ }
- if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
+ //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)
{
- EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
+ if (swigCMemOwn)
+ {
+ swigCMemOwn = false;
+ NDalicManualPINVOKE.delete_InputMethodContext_EventData(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
}
+
+ disposed = true;
}
}
- private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
+ /// <summary>
+ /// Data required by the IMF from the callback.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ public class ImfCallbackData : global::System.IDisposable
{
- ImfCallbackData imfCallbackData = null;
+ /// <summary>
+ /// swigCMemOwn
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool swigCMemOwn;
- EventReceivedEventArgs e = new EventReceivedEventArgs();
+ /// <summary>
+ /// A Flat to check if it is already disposed.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ protected bool disposed = false;
- if (imfManager != null)
- {
- e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
- }
- if (imfEventData != null)
+ 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> 3 </since_tizen>
+ public ImfCallbackData() : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_0(), true)
{
- e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- if (_eventReceivedEventHandler != null)
+ /// <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> 3 </since_tizen>
+ public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
{
- imfCallbackData = _eventReceivedEventHandler(this, e);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- if (imfCallbackData != null)
+
+ internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
{
- return imfCallbackData.GetImfCallbackDataPtr();
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
- else
+
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ ~ImfCallbackData()
{
- return new ImfCallbackData().GetImfCallbackDataPtr();
+ if (!isDisposeQueued)
+ {
+ isDisposeQueued = true;
+ DisposeQueue.Instance.Add(this);
+ }
}
- }
-
- internal KeyboardEventSignalType EventReceivedSignal()
- {
- KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- /// <summary>
- /// ImfManager status changed event arguments.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public class StatusChangedEventArgs : EventArgs
- {
/// <summary>
- /// ImfManager status
+ /// The current text string.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public bool StatusChanged
+ public string CurrentText
{
- get;
- set;
+ 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;
+ }
}
- }
-
- private delegate void StatusChangedEventCallbackType(bool statusChanged);
- private StatusChangedEventCallbackType _statusChangedEventCallback;
- private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
- /// <summary>
- /// ImfManager status changed.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public event EventHandler<StatusChangedEventArgs> StatusChanged
- {
- add
+ /// <summary>
+ /// The current text string.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int CursorPosition
{
- if (_statusChangedEventHandler == null)
+ set
{
- _statusChangedEventCallback = OnStatusChanged;
- StatusChangedSignal().Connect(_statusChangedEventCallback);
+ NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
-
- _statusChangedEventHandler += value;
- }
- remove
- {
- _statusChangedEventHandler -= value;
-
- if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
+ get
{
- StatusChangedSignal().Disconnect(_statusChangedEventCallback);
+ int ret = NDalicManualPINVOKE.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>
+ /// If the cursor position needs to be updated.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public bool Update
{
- _statusChangedEventHandler(this, e);
+ 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;
+ }
}
- }
-
- internal StatusSignalType StatusChangedSignal()
- {
- StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.InputMethodContext_StatusChangedSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- /// <summary>
- /// ImfManager resized event.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public class ResizedEventArgs : EventArgs
- {
/// <summary>
- /// resized.
+ /// Flags if preedit reset is required.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public int Resized
+ public bool PreeditResetRequired
{
- get;
- set;
+ 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;
+ }
}
- }
-
- private delegate void ResizedEventCallbackType(int resized);
- private ResizedEventCallbackType _resizedEventCallback;
- private event EventHandler<ResizedEventArgs> _resizedEventHandler;
- /// <summary>
- /// ImfManager resized.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public event EventHandler<ResizedEventArgs> Resized
- {
- add
+ /// <summary>
+ /// The dispose pattern.
+ /// </summary>
+ /// <since_tizen> 3 </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.");
}
- _resizedEventHandler += value;
- }
- remove
- {
- _resizedEventHandler -= value;
-
- if (_resizedEventHandler == null && _resizedEventCallback != null)
+ if (isDisposeQueued)
{
- ResizedSignal().Disconnect(_resizedEventCallback);
+ Dispose(DisposeTypes.Implicit);
+ }
+ else
+ {
+ Dispose(DisposeTypes.Explicit);
+ System.GC.SuppressFinalize(this);
}
}
- }
- private void OnResized(int resized)
- {
- ResizedEventArgs e = new ResizedEventArgs();
- e.Resized = resized;
+ internal IntPtr GetImfCallbackDataPtr()
+ {
+ return (IntPtr)swigCPtr;
+ }
+
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
+ {
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ }
- if (_resizedEventHandler != null)
+ internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
{
- _resizedEventHandler(this, e);
+ ImfCallbackData ret = new ImfCallbackData(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
- }
-
- internal KeyboardResizedSignalType ResizedSignal()
- {
- KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- /// <summary>
- /// ImfManager language changed event args.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- public class LanguageChangedEventArgs : EventArgs
- {
/// <summary>
- /// language changed.
+ /// Dispose.
/// </summary>
- /// <since_tizen> 4 </since_tizen>
- public int LanguageChanged
+ /// <since_tizen> 3 </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>
- /// ImfManager 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;
+ NDalicManualPINVOKE.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>
- /// ImfManager keyboard type changed event arguments.
+ /// ImfManager activated event arguments.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public class KeyboardTypeChangedEventArgs : EventArgs
+ public class ActivatedEventArgs : EventArgs
{
/// <summary>
- /// ImfManager keyboard type
+ /// ImfManager
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public KeyboardType KeyboardType
+ public ImfManager ImfManager
{
get;
set;
}
}
- private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
- private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
- private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
-
/// <summary>
- /// ImfManager keyboard type changed.
+ /// ImfManager event received event arguments.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
+ public class EventReceivedEventArgs : EventArgs
{
- add
- {
- if (_keyboardTypeChangedEventHandler == null)
- {
- _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
- KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
- }
-
- _keyboardTypeChangedEventHandler += value;
- }
- remove
+ /// <summary>
+ /// ImfManager
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public ImfManager ImfManager
{
- _keyboardTypeChangedEventHandler -= value;
-
- if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
- {
- KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
- }
+ get;
+ set;
}
- }
-
- private void OnKeyboardTypeChanged(KeyboardType type)
- {
- KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
-
- e.KeyboardType = type;
- if (_keyboardTypeChangedEventHandler != null)
+ /// <summary>
+ /// ImfEventData
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public ImfEventData ImfEventData
{
- _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.
+ /// ImfManager status changed event arguments.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum TextDirection
+ /// <since_tizen> 4 </since_tizen>
+ public class StatusChangedEventArgs : EventArgs
{
/// <summary>
- /// Left to right.
- /// </summary>
- LeftToRight,
- /// <summary>
- /// Right to left.
+ /// ImfManager status
/// </summary>
- RightToLeft
+ /// <since_tizen> 4 </since_tizen>
+ public bool StatusChanged
+ {
+ get;
+ set;
+ }
}
/// <summary>
- /// Events that are generated by the IMF.
+ /// ImfManager resized event.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum ImfEvent
+ /// <since_tizen> 4 </since_tizen>
+ public class ResizedEventArgs : 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.
+ /// resized.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- PrivateCommand
+ public int Resized
+ {
+ get;
+ set;
+ }
}
/// <summary>
- /// Enumeration for the state of the input panel.
+ /// ImfManager language changed event args.
/// </summary>
- /// <since_tizen> 3 </since_tizen>
- public enum State
+ /// <since_tizen> 4 </since_tizen>
+ public class LanguageChangedEventArgs : 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.
+ /// language changed.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- WillShow
+ public int LanguageChanged
+ {
+ get;
+ set;
+ }
}
/// <summary>
- /// Enumeration for the types of keyboard.
+ /// ImfManager keyboard type changed event arguments.
/// </summary>
/// <since_tizen> 4 </since_tizen>
- public enum KeyboardType
+ public class KeyboardTypeChangedEventArgs : EventArgs
{
/// <summary>
- /// Software keyboard (virtual keyboard) is default.
- /// </summary>
- /// <since_tizen> 4 </since_tizen>
- SoftwareKeyboard,
- /// <summary>
- /// Hardware keyboard.
+ /// ImfManager keyboard type
/// </summary>
/// <since_tizen> 4 </since_tizen>
- HardwareKeyboard
+ public KeyboardType KeyboardType
+ {
+ get;
+ set;
+ }
}
}
}