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 /// Retrieves a handle to the instance of the ImfManager.
501 /// <returns>A handle to the ImfManager.</returns>
502 /// <since_tizen> 3 </since_tizen>
503 public static ImfManager Get()
505 ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
506 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511 /// Activates the IMF.<br/>
512 /// It means that the text editing is started somewhere.<br/>
513 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
515 /// <since_tizen> 3 </since_tizen>
516 public void Activate()
518 NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
519 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523 /// Deactivates the IMF.<br/>
524 /// It means that the text editing is finished somewhere.
526 /// <since_tizen> 3 </since_tizen>
527 public void Deactivate()
529 NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
530 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
534 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
535 /// If true, then the keyboard will be restored (activated) after focus is regained.
537 /// <returns>The restoration status.</returns>
538 /// <since_tizen> 3 </since_tizen>
539 public bool RestoreAfterFocusLost()
541 bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
547 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
549 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
550 /// <since_tizen> 3 </since_tizen>
551 public void SetRestoreAfterFocusLost(bool toggle)
553 NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
554 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558 /// Sends a message reset to the preedit state or the IMF module.
560 /// <since_tizen> 3 </since_tizen>
561 public new void Reset()
563 NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
564 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
570 /// <since_tizen> 3 </since_tizen>
571 public void NotifyCursorPosition()
573 NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
574 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
578 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
580 /// <param name="cursorPosition">The position of the cursor.</param>
581 /// <since_tizen> 3 </since_tizen>
582 public void SetCursorPosition(uint cursorPosition)
584 NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
591 /// <returns>The current position of the cursor.</returns>
592 /// <since_tizen> 3 </since_tizen>
593 public uint GetCursorPosition()
595 uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
601 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
603 /// <param name="text">The text string surrounding the current cursor point.</param>
604 /// <since_tizen> 3 </since_tizen>
605 public void SetSurroundingText(string text)
607 NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
608 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
614 /// <returns>The surrounding text.</returns>
615 /// <since_tizen> 3 </since_tizen>
616 public string GetSurroundingText()
618 string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
619 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
624 /// Notifies the IMF context that text input is set to multiline or not.
626 /// <param name="multiLine">True if multiline text input is used.</param>
627 /// <since_tizen> 3 </since_tizen>
628 public void NotifyTextInputMultiLine(bool multiLine)
630 NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
635 /// Returns the text direction of the keyboard's current input language.
637 /// <returns>The direction of the text.</returns>
638 /// <since_tizen> 3 </since_tizen>
639 public ImfManager.TextDirection GetTextDirection()
641 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
647 /// Provides the size and the position of the keyboard.<br/>
648 /// The position is relative to whether the keyboard is visible or not.<br/>
649 /// If the keyboard is not visible, then the position will be off the screen.<br/>
650 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
651 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
653 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
654 /// <since_tizen> 3 </since_tizen>
655 public Rectangle GetInputMethodArea()
657 Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
658 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662 internal void ApplyOptions(InputMethodOptions options)
664 NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
665 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
669 /// Sets up the input-panel specific data.
671 /// <param name="text">The specific data to be set to the input panel.</param>
672 /// <since_tizen> 3 </since_tizen>
673 public void SetInputPanelUserData(string text)
675 NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
676 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
680 /// Gets the specific data of the current active input panel.
682 /// <param name="text">The specific data to be received from the input panel.</param>
683 /// <since_tizen> 4 </since_tizen>
684 public void GetInputPanelUserData(out string text)
686 NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
687 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691 /// Gets the state of the current active input panel.
693 /// <returns>The state of the input panel.</returns>
694 /// <since_tizen> 3 </since_tizen>
695 public ImfManager.State GetInputPanelState()
697 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
698 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 /// Sets the return key on the input panel to be visible or invisible.<br/>
704 /// The default is true.
706 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
707 /// <since_tizen> 3 </since_tizen>
708 public void SetReturnKeyState(bool visible)
710 NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
711 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715 /// Enables to show the input panel automatically when focused.
717 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
718 /// <since_tizen> 3 </since_tizen>
719 public void AutoEnableInputPanel(bool enabled)
721 NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
726 /// Shows the input panel.
728 /// <since_tizen> 3 </since_tizen>
729 public void ShowInputPanel()
731 NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 /// Hides the input panel.
738 /// <since_tizen> 3 </since_tizen>
739 public void HideInputPanel()
741 NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
742 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746 /// Gets the keyboard type.<br/>
747 /// The default keyboard type is SoftwareKeyboard.
749 /// <returns>The keyboard type.</returns>
750 /// <since_tizen> 4 </since_tizen>
751 public ImfManager.KeyboardType GetKeyboardType()
753 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
754 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
759 /// Gets the current language locale of the input panel.<br/>
760 /// For example, en_US, en_GB, en_PH, fr_FR, ...
762 /// <returns>The current language locale of the input panel.</returns>
763 /// <since_tizen> 4 </since_tizen>
764 public string GetInputPanelLocale()
766 string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
774 /// <since_tizen> 3 </since_tizen>
775 public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
781 /// ImfManager activated event arguments.
783 /// <since_tizen> 4 </since_tizen>
784 public class ActivatedEventArgs : EventArgs
789 /// <since_tizen> 4 </since_tizen>
790 public ImfManager ImfManager
797 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
798 private delegate void ActivatedEventCallbackType(IntPtr data);
799 private ActivatedEventCallbackType _activatedEventCallback;
800 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
803 /// ImfManager activated.
805 /// <since_tizen> 4 </since_tizen>
806 public event EventHandler<ActivatedEventArgs> Activated
810 if (_activatedEventHandler == null)
812 _activatedEventCallback = OnActivated;
813 ActivatedSignal().Connect(_activatedEventCallback);
816 _activatedEventHandler += value;
820 _activatedEventHandler -= value;
822 if (_activatedEventHandler == null && _activatedEventCallback != null)
824 ActivatedSignal().Disconnect(_activatedEventCallback);
829 private void OnActivated(IntPtr data)
831 ActivatedEventArgs e = new ActivatedEventArgs();
835 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
838 if (_activatedEventHandler != null)
840 _activatedEventHandler(this, e);
844 internal ActivatedSignalType ActivatedSignal()
846 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
847 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
852 /// ImfManager event received event arguments.
854 /// <since_tizen> 4 </since_tizen>
855 public class EventReceivedEventArgs : EventArgs
860 /// <since_tizen> 4 </since_tizen>
861 public ImfManager ImfManager
870 /// <since_tizen> 4 </since_tizen>
871 public ImfEventData ImfEventData
878 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
879 private EventReceivedEventCallbackType _eventReceivedEventCallback;
880 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
883 /// ImfManager event received.
885 /// <since_tizen> 4 </since_tizen>
886 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
890 if (_eventReceivedEventHandler == null)
892 _eventReceivedEventCallback = OnEventReceived;
893 EventReceivedSignal().Connect(_eventReceivedEventCallback);
896 _eventReceivedEventHandler += value;
900 _eventReceivedEventHandler -= value;
902 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
904 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
909 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
911 ImfCallbackData imfCallbackData = null;
913 EventReceivedEventArgs e = new EventReceivedEventArgs();
915 if (imfManager != null)
917 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
919 if (imfEventData != null)
921 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
924 if (_eventReceivedEventHandler != null)
926 imfCallbackData = _eventReceivedEventHandler(this, e);
928 if (imfCallbackData != null)
930 return imfCallbackData.GetImfCallbackDataPtr();
934 return new ImfCallbackData().GetImfCallbackDataPtr();
938 internal ImfEventSignalType EventReceivedSignal()
940 ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
941 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
946 /// ImfManager status changed event arguments.
948 /// <since_tizen> 4 </since_tizen>
949 public class StatusChangedEventArgs : EventArgs
952 /// ImfManager status
954 /// <since_tizen> 4 </since_tizen>
955 public bool StatusChanged
962 private delegate void StatusChangedEventCallbackType(bool statusChanged);
963 private StatusChangedEventCallbackType _statusChangedEventCallback;
964 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
967 /// ImfManager status changed.
969 /// <since_tizen> 4 </since_tizen>
970 public event EventHandler<StatusChangedEventArgs> StatusChanged
974 if (_statusChangedEventHandler == null)
976 _statusChangedEventCallback = OnStatusChanged;
977 StatusChangedSignal().Connect(_statusChangedEventCallback);
980 _statusChangedEventHandler += value;
984 _statusChangedEventHandler -= value;
986 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
988 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
993 private void OnStatusChanged(bool statusChanged)
995 StatusChangedEventArgs e = new StatusChangedEventArgs();
997 e.StatusChanged = statusChanged;
999 if (_statusChangedEventHandler != null)
1001 _statusChangedEventHandler(this, e);
1005 internal StatusSignalType StatusChangedSignal()
1007 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
1008 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1013 /// ImfManager resized event.
1015 /// <since_tizen> 4 </since_tizen>
1016 public class ResizedEventArgs : EventArgs
1021 /// <since_tizen> 4 </since_tizen>
1029 private delegate void ResizedEventCallbackType(int resized);
1030 private ResizedEventCallbackType _resizedEventCallback;
1031 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1034 /// ImfManager resized.
1036 /// <since_tizen> 4 </since_tizen>
1037 public event EventHandler<ResizedEventArgs> Resized
1041 if (_resizedEventHandler == null)
1043 _resizedEventCallback = OnResized;
1044 ResizedSignal().Connect(_resizedEventCallback);
1047 _resizedEventHandler += value;
1051 _resizedEventHandler -= value;
1053 if (_resizedEventHandler == null && _resizedEventCallback != null)
1055 ResizedSignal().Disconnect(_resizedEventCallback);
1060 private void OnResized(int resized)
1062 ResizedEventArgs e = new ResizedEventArgs();
1063 e.Resized = resized;
1065 if (_resizedEventHandler != null)
1067 _resizedEventHandler(this, e);
1071 internal KeyboardResizedSignalType ResizedSignal()
1073 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false);
1074 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1079 /// ImfManager language changed event args.
1081 /// <since_tizen> 4 </since_tizen>
1082 public class LanguageChangedEventArgs : EventArgs
1085 /// language changed.
1087 /// <since_tizen> 4 </since_tizen>
1088 public int LanguageChanged
1095 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1096 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1097 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1100 /// ImfManager language changed.
1102 /// <since_tizen> 4 </since_tizen>
1103 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1107 if (_languageChangedEventHandler == null)
1109 _languageChangedEventCallback = OnLanguageChanged;
1110 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1113 _languageChangedEventHandler += value;
1117 _languageChangedEventHandler -= value;
1119 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1121 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1126 private void OnLanguageChanged(int languageChanged)
1128 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1129 e.LanguageChanged = languageChanged;
1131 if (_languageChangedEventHandler != null)
1133 _languageChangedEventHandler(this, e);
1137 internal LanguageChangedSignalType LanguageChangedSignal()
1139 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false);
1140 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1145 /// ImfManager keyboard type changed event arguments.
1147 /// <since_tizen> 4 </since_tizen>
1148 public class KeyboardTypeChangedEventArgs : EventArgs
1151 /// ImfManager keyboard type
1153 /// <since_tizen> 4 </since_tizen>
1154 public KeyboardType KeyboardType
1161 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1162 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1163 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1166 /// ImfManager keyboard type changed.
1168 /// <since_tizen> 4 </since_tizen>
1169 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1173 if (_keyboardTypeChangedEventHandler == null)
1175 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1176 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1179 _keyboardTypeChangedEventHandler += value;
1183 _keyboardTypeChangedEventHandler -= value;
1185 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1187 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1192 private void OnKeyboardTypeChanged(KeyboardType type)
1194 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1196 e.KeyboardType = type;
1198 if (_keyboardTypeChangedEventHandler != null)
1200 _keyboardTypeChangedEventHandler(this, e);
1204 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1206 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212 /// The direction of the text.
1214 /// <since_tizen> 3 </since_tizen>
1215 public enum TextDirection
1228 /// Events that are generated by the IMF.
1230 /// <since_tizen> 3 </since_tizen>
1231 public enum ImfEvent
1236 /// <since_tizen> 4 </since_tizen>
1239 /// Pre-Edit changed.
1241 /// <since_tizen> 4 </since_tizen>
1244 /// Commit received.
1246 /// <since_tizen> 4 </since_tizen>
1249 /// An event to delete a range of characters from the string.
1251 /// <since_tizen> 4 </since_tizen>
1254 /// An event to query string and the cursor position.
1256 /// <since_tizen> 4 </since_tizen>
1259 /// Private command sent from the input panel.
1261 /// <since_tizen> 4 </since_tizen>
1266 /// Enumeration for the state of the input panel.
1268 /// <since_tizen> 3 </since_tizen>
1274 /// <since_tizen> 4 </since_tizen>
1277 /// Input panel is shown.
1279 /// <since_tizen> 4 </since_tizen>
1282 /// Input panel is hidden.
1284 /// <since_tizen> 4 </since_tizen>
1287 /// Input panel in process of being shown.
1289 /// <since_tizen> 4 </since_tizen>
1294 /// Enumeration for the types of keyboard.
1296 /// <since_tizen> 4 </since_tizen>
1297 public enum KeyboardType
1300 /// Software keyboard (virtual keyboard) is default.
1302 /// <since_tizen> 4 </since_tizen>
1305 /// Hardware keyboard.
1307 /// <since_tizen> 4 </since_tizen>