2 * Copyright(c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
25 /// Specifically manages the input method framework which enables the virtual or hardware keyboards.
27 /// <since_tizen> 3 </since_tizen>
28 public class InputMethodContext : BaseHandle
30 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32 internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
46 /// <param name="type">Dispose Type</param>
47 /// <since_tizen> 3 </since_tizen>
48 /// Please DO NOT use! This will be deprecated!
49 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 protected override void Dispose(DisposeTypes type)
58 if (type == DisposeTypes.Explicit)
61 //Release your own managed resources here.
62 //You should release all of your own disposable objects here.
66 //Release your own unmanaged resources here.
67 //You should not access any managed member here except static instance.
68 //because the execution order of Finalizes is non-deterministic.
70 if (_keyboardTypeChangedEventCallback != null)
72 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
75 if (swigCPtr.Handle != global::System.IntPtr.Zero)
80 NDalicManualPINVOKE.delete_InputMethodContext(swigCPtr);
82 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
89 /// This structure is used to pass on data from the IMF regarding predictive text.
91 /// <since_tizen> 3 </since_tizen>
92 public class EventData : global::System.IDisposable
94 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
98 /// <since_tizen> 3 </since_tizen>
99 protected bool swigCMemOwn;
101 internal EventData(IntPtr cPtr, bool cMemoryOwn)
103 swigCMemOwn = cMemoryOwn;
104 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
107 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
109 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
112 //A Flag to check who called Dispose(). (By User or DisposeQueue)
113 private bool isDisposeQueued = false;
115 /// A Flat to check if it is already disposed.
117 /// <since_tizen> 3 </since_tizen>
118 protected bool disposed = false;
123 /// <since_tizen> 3 </since_tizen>
126 if (!isDisposeQueued)
128 isDisposeQueued = true;
129 DisposeQueue.Instance.Add(this);
134 /// The dispose pattern.
136 /// <since_tizen> 3 </since_tizen>
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);
159 /// <since_tizen> 3 </since_tizen>
160 protected virtual void Dispose(DisposeTypes type)
167 if (type == DisposeTypes.Explicit)
170 //Release your own managed resources here.
171 //You should release all of your own disposable objects here.
175 //Release your own unmanaged resources here.
176 //You should not access any managed member here except static instance.
177 //because the execution order of Finalizes is non-deterministic.
179 if (swigCPtr.Handle != IntPtr.Zero)
184 NDalicManualPINVOKE.delete_InputMethodContext_EventData(swigCPtr);
186 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
192 internal static EventData GetEventDataFromPtr(IntPtr cPtr)
194 EventData ret = new EventData(cPtr, false);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 /// The default constructor.
202 /// <since_tizen> 3 </since_tizen>
203 public EventData() : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_0(), true)
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 /// <param name="aEventName">The name of the event from the IMF.</param>
212 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
213 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
214 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
215 /// <since_tizen> 3 </since_tizen>
216 public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222 /// The pre-edit or the commit string.
224 /// <since_tizen> 4 </since_tizen>
225 public string PredictiveString
229 NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 string ret = NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_get(swigCPtr);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 /// The name of the event from the IMF.
243 /// <since_tizen> 4 </since_tizen>
244 public InputMethodContext.EventType EventName
248 NDalicManualPINVOKE.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253 InputMethodContext.EventType ret = (InputMethodContext.EventType)NDalicManualPINVOKE.InputMethodContext_EventData_eventName_get(swigCPtr);
254 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260 /// The start position from the current cursor position to start deleting characters.
262 /// <since_tizen> 4 </since_tizen>
263 public int CursorOffset
267 NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_set(swigCPtr, value);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
272 int ret = NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_get(swigCPtr);
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 /// The number of characters to delete from the cursorOffset.
281 /// <since_tizen> 4 </since_tizen>
282 public int NumberOfChars
286 NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_set(swigCPtr, value);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291 int ret = NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_get(swigCPtr);
292 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 /// Data required by the IMF from the callback.
302 /// <since_tizen> 3 </since_tizen>
303 public class CallbackData : global::System.IDisposable
305 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
309 /// <since_tizen> 3 </since_tizen>
310 protected bool swigCMemOwn;
312 internal IntPtr GetCallbackDataPtr()
314 return (IntPtr)swigCPtr;
317 internal CallbackData(IntPtr cPtr, bool cMemoryOwn)
319 swigCMemOwn = cMemoryOwn;
320 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
323 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CallbackData obj)
325 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
328 //A Flag to check who called Dispose(). (By User or DisposeQueue)
329 private bool isDisposeQueued = false;
331 /// A Flat to check if it is already disposed.
333 /// <since_tizen> 3 </since_tizen>
334 protected bool disposed = false;
340 /// <since_tizen> 3 </since_tizen>
343 if (!isDisposeQueued)
345 isDisposeQueued = true;
346 DisposeQueue.Instance.Add(this);
351 /// The dispose pattern.
353 /// <since_tizen> 3 </since_tizen>
354 public void Dispose()
356 //Throw excpetion if Dispose() is called in separate thread.
357 if (!Window.IsInstalled())
359 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
364 Dispose(DisposeTypes.Implicit);
368 Dispose(DisposeTypes.Explicit);
369 System.GC.SuppressFinalize(this);
376 /// <since_tizen> 3 </since_tizen>
377 protected virtual void Dispose(DisposeTypes type)
384 if (type == DisposeTypes.Explicit)
387 //Release your own managed resources here.
388 //You should release all of your own disposable objects here.
392 //Release your own unmanaged resources here.
393 //You should not access any managed member here except static instance.
394 //because the execution order of Finalizes is non-deterministic.
396 if (swigCPtr.Handle != IntPtr.Zero)
401 NDalicManualPINVOKE.delete_InputMethodContext_CallbackData(swigCPtr);
403 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
409 internal static CallbackData GetCallbackDataFromPtr(IntPtr cPtr)
411 CallbackData ret = new CallbackData(cPtr, false);
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 /// The default constructor.
419 /// <since_tizen> 3 </since_tizen>
420 public CallbackData() : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_0(), true)
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
429 /// <param name="aCursorPosition">The new position of the cursor.</param>
430 /// <param name="aCurrentText">The current text string.</param>
431 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
432 /// <since_tizen> 3 </since_tizen>
433 public CallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439 /// The current text string.
441 /// <since_tizen> 4 </since_tizen>
442 public string CurrentText
446 NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_set(swigCPtr, value);
447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451 string ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_get(swigCPtr);
452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
458 /// The current text string.
460 /// <since_tizen> 4 </since_tizen>
461 public int CursorPosition
465 NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
470 int ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_get(swigCPtr);
471 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477 /// If the cursor position needs to be updated.
479 /// <since_tizen> 4 </since_tizen>
484 NDalicManualPINVOKE.InputMethodContext_CallbackData_update_set(swigCPtr, value);
485 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489 bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_update_get(swigCPtr);
490 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 /// Flags if preedit reset is required.
498 /// <since_tizen> 4 </since_tizen>
499 public bool PreeditResetRequired
503 NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_set(swigCPtr, value);
504 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
508 bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_get(swigCPtr);
509 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
517 /// Destroy the context of the IMF.<br/>
519 /// <since_tizen> 5 </since_tizen>
520 public void DestroyContext()
522 NDalicManualPINVOKE.InputMethodContext_Finalize(swigCPtr);
523 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527 /// Destroy the context of the IMF.<br/>
529 /// <since_tizen> 4 </since_tizen>
530 /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.InputMethodContext.Instance.DestroyContext()!
531 [Obsolete("Please do not use! This will be deprecated! Please use InputMethodContext.Instance.DestroyContext() instead!")]
532 [EditorBrowsable(EditorBrowsableState.Never)]
533 public void Finalize()
539 /// Constructor.<br/>
541 /// <since_tizen> 5 </since_tizen>
542 public InputMethodContext () : this (NDalicManualPINVOKE.InputMethodContext_New(), true) {
543 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 internal InputMethodContext(InputMethodContext inputMethodContext) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(InputMethodContext.getCPtr(inputMethodContext)), true) {
548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551 internal InputMethodContext Assign(InputMethodContext inputMethodContext) {
552 InputMethodContext ret = new InputMethodContext(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
553 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557 internal static InputMethodContext DownCast(BaseHandle handle) {
558 InputMethodContext ret = new InputMethodContext(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
559 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 /// Activates the IMF.<br/>
565 /// It means that the text editing is started somewhere.<br/>
566 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
568 /// <since_tizen> 3 </since_tizen>
569 public void Activate()
571 NDalicManualPINVOKE.InputMethodContext_Activate(swigCPtr);
572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 /// Deactivates the IMF.<br/>
577 /// It means that the text editing is finished somewhere.
579 /// <since_tizen> 3 </since_tizen>
580 public void Deactivate()
582 NDalicManualPINVOKE.InputMethodContext_Deactivate(swigCPtr);
583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
587 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
588 /// If true, then the keyboard will be restored (activated) after focus is regained.
590 /// <returns>The restoration status.</returns>
591 /// <since_tizen> 3 </since_tizen>
592 public bool RestoreAfterFocusLost()
594 bool ret = NDalicManualPINVOKE.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
600 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
602 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
603 /// <since_tizen> 3 </since_tizen>
604 public void SetRestoreAfterFocusLost(bool toggle)
606 NDalicManualPINVOKE.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
607 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
611 /// Sends a message reset to the preedit state or the IMF module.
613 /// <since_tizen> 3 </since_tizen>
614 public new void Reset()
616 NDalicManualPINVOKE.InputMethodContext_Reset(swigCPtr);
617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
621 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
623 /// <since_tizen> 3 </since_tizen>
624 public void NotifyCursorPosition()
626 NDalicManualPINVOKE.InputMethodContext_NotifyCursorPosition(swigCPtr);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
633 /// <param name="cursorPosition">The position of the cursor.</param>
634 /// <since_tizen> 3 </since_tizen>
635 public void SetCursorPosition(uint cursorPosition)
637 NDalicManualPINVOKE.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
644 /// <returns>The current position of the cursor.</returns>
645 /// <since_tizen> 3 </since_tizen>
646 public uint GetCursorPosition()
648 uint ret = NDalicManualPINVOKE.InputMethodContext_GetCursorPosition(swigCPtr);
649 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
656 /// <param name="text">The text string surrounding the current cursor point.</param>
657 /// <since_tizen> 3 </since_tizen>
658 public void SetSurroundingText(string text)
660 NDalicManualPINVOKE.InputMethodContext_SetSurroundingText(swigCPtr, text);
661 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
667 /// <returns>The surrounding text.</returns>
668 /// <since_tizen> 3 </since_tizen>
669 public string GetSurroundingText()
671 string ret = NDalicManualPINVOKE.InputMethodContext_GetSurroundingText(swigCPtr);
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677 /// Notifies the IMF context that text input is set to multiline or not.
679 /// <param name="multiLine">True if multiline text input is used.</param>
680 /// <since_tizen> 3 </since_tizen>
681 public void NotifyTextInputMultiLine(bool multiLine)
683 NDalicManualPINVOKE.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 /// Returns the text direction of the keyboard's current input language.
690 /// <returns>The direction of the text.</returns>
691 /// <since_tizen> 3 </since_tizen>
692 public InputMethodContext.TextDirection GetTextDirection()
694 InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)NDalicManualPINVOKE.InputMethodContext_GetTextDirection(swigCPtr);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Provides the size and the position of the keyboard.<br/>
701 /// The position is relative to whether the keyboard is visible or not.<br/>
702 /// If the keyboard is not visible, then the position will be off the screen.<br/>
703 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
704 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
706 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
707 /// <since_tizen> 3 </since_tizen>
708 public Rectangle GetInputMethodArea()
710 Rectangle ret = new Rectangle(NDalicManualPINVOKE.InputMethodContext_GetInputMethodArea(swigCPtr), true);
711 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 internal void ApplyOptions(InputMethodOptions options)
717 NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 /// Sets up the input-panel specific data.
724 /// <param name="text">The specific data to be set to the input panel.</param>
725 /// <since_tizen> 3 </since_tizen>
726 public void SetInputPanelUserData(string text)
728 NDalicManualPINVOKE.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
729 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733 /// Gets the specific data of the current active input panel.
735 /// <param name="text">The specific data to be received from the input panel.</param>
736 /// <since_tizen> 4 </since_tizen>
737 public void GetInputPanelUserData(out string text)
739 NDalicManualPINVOKE.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744 /// Gets the state of the current active input panel.
746 /// <returns>The state of the input panel.</returns>
747 /// <since_tizen> 3 </since_tizen>
748 public InputMethodContext.State GetInputPanelState()
750 InputMethodContext.State ret = (InputMethodContext.State)NDalicManualPINVOKE.InputMethodContext_GetInputPanelState(swigCPtr);
751 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 /// Sets the return key on the input panel to be visible or invisible.<br/>
757 /// The default is true.
759 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
760 /// <since_tizen> 3 </since_tizen>
761 public void SetReturnKeyState(bool visible)
763 NDalicManualPINVOKE.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
764 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
768 /// Enables to show the input panel automatically when focused.
770 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
771 /// <since_tizen> 3 </since_tizen>
772 public void AutoEnableInputPanel(bool enabled)
774 NDalicManualPINVOKE.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 /// Shows the input panel.
781 /// <since_tizen> 3 </since_tizen>
782 public void ShowInputPanel()
784 NDalicManualPINVOKE.InputMethodContext_ShowInputPanel(swigCPtr);
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 /// Hides the input panel.
791 /// <since_tizen> 3 </since_tizen>
792 public void HideInputPanel()
794 NDalicManualPINVOKE.InputMethodContext_HideInputPanel(swigCPtr);
795 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
799 /// Gets the keyboard type.<br/>
800 /// The default keyboard type is SoftwareKeyboard.
802 /// <returns>The keyboard type.</returns>
803 /// <since_tizen> 4 </since_tizen>
804 public InputMethodContext.KeyboardType GetKeyboardType()
806 InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)NDalicManualPINVOKE.InputMethodContext_GetKeyboardType(swigCPtr);
807 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 /// Gets the current language locale of the input panel.<br/>
813 /// For example, en_US, en_GB, en_PH, fr_FR, ...
815 /// <returns>The current language locale of the input panel.</returns>
816 /// <since_tizen> 4 </since_tizen>
817 public string GetInputPanelLocale()
819 string ret = NDalicManualPINVOKE.InputMethodContext_GetInputPanelLocale(swigCPtr);
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
824 internal void AllowTextPrediction(bool prediction)
826 NDalicManualPINVOKE.InputMethodContext_AllowTextPrediction(swigCPtr, prediction);
827 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830 internal bool IsTextPredictionAllowed()
832 bool ret = NDalicManualPINVOKE.InputMethodContext_IsTextPredictionAllowed(swigCPtr);
833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
838 /// Gets/Sets whether the IM context allow to use the text prediction.
840 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
841 [EditorBrowsable(EditorBrowsableState.Never)]
842 public bool TextPrediction
846 return IsTextPredictionAllowed();
850 AllowTextPrediction(value);
855 /// InputMethodContext activated event arguments.
857 /// <since_tizen> 4 </since_tizen>
858 public class ActivatedEventArgs : EventArgs
861 /// InputMethodContext
863 /// <since_tizen> 4 </since_tizen>
864 public InputMethodContext InputMethodContext
871 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
872 private delegate void ActivatedEventCallbackType(IntPtr data);
873 private ActivatedEventCallbackType _activatedEventCallback;
874 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
877 /// InputMethodContext activated.
879 /// <since_tizen> 4 </since_tizen>
880 public event EventHandler<ActivatedEventArgs> Activated
884 if (_activatedEventHandler == null)
886 _activatedEventCallback = OnActivated;
887 ActivatedSignal().Connect(_activatedEventCallback);
890 _activatedEventHandler += value;
894 _activatedEventHandler -= value;
896 if (_activatedEventHandler == null && _activatedEventCallback != null)
898 ActivatedSignal().Disconnect(_activatedEventCallback);
903 private void OnActivated(IntPtr data)
905 ActivatedEventArgs e = new ActivatedEventArgs();
909 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
912 if (_activatedEventHandler != null)
914 _activatedEventHandler(this, e);
918 internal ActivatedSignalType ActivatedSignal()
920 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.InputMethodContext_ActivatedSignal(swigCPtr), false);
921 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
926 /// InputMethodContext event received event arguments.
928 /// <since_tizen> 4 </since_tizen>
929 public class EventReceivedEventArgs : EventArgs
932 /// InputMethodContext
934 /// <since_tizen> 4 </since_tizen>
935 public InputMethodContext InputMethodContext
944 /// <since_tizen> 4 </since_tizen>
945 public EventData EventData
952 private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
953 private EventReceivedEventCallbackType _eventReceivedEventCallback;
954 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> _eventReceivedEventHandler;
957 /// InputMethodContext event received.
959 /// <since_tizen> 4 </since_tizen>
960 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
964 if (_eventReceivedEventHandler == null)
966 _eventReceivedEventCallback = OnEventReceived;
967 EventReceivedSignal().Connect(_eventReceivedEventCallback);
970 _eventReceivedEventHandler += value;
974 _eventReceivedEventHandler -= value;
976 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
978 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
983 private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
985 CallbackData callbackData = null;
987 EventReceivedEventArgs e = new EventReceivedEventArgs();
989 if (inputMethodContext != null)
991 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
993 if (eventData != null)
995 e.EventData = EventData.GetEventDataFromPtr(eventData);
998 if (_eventReceivedEventHandler != null)
1000 callbackData = _eventReceivedEventHandler(this, e);
1002 if (callbackData != null)
1004 return callbackData.GetCallbackDataPtr();
1008 return new CallbackData().GetCallbackDataPtr();
1012 internal KeyboardEventSignalType EventReceivedSignal()
1014 KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
1015 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020 /// InputMethodContext status changed event arguments.
1022 /// <since_tizen> 4 </since_tizen>
1023 public class StatusChangedEventArgs : EventArgs
1026 /// InputMethodContext status
1028 /// <since_tizen> 4 </since_tizen>
1029 public bool StatusChanged
1036 private delegate void StatusChangedEventCallbackType(bool statusChanged);
1037 private StatusChangedEventCallbackType _statusChangedEventCallback;
1038 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
1041 /// InputMethodContext status changed.
1043 /// <since_tizen> 4 </since_tizen>
1044 public event EventHandler<StatusChangedEventArgs> StatusChanged
1048 if (_statusChangedEventHandler == null)
1050 _statusChangedEventCallback = OnStatusChanged;
1051 StatusChangedSignal().Connect(_statusChangedEventCallback);
1054 _statusChangedEventHandler += value;
1058 _statusChangedEventHandler -= value;
1060 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
1062 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1067 private void OnStatusChanged(bool statusChanged)
1069 StatusChangedEventArgs e = new StatusChangedEventArgs();
1071 e.StatusChanged = statusChanged;
1073 if (_statusChangedEventHandler != null)
1075 _statusChangedEventHandler(this, e);
1079 internal StatusSignalType StatusChangedSignal()
1081 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.InputMethodContext_StatusChangedSignal(swigCPtr), false);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087 /// InputMethodContext resized event.
1089 /// <since_tizen> 4 </since_tizen>
1090 public class ResizedEventArgs : EventArgs
1095 /// <since_tizen> 4 </since_tizen>
1103 private delegate void ResizedEventCallbackType(int resized);
1104 private ResizedEventCallbackType _resizedEventCallback;
1105 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1108 /// InputMethodContext resized.
1110 /// <since_tizen> 4 </since_tizen>
1111 public event EventHandler<ResizedEventArgs> Resized
1115 if (_resizedEventHandler == null)
1117 _resizedEventCallback = OnResized;
1118 ResizedSignal().Connect(_resizedEventCallback);
1121 _resizedEventHandler += value;
1125 _resizedEventHandler -= value;
1127 if (_resizedEventHandler == null && _resizedEventCallback != null)
1129 ResizedSignal().Disconnect(_resizedEventCallback);
1134 private void OnResized(int resized)
1136 ResizedEventArgs e = new ResizedEventArgs();
1137 e.Resized = resized;
1139 if (_resizedEventHandler != null)
1141 _resizedEventHandler(this, e);
1145 internal KeyboardResizedSignalType ResizedSignal()
1147 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
1148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1153 /// InputMethodContext language changed event args.
1155 /// <since_tizen> 4 </since_tizen>
1156 public class LanguageChangedEventArgs : EventArgs
1159 /// language changed.
1161 /// <since_tizen> 4 </since_tizen>
1162 public int LanguageChanged
1169 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1170 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1171 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1174 /// InputMethodContext language changed.
1176 /// <since_tizen> 4 </since_tizen>
1177 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1181 if (_languageChangedEventHandler == null)
1183 _languageChangedEventCallback = OnLanguageChanged;
1184 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1187 _languageChangedEventHandler += value;
1191 _languageChangedEventHandler -= value;
1193 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1195 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1200 private void OnLanguageChanged(int languageChanged)
1202 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1203 e.LanguageChanged = languageChanged;
1205 if (_languageChangedEventHandler != null)
1207 _languageChangedEventHandler(this, e);
1211 internal LanguageChangedSignalType LanguageChangedSignal()
1213 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1219 /// InputMethodContext keyboard type changed event arguments.
1221 /// <since_tizen> 4 </since_tizen>
1222 public class KeyboardTypeChangedEventArgs : EventArgs
1225 /// InputMethodContext keyboard type
1227 /// <since_tizen> 4 </since_tizen>
1228 public KeyboardType KeyboardType
1235 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1236 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1237 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1240 /// InputMethodContext keyboard type changed.
1242 /// <since_tizen> 4 </since_tizen>
1243 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1247 if (_keyboardTypeChangedEventHandler == null)
1249 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1250 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1253 _keyboardTypeChangedEventHandler += value;
1257 _keyboardTypeChangedEventHandler -= value;
1259 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1261 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1266 private void OnKeyboardTypeChanged(KeyboardType type)
1268 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1270 e.KeyboardType = type;
1272 if (_keyboardTypeChangedEventHandler != null)
1274 _keyboardTypeChangedEventHandler(this, e);
1278 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1280 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
1281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1286 /// The direction of the text.
1288 /// <since_tizen> 3 </since_tizen>
1289 public enum TextDirection
1302 /// Events that are generated by the IMF.
1304 /// <since_tizen> 3 </since_tizen>
1305 public enum EventType
1310 /// <since_tizen> 4 </since_tizen>
1313 /// Pre-Edit changed.
1315 /// <since_tizen> 4 </since_tizen>
1318 /// Commit received.
1320 /// <since_tizen> 4 </since_tizen>
1323 /// An event to delete a range of characters from the string.
1325 /// <since_tizen> 4 </since_tizen>
1328 /// An event to query string and the cursor position.
1330 /// <since_tizen> 4 </since_tizen>
1333 /// Private command sent from the input panel.
1335 /// <since_tizen> 4 </since_tizen>
1340 /// Enumeration for the state of the input panel.
1342 /// <since_tizen> 3 </since_tizen>
1348 /// <since_tizen> 4 </since_tizen>
1351 /// Input panel is shown.
1353 /// <since_tizen> 4 </since_tizen>
1356 /// Input panel is hidden.
1358 /// <since_tizen> 4 </since_tizen>
1361 /// Input panel in process of being shown.
1363 /// <since_tizen> 4 </since_tizen>
1368 /// Enumeration for the types of keyboard.
1370 /// <since_tizen> 4 </since_tizen>
1371 public enum KeyboardType
1374 /// Software keyboard (virtual keyboard) is default.
1376 /// <since_tizen> 4 </since_tizen>
1379 /// Hardware keyboard.
1381 /// <since_tizen> 4 </since_tizen>