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 public static ImfManager Instance
57 /// This structure is used to pass on data from the IMF regarding predictive text.
59 /// <since_tizen> 3 </since_tizen>
60 public class ImfEventData : global::System.IDisposable
62 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
66 /// <since_tizen> 3 </since_tizen>
67 protected bool swigCMemOwn;
69 internal ImfEventData(IntPtr cPtr, bool cMemoryOwn)
71 swigCMemOwn = cMemoryOwn;
72 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
75 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
77 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
80 //A Flag to check who called Dispose(). (By User or DisposeQueue)
81 private bool isDisposeQueued = false;
83 /// A Flat to check if it is already disposed.
85 /// <since_tizen> 3 </since_tizen>
86 protected bool disposed = false;
91 /// <since_tizen> 3 </since_tizen>
96 isDisposeQueued = true;
97 DisposeQueue.Instance.Add(this);
102 /// The dispose pattern.
104 /// <since_tizen> 3 </since_tizen>
105 public void Dispose()
107 //Throw excpetion if Dispose() is called in separate thread.
108 if (!Window.IsInstalled())
110 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
115 Dispose(DisposeTypes.Implicit);
119 Dispose(DisposeTypes.Explicit);
120 System.GC.SuppressFinalize(this);
127 /// <since_tizen> 3 </since_tizen>
128 protected virtual void Dispose(DisposeTypes type)
135 if (type == DisposeTypes.Explicit)
138 //Release your own managed resources here.
139 //You should release all of your own disposable objects here.
143 //Release your own unmanaged resources here.
144 //You should not access any managed member here except static instance.
145 //because the execution order of Finalizes is non-deterministic.
147 if (swigCPtr.Handle != IntPtr.Zero)
152 NDalicManualPINVOKE.delete_ImfManager_ImfEventData(swigCPtr);
154 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
160 internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr)
162 ImfEventData ret = new ImfEventData(cPtr, false);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// The default constructor.
170 /// <since_tizen> 3 </since_tizen>
171 public ImfEventData() : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_0(), true)
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 /// <param name="aEventName">The name of the event from the IMF.</param>
180 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
181 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
182 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
183 /// <since_tizen> 3 </since_tizen>
184 public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190 /// The pre-edit or the commit string.
192 /// <since_tizen> 4 </since_tizen>
193 public string PredictiveString
197 NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value);
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr);
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 /// The name of the event from the IMF.
211 /// <since_tizen> 4 </since_tizen>
212 public ImfManager.ImfEvent EventName
216 NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value);
217 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr);
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 /// The start position from the current cursor position to start deleting characters.
230 /// <since_tizen> 4 </since_tizen>
231 public int CursorOffset
235 NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
240 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 /// The number of characters to delete from the cursorOffset.
249 /// <since_tizen> 4 </since_tizen>
250 public int NumberOfChars
254 NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value);
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268 /// Data required by the IMF from the callback.
270 /// <since_tizen> 3 </since_tizen>
271 public class ImfCallbackData : global::System.IDisposable
273 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
277 /// <since_tizen> 3 </since_tizen>
278 protected bool swigCMemOwn;
280 internal IntPtr GetImfCallbackDataPtr()
282 return (IntPtr)swigCPtr;
285 internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn)
287 swigCMemOwn = cMemoryOwn;
288 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
291 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
293 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
296 //A Flag to check who called Dispose(). (By User or DisposeQueue)
297 private bool isDisposeQueued = false;
299 /// A Flat to check if it is already disposed.
301 /// <since_tizen> 3 </since_tizen>
302 protected bool disposed = false;
308 /// <since_tizen> 3 </since_tizen>
311 if (!isDisposeQueued)
313 isDisposeQueued = true;
314 DisposeQueue.Instance.Add(this);
319 /// The dispose pattern.
321 /// <since_tizen> 3 </since_tizen>
322 public void Dispose()
324 //Throw excpetion if Dispose() is called in separate thread.
325 if (!Window.IsInstalled())
327 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
332 Dispose(DisposeTypes.Implicit);
336 Dispose(DisposeTypes.Explicit);
337 System.GC.SuppressFinalize(this);
344 /// <since_tizen> 3 </since_tizen>
345 protected virtual void Dispose(DisposeTypes type)
352 if (type == DisposeTypes.Explicit)
355 //Release your own managed resources here.
356 //You should release all of your own disposable objects here.
360 //Release your own unmanaged resources here.
361 //You should not access any managed member here except static instance.
362 //because the execution order of Finalizes is non-deterministic.
364 if (swigCPtr.Handle != IntPtr.Zero)
369 NDalicManualPINVOKE.delete_ImfManager_ImfCallbackData(swigCPtr);
371 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
377 internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr)
379 ImfCallbackData ret = new ImfCallbackData(cPtr, false);
380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 /// The default constructor.
387 /// <since_tizen> 3 </since_tizen>
388 public ImfCallbackData() : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_0(), true)
390 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
396 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
397 /// <param name="aCursorPosition">The new position of the cursor.</param>
398 /// <param name="aCurrentText">The current text string.</param>
399 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
400 /// <since_tizen> 3 </since_tizen>
401 public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 /// The current text string.
409 /// <since_tizen> 4 </since_tizen>
410 public string CurrentText
414 NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419 string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr);
420 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
426 /// The current text string.
428 /// <since_tizen> 4 </since_tizen>
429 public int CursorPosition
433 NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value);
434 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
438 int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr);
439 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
445 /// If the cursor position needs to be updated.
447 /// <since_tizen> 4 </since_tizen>
452 NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value);
453 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
457 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr);
458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464 /// Flags if preedit reset is required.
466 /// <since_tizen> 4 </since_tizen>
467 public bool PreeditResetRequired
471 NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr);
477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
485 /// Destroy the context of the IMF.<br/>
487 /// <since_tizen> 5 </since_tizen>
488 public void DestroyContext()
490 NDalicManualPINVOKE.ImfManager_Finalize(swigCPtr);
491 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
495 /// Destroy the context of the IMF.<br/>
497 /// <since_tizen> 4 </since_tizen>
498 /// Please do not use! This will be deprecated, instead please USE Tizen.NUI.ImfManager.Instance.DestroyContext()!
499 [Obsolete("Please do not use! This will be deprecated! Please use ImfManager.Instance.DestroyContext() instead!")]
500 [EditorBrowsable(EditorBrowsableState.Never)]
501 public void Finalize()
507 /// Retrieves a handle to the instance of the ImfManager.
509 /// <returns>A handle to the ImfManager.</returns>
510 /// <since_tizen> 3 </since_tizen>
511 public static ImfManager Get()
513 ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
514 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 /// Activates the IMF.<br/>
520 /// It means that the text editing is started somewhere.<br/>
521 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
523 /// <since_tizen> 3 </since_tizen>
524 public void Activate()
526 NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531 /// Deactivates the IMF.<br/>
532 /// It means that the text editing is finished somewhere.
534 /// <since_tizen> 3 </since_tizen>
535 public void Deactivate()
537 NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
543 /// If true, then the keyboard will be restored (activated) after focus is regained.
545 /// <returns>The restoration status.</returns>
546 /// <since_tizen> 3 </since_tizen>
547 public bool RestoreAfterFocusLost()
549 bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
555 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
557 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
558 /// <since_tizen> 3 </since_tizen>
559 public void SetRestoreAfterFocusLost(bool toggle)
561 NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
562 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
566 /// Sends a message reset to the preedit state or the IMF module.
568 /// <since_tizen> 3 </since_tizen>
569 public new void Reset()
571 NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
572 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
578 /// <since_tizen> 3 </since_tizen>
579 public void NotifyCursorPosition()
581 NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
586 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
588 /// <param name="cursorPosition">The position of the cursor.</param>
589 /// <since_tizen> 3 </since_tizen>
590 public void SetCursorPosition(uint cursorPosition)
592 NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
599 /// <returns>The current position of the cursor.</returns>
600 /// <since_tizen> 3 </since_tizen>
601 public uint GetCursorPosition()
603 uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
604 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
609 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
611 /// <param name="text">The text string surrounding the current cursor point.</param>
612 /// <since_tizen> 3 </since_tizen>
613 public void SetSurroundingText(string text)
615 NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
616 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
622 /// <returns>The surrounding text.</returns>
623 /// <since_tizen> 3 </since_tizen>
624 public string GetSurroundingText()
626 string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632 /// Notifies the IMF context that text input is set to multiline or not.
634 /// <param name="multiLine">True if multiline text input is used.</param>
635 /// <since_tizen> 3 </since_tizen>
636 public void NotifyTextInputMultiLine(bool multiLine)
638 NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
639 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 /// Returns the text direction of the keyboard's current input language.
645 /// <returns>The direction of the text.</returns>
646 /// <since_tizen> 3 </since_tizen>
647 public ImfManager.TextDirection GetTextDirection()
649 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
655 /// Provides the size and the position of the keyboard.<br/>
656 /// The position is relative to whether the keyboard is visible or not.<br/>
657 /// If the keyboard is not visible, then the position will be off the screen.<br/>
658 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
659 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
661 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
662 /// <since_tizen> 3 </since_tizen>
663 public Rectangle GetInputMethodArea()
665 Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
666 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
670 internal void ApplyOptions(InputMethodOptions options)
672 NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677 /// Sets up the input-panel specific data.
679 /// <param name="text">The specific data to be set to the input panel.</param>
680 /// <since_tizen> 3 </since_tizen>
681 public void SetInputPanelUserData(string text)
683 NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
684 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688 /// Gets the specific data of the current active input panel.
690 /// <param name="text">The specific data to be received from the input panel.</param>
691 /// <since_tizen> 4 </since_tizen>
692 public void GetInputPanelUserData(out string text)
694 NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
699 /// Gets the state of the current active input panel.
701 /// <returns>The state of the input panel.</returns>
702 /// <since_tizen> 3 </since_tizen>
703 public ImfManager.State GetInputPanelState()
705 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
706 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 /// Sets the return key on the input panel to be visible or invisible.<br/>
712 /// The default is true.
714 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
715 /// <since_tizen> 3 </since_tizen>
716 public void SetReturnKeyState(bool visible)
718 NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
723 /// Enables to show the input panel automatically when focused.
725 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
726 /// <since_tizen> 3 </since_tizen>
727 public void AutoEnableInputPanel(bool enabled)
729 NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
730 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
734 /// Shows the input panel.
736 /// <since_tizen> 3 </since_tizen>
737 public void ShowInputPanel()
739 NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
744 /// Hides the input panel.
746 /// <since_tizen> 3 </since_tizen>
747 public void HideInputPanel()
749 NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
754 /// Gets the keyboard type.<br/>
755 /// The default keyboard type is SoftwareKeyboard.
757 /// <returns>The keyboard type.</returns>
758 /// <since_tizen> 4 </since_tizen>
759 public ImfManager.KeyboardType GetKeyboardType()
761 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
762 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
767 /// Gets the current language locale of the input panel.<br/>
768 /// For example, en_US, en_GB, en_PH, fr_FR, ...
770 /// <returns>The current language locale of the input panel.</returns>
771 /// <since_tizen> 4 </since_tizen>
772 public string GetInputPanelLocale()
774 string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 /// <since_tizen> 3 </since_tizen>
783 public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
785 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
789 /// ImfManager activated event arguments.
791 /// <since_tizen> 4 </since_tizen>
792 public class ActivatedEventArgs : EventArgs
797 /// <since_tizen> 4 </since_tizen>
798 public ImfManager ImfManager
805 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
806 private delegate void ActivatedEventCallbackType(IntPtr data);
807 private ActivatedEventCallbackType _activatedEventCallback;
808 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
811 /// ImfManager activated.
813 /// <since_tizen> 4 </since_tizen>
814 public event EventHandler<ActivatedEventArgs> Activated
818 if (_activatedEventHandler == null)
820 _activatedEventCallback = OnActivated;
821 ActivatedSignal().Connect(_activatedEventCallback);
824 _activatedEventHandler += value;
828 _activatedEventHandler -= value;
830 if (_activatedEventHandler == null && _activatedEventCallback != null)
832 ActivatedSignal().Disconnect(_activatedEventCallback);
837 private void OnActivated(IntPtr data)
839 ActivatedEventArgs e = new ActivatedEventArgs();
843 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
846 if (_activatedEventHandler != null)
848 _activatedEventHandler(this, e);
852 internal ActivatedSignalType ActivatedSignal()
854 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
860 /// ImfManager event received event arguments.
862 /// <since_tizen> 4 </since_tizen>
863 public class EventReceivedEventArgs : EventArgs
868 /// <since_tizen> 4 </since_tizen>
869 public ImfManager ImfManager
878 /// <since_tizen> 4 </since_tizen>
879 public ImfEventData ImfEventData
886 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
887 private EventReceivedEventCallbackType _eventReceivedEventCallback;
888 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
891 /// ImfManager event received.
893 /// <since_tizen> 4 </since_tizen>
894 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
898 if (_eventReceivedEventHandler == null)
900 _eventReceivedEventCallback = OnEventReceived;
901 EventReceivedSignal().Connect(_eventReceivedEventCallback);
904 _eventReceivedEventHandler += value;
908 _eventReceivedEventHandler -= value;
910 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
912 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
917 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
919 ImfCallbackData imfCallbackData = null;
921 EventReceivedEventArgs e = new EventReceivedEventArgs();
923 if (imfManager != null)
925 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
927 if (imfEventData != null)
929 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
932 if (_eventReceivedEventHandler != null)
934 imfCallbackData = _eventReceivedEventHandler(this, e);
936 if (imfCallbackData != null)
938 return imfCallbackData.GetImfCallbackDataPtr();
942 return new ImfCallbackData().GetImfCallbackDataPtr();
946 internal ImfEventSignalType EventReceivedSignal()
948 ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
949 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
954 /// ImfManager status changed event arguments.
956 /// <since_tizen> 4 </since_tizen>
957 public class StatusChangedEventArgs : EventArgs
960 /// ImfManager status
962 /// <since_tizen> 4 </since_tizen>
963 public bool StatusChanged
970 private delegate void StatusChangedEventCallbackType(bool statusChanged);
971 private StatusChangedEventCallbackType _statusChangedEventCallback;
972 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
975 /// ImfManager status changed.
977 /// <since_tizen> 4 </since_tizen>
978 public event EventHandler<StatusChangedEventArgs> StatusChanged
982 if (_statusChangedEventHandler == null)
984 _statusChangedEventCallback = OnStatusChanged;
985 StatusChangedSignal().Connect(_statusChangedEventCallback);
988 _statusChangedEventHandler += value;
992 _statusChangedEventHandler -= value;
994 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
996 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
1001 private void OnStatusChanged(bool statusChanged)
1003 StatusChangedEventArgs e = new StatusChangedEventArgs();
1005 e.StatusChanged = statusChanged;
1007 if (_statusChangedEventHandler != null)
1009 _statusChangedEventHandler(this, e);
1013 internal StatusSignalType StatusChangedSignal()
1015 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
1016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1021 /// ImfManager resized event.
1023 /// <since_tizen> 4 </since_tizen>
1024 public class ResizedEventArgs : EventArgs
1029 /// <since_tizen> 4 </since_tizen>
1037 private delegate void ResizedEventCallbackType(int resized);
1038 private ResizedEventCallbackType _resizedEventCallback;
1039 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1042 /// ImfManager resized.
1044 /// <since_tizen> 4 </since_tizen>
1045 public event EventHandler<ResizedEventArgs> Resized
1049 if (_resizedEventHandler == null)
1051 _resizedEventCallback = OnResized;
1052 ResizedSignal().Connect(_resizedEventCallback);
1055 _resizedEventHandler += value;
1059 _resizedEventHandler -= value;
1061 if (_resizedEventHandler == null && _resizedEventCallback != null)
1063 ResizedSignal().Disconnect(_resizedEventCallback);
1068 private void OnResized(int resized)
1070 ResizedEventArgs e = new ResizedEventArgs();
1071 e.Resized = resized;
1073 if (_resizedEventHandler != null)
1075 _resizedEventHandler(this, e);
1079 internal KeyboardResizedSignalType ResizedSignal()
1081 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false);
1082 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1087 /// ImfManager language changed event args.
1089 /// <since_tizen> 4 </since_tizen>
1090 public class LanguageChangedEventArgs : EventArgs
1093 /// language changed.
1095 /// <since_tizen> 4 </since_tizen>
1096 public int LanguageChanged
1103 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1104 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1105 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1108 /// ImfManager language changed.
1110 /// <since_tizen> 4 </since_tizen>
1111 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1115 if (_languageChangedEventHandler == null)
1117 _languageChangedEventCallback = OnLanguageChanged;
1118 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1121 _languageChangedEventHandler += value;
1125 _languageChangedEventHandler -= value;
1127 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1129 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1134 private void OnLanguageChanged(int languageChanged)
1136 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1137 e.LanguageChanged = languageChanged;
1139 if (_languageChangedEventHandler != null)
1141 _languageChangedEventHandler(this, e);
1145 internal LanguageChangedSignalType LanguageChangedSignal()
1147 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false);
1148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1153 /// ImfManager keyboard type changed event arguments.
1155 /// <since_tizen> 4 </since_tizen>
1156 public class KeyboardTypeChangedEventArgs : EventArgs
1159 /// ImfManager keyboard type
1161 /// <since_tizen> 4 </since_tizen>
1162 public KeyboardType KeyboardType
1169 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1170 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1171 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1174 /// ImfManager keyboard type changed.
1176 /// <since_tizen> 4 </since_tizen>
1177 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1181 if (_keyboardTypeChangedEventHandler == null)
1183 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1184 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1187 _keyboardTypeChangedEventHandler += value;
1191 _keyboardTypeChangedEventHandler -= value;
1193 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1195 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1200 private void OnKeyboardTypeChanged(KeyboardType type)
1202 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1204 e.KeyboardType = type;
1206 if (_keyboardTypeChangedEventHandler != null)
1208 _keyboardTypeChangedEventHandler(this, e);
1212 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1214 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1220 /// The direction of the text.
1222 /// <since_tizen> 3 </since_tizen>
1223 public enum TextDirection
1236 /// Events that are generated by the IMF.
1238 /// <since_tizen> 3 </since_tizen>
1239 public enum ImfEvent
1244 /// <since_tizen> 4 </since_tizen>
1247 /// Pre-Edit changed.
1249 /// <since_tizen> 4 </since_tizen>
1252 /// Commit received.
1254 /// <since_tizen> 4 </since_tizen>
1257 /// An event to delete a range of characters from the string.
1259 /// <since_tizen> 4 </since_tizen>
1262 /// An event to query string and the cursor position.
1264 /// <since_tizen> 4 </since_tizen>
1267 /// Private command sent from the input panel.
1269 /// <since_tizen> 4 </since_tizen>
1274 /// Enumeration for the state of the input panel.
1276 /// <since_tizen> 3 </since_tizen>
1282 /// <since_tizen> 4 </since_tizen>
1285 /// Input panel is shown.
1287 /// <since_tizen> 4 </since_tizen>
1290 /// Input panel is hidden.
1292 /// <since_tizen> 4 </since_tizen>
1295 /// Input panel in process of being shown.
1297 /// <since_tizen> 4 </since_tizen>
1302 /// Enumeration for the types of keyboard.
1304 /// <since_tizen> 4 </since_tizen>
1305 public enum KeyboardType
1308 /// Software keyboard (virtual keyboard) is default.
1310 /// <since_tizen> 4 </since_tizen>
1313 /// Hardware keyboard.
1315 /// <since_tizen> 4 </since_tizen>