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 [Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")]
545 [EditorBrowsable(EditorBrowsableState.Never)]
546 public void Finalize()
552 /// Retrieves a handle to the instance of the ImfManager.
554 /// <returns>A handle to the ImfManager.</returns>
555 /// <since_tizen> 3 </since_tizen>
556 public static ImfManager Get()
558 return new ImfManager();
562 /// Constructor.<br/>
564 /// <since_tizen> 5 </since_tizen>
565 public ImfManager () : this (NDalicManualPINVOKE.InputMethodContext_New(), true) {
566 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
570 internal ImfManager(ImfManager imfManager) : this(NDalicManualPINVOKE.new_InputMethodContext__SWIG_1(ImfManager.getCPtr(imfManager)), true) {
571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 internal ImfManager Assign(ImfManager imfManager) {
575 ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_Assign(swigCPtr, ImfManager.getCPtr(imfManager)), false);
576 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
580 internal static ImfManager DownCast(BaseHandle handle) {
581 ImfManager ret = new ImfManager(NDalicManualPINVOKE.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
587 /// Activates the IMF.<br/>
588 /// It means that the text editing is started somewhere.<br/>
589 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
591 /// <since_tizen> 3 </since_tizen>
592 public void Activate()
594 NDalicManualPINVOKE.InputMethodContext_Activate(swigCPtr);
595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 /// Deactivates the IMF.<br/>
600 /// It means that the text editing is finished somewhere.
602 /// <since_tizen> 3 </since_tizen>
603 public void Deactivate()
605 NDalicManualPINVOKE.InputMethodContext_Deactivate(swigCPtr);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
611 /// If true, then the keyboard will be restored (activated) after focus is regained.
613 /// <returns>The restoration status.</returns>
614 /// <since_tizen> 3 </since_tizen>
615 public bool RestoreAfterFocusLost()
617 bool ret = NDalicManualPINVOKE.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
623 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
625 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
626 /// <since_tizen> 3 </since_tizen>
627 public void SetRestoreAfterFocusLost(bool toggle)
629 NDalicManualPINVOKE.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
630 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
634 /// Sends a message reset to the preedit state or the IMF module.
636 /// <since_tizen> 3 </since_tizen>
637 public new void Reset()
639 NDalicManualPINVOKE.InputMethodContext_Reset(swigCPtr);
640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
646 /// <since_tizen> 3 </since_tizen>
647 public void NotifyCursorPosition()
649 NDalicManualPINVOKE.InputMethodContext_NotifyCursorPosition(swigCPtr);
650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
656 /// <param name="cursorPosition">The position of the cursor.</param>
657 /// <since_tizen> 3 </since_tizen>
658 public void SetCursorPosition(uint cursorPosition)
660 NDalicManualPINVOKE.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
661 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
667 /// <returns>The current position of the cursor.</returns>
668 /// <since_tizen> 3 </since_tizen>
669 public uint GetCursorPosition()
671 uint ret = NDalicManualPINVOKE.InputMethodContext_GetCursorPosition(swigCPtr);
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
679 /// <param name="text">The text string surrounding the current cursor point.</param>
680 /// <since_tizen> 3 </since_tizen>
681 public void SetSurroundingText(string text)
683 NDalicManualPINVOKE.InputMethodContext_SetSurroundingText(swigCPtr, text);
684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
690 /// <returns>The surrounding text.</returns>
691 /// <since_tizen> 3 </since_tizen>
692 public string GetSurroundingText()
694 string ret = NDalicManualPINVOKE.InputMethodContext_GetSurroundingText(swigCPtr);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Notifies the IMF context that text input is set to multiline or not.
702 /// <param name="multiLine">True if multiline text input is used.</param>
703 /// <since_tizen> 3 </since_tizen>
704 public void NotifyTextInputMultiLine(bool multiLine)
706 NDalicManualPINVOKE.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 /// Returns the text direction of the keyboard's current input language.
713 /// <returns>The direction of the text.</returns>
714 /// <since_tizen> 3 </since_tizen>
715 public ImfManager.TextDirection GetTextDirection()
717 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.InputMethodContext_GetTextDirection(swigCPtr);
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723 /// Provides the size and the position of the keyboard.<br/>
724 /// The position is relative to whether the keyboard is visible or not.<br/>
725 /// If the keyboard is not visible, then the position will be off the screen.<br/>
726 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
727 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
729 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
730 /// <since_tizen> 3 </since_tizen>
731 public Rectangle GetInputMethodArea()
733 Rectangle ret = new Rectangle(NDalicManualPINVOKE.InputMethodContext_GetInputMethodArea(swigCPtr), true);
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 internal void ApplyOptions(InputMethodOptions options)
740 NDalicManualPINVOKE.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
741 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
745 /// Sets up the input-panel specific data.
747 /// <param name="text">The specific data to be set to the input panel.</param>
748 /// <since_tizen> 3 </since_tizen>
749 public void SetInputPanelUserData(string text)
751 NDalicManualPINVOKE.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
752 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 /// Gets the specific data of the current active input panel.
758 /// <param name="text">The specific data to be received from the input panel.</param>
759 /// <since_tizen> 4 </since_tizen>
760 public void GetInputPanelUserData(out string text)
762 NDalicManualPINVOKE.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
767 /// Gets the state of the current active input panel.
769 /// <returns>The state of the input panel.</returns>
770 /// <since_tizen> 3 </since_tizen>
771 public ImfManager.State GetInputPanelState()
773 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.InputMethodContext_GetInputPanelState(swigCPtr);
774 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
779 /// Sets the return key on the input panel to be visible or invisible.<br/>
780 /// The default is true.
782 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
783 /// <since_tizen> 3 </since_tizen>
784 public void SetReturnKeyState(bool visible)
786 NDalicManualPINVOKE.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791 /// Enables to show the input panel automatically when focused.
793 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
794 /// <since_tizen> 3 </since_tizen>
795 public void AutoEnableInputPanel(bool enabled)
797 NDalicManualPINVOKE.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
798 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
802 /// Shows the input panel.
804 /// <since_tizen> 3 </since_tizen>
805 public void ShowInputPanel()
807 NDalicManualPINVOKE.InputMethodContext_ShowInputPanel(swigCPtr);
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812 /// Hides the input panel.
814 /// <since_tizen> 3 </since_tizen>
815 public void HideInputPanel()
817 NDalicManualPINVOKE.InputMethodContext_HideInputPanel(swigCPtr);
818 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
822 /// Gets the keyboard type.<br/>
823 /// The default keyboard type is SoftwareKeyboard.
825 /// <returns>The keyboard type.</returns>
826 /// <since_tizen> 4 </since_tizen>
827 public ImfManager.KeyboardType GetKeyboardType()
829 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.InputMethodContext_GetKeyboardType(swigCPtr);
830 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
835 /// Gets the current language locale of the input panel.<br/>
836 /// For example, en_US, en_GB, en_PH, fr_FR, ...
838 /// <returns>The current language locale of the input panel.</returns>
839 /// <since_tizen> 4 </since_tizen>
840 public string GetInputPanelLocale()
842 string ret = NDalicManualPINVOKE.InputMethodContext_GetInputPanelLocale(swigCPtr);
843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 /// ImfManager activated event arguments.
850 /// <since_tizen> 4 </since_tizen>
851 public class ActivatedEventArgs : EventArgs
856 /// <since_tizen> 4 </since_tizen>
857 public ImfManager ImfManager
864 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
865 private delegate void ActivatedEventCallbackType(IntPtr data);
866 private ActivatedEventCallbackType _activatedEventCallback;
867 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
870 /// ImfManager activated.
872 /// <since_tizen> 4 </since_tizen>
873 public event EventHandler<ActivatedEventArgs> Activated
877 if (_activatedEventHandler == null)
879 _activatedEventCallback = OnActivated;
880 ActivatedSignal().Connect(_activatedEventCallback);
883 _activatedEventHandler += value;
887 _activatedEventHandler -= value;
889 if (_activatedEventHandler == null && _activatedEventCallback != null)
891 ActivatedSignal().Disconnect(_activatedEventCallback);
896 private void OnActivated(IntPtr data)
898 ActivatedEventArgs e = new ActivatedEventArgs();
902 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
905 if (_activatedEventHandler != null)
907 _activatedEventHandler(this, e);
911 internal ActivatedSignalType ActivatedSignal()
913 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.InputMethodContext_ActivatedSignal(swigCPtr), false);
914 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919 /// ImfManager event received event arguments.
921 /// <since_tizen> 4 </since_tizen>
922 public class EventReceivedEventArgs : EventArgs
927 /// <since_tizen> 4 </since_tizen>
928 public ImfManager ImfManager
937 /// <since_tizen> 4 </since_tizen>
938 public ImfEventData ImfEventData
945 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
946 private EventReceivedEventCallbackType _eventReceivedEventCallback;
947 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
950 /// ImfManager event received.
952 /// <since_tizen> 4 </since_tizen>
953 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
957 if (_eventReceivedEventHandler == null)
959 _eventReceivedEventCallback = OnEventReceived;
960 EventReceivedSignal().Connect(_eventReceivedEventCallback);
963 _eventReceivedEventHandler += value;
967 _eventReceivedEventHandler -= value;
969 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
971 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
976 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
978 ImfCallbackData imfCallbackData = null;
980 EventReceivedEventArgs e = new EventReceivedEventArgs();
982 if (imfManager != null)
984 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
986 if (imfEventData != null)
988 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
991 if (_eventReceivedEventHandler != null)
993 imfCallbackData = _eventReceivedEventHandler(this, e);
995 if (imfCallbackData != null)
997 return imfCallbackData.GetImfCallbackDataPtr();
1001 return new ImfCallbackData().GetImfCallbackDataPtr();
1005 internal KeyboardEventSignalType EventReceivedSignal()
1007 KeyboardEventSignalType ret = new KeyboardEventSignalType(NDalicManualPINVOKE.InputMethodContext_EventReceivedSignal(swigCPtr), false);
1008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 /// ImfManager status changed event arguments.
1015 /// <since_tizen> 4 </since_tizen>
1016 public class StatusChangedEventArgs : EventArgs
1019 /// ImfManager status
1021 /// <since_tizen> 4 </since_tizen>
1022 public bool StatusChanged
1029 private delegate void StatusChangedEventCallbackType(bool statusChanged);
1030 private StatusChangedEventCallbackType _statusChangedEventCallback;
1031 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
1034 /// ImfManager status changed.
1036 /// <since_tizen> 4 </since_tizen>
1037 public event EventHandler<StatusChangedEventArgs> StatusChanged
1041 if (_statusChangedEventHandler == null)
1043 _statusChangedEventCallback = OnStatusChanged;
1044 StatusChangedSignal().Connect(_statusChangedEventCallback);
1047 _statusChangedEventHandler += value;
1051 _statusChangedEventHandler -= value;
1053 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
1055 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1060 private void OnStatusChanged(bool statusChanged)
1062 StatusChangedEventArgs e = new StatusChangedEventArgs();
1064 e.StatusChanged = statusChanged;
1066 if (_statusChangedEventHandler != null)
1068 _statusChangedEventHandler(this, e);
1072 internal StatusSignalType StatusChangedSignal()
1074 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.InputMethodContext_StatusChangedSignal(swigCPtr), false);
1075 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1080 /// ImfManager resized event.
1082 /// <since_tizen> 4 </since_tizen>
1083 public class ResizedEventArgs : EventArgs
1088 /// <since_tizen> 4 </since_tizen>
1096 private delegate void ResizedEventCallbackType(int resized);
1097 private ResizedEventCallbackType _resizedEventCallback;
1098 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1101 /// ImfManager resized.
1103 /// <since_tizen> 4 </since_tizen>
1104 public event EventHandler<ResizedEventArgs> Resized
1108 if (_resizedEventHandler == null)
1110 _resizedEventCallback = OnResized;
1111 ResizedSignal().Connect(_resizedEventCallback);
1114 _resizedEventHandler += value;
1118 _resizedEventHandler -= value;
1120 if (_resizedEventHandler == null && _resizedEventCallback != null)
1122 ResizedSignal().Disconnect(_resizedEventCallback);
1127 private void OnResized(int resized)
1129 ResizedEventArgs e = new ResizedEventArgs();
1130 e.Resized = resized;
1132 if (_resizedEventHandler != null)
1134 _resizedEventHandler(this, e);
1138 internal KeyboardResizedSignalType ResizedSignal()
1140 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.InputMethodContext_ResizedSignal(swigCPtr), false);
1141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146 /// ImfManager language changed event args.
1148 /// <since_tizen> 4 </since_tizen>
1149 public class LanguageChangedEventArgs : EventArgs
1152 /// language changed.
1154 /// <since_tizen> 4 </since_tizen>
1155 public int LanguageChanged
1162 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1163 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1164 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1167 /// ImfManager language changed.
1169 /// <since_tizen> 4 </since_tizen>
1170 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1174 if (_languageChangedEventHandler == null)
1176 _languageChangedEventCallback = OnLanguageChanged;
1177 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1180 _languageChangedEventHandler += value;
1184 _languageChangedEventHandler -= value;
1186 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1188 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1193 private void OnLanguageChanged(int languageChanged)
1195 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1196 e.LanguageChanged = languageChanged;
1198 if (_languageChangedEventHandler != null)
1200 _languageChangedEventHandler(this, e);
1204 internal LanguageChangedSignalType LanguageChangedSignal()
1206 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
1207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212 /// ImfManager keyboard type changed event arguments.
1214 /// <since_tizen> 4 </since_tizen>
1215 public class KeyboardTypeChangedEventArgs : EventArgs
1218 /// ImfManager keyboard type
1220 /// <since_tizen> 4 </since_tizen>
1221 public KeyboardType KeyboardType
1228 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1229 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1230 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1233 /// ImfManager keyboard type changed.
1235 /// <since_tizen> 4 </since_tizen>
1236 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1240 if (_keyboardTypeChangedEventHandler == null)
1242 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1243 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1246 _keyboardTypeChangedEventHandler += value;
1250 _keyboardTypeChangedEventHandler -= value;
1252 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1254 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1259 private void OnKeyboardTypeChanged(KeyboardType type)
1261 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1263 e.KeyboardType = type;
1265 if (_keyboardTypeChangedEventHandler != null)
1267 _keyboardTypeChangedEventHandler(this, e);
1271 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1273 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1279 /// The direction of the text.
1281 /// <since_tizen> 3 </since_tizen>
1282 public enum TextDirection
1295 /// Events that are generated by the IMF.
1297 /// <since_tizen> 3 </since_tizen>
1298 public enum ImfEvent
1303 /// <since_tizen> 4 </since_tizen>
1306 /// Pre-Edit changed.
1308 /// <since_tizen> 4 </since_tizen>
1311 /// Commit received.
1313 /// <since_tizen> 4 </since_tizen>
1316 /// An event to delete a range of characters from the string.
1318 /// <since_tizen> 4 </since_tizen>
1321 /// An event to query string and the cursor position.
1323 /// <since_tizen> 4 </since_tizen>
1326 /// Private command sent from the input panel.
1328 /// <since_tizen> 4 </since_tizen>
1333 /// Enumeration for the state of the input panel.
1335 /// <since_tizen> 3 </since_tizen>
1341 /// <since_tizen> 4 </since_tizen>
1344 /// Input panel is shown.
1346 /// <since_tizen> 4 </since_tizen>
1349 /// Input panel is hidden.
1351 /// <since_tizen> 4 </since_tizen>
1354 /// Input panel in process of being shown.
1356 /// <since_tizen> 4 </since_tizen>
1361 /// Enumeration for the types of keyboard.
1363 /// <since_tizen> 4 </since_tizen>
1364 public enum KeyboardType
1367 /// Software keyboard (virtual keyboard) is default.
1369 /// <since_tizen> 4 </since_tizen>
1372 /// Hardware keyboard.
1374 /// <since_tizen> 4 </since_tizen>