2 * Copyright(c) 2017 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 ImfManager : BaseHandle
30 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32 internal ImfManager(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ImfManager_SWIGUpcast(cPtr), cMemoryOwn)
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
42 private static readonly ImfManager instance = ImfManager.Get();
45 /// Gets the singleton of the ImfManager object.
47 /// <since_tizen> 5 </since_tizen>
48 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
49 [EditorBrowsable(EditorBrowsableState.Never)]
50 public static ImfManager Instance
59 /// This structure is used to pass on data from the IMF regarding predictive text.
61 /// <since_tizen> 3 </since_tizen>
62 public class ImfEventData : global::System.IDisposable
64 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
68 /// <since_tizen> 3 </since_tizen>
69 protected bool swigCMemOwn;
71 internal ImfEventData(IntPtr cPtr, bool cMemoryOwn)
73 swigCMemOwn = cMemoryOwn;
74 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
77 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
79 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
82 //A Flag to check who called Dispose(). (By User or DisposeQueue)
83 private bool isDisposeQueued = false;
85 /// A Flat to check if it is already disposed.
87 /// <since_tizen> 3 </since_tizen>
88 protected bool disposed = false;
93 /// <since_tizen> 3 </since_tizen>
98 isDisposeQueued = true;
99 DisposeQueue.Instance.Add(this);
104 /// The dispose pattern.
106 /// <since_tizen> 3 </since_tizen>
107 public void Dispose()
109 //Throw excpetion if Dispose() is called in separate thread.
110 if (!Window.IsInstalled())
112 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
117 Dispose(DisposeTypes.Implicit);
121 Dispose(DisposeTypes.Explicit);
122 System.GC.SuppressFinalize(this);
129 /// <since_tizen> 3 </since_tizen>
130 protected virtual void Dispose(DisposeTypes type)
137 if (type == DisposeTypes.Explicit)
140 //Release your own managed resources here.
141 //You should release all of your own disposable objects here.
145 //Release your own unmanaged resources here.
146 //You should not access any managed member here except static instance.
147 //because the execution order of Finalizes is non-deterministic.
149 if (swigCPtr.Handle != IntPtr.Zero)
154 NDalicManualPINVOKE.delete_ImfManager_ImfEventData(swigCPtr);
156 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
162 internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
164 ImfEventData ret = new ImfEventData(cPtr, false);
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 /// The default constructor.
172 /// <since_tizen> 3 </since_tizen>
173 public ImfEventData() : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_0(), true)
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// <param name="aEventName">The name of the event from the IMF.</param>
182 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
183 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
184 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
185 /// <since_tizen> 3 </since_tizen>
186 public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 /// The pre-edit or the commit string.
194 /// <since_tizen> 4 </since_tizen>
195 public string PredictiveString
199 NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value);
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211 /// The name of the event from the IMF.
213 /// <since_tizen> 4 </since_tizen>
214 public ImfManager.ImfEvent EventName
218 NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value);
219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223 ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr);
224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 /// The start position from the current cursor position to start deleting characters.
232 /// <since_tizen> 4 </since_tizen>
233 public int CursorOffset
237 NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249 /// The number of characters to delete from the cursorOffset.
251 /// <since_tizen> 4 </since_tizen>
252 public int NumberOfChars
256 NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value);
257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
261 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270 /// Data required by the IMF from the callback.
272 /// <since_tizen> 3 </since_tizen>
273 public class ImfCallbackData : global::System.IDisposable
275 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
279 /// <since_tizen> 3 </since_tizen>
280 protected bool swigCMemOwn;
282 internal IntPtr GetImfCallbackDataPtr()
284 return (IntPtr)swigCPtr;
287 internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
289 swigCMemOwn = cMemoryOwn;
290 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
293 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
295 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
298 //A Flag to check who called Dispose(). (By User or DisposeQueue)
299 private bool isDisposeQueued = false;
301 /// A Flat to check if it is already disposed.
303 /// <since_tizen> 3 </since_tizen>
304 protected bool disposed = false;
310 /// <since_tizen> 3 </since_tizen>
313 if (!isDisposeQueued)
315 isDisposeQueued = true;
316 DisposeQueue.Instance.Add(this);
321 /// The dispose pattern.
323 /// <since_tizen> 3 </since_tizen>
324 public void Dispose()
326 //Throw excpetion if Dispose() is called in separate thread.
327 if (!Window.IsInstalled())
329 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
334 Dispose(DisposeTypes.Implicit);
338 Dispose(DisposeTypes.Explicit);
339 System.GC.SuppressFinalize(this);
346 /// <since_tizen> 3 </since_tizen>
347 protected virtual void Dispose(DisposeTypes type)
354 if (type == DisposeTypes.Explicit)
357 //Release your own managed resources here.
358 //You should release all of your own disposable objects here.
362 //Release your own unmanaged resources here.
363 //You should not access any managed member here except static instance.
364 //because the execution order of Finalizes is non-deterministic.
366 if (swigCPtr.Handle != IntPtr.Zero)
371 NDalicManualPINVOKE.delete_ImfManager_ImfCallbackData(swigCPtr);
373 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
379 internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
381 ImfCallbackData ret = new ImfCallbackData(cPtr, false);
382 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 /// The default constructor.
389 /// <since_tizen> 3 </since_tizen>
390 public ImfCallbackData() : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_0(), true)
392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
399 /// <param name="aCursorPosition">The new position of the cursor.</param>
400 /// <param name="aCurrentText">The current text string.</param>
401 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
402 /// <since_tizen> 3 </since_tizen>
403 public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
405 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409 /// The current text string.
411 /// <since_tizen> 4 </since_tizen>
412 public string CurrentText
416 NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value);
417 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
421 string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr);
422 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
428 /// The current text string.
430 /// <since_tizen> 4 </since_tizen>
431 public int CursorPosition
435 NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
440 int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447 /// If the cursor position needs to be updated.
449 /// <since_tizen> 4 </since_tizen>
454 NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value);
455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466 /// Flags if preedit reset is required.
468 /// <since_tizen> 4 </since_tizen>
469 public bool PreeditResetRequired
473 NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value);
474 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
478 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr);
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
487 /// Destroy the context of the IMF.<br/>
489 /// <since_tizen> 5 </since_tizen>
490 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
491 [EditorBrowsable(EditorBrowsableState.Never)]
492 public void DestroyContext()
494 NDalicManualPINVOKE.ImfManager_Finalize(swigCPtr);
495 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 /// Destroy the context of the IMF.<br/>
501 /// <since_tizen> 4 </since_tizen>
502 /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.ImfManager.Instance.DestroyContext()!
503 [Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")]
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 public void Finalize()
511 /// Retrieves a handle to the instance of the ImfManager.
513 /// <returns>A handle to the ImfManager.</returns>
514 /// <since_tizen> 3 </since_tizen>
515 public static ImfManager Get()
517 ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
518 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 /// Activates the IMF.<br/>
524 /// It means that the text editing is started somewhere.<br/>
525 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
527 /// <since_tizen> 3 </since_tizen>
528 public void Activate()
530 NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
531 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535 /// Deactivates the IMF.<br/>
536 /// It means that the text editing is finished somewhere.
538 /// <since_tizen> 3 </since_tizen>
539 public void Deactivate()
541 NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
546 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
547 /// If true, then the keyboard will be restored (activated) after focus is regained.
549 /// <returns>The restoration status.</returns>
550 /// <since_tizen> 3 </since_tizen>
551 public bool RestoreAfterFocusLost()
553 bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
561 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
562 /// <since_tizen> 3 </since_tizen>
563 public void SetRestoreAfterFocusLost(bool toggle)
565 NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
566 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
570 /// Sends a message reset to the preedit state or the IMF module.
572 /// <since_tizen> 3 </since_tizen>
573 public new void Reset()
575 NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
576 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
580 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
582 /// <since_tizen> 3 </since_tizen>
583 public void NotifyCursorPosition()
585 NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
586 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
592 /// <param name="cursorPosition">The position of the cursor.</param>
593 /// <since_tizen> 3 </since_tizen>
594 public void SetCursorPosition(uint cursorPosition)
596 NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
597 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
603 /// <returns>The current position of the cursor.</returns>
604 /// <since_tizen> 3 </since_tizen>
605 public uint GetCursorPosition()
607 uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
613 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
615 /// <param name="text">The text string surrounding the current cursor point.</param>
616 /// <since_tizen> 3 </since_tizen>
617 public void SetSurroundingText(string text)
619 NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
626 /// <returns>The surrounding text.</returns>
627 /// <since_tizen> 3 </since_tizen>
628 public string GetSurroundingText()
630 string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
636 /// Notifies the IMF context that text input is set to multiline or not.
638 /// <param name="multiLine">True if multiline text input is used.</param>
639 /// <since_tizen> 3 </since_tizen>
640 public void NotifyTextInputMultiLine(bool multiLine)
642 NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
643 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 /// Returns the text direction of the keyboard's current input language.
649 /// <returns>The direction of the text.</returns>
650 /// <since_tizen> 3 </since_tizen>
651 public ImfManager.TextDirection GetTextDirection()
653 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 /// Provides the size and the position of the keyboard.<br/>
660 /// The position is relative to whether the keyboard is visible or not.<br/>
661 /// If the keyboard is not visible, then the position will be off the screen.<br/>
662 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
663 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
665 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
666 /// <since_tizen> 3 </since_tizen>
667 public Rectangle GetInputMethodArea()
669 Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
670 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
674 internal void ApplyOptions(InputMethodOptions options)
676 NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
677 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
681 /// Sets up the input-panel specific data.
683 /// <param name="text">The specific data to be set to the input panel.</param>
684 /// <since_tizen> 3 </since_tizen>
685 public void SetInputPanelUserData(string text)
687 NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
688 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
692 /// Gets the specific data of the current active input panel.
694 /// <param name="text">The specific data to be received from the input panel.</param>
695 /// <since_tizen> 4 </since_tizen>
696 public void GetInputPanelUserData(out string text)
698 NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
699 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 /// Gets the state of the current active input panel.
705 /// <returns>The state of the input panel.</returns>
706 /// <since_tizen> 3 </since_tizen>
707 public ImfManager.State GetInputPanelState()
709 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 /// Sets the return key on the input panel to be visible or invisible.<br/>
716 /// The default is true.
718 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
719 /// <since_tizen> 3 </since_tizen>
720 public void SetReturnKeyState(bool visible)
722 NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
723 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
727 /// Enables to show the input panel automatically when focused.
729 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
730 /// <since_tizen> 3 </since_tizen>
731 public void AutoEnableInputPanel(bool enabled)
733 NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 /// Shows the input panel.
740 /// <since_tizen> 3 </since_tizen>
741 public void ShowInputPanel()
743 NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
744 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 /// Hides the input panel.
750 /// <since_tizen> 3 </since_tizen>
751 public void HideInputPanel()
753 NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
758 /// Gets the keyboard type.<br/>
759 /// The default keyboard type is SoftwareKeyboard.
761 /// <returns>The keyboard type.</returns>
762 /// <since_tizen> 4 </since_tizen>
763 public ImfManager.KeyboardType GetKeyboardType()
765 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 /// Gets the current language locale of the input panel.<br/>
772 /// For example, en_US, en_GB, en_PH, fr_FR, ...
774 /// <returns>The current language locale of the input panel.</returns>
775 /// <since_tizen> 4 </since_tizen>
776 public string GetInputPanelLocale()
778 string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
779 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
786 /// <since_tizen> 3 </since_tizen>
787 public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
793 /// ImfManager activated event arguments.
795 /// <since_tizen> 4 </since_tizen>
796 public class ActivatedEventArgs : EventArgs
801 /// <since_tizen> 4 </since_tizen>
802 public ImfManager ImfManager
809 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
810 private delegate void ActivatedEventCallbackType(IntPtr data);
811 private ActivatedEventCallbackType _activatedEventCallback;
812 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
815 /// ImfManager activated.
817 /// <since_tizen> 4 </since_tizen>
818 public event EventHandler<ActivatedEventArgs> Activated
822 if (_activatedEventHandler == null)
824 _activatedEventCallback = OnActivated;
825 ActivatedSignal().Connect(_activatedEventCallback);
828 _activatedEventHandler += value;
832 _activatedEventHandler -= value;
834 if (_activatedEventHandler == null && _activatedEventCallback != null)
836 ActivatedSignal().Disconnect(_activatedEventCallback);
841 private void OnActivated(IntPtr data)
843 ActivatedEventArgs e = new ActivatedEventArgs();
847 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
850 if (_activatedEventHandler != null)
852 _activatedEventHandler(this, e);
856 internal ActivatedSignalType ActivatedSignal()
858 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
859 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
864 /// ImfManager event received event arguments.
866 /// <since_tizen> 4 </since_tizen>
867 public class EventReceivedEventArgs : EventArgs
872 /// <since_tizen> 4 </since_tizen>
873 public ImfManager ImfManager
882 /// <since_tizen> 4 </since_tizen>
883 public ImfEventData ImfEventData
890 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
891 private EventReceivedEventCallbackType _eventReceivedEventCallback;
892 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
895 /// ImfManager event received.
897 /// <since_tizen> 4 </since_tizen>
898 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
902 if (_eventReceivedEventHandler == null)
904 _eventReceivedEventCallback = OnEventReceived;
905 EventReceivedSignal().Connect(_eventReceivedEventCallback);
908 _eventReceivedEventHandler += value;
912 _eventReceivedEventHandler -= value;
914 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
916 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
921 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
923 ImfCallbackData imfCallbackData = null;
925 EventReceivedEventArgs e = new EventReceivedEventArgs();
927 if (imfManager != null)
929 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
931 if (imfEventData != null)
933 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
936 if (_eventReceivedEventHandler != null)
938 imfCallbackData = _eventReceivedEventHandler(this, e);
940 if (imfCallbackData != null)
942 return imfCallbackData.GetImfCallbackDataPtr();
946 return new ImfCallbackData().GetImfCallbackDataPtr();
950 internal ImfEventSignalType EventReceivedSignal()
952 ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
953 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
958 /// ImfManager status changed event arguments.
960 /// <since_tizen> 4 </since_tizen>
961 public class StatusChangedEventArgs : EventArgs
964 /// ImfManager status
966 /// <since_tizen> 4 </since_tizen>
967 public bool StatusChanged
974 private delegate void StatusChangedEventCallbackType(bool statusChanged);
975 private StatusChangedEventCallbackType _statusChangedEventCallback;
976 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
979 /// ImfManager status changed.
981 /// <since_tizen> 4 </since_tizen>
982 public event EventHandler<StatusChangedEventArgs> StatusChanged
986 if (_statusChangedEventHandler == null)
988 _statusChangedEventCallback = OnStatusChanged;
989 StatusChangedSignal().Connect(_statusChangedEventCallback);
992 _statusChangedEventHandler += value;
996 _statusChangedEventHandler -= value;
998 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
1000 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1005 private void OnStatusChanged(bool statusChanged)
1007 StatusChangedEventArgs e = new StatusChangedEventArgs();
1009 e.StatusChanged = statusChanged;
1011 if (_statusChangedEventHandler != null)
1013 _statusChangedEventHandler(this, e);
1017 internal StatusSignalType StatusChangedSignal()
1019 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
1020 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1025 /// ImfManager resized event.
1027 /// <since_tizen> 4 </since_tizen>
1028 public class ResizedEventArgs : EventArgs
1033 /// <since_tizen> 4 </since_tizen>
1041 private delegate void ResizedEventCallbackType(int resized);
1042 private ResizedEventCallbackType _resizedEventCallback;
1043 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1046 /// ImfManager resized.
1048 /// <since_tizen> 4 </since_tizen>
1049 public event EventHandler<ResizedEventArgs> Resized
1053 if (_resizedEventHandler == null)
1055 _resizedEventCallback = OnResized;
1056 ResizedSignal().Connect(_resizedEventCallback);
1059 _resizedEventHandler += value;
1063 _resizedEventHandler -= value;
1065 if (_resizedEventHandler == null && _resizedEventCallback != null)
1067 ResizedSignal().Disconnect(_resizedEventCallback);
1072 private void OnResized(int resized)
1074 ResizedEventArgs e = new ResizedEventArgs();
1075 e.Resized = resized;
1077 if (_resizedEventHandler != null)
1079 _resizedEventHandler(this, e);
1083 internal KeyboardResizedSignalType ResizedSignal()
1085 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false);
1086 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091 /// ImfManager language changed event args.
1093 /// <since_tizen> 4 </since_tizen>
1094 public class LanguageChangedEventArgs : EventArgs
1097 /// language changed.
1099 /// <since_tizen> 4 </since_tizen>
1100 public int LanguageChanged
1107 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1108 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1109 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1112 /// ImfManager language changed.
1114 /// <since_tizen> 4 </since_tizen>
1115 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1119 if (_languageChangedEventHandler == null)
1121 _languageChangedEventCallback = OnLanguageChanged;
1122 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1125 _languageChangedEventHandler += value;
1129 _languageChangedEventHandler -= value;
1131 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1133 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1138 private void OnLanguageChanged(int languageChanged)
1140 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1141 e.LanguageChanged = languageChanged;
1143 if (_languageChangedEventHandler != null)
1145 _languageChangedEventHandler(this, e);
1149 internal LanguageChangedSignalType LanguageChangedSignal()
1151 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false);
1152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1157 /// ImfManager keyboard type changed event arguments.
1159 /// <since_tizen> 4 </since_tizen>
1160 public class KeyboardTypeChangedEventArgs : EventArgs
1163 /// ImfManager keyboard type
1165 /// <since_tizen> 4 </since_tizen>
1166 public KeyboardType KeyboardType
1173 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1174 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1175 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1178 /// ImfManager keyboard type changed.
1180 /// <since_tizen> 4 </since_tizen>
1181 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1185 if (_keyboardTypeChangedEventHandler == null)
1187 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1188 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1191 _keyboardTypeChangedEventHandler += value;
1195 _keyboardTypeChangedEventHandler -= value;
1197 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1199 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1204 private void OnKeyboardTypeChanged(KeyboardType type)
1206 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1208 e.KeyboardType = type;
1210 if (_keyboardTypeChangedEventHandler != null)
1212 _keyboardTypeChangedEventHandler(this, e);
1216 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1218 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1224 /// The direction of the text.
1226 /// <since_tizen> 3 </since_tizen>
1227 public enum TextDirection
1240 /// Events that are generated by the IMF.
1242 /// <since_tizen> 3 </since_tizen>
1243 public enum ImfEvent
1248 /// <since_tizen> 4 </since_tizen>
1251 /// Pre-Edit changed.
1253 /// <since_tizen> 4 </since_tizen>
1256 /// Commit received.
1258 /// <since_tizen> 4 </since_tizen>
1261 /// An event to delete a range of characters from the string.
1263 /// <since_tizen> 4 </since_tizen>
1266 /// An event to query string and the cursor position.
1268 /// <since_tizen> 4 </since_tizen>
1271 /// Private command sent from the input panel.
1273 /// <since_tizen> 4 </since_tizen>
1278 /// Enumeration for the state of the input panel.
1280 /// <since_tizen> 3 </since_tizen>
1286 /// <since_tizen> 4 </since_tizen>
1289 /// Input panel is shown.
1291 /// <since_tizen> 4 </since_tizen>
1294 /// Input panel is hidden.
1296 /// <since_tizen> 4 </since_tizen>
1299 /// Input panel in process of being shown.
1301 /// <since_tizen> 4 </since_tizen>
1306 /// Enumeration for the types of keyboard.
1308 /// <since_tizen> 4 </since_tizen>
1309 public enum KeyboardType
1312 /// Software keyboard (virtual keyboard) is default.
1314 /// <since_tizen> 4 </since_tizen>
1317 /// Hardware keyboard.
1319 /// <since_tizen> 4 </since_tizen>