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 [Obsolete("Please do not use! This will be deprecated! Please use InputMethodContext instead!")]
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class ImfManager : BaseHandle
32 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34 internal ImfManager(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
36 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
39 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj)
41 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
45 /// Gets the singleton of the ImfManager object.
47 /// <since_tizen> 5 </since_tizen>
48 public static ImfManager Instance
52 return new ImfManager();
59 /// <param name="type">Dispose Type</param>
60 /// <since_tizen> 3 </since_tizen>
61 /// Please DO NOT use! This will be deprecated!
62 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, ImfManager, TtsPlayer, Window) is not required.
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 protected override void Dispose(DisposeTypes type)
71 if (type == DisposeTypes.Explicit)
74 //Release your own managed resources here.
75 //You should release all of your own disposable objects here.
79 //Release your own unmanaged resources here.
80 //You should not access any managed member here except static instance.
81 //because the execution order of Finalizes is non-deterministic.
83 if (_keyboardTypeChangedEventCallback != null)
85 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
88 if (swigCPtr.Handle != global::System.IntPtr.Zero)
93 NDalicManualPINVOKE.delete_InputMethodContext(swigCPtr);
95 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
102 /// This structure is used to pass on data from the IMF regarding predictive text.
104 /// <since_tizen> 3 </since_tizen>
105 public class ImfEventData : global::System.IDisposable
107 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
111 /// <since_tizen> 3 </since_tizen>
112 protected bool swigCMemOwn;
114 internal ImfEventData(IntPtr cPtr, bool cMemoryOwn)
116 swigCMemOwn = cMemoryOwn;
117 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
120 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
122 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
125 //A Flag to check who called Dispose(). (By User or DisposeQueue)
126 private bool isDisposeQueued = false;
128 /// A Flat to check if it is already disposed.
130 /// <since_tizen> 3 </since_tizen>
131 protected bool disposed = false;
136 /// <since_tizen> 3 </since_tizen>
139 if (!isDisposeQueued)
141 isDisposeQueued = true;
142 DisposeQueue.Instance.Add(this);
147 /// The dispose pattern.
149 /// <since_tizen> 3 </since_tizen>
150 public void Dispose()
152 //Throw excpetion if Dispose() is called in separate thread.
153 if (!Window.IsInstalled())
155 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
160 Dispose(DisposeTypes.Implicit);
164 Dispose(DisposeTypes.Explicit);
165 System.GC.SuppressFinalize(this);
172 /// <since_tizen> 3 </since_tizen>
173 protected virtual void Dispose(DisposeTypes type)
180 if (type == DisposeTypes.Explicit)
183 //Release your own managed resources here.
184 //You should release all of your own disposable objects here.
188 //Release your own unmanaged resources here.
189 //You should not access any managed member here except static instance.
190 //because the execution order of Finalizes is non-deterministic.
192 if (swigCPtr.Handle != IntPtr.Zero)
197 NDalicManualPINVOKE.delete_InputMethodContext_EventData(swigCPtr);
199 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
205 internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
207 ImfEventData ret = new ImfEventData(cPtr, false);
208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213 /// The default constructor.
215 /// <since_tizen> 3 </since_tizen>
216 public ImfEventData() : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_0(), true)
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224 /// <param name="aEventName">The name of the event from the IMF.</param>
225 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
226 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
227 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
228 /// <since_tizen> 3 </since_tizen>
229 public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 /// The pre-edit or the commit string.
237 /// <since_tizen> 4 </since_tizen>
238 public string PredictiveString
242 NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 string ret = NDalicManualPINVOKE.InputMethodContext_EventData_predictiveString_get(swigCPtr);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254 /// The name of the event from the IMF.
256 /// <since_tizen> 4 </since_tizen>
257 public ImfManager.ImfEvent EventName
261 NDalicManualPINVOKE.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266 ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.InputMethodContext_EventData_eventName_get(swigCPtr);
267 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// The start position from the current cursor position to start deleting characters.
275 /// <since_tizen> 4 </since_tizen>
276 public int CursorOffset
280 NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_set(swigCPtr, value);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 int ret = NDalicManualPINVOKE.InputMethodContext_EventData_cursorOffset_get(swigCPtr);
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 /// The number of characters to delete from the cursorOffset.
294 /// <since_tizen> 4 </since_tizen>
295 public int NumberOfChars
299 NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_set(swigCPtr, value);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304 int ret = NDalicManualPINVOKE.InputMethodContext_EventData_numberOfChars_get(swigCPtr);
305 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313 /// Data required by the IMF from the callback.
315 /// <since_tizen> 3 </since_tizen>
316 public class ImfCallbackData : global::System.IDisposable
318 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
322 /// <since_tizen> 3 </since_tizen>
323 protected bool swigCMemOwn;
325 internal IntPtr GetImfCallbackDataPtr()
327 return (IntPtr)swigCPtr;
330 internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
332 swigCMemOwn = cMemoryOwn;
333 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
336 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
338 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
341 //A Flag to check who called Dispose(). (By User or DisposeQueue)
342 private bool isDisposeQueued = false;
344 /// A Flat to check if it is already disposed.
346 /// <since_tizen> 3 </since_tizen>
347 protected bool disposed = false;
353 /// <since_tizen> 3 </since_tizen>
356 if (!isDisposeQueued)
358 isDisposeQueued = true;
359 DisposeQueue.Instance.Add(this);
364 /// The dispose pattern.
366 /// <since_tizen> 3 </since_tizen>
367 public void Dispose()
369 //Throw excpetion if Dispose() is called in separate thread.
370 if (!Window.IsInstalled())
372 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
377 Dispose(DisposeTypes.Implicit);
381 Dispose(DisposeTypes.Explicit);
382 System.GC.SuppressFinalize(this);
389 /// <since_tizen> 3 </since_tizen>
390 protected virtual void Dispose(DisposeTypes type)
397 if (type == DisposeTypes.Explicit)
400 //Release your own managed resources here.
401 //You should release all of your own disposable objects here.
405 //Release your own unmanaged resources here.
406 //You should not access any managed member here except static instance.
407 //because the execution order of Finalizes is non-deterministic.
409 if (swigCPtr.Handle != IntPtr.Zero)
414 NDalicManualPINVOKE.delete_InputMethodContext_CallbackData(swigCPtr);
416 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
422 internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
424 ImfCallbackData ret = new ImfCallbackData(cPtr, false);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
430 /// The default constructor.
432 /// <since_tizen> 3 </since_tizen>
433 public ImfCallbackData() : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_0(), true)
435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
442 /// <param name="aCursorPosition">The new position of the cursor.</param>
443 /// <param name="aCurrentText">The current text string.</param>
444 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
445 /// <since_tizen> 3 </since_tizen>
446 public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
452 /// The current text string.
454 /// <since_tizen> 4 </since_tizen>
455 public string CurrentText
459 NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_set(swigCPtr, value);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464 string ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_currentText_get(swigCPtr);
465 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471 /// The current text string.
473 /// <since_tizen> 4 </since_tizen>
474 public int CursorPosition
478 NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483 int ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_cursorPosition_get(swigCPtr);
484 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
490 /// If the cursor position needs to be updated.
492 /// <since_tizen> 4 </since_tizen>
497 NDalicManualPINVOKE.InputMethodContext_CallbackData_update_set(swigCPtr, value);
498 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
502 bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_update_get(swigCPtr);
503 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
509 /// Flags if preedit reset is required.
511 /// <since_tizen> 4 </since_tizen>
512 public bool PreeditResetRequired
516 NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_set(swigCPtr, value);
517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 bool ret = NDalicManualPINVOKE.InputMethodContext_CallbackData_preeditResetRequired_get(swigCPtr);
522 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 /// Destroys the context of the IMF.<br/>
532 /// <since_tizen> 5 </since_tizen>
533 public void DestroyContext()
535 NDalicManualPINVOKE.InputMethodContext_Finalize(swigCPtr);
536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
540 /// Destroy the context of the IMF.<br/>
542 /// <since_tizen> 4 </since_tizen>
543 /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.ImfManager.Instance.DestroyContext()!
544 #pragma warning disable 0465
545 [Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")]
546 [EditorBrowsable(EditorBrowsableState.Never)]
547 public void Finalize()
551 #pragma warning restore 0465
554 /// Retrieves a handle to the instance of the ImfManager.
556 /// <returns>A handle to the ImfManager.</returns>
557 /// <since_tizen> 3 </since_tizen>
558 public static ImfManager Get()
560 return new ImfManager();
564 /// Constructor.<br/>
566 /// <since_tizen> 5 </since_tizen>
567 public ImfManager () : this (NDalicManualPINVOKE.InputMethodContext_New(), true) {
568 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572 internal ImfManager(ImfManager imfManager) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(ImfManager.getCPtr(imfManager)), true) {
573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 internal ImfManager Assign(ImfManager imfManager) {
577 ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, ImfManager.getCPtr(imfManager)), false);
578 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 internal static ImfManager DownCast(BaseHandle handle) {
583 ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
584 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589 /// Activates the IMF.<br/>
590 /// It means that the text editing is started somewhere.<br/>
591 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
593 /// <since_tizen> 3 </since_tizen>
594 public void Activate()
596 NDalicManualPINVOKE.InputMethodContext_Activate(swigCPtr);
597 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 /// Deactivates the IMF.<br/>
602 /// It means that the text editing is finished somewhere.
604 /// <since_tizen> 3 </since_tizen>
605 public void Deactivate()
607 NDalicManualPINVOKE.InputMethodContext_Deactivate(swigCPtr);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
613 /// If true, then the keyboard will be restored (activated) after focus is regained.
615 /// <returns>The restoration status.</returns>
616 /// <since_tizen> 3 </since_tizen>
617 public bool RestoreAfterFocusLost()
619 bool ret = NDalicManualPINVOKE.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
627 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
628 /// <since_tizen> 3 </since_tizen>
629 public void SetRestoreAfterFocusLost(bool toggle)
631 NDalicManualPINVOKE.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
632 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 /// Sends a message reset to the preedit state or the IMF module.
638 /// <since_tizen> 3 </since_tizen>
639 public new void Reset()
641 NDalicManualPINVOKE.InputMethodContext_Reset(swigCPtr);
642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
646 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
648 /// <since_tizen> 3 </since_tizen>
649 public void NotifyCursorPosition()
651 NDalicManualPINVOKE.InputMethodContext_NotifyCursorPosition(swigCPtr);
652 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
658 /// <param name="cursorPosition">The position of the cursor.</param>
659 /// <since_tizen> 3 </since_tizen>
660 public void SetCursorPosition(uint cursorPosition)
662 NDalicManualPINVOKE.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
663 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
669 /// <returns>The current position of the cursor.</returns>
670 /// <since_tizen> 3 </since_tizen>
671 public uint GetCursorPosition()
673 uint ret = NDalicManualPINVOKE.InputMethodContext_GetCursorPosition(swigCPtr);
674 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
679 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
681 /// <param name="text">The text string surrounding the current cursor point.</param>
682 /// <since_tizen> 3 </since_tizen>
683 public void SetSurroundingText(string text)
685 NDalicManualPINVOKE.InputMethodContext_SetSurroundingText(swigCPtr, text);
686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
690 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
692 /// <returns>The surrounding text.</returns>
693 /// <since_tizen> 3 </since_tizen>
694 public string GetSurroundingText()
696 string ret = NDalicManualPINVOKE.InputMethodContext_GetSurroundingText(swigCPtr);
697 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
702 /// Notifies the IMF context that text input is set to multiline or not.
704 /// <param name="multiLine">True if multiline text input is used.</param>
705 /// <since_tizen> 3 </since_tizen>
706 public void NotifyTextInputMultiLine(bool multiLine)
708 NDalicManualPINVOKE.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
709 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
713 /// Returns the text direction of the keyboard's current input language.
715 /// <returns>The direction of the text.</returns>
716 /// <since_tizen> 3 </since_tizen>
717 public ImfManager.TextDirection GetTextDirection()
719 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.InputMethodContext_GetTextDirection(swigCPtr);
720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725 /// Provides the size and the position of the keyboard.<br/>
726 /// The position is relative to whether the keyboard is visible or not.<br/>
727 /// If the keyboard is not visible, then the position will be off the screen.<br/>
728 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
729 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
731 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
732 /// <since_tizen> 3 </since_tizen>
733 public Rectangle GetInputMethodArea()
735 Rectangle ret = new Rectangle(NDalicManualPINVOKE.InputMethodContext_GetInputMethodArea(swigCPtr), true);
736 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
740 internal void ApplyOptions(InputMethodOptions options)
742 NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747 /// Sets up the input-panel specific data.
749 /// <param name="text">The specific data to be set to the input panel.</param>
750 /// <since_tizen> 3 </since_tizen>
751 public void SetInputPanelUserData(string text)
753 NDalicManualPINVOKE.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 /// Gets the specific data of the current active input panel.
760 /// <param name="text">The specific data to be received from the input panel.</param>
761 /// <since_tizen> 4 </since_tizen>
762 public void GetInputPanelUserData(out string text)
764 NDalicManualPINVOKE.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 /// Gets the state of the current active input panel.
771 /// <returns>The state of the input panel.</returns>
772 /// <since_tizen> 3 </since_tizen>
773 public ImfManager.State GetInputPanelState()
775 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.InputMethodContext_GetInputPanelState(swigCPtr);
776 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
781 /// Sets the return key on the input panel to be visible or invisible.<br/>
782 /// The default is true.
784 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
785 /// <since_tizen> 3 </since_tizen>
786 public void SetReturnKeyState(bool visible)
788 NDalicManualPINVOKE.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 /// Enables to show the input panel automatically when focused.
795 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
796 /// <since_tizen> 3 </since_tizen>
797 public void AutoEnableInputPanel(bool enabled)
799 NDalicManualPINVOKE.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
804 /// Shows the input panel.
806 /// <since_tizen> 3 </since_tizen>
807 public void ShowInputPanel()
809 NDalicManualPINVOKE.InputMethodContext_ShowInputPanel(swigCPtr);
810 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
814 /// Hides the input panel.
816 /// <since_tizen> 3 </since_tizen>
817 public void HideInputPanel()
819 NDalicManualPINVOKE.InputMethodContext_HideInputPanel(swigCPtr);
820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
824 /// Gets the keyboard type.<br/>
825 /// The default keyboard type is SoftwareKeyboard.
827 /// <returns>The keyboard type.</returns>
828 /// <since_tizen> 4 </since_tizen>
829 public ImfManager.KeyboardType GetKeyboardType()
831 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.InputMethodContext_GetKeyboardType(swigCPtr);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
837 /// Gets the current language locale of the input panel.<br/>
838 /// For example, en_US, en_GB, en_PH, fr_FR, ...
840 /// <returns>The current language locale of the input panel.</returns>
841 /// <since_tizen> 4 </since_tizen>
842 public string GetInputPanelLocale()
844 string ret = NDalicManualPINVOKE.InputMethodContext_GetInputPanelLocale(swigCPtr);
845 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
850 /// ImfManager activated event arguments.
852 /// <since_tizen> 4 </since_tizen>
853 public class ActivatedEventArgs : EventArgs
858 /// <since_tizen> 4 </since_tizen>
859 public ImfManager ImfManager
866 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
867 private delegate void ActivatedEventCallbackType(IntPtr data);
868 private ActivatedEventCallbackType _activatedEventCallback;
869 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
872 /// ImfManager activated.
874 /// <since_tizen> 4 </since_tizen>
875 public event EventHandler<ActivatedEventArgs> Activated
879 if (_activatedEventHandler == null)
881 _activatedEventCallback = OnActivated;
882 ActivatedSignal().Connect(_activatedEventCallback);
885 _activatedEventHandler += value;
889 _activatedEventHandler -= value;
891 if (_activatedEventHandler == null && _activatedEventCallback != null)
893 ActivatedSignal().Disconnect(_activatedEventCallback);
898 private void OnActivated(IntPtr data)
900 ActivatedEventArgs e = new ActivatedEventArgs();
904 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
907 if (_activatedEventHandler != null)
909 _activatedEventHandler(this, e);
913 internal ActivatedSignalType ActivatedSignal()
915 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.InputMethodContext_ActivatedSignal(swigCPtr), false);
916 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921 /// ImfManager event received event arguments.
923 /// <since_tizen> 4 </since_tizen>
924 public class EventReceivedEventArgs : EventArgs
929 /// <since_tizen> 4 </since_tizen>
930 public ImfManager ImfManager
939 /// <since_tizen> 4 </since_tizen>
940 public ImfEventData ImfEventData
947 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
948 private EventReceivedEventCallbackType _eventReceivedEventCallback;
949 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
952 /// ImfManager event received.
954 /// <since_tizen> 4 </since_tizen>
955 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
959 if (_eventReceivedEventHandler == null)
961 _eventReceivedEventCallback = OnEventReceived;
962 EventReceivedSignal().Connect(_eventReceivedEventCallback);
965 _eventReceivedEventHandler += value;
969 _eventReceivedEventHandler -= value;
971 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
973 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
978 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
980 ImfCallbackData imfCallbackData = null;
982 EventReceivedEventArgs e = new EventReceivedEventArgs();
984 if (imfManager != null)
986 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
988 if (imfEventData != null)
990 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
993 if (_eventReceivedEventHandler != null)
995 imfCallbackData = _eventReceivedEventHandler(this, e);
997 if (imfCallbackData != null)
999 return imfCallbackData.GetImfCallbackDataPtr();
1003 return new ImfCallbackData().GetImfCallbackDataPtr();
1007 internal KeyboardEventSignalType EventReceivedSignal()
1009 KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
1010 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1015 /// ImfManager status changed event arguments.
1017 /// <since_tizen> 4 </since_tizen>
1018 public class StatusChangedEventArgs : EventArgs
1021 /// ImfManager status
1023 /// <since_tizen> 4 </since_tizen>
1024 public bool StatusChanged
1031 private delegate void StatusChangedEventCallbackType(bool statusChanged);
1032 private StatusChangedEventCallbackType _statusChangedEventCallback;
1033 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
1036 /// ImfManager status changed.
1038 /// <since_tizen> 4 </since_tizen>
1039 public event EventHandler<StatusChangedEventArgs> StatusChanged
1043 if (_statusChangedEventHandler == null)
1045 _statusChangedEventCallback = OnStatusChanged;
1046 StatusChangedSignal().Connect(_statusChangedEventCallback);
1049 _statusChangedEventHandler += value;
1053 _statusChangedEventHandler -= value;
1055 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
1057 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1062 private void OnStatusChanged(bool statusChanged)
1064 StatusChangedEventArgs e = new StatusChangedEventArgs();
1066 e.StatusChanged = statusChanged;
1068 if (_statusChangedEventHandler != null)
1070 _statusChangedEventHandler(this, e);
1074 internal StatusSignalType StatusChangedSignal()
1076 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.InputMethodContext_StatusChangedSignal(swigCPtr), false);
1077 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1082 /// ImfManager resized event.
1084 /// <since_tizen> 4 </since_tizen>
1085 public class ResizedEventArgs : EventArgs
1090 /// <since_tizen> 4 </since_tizen>
1098 private delegate void ResizedEventCallbackType(int resized);
1099 private ResizedEventCallbackType _resizedEventCallback;
1100 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1103 /// ImfManager resized.
1105 /// <since_tizen> 4 </since_tizen>
1106 public event EventHandler<ResizedEventArgs> Resized
1110 if (_resizedEventHandler == null)
1112 _resizedEventCallback = OnResized;
1113 ResizedSignal().Connect(_resizedEventCallback);
1116 _resizedEventHandler += value;
1120 _resizedEventHandler -= value;
1122 if (_resizedEventHandler == null && _resizedEventCallback != null)
1124 ResizedSignal().Disconnect(_resizedEventCallback);
1129 private void OnResized(int resized)
1131 ResizedEventArgs e = new ResizedEventArgs();
1132 e.Resized = resized;
1134 if (_resizedEventHandler != null)
1136 _resizedEventHandler(this, e);
1140 internal KeyboardResizedSignalType ResizedSignal()
1142 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
1143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1148 /// ImfManager language changed event args.
1150 /// <since_tizen> 4 </since_tizen>
1151 public class LanguageChangedEventArgs : EventArgs
1154 /// language changed.
1156 /// <since_tizen> 4 </since_tizen>
1157 public int LanguageChanged
1164 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1165 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1166 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1169 /// ImfManager language changed.
1171 /// <since_tizen> 4 </since_tizen>
1172 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1176 if (_languageChangedEventHandler == null)
1178 _languageChangedEventCallback = OnLanguageChanged;
1179 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1182 _languageChangedEventHandler += value;
1186 _languageChangedEventHandler -= value;
1188 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1190 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1195 private void OnLanguageChanged(int languageChanged)
1197 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1198 e.LanguageChanged = languageChanged;
1200 if (_languageChangedEventHandler != null)
1202 _languageChangedEventHandler(this, e);
1206 internal LanguageChangedSignalType LanguageChangedSignal()
1208 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
1209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214 /// ImfManager keyboard type changed event arguments.
1216 /// <since_tizen> 4 </since_tizen>
1217 public class KeyboardTypeChangedEventArgs : EventArgs
1220 /// ImfManager keyboard type
1222 /// <since_tizen> 4 </since_tizen>
1223 public KeyboardType KeyboardType
1230 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1231 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1232 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1235 /// ImfManager keyboard type changed.
1237 /// <since_tizen> 4 </since_tizen>
1238 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1242 if (_keyboardTypeChangedEventHandler == null)
1244 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1245 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1248 _keyboardTypeChangedEventHandler += value;
1252 _keyboardTypeChangedEventHandler -= value;
1254 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1256 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1261 private void OnKeyboardTypeChanged(KeyboardType type)
1263 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1265 e.KeyboardType = type;
1267 if (_keyboardTypeChangedEventHandler != null)
1269 _keyboardTypeChangedEventHandler(this, e);
1273 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1275 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
1276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1281 /// The direction of the text.
1283 /// <since_tizen> 3 </since_tizen>
1284 public enum TextDirection
1297 /// Events that are generated by the IMF.
1299 /// <since_tizen> 3 </since_tizen>
1300 public enum ImfEvent
1305 /// <since_tizen> 4 </since_tizen>
1308 /// Pre-Edit changed.
1310 /// <since_tizen> 4 </since_tizen>
1313 /// Commit received.
1315 /// <since_tizen> 4 </since_tizen>
1318 /// An event to delete a range of characters from the string.
1320 /// <since_tizen> 4 </since_tizen>
1323 /// An event to query string and the cursor position.
1325 /// <since_tizen> 4 </since_tizen>
1328 /// Private command sent from the input panel.
1330 /// <since_tizen> 4 </since_tizen>
1335 /// Enumeration for the state of the input panel.
1337 /// <since_tizen> 3 </since_tizen>
1343 /// <since_tizen> 4 </since_tizen>
1346 /// Input panel is shown.
1348 /// <since_tizen> 4 </since_tizen>
1351 /// Input panel is hidden.
1353 /// <since_tizen> 4 </since_tizen>
1356 /// Input panel in process of being shown.
1358 /// <since_tizen> 4 </since_tizen>
1363 /// Enumeration for the types of keyboard.
1365 /// <since_tizen> 4 </since_tizen>
1366 public enum KeyboardType
1369 /// Software keyboard (virtual keyboard) is default.
1371 /// <since_tizen> 4 </since_tizen>
1374 /// Hardware keyboard.
1376 /// <since_tizen> 4 </since_tizen>