1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 using System.Runtime.InteropServices;
22 /// Specifically manages the ecore input method framework which enables the virtual or hardware keyboards.
24 public class ImfManager : BaseHandle
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28 internal ImfManager(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ImfManager_SWIGUpcast(cPtr), cMemoryOwn)
30 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
33 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj)
35 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
38 protected override void Dispose(DisposeTypes type)
45 if (type == DisposeTypes.Explicit)
48 //Release your own managed resources here.
49 //You should release all of your own disposable objects here.
53 //Release your own unmanaged resources here.
54 //You should not access any managed member here except static instance.
55 //because the execution order of Finalizes is non-deterministic.
57 if (_keyboardTypeChangedEventCallback != null)
59 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
62 if (_imfManagerLanguageChangedEventCallback != null)
64 LanguageChangedSignal().Disconnect(_imfManagerLanguageChangedEventCallback);
67 if (_imfManagerResizedEventCallback != null)
69 ResizedSignal().Disconnect(_imfManagerResizedEventCallback);
72 if (_imfManagerStatusChangedEventCallback != null)
74 StatusChangedSignal().Disconnect(_imfManagerStatusChangedEventCallback);
77 if (_imfManagerEventReceivedEventCallback != null)
79 EventReceivedSignal().Disconnect(_imfManagerEventReceivedEventCallback);
82 if (_imfManagerActivatedEventCallback != null)
84 ActivatedSignal().Disconnect(_imfManagerActivatedEventCallback);
87 if (swigCPtr.Handle != global::System.IntPtr.Zero)
92 NDalicManualPINVOKE.delete_ImfManager(swigCPtr);
94 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
101 /// This structure is used to pass on data from the IMF regarding predictive text.
103 public class ImfEventData : global::System.IDisposable
105 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
106 protected bool swigCMemOwn;
108 internal ImfEventData(IntPtr cPtr, bool cMemoryOwn)
110 swigCMemOwn = cMemoryOwn;
111 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
114 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
116 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
119 //A Flag to check who called Dispose(). (By User or DisposeQueue)
120 private bool isDisposeQueued = false;
121 //A Flat to check if it is already disposed.
122 protected bool disposed = false;
127 if (!isDisposeQueued)
129 isDisposeQueued = true;
130 DisposeQueue.Instance.Add(this);
135 /// The dispose pattern.
137 public void Dispose()
139 //Throw excpetion if Dispose() is called in separate thread.
140 if (!Window.IsInstalled())
142 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
147 Dispose(DisposeTypes.Implicit);
151 Dispose(DisposeTypes.Explicit);
152 System.GC.SuppressFinalize(this);
156 protected virtual void Dispose(DisposeTypes type)
163 if (type == DisposeTypes.Explicit)
166 //Release your own managed resources here.
167 //You should release all of your own disposable objects here.
171 //Release your own unmanaged resources here.
172 //You should not access any managed member here except static instance.
173 //because the execution order of Finalizes is non-deterministic.
175 if (swigCPtr.Handle != IntPtr.Zero)
180 NDalicManualPINVOKE.delete_ImfManager_ImfEventData(swigCPtr);
182 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
188 internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
190 ImfEventData ret = new ImfEventData(cPtr, false);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// The default constructor.
198 public ImfEventData() : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_0(), true)
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206 /// <param name="aEventName">The name of the event from the IMF.</param>
207 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
208 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
209 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
210 public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216 /// The pre-edit or the commit string.
218 [Obsolete("Please do not use! this will be deprecated")]
219 public string predictiveString
223 NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr);
229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 /// The pre-edit or the commit string.
237 public string PredictiveString
241 NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value);
242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
246 string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr);
247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 /// The name of the event from the IMF.
255 [Obsolete("Please do not use! this will be deprecated")]
256 public ImfManager.ImfEvent eventName
260 NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value);
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr);
266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 /// The name of the event from the IMF.
274 public ImfManager.ImfEvent EventName
278 NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value);
279 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283 ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr);
284 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 /// The start position from the current cursor position to start deleting characters.
292 [Obsolete("Please do not use! this will be deprecated")]
293 public int cursorOffset
297 NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr);
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
309 /// The start position from the current cursor position to start deleting characters.
311 public int CursorOffset
315 NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value);
316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr);
321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 /// The number of characters to delete from the cursorOffset.
329 [Obsolete("Please do not use! this will be deprecated")]
330 public int numberOfChars
334 NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value);
335 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr);
340 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346 /// The number of characters to delete from the cursorOffset.
348 public int NumberOfChars
352 NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value);
353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
366 /// Data required by the IMF from the callback.
368 public class ImfCallbackData : global::System.IDisposable
370 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
371 protected bool swigCMemOwn;
373 internal IntPtr GetImfCallbackDataPtr()
375 return (IntPtr)swigCPtr;
378 internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
380 swigCMemOwn = cMemoryOwn;
381 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
384 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
386 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
389 //A Flag to check who called Dispose(). (By User or DisposeQueue)
390 private bool isDisposeQueued = false;
391 //A Flat to check if it is already disposed.
392 protected bool disposed = false;
397 if (!isDisposeQueued)
399 isDisposeQueued = true;
400 DisposeQueue.Instance.Add(this);
405 /// The dispose pattern.
407 public void Dispose()
409 //Throw excpetion if Dispose() is called in separate thread.
410 if (!Window.IsInstalled())
412 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
417 Dispose(DisposeTypes.Implicit);
421 Dispose(DisposeTypes.Explicit);
422 System.GC.SuppressFinalize(this);
426 protected virtual void Dispose(DisposeTypes type)
433 if (type == DisposeTypes.Explicit)
436 //Release your own managed resources here.
437 //You should release all of your own disposable objects here.
441 //Release your own unmanaged resources here.
442 //You should not access any managed member here except static instance.
443 //because the execution order of Finalizes is non-deterministic.
445 if (swigCPtr.Handle != IntPtr.Zero)
450 NDalicManualPINVOKE.delete_ImfManager_ImfCallbackData(swigCPtr);
452 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
458 internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
460 ImfCallbackData ret = new ImfCallbackData(cPtr, false);
461 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466 /// The default constructor.
468 public ImfCallbackData() : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_0(), true)
470 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
477 /// <param name="aCursorPosition">The new position of the cursor.</param>
478 /// <param name="aCurrentText">The current text string.</param>
479 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
480 public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
482 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 /// The current text string.
488 [Obsolete("Please do not use! this will be deprecated")]
489 public string currentText
493 NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value);
494 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498 string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr);
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505 /// The current text string.
507 public string CurrentText
511 NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value);
512 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516 string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr);
517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 /// The current text string.
525 [Obsolete("Please do not use! this will be deprecated")]
526 public int cursorPosition
530 NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value);
531 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535 int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 /// The current text string.
544 public int CursorPosition
548 NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value);
549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
553 int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr);
554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 /// If the cursor position needs to be updated.
562 [Obsolete("Please do not use! this will be deprecated")]
567 NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value);
568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr);
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579 /// If the cursor position needs to be updated.
585 NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value);
586 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr);
591 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// Flags if preedit reset is required.
599 [Obsolete("Please do not use! this will be deprecated")]
600 public bool preeditResetRequired
604 NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value);
605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr);
610 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616 /// Flags if preedit reset is required.
618 public bool PreeditResetRequired
622 NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value);
623 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr);
628 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 /// Retrieves a handle to the instance of the ImfManager.
638 /// <returns>A handle to the ImfManager.</returns>
639 public static ImfManager Get()
641 ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 /// Activates the IMF.<br/>
648 /// It means that the text editing is started somewhere.<br/>
649 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
651 public void Activate()
653 NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 /// Deactivates the IMF.<br/>
659 /// It means that the text editing is finished somewhere.
661 public void Deactivate()
663 NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
664 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
668 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
669 /// If true, then the keyboard will be restored (activated) after focus is regained.
671 /// <returns>The restoration status.</returns>
672 public bool RestoreAfterFocusLost()
674 bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
682 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
683 public void SetRestoreAfterFocusLost(bool toggle)
685 NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
690 /// Sends a message reset to the preedit state or the IMF module.
692 public new void Reset()
694 NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
699 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
701 public void NotifyCursorPosition()
703 NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
708 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
710 /// <param name="cursorPosition">The position of the cursor.</param>
711 public void SetCursorPosition(uint cursorPosition)
713 NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
720 /// <returns>The current position of the cursor.</returns>
721 public uint GetCursorPosition()
723 uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
724 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
729 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
731 /// <param name="text">The text string surrounding the current cursor point.</param>
732 public void SetSurroundingText(string text)
734 NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
735 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
741 /// <returns>The surrounding text.</returns>
742 public string GetSurroundingText()
744 string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 /// Notifies the IMF context that text input is set to multiline or not.
752 /// <param name="multiLine">True if multiline text input is used.</param>
753 public void NotifyTextInputMultiLine(bool multiLine)
755 NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 /// Returns the text direction of the keyboard's current input language.
762 /// <returns>The direction of the text.</returns>
763 public ImfManager.TextDirection GetTextDirection()
765 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 /// Provides the size and the position of the keyboard.<br/>
772 /// The position is relative to whether the keyboard is visible or not.<br/>
773 /// If the keyboard is not visible, then the position will be off the screen.<br/>
774 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
775 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
777 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
778 public Rectangle GetInputMethodArea()
780 Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
781 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785 internal void ApplyOptions(InputMethodOptions options)
787 NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
788 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
792 /// Sets up the input-panel specific data.
794 /// <param name="text">The specific data to be set to the input panel.</param>
795 public void SetInputPanelUserData(string text)
797 NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
802 /// Gets the specific data of the current active input panel.
804 /// <param name="text">The specific data to be received from the input panel.</param>
805 public void GetInputPanelUserData(out string text)
807 NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 /// Gets the state of the current active input panel.
814 /// <returns>The state of the input panel.</returns>
815 public ImfManager.State GetInputPanelState()
817 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
823 /// Sets the return key on the input panel to be visible or invisible.<br/>
824 /// The default is true.
826 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
827 public void SetReturnKeyState(bool visible)
829 NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
834 /// Enables to show the input panel automatically when focused.
836 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
837 public void AutoEnableInputPanel(bool enabled)
839 NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
840 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
844 /// Shows the input panel.
846 public void ShowInputPanel()
848 NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
849 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
853 /// Hides the input panel.
855 public void HideInputPanel()
857 NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
862 /// Gets the keyboard type.<br/>
863 /// The default keyboard type is SoftwareKeyboard.
865 /// <returns>The keyboard type.</returns>
866 public ImfManager.KeyboardType GetKeyboardType()
868 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
869 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
874 /// Gets the current language locale of the input panel.<br/>
875 /// For example, en_US, en_GB, en_PH, fr_FR, ...
877 /// <returns>The current language locale of the input panel.</returns>
878 public string GetInputPanelLocale()
880 string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
881 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
888 public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
894 /// ImfManager activated event arguments.
896 [Obsolete("Please do not use! this will be deprecated")]
897 public class ImfManagerActivatedEventArgs : EventArgs
899 public ImfManager ImfManager
906 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
907 private delegate void ImfManagerActivatedEventCallbackType(global::System.IntPtr data);
908 private ImfManagerActivatedEventCallbackType _imfManagerActivatedEventCallback;
909 private event EventHandler<ImfManagerActivatedEventArgs> _imfManagerActivatedEventHandler;
912 /// ImfManager activated event.
914 [Obsolete("Please do not use! this will be deprecated")]
915 public event EventHandler<ImfManagerActivatedEventArgs> ImfManagerActivated
919 if (_imfManagerActivatedEventHandler == null)
921 _imfManagerActivatedEventCallback = OnImfManagerActivated;
922 ActivatedSignal().Connect(_imfManagerActivatedEventCallback);
925 _imfManagerActivatedEventHandler += value;
929 _imfManagerActivatedEventHandler -= value;
931 if (_imfManagerActivatedEventHandler == null && _imfManagerActivatedEventCallback != null)
933 ActivatedSignal().Disconnect(_imfManagerActivatedEventCallback);
938 private void OnImfManagerActivated(global::System.IntPtr data)
940 ImfManagerActivatedEventArgs e = new ImfManagerActivatedEventArgs();
944 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
947 if (_imfManagerActivatedEventHandler != null)
949 _imfManagerActivatedEventHandler(this, e);
954 /// ImfManager activated event arguments.
956 public class ActivatedEventArgs : EventArgs
958 public ImfManager ImfManager
965 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
966 private delegate void ActivatedEventCallbackType(IntPtr data);
967 private ActivatedEventCallbackType _activatedEventCallback;
968 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
971 /// ImfManager activated.
973 public event EventHandler<ActivatedEventArgs> Activated
977 if (_activatedEventHandler == null)
979 _activatedEventCallback = OnActivated;
980 ActivatedSignal().Connect(_activatedEventCallback);
983 _activatedEventHandler += value;
987 _activatedEventHandler -= value;
989 if (_activatedEventHandler == null && _activatedEventCallback != null)
991 ActivatedSignal().Disconnect(_activatedEventCallback);
996 private void OnActivated(IntPtr data)
998 ActivatedEventArgs e = new ActivatedEventArgs();
1002 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
1005 if (_activatedEventHandler != null)
1007 _activatedEventHandler(this, e);
1012 /// ImfManager activated signal.
1014 [Obsolete("Please do not use! this will be internal")]
1015 public ActivatedSignalType ActivatedSignal()
1017 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
1018 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023 /// ImfManager event received event arguments.
1025 [Obsolete("Please do not use! this will be deprecated")]
1026 public class ImfManagerEventReceivedEventArgs : EventArgs
1028 public ImfManager ImfManager
1035 private delegate void ImfManagerEventReceivedEventCallbackType(global::System.IntPtr data);
1036 private ImfManagerEventReceivedEventCallbackType _imfManagerEventReceivedEventCallback;
1037 private event EventHandler<ImfManagerEventReceivedEventArgs> _imfManagerEventReceivedEventHandler;
1040 /// ImfManager event received.
1042 [Obsolete("Please do not use! this will be deprecated")]
1043 public event EventHandler<ImfManagerEventReceivedEventArgs> ImfManagerEventReceived
1047 if (_imfManagerEventReceivedEventHandler == null)
1049 _imfManagerEventReceivedEventCallback = OnImfManagerEventReceived;
1050 EventReceivedSignal().Connect(_imfManagerEventReceivedEventCallback);
1053 _imfManagerEventReceivedEventHandler += value;
1057 _imfManagerEventReceivedEventHandler -= value;
1059 if (_imfManagerEventReceivedEventHandler == null && _imfManagerEventReceivedEventCallback != null)
1061 EventReceivedSignal().Disconnect(_imfManagerEventReceivedEventCallback);
1066 private void OnImfManagerEventReceived(global::System.IntPtr data)
1068 ImfManagerEventReceivedEventArgs e = new ImfManagerEventReceivedEventArgs();
1072 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
1075 if (_imfManagerEventReceivedEventHandler != null)
1077 _imfManagerEventReceivedEventHandler(this, e);
1082 /// ImfManager event received event arguments.
1084 public class EventReceivedEventArgs : EventArgs
1086 public ImfManager ImfManager
1092 public ImfEventData ImfEventData
1099 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
1100 private EventReceivedEventCallbackType _eventReceivedEventCallback;
1101 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
1104 /// ImfManager event received.
1106 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
1110 if (_eventReceivedEventHandler == null)
1112 _eventReceivedEventCallback = OnEventReceived;
1113 EventReceivedSignal().Connect(_eventReceivedEventCallback);
1116 _eventReceivedEventHandler += value;
1120 _eventReceivedEventHandler -= value;
1122 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
1124 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
1129 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
1131 ImfCallbackData imfCallbackData = null;
1133 EventReceivedEventArgs e = new EventReceivedEventArgs();
1135 if (imfManager != null)
1137 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
1139 if (imfEventData != null)
1141 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
1144 if (_eventReceivedEventHandler != null)
1146 imfCallbackData = _eventReceivedEventHandler(this, e);
1148 if (imfCallbackData != null)
1150 return imfCallbackData.GetImfCallbackDataPtr();
1154 return new ImfCallbackData().GetImfCallbackDataPtr();
1159 /// ImfManager event received signal.
1161 [Obsolete("Please do not use! this will be internal")]
1162 public ImfEventSignalType EventReceivedSignal()
1164 ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
1165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1170 /// ImfManager status changed event arguments.
1172 [Obsolete("Please do not use! this will be deprecated")]
1173 public class ImfManagerStatusChangedEventArgs : EventArgs
1175 public ImfManager ImfManager
1182 private delegate void ImfManagerStatusChangedEventCallbackType(global::System.IntPtr data);
1183 private ImfManagerStatusChangedEventCallbackType _imfManagerStatusChangedEventCallback;
1184 private event EventHandler<ImfManagerStatusChangedEventArgs> _imfManagerStatusChangedEventHandler;
1187 /// ImfManager status changed.
1189 [Obsolete("Please do not use! this will be deprecated")]
1190 public event EventHandler<ImfManagerStatusChangedEventArgs> ImfManagerStatusChanged
1194 if (_imfManagerStatusChangedEventHandler == null)
1196 _imfManagerStatusChangedEventCallback = OnImfManagerStatusChanged;
1197 StatusChangedSignal().Connect(_imfManagerStatusChangedEventCallback);
1200 _imfManagerStatusChangedEventHandler += value;
1204 _imfManagerStatusChangedEventHandler -= value;
1206 if (_imfManagerStatusChangedEventHandler == null && _imfManagerStatusChangedEventCallback != null)
1208 StatusChangedSignal().Disconnect(_imfManagerStatusChangedEventCallback);
1213 private void OnImfManagerStatusChanged(global::System.IntPtr data)
1215 ImfManagerStatusChangedEventArgs e = new ImfManagerStatusChangedEventArgs();
1219 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
1222 if (_imfManagerStatusChangedEventHandler != null)
1224 _imfManagerStatusChangedEventHandler(this, e);
1229 /// ImfManager status changed event arguments.
1231 public class StatusChangedEventArgs : EventArgs
1233 public bool StatusChanged
1240 private delegate void StatusChangedEventCallbackType(bool statusChanged);
1241 private StatusChangedEventCallbackType _statusChangedEventCallback;
1242 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
1245 /// ImfManager status changed.
1247 public event EventHandler<StatusChangedEventArgs> StatusChanged
1251 if (_statusChangedEventHandler == null)
1253 _statusChangedEventCallback = OnStatusChanged;
1254 StatusChangedSignal().Connect(_statusChangedEventCallback);
1257 _statusChangedEventHandler += value;
1261 _statusChangedEventHandler -= value;
1263 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
1265 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1270 private void OnStatusChanged(bool statusChanged)
1272 StatusChangedEventArgs e = new StatusChangedEventArgs();
1274 e.StatusChanged = statusChanged;
1276 if (_statusChangedEventHandler != null)
1278 _statusChangedEventHandler(this, e);
1283 /// ImfManager status changed signal.
1285 [Obsolete("Please do not use! this will be internal")]
1286 public StatusSignalType StatusChangedSignal()
1288 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
1289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1294 /// ImfManager resized event arguments.
1296 [Obsolete("Please do not use! this will be deprecated")]
1297 public class ImfManagerResizedEventArgs : EventArgs
1299 public ImfManager ImfManager
1306 private delegate void ImfManagerResizedEventCallbackType(IntPtr data);
1307 private ImfManagerResizedEventCallbackType _imfManagerResizedEventCallback;
1308 private event EventHandler<ImfManagerResizedEventArgs> _imfManagerResizedEventHandler;
1311 /// ImfManager resized event.
1313 [Obsolete("Please do not use! this will be deprecated")]
1314 public event EventHandler<ImfManagerResizedEventArgs> ImfManagerResized
1318 if (_imfManagerResizedEventHandler == null)
1320 _imfManagerResizedEventCallback = OnImfManagerResized;
1321 ResizedSignal().Connect(_imfManagerResizedEventCallback);
1324 _imfManagerResizedEventHandler += value;
1328 _imfManagerResizedEventHandler -= value;
1330 if (_imfManagerResizedEventHandler == null && _imfManagerResizedEventCallback != null)
1332 ResizedSignal().Disconnect(_imfManagerResizedEventCallback);
1337 private void OnImfManagerResized(IntPtr data)
1339 ImfManagerResizedEventArgs e = new ImfManagerResizedEventArgs();
1343 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
1346 if (_imfManagerResizedEventHandler != null)
1348 _imfManagerResizedEventHandler(this, e);
1352 private delegate void ResizedEventCallbackType();
1353 private ResizedEventCallbackType _resizedEventCallback;
1354 private event EventHandler _resizedEventHandler;
1357 /// ImfManager resized.
1359 public event EventHandler Resized
1363 if (_resizedEventHandler == null)
1365 _resizedEventCallback = OnResized;
1366 ResizedSignal().Connect(_resizedEventCallback);
1369 _resizedEventHandler += value;
1373 _resizedEventHandler -= value;
1375 if (_resizedEventHandler == null && _resizedEventCallback != null)
1377 ResizedSignal().Disconnect(_resizedEventCallback);
1382 private void OnResized()
1384 if (_resizedEventHandler != null)
1386 _resizedEventHandler(this, null);
1391 /// ImfManager resized signal.
1393 [Obsolete("Please do not use! this will be internal")]
1394 public ImfVoidSignalType ResizedSignal()
1396 ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false);
1397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1402 /// ImfManager language changed event arguments.
1404 [Obsolete("Please do not use! this will be deprecated")]
1405 public class ImfManagerLanguageChangedEventArgs : EventArgs
1407 public ImfManager ImfManager
1414 private delegate void ImfManagerLanguageChangedEventCallbackType(IntPtr data);
1415 private ImfManagerLanguageChangedEventCallbackType _imfManagerLanguageChangedEventCallback;
1416 private event EventHandler<ImfManagerLanguageChangedEventArgs> _imfManagerLanguageChangedEventHandler;
1419 /// ImfManager language changed event.
1421 [Obsolete("Please do not use! this will be deprecated")]
1422 public event EventHandler<ImfManagerLanguageChangedEventArgs> ImfManagerLanguageChanged
1426 if (_imfManagerLanguageChangedEventHandler == null)
1428 _imfManagerLanguageChangedEventCallback = OnImfManagerLanguageChanged;
1429 LanguageChangedSignal().Connect(_imfManagerLanguageChangedEventCallback);
1432 _imfManagerLanguageChangedEventHandler += value;
1436 _imfManagerLanguageChangedEventHandler -= value;
1438 if (_imfManagerLanguageChangedEventHandler == null && _imfManagerLanguageChangedEventCallback != null)
1440 LanguageChangedSignal().Disconnect(_imfManagerLanguageChangedEventCallback);
1445 private void OnImfManagerLanguageChanged(IntPtr data)
1447 ImfManagerLanguageChangedEventArgs e = new ImfManagerLanguageChangedEventArgs();
1451 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
1454 if (_imfManagerLanguageChangedEventHandler != null)
1456 _imfManagerLanguageChangedEventHandler(this, e);
1460 private delegate void LanguageChangedEventCallbackType();
1461 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1462 private event EventHandler _languageChangedEventHandler;
1465 /// ImfManager language changed.
1467 public event EventHandler LanguageChanged
1471 if (_languageChangedEventHandler == null)
1473 _languageChangedEventCallback = OnLanguageChanged;
1474 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1477 _languageChangedEventHandler += value;
1481 _languageChangedEventHandler -= value;
1483 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1485 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1490 private void OnLanguageChanged()
1492 if (_languageChangedEventHandler != null)
1494 _languageChangedEventHandler(this, null);
1499 /// ImfManager language changed signal.
1501 [Obsolete("Please do not use! this will be internal")]
1502 public ImfVoidSignalType LanguageChangedSignal()
1504 ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false);
1505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1510 /// ImfManager keyboard type changed event arguments.
1512 public class KeyboardTypeChangedEventArgs : EventArgs
1514 public KeyboardType KeyboardType
1521 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1522 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1523 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1526 /// ImfManager keyboard type changed.
1528 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1532 if (_keyboardTypeChangedEventHandler == null)
1534 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1535 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1538 _keyboardTypeChangedEventHandler += value;
1542 _keyboardTypeChangedEventHandler -= value;
1544 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1546 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1551 private void OnKeyboardTypeChanged(KeyboardType type)
1553 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1555 e.KeyboardType = type;
1557 if (_keyboardTypeChangedEventHandler != null)
1559 _keyboardTypeChangedEventHandler(this, e);
1563 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1565 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1566 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1571 /// The direction of the text.
1573 public enum TextDirection
1586 /// Events that are generated by the IMF.
1588 public enum ImfEvent
1595 /// Pre-Edit changed.
1599 /// Commit recieved.
1603 /// An event to delete a range of characters from the string.
1607 /// An event to query string and the cursor position.
1611 /// Private command sent from the input panel.
1617 /// Enumeration for the state of the input panel.
1626 /// Input panel is shown.
1630 /// Input panel is hidden.
1634 /// Input panel in process of being shown.
1640 /// Enumeration for the types of keyboard.
1642 public enum KeyboardType
1645 /// Software keyboard (virtual keyboard) is default.
1649 /// Hardware keyboard.