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 /// Retrieves a handle to the instance of the ImfManager.
497 /// <returns>A handle to the ImfManager.</returns>
498 /// <since_tizen> 3 </since_tizen>
499 public static ImfManager Get()
501 ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507 /// Activates the IMF.<br/>
508 /// It means that the text editing is started somewhere.<br/>
509 /// If the hardware keyboard isn't connected, then it will show the virtual keyboard.
511 /// <since_tizen> 3 </since_tizen>
512 public void Activate()
514 NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 /// Deactivates the IMF.<br/>
520 /// It means that the text editing is finished somewhere.
522 /// <since_tizen> 3 </since_tizen>
523 public void Deactivate()
525 NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
526 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 /// Gets the restoration status which controls if the keyboard is restored after the focus is lost and then regained.<br/>
531 /// If true, then the keyboard will be restored (activated) after focus is regained.
533 /// <returns>The restoration status.</returns>
534 /// <since_tizen> 3 </since_tizen>
535 public bool RestoreAfterFocusLost()
537 bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
538 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
545 /// <param name="toggle">True means that keyboard should be restored after the focus is lost and regained.</param>
546 /// <since_tizen> 3 </since_tizen>
547 public void SetRestoreAfterFocusLost(bool toggle)
549 NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
550 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554 /// Sends a message reset to the preedit state or the IMF module.
556 /// <since_tizen> 3 </since_tizen>
557 public new void Reset()
559 NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564 /// Notifies the IMF context that the cursor position has changed, required for features like auto-capitalization.
566 /// <since_tizen> 3 </since_tizen>
567 public void NotifyCursorPosition()
569 NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
570 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
576 /// <param name="cursorPosition">The position of the cursor.</param>
577 /// <since_tizen> 3 </since_tizen>
578 public void SetCursorPosition(uint cursorPosition)
580 NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
581 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
587 /// <returns>The current position of the cursor.</returns>
588 /// <since_tizen> 3 </since_tizen>
589 public uint GetCursorPosition()
591 uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
597 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
599 /// <param name="text">The text string surrounding the current cursor point.</param>
600 /// <since_tizen> 3 </since_tizen>
601 public void SetSurroundingText(string text)
603 NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
604 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
608 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
610 /// <returns>The surrounding text.</returns>
611 /// <since_tizen> 3 </since_tizen>
612 public string GetSurroundingText()
614 string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620 /// Notifies the IMF context that text input is set to multiline or not.
622 /// <param name="multiLine">True if multiline text input is used.</param>
623 /// <since_tizen> 3 </since_tizen>
624 public void NotifyTextInputMultiLine(bool multiLine)
626 NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
631 /// Returns the text direction of the keyboard's current input language.
633 /// <returns>The direction of the text.</returns>
634 /// <since_tizen> 3 </since_tizen>
635 public ImfManager.TextDirection GetTextDirection()
637 ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
643 /// Provides the size and the position of the keyboard.<br/>
644 /// The position is relative to whether the keyboard is visible or not.<br/>
645 /// If the keyboard is not visible, then the position will be off the screen.<br/>
646 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
647 /// the values then taken down. So ideally, GetInputMethodArea() should be called after Show().
649 /// <returns>Rectangle which is keyboard panel x, y, width, height.</returns>
650 /// <since_tizen> 3 </since_tizen>
651 public Rectangle GetInputMethodArea()
653 Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
654 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658 internal void ApplyOptions(InputMethodOptions options)
660 NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
661 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665 /// Sets up the input-panel specific data.
667 /// <param name="text">The specific data to be set to the input panel.</param>
668 /// <since_tizen> 3 </since_tizen>
669 public void SetInputPanelUserData(string text)
671 NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 /// Gets the specific data of the current active input panel.
678 /// <param name="text">The specific data to be received from the input panel.</param>
679 /// <since_tizen> 4 </since_tizen>
680 public void GetInputPanelUserData(out string text)
682 NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 /// Gets the state of the current active input panel.
689 /// <returns>The state of the input panel.</returns>
690 /// <since_tizen> 3 </since_tizen>
691 public ImfManager.State GetInputPanelState()
693 ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
699 /// Sets the return key on the input panel to be visible or invisible.<br/>
700 /// The default is true.
702 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
703 /// <since_tizen> 3 </since_tizen>
704 public void SetReturnKeyState(bool visible)
706 NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711 /// Enables to show the input panel automatically when focused.
713 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
714 /// <since_tizen> 3 </since_tizen>
715 public void AutoEnableInputPanel(bool enabled)
717 NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
718 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
722 /// Shows the input panel.
724 /// <since_tizen> 3 </since_tizen>
725 public void ShowInputPanel()
727 NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
728 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Hides the input panel.
734 /// <since_tizen> 3 </since_tizen>
735 public void HideInputPanel()
737 NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
738 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
742 /// Gets the keyboard type.<br/>
743 /// The default keyboard type is SoftwareKeyboard.
745 /// <returns>The keyboard type.</returns>
746 /// <since_tizen> 4 </since_tizen>
747 public ImfManager.KeyboardType GetKeyboardType()
749 ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
750 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 /// Gets the current language locale of the input panel.<br/>
756 /// For example, en_US, en_GB, en_PH, fr_FR, ...
758 /// <returns>The current language locale of the input panel.</returns>
759 /// <since_tizen> 4 </since_tizen>
760 public string GetInputPanelLocale()
762 string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
763 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 /// <since_tizen> 3 </since_tizen>
771 public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
773 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 /// ImfManager activated event arguments.
779 /// <since_tizen> 4 </since_tizen>
780 public class ActivatedEventArgs : EventArgs
785 /// <since_tizen> 4 </since_tizen>
786 public ImfManager ImfManager
793 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
794 private delegate void ActivatedEventCallbackType(IntPtr data);
795 private ActivatedEventCallbackType _activatedEventCallback;
796 private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
799 /// ImfManager activated.
801 /// <since_tizen> 4 </since_tizen>
802 public event EventHandler<ActivatedEventArgs> Activated
806 if (_activatedEventHandler == null)
808 _activatedEventCallback = OnActivated;
809 ActivatedSignal().Connect(_activatedEventCallback);
812 _activatedEventHandler += value;
816 _activatedEventHandler -= value;
818 if (_activatedEventHandler == null && _activatedEventCallback != null)
820 ActivatedSignal().Disconnect(_activatedEventCallback);
825 private void OnActivated(IntPtr data)
827 ActivatedEventArgs e = new ActivatedEventArgs();
831 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager;
834 if (_activatedEventHandler != null)
836 _activatedEventHandler(this, e);
840 internal ActivatedSignalType ActivatedSignal()
842 ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
848 /// ImfManager event received event arguments.
850 /// <since_tizen> 4 </since_tizen>
851 public class EventReceivedEventArgs : EventArgs
856 /// <since_tizen> 4 </since_tizen>
857 public ImfManager ImfManager
866 /// <since_tizen> 4 </since_tizen>
867 public ImfEventData ImfEventData
874 private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData);
875 private EventReceivedEventCallbackType _eventReceivedEventCallback;
876 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> _eventReceivedEventHandler;
879 /// ImfManager event received.
881 /// <since_tizen> 4 </since_tizen>
882 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, ImfCallbackData> EventReceived
886 if (_eventReceivedEventHandler == null)
888 _eventReceivedEventCallback = OnEventReceived;
889 EventReceivedSignal().Connect(_eventReceivedEventCallback);
892 _eventReceivedEventHandler += value;
896 _eventReceivedEventHandler -= value;
898 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
900 EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
905 private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData)
907 ImfCallbackData imfCallbackData = null;
909 EventReceivedEventArgs e = new EventReceivedEventArgs();
911 if (imfManager != null)
913 e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager;
915 if (imfEventData != null)
917 e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
920 if (_eventReceivedEventHandler != null)
922 imfCallbackData = _eventReceivedEventHandler(this, e);
924 if (imfCallbackData != null)
926 return imfCallbackData.GetImfCallbackDataPtr();
930 return new ImfCallbackData().GetImfCallbackDataPtr();
934 internal ImfEventSignalType EventReceivedSignal()
936 ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
937 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
942 /// ImfManager status changed event arguments.
944 /// <since_tizen> 4 </since_tizen>
945 public class StatusChangedEventArgs : EventArgs
948 /// ImfManager status
950 /// <since_tizen> 4 </since_tizen>
951 public bool StatusChanged
958 private delegate void StatusChangedEventCallbackType(bool statusChanged);
959 private StatusChangedEventCallbackType _statusChangedEventCallback;
960 private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
963 /// ImfManager status changed.
965 /// <since_tizen> 4 </since_tizen>
966 public event EventHandler<StatusChangedEventArgs> StatusChanged
970 if (_statusChangedEventHandler == null)
972 _statusChangedEventCallback = OnStatusChanged;
973 StatusChangedSignal().Connect(_statusChangedEventCallback);
976 _statusChangedEventHandler += value;
980 _statusChangedEventHandler -= value;
982 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
984 StatusChangedSignal().Disconnect(_statusChangedEventCallback);
989 private void OnStatusChanged(bool statusChanged)
991 StatusChangedEventArgs e = new StatusChangedEventArgs();
993 e.StatusChanged = statusChanged;
995 if (_statusChangedEventHandler != null)
997 _statusChangedEventHandler(this, e);
1001 internal StatusSignalType StatusChangedSignal()
1003 StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
1004 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1009 /// ImfManager resized event.
1011 /// <since_tizen> 4 </since_tizen>
1012 public class ResizedEventArgs : EventArgs
1017 /// <since_tizen> 4 </since_tizen>
1025 private delegate void ResizedEventCallbackType(int resized);
1026 private ResizedEventCallbackType _resizedEventCallback;
1027 private event EventHandler<ResizedEventArgs> _resizedEventHandler;
1030 /// ImfManager resized.
1032 /// <since_tizen> 4 </since_tizen>
1033 public event EventHandler<ResizedEventArgs> Resized
1037 if (_resizedEventHandler == null)
1039 _resizedEventCallback = OnResized;
1040 ResizedSignal().Connect(_resizedEventCallback);
1043 _resizedEventHandler += value;
1047 _resizedEventHandler -= value;
1049 if (_resizedEventHandler == null && _resizedEventCallback != null)
1051 ResizedSignal().Disconnect(_resizedEventCallback);
1056 private void OnResized(int resized)
1058 ResizedEventArgs e = new ResizedEventArgs();
1059 e.Resized = resized;
1061 if (_resizedEventHandler != null)
1063 _resizedEventHandler(this, e);
1067 internal KeyboardResizedSignalType ResizedSignal()
1069 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false);
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1075 /// ImfManager language changed event args.
1077 /// <since_tizen> 4 </since_tizen>
1078 public class LanguageChangedEventArgs : EventArgs
1081 /// language changed.
1083 /// <since_tizen> 4 </since_tizen>
1084 public int LanguageChanged
1091 private delegate void LanguageChangedEventCallbackType(int languageChanged);
1092 private LanguageChangedEventCallbackType _languageChangedEventCallback;
1093 private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
1096 /// ImfManager language changed.
1098 /// <since_tizen> 4 </since_tizen>
1099 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
1103 if (_languageChangedEventHandler == null)
1105 _languageChangedEventCallback = OnLanguageChanged;
1106 LanguageChangedSignal().Connect(_languageChangedEventCallback);
1109 _languageChangedEventHandler += value;
1113 _languageChangedEventHandler -= value;
1115 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
1117 LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
1122 private void OnLanguageChanged(int languageChanged)
1124 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
1125 e.LanguageChanged = languageChanged;
1127 if (_languageChangedEventHandler != null)
1129 _languageChangedEventHandler(this, e);
1133 internal LanguageChangedSignalType LanguageChangedSignal()
1135 LanguageChangedSignalType ret = new LanguageChangedSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false);
1136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1141 /// ImfManager keyboard type changed event arguments.
1143 /// <since_tizen> 4 </since_tizen>
1144 public class KeyboardTypeChangedEventArgs : EventArgs
1147 /// ImfManager keyboard type
1149 /// <since_tizen> 4 </since_tizen>
1150 public KeyboardType KeyboardType
1157 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
1158 private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
1159 private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
1162 /// ImfManager keyboard type changed.
1164 /// <since_tizen> 4 </since_tizen>
1165 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
1169 if (_keyboardTypeChangedEventHandler == null)
1171 _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
1172 KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
1175 _keyboardTypeChangedEventHandler += value;
1179 _keyboardTypeChangedEventHandler -= value;
1181 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
1183 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
1188 private void OnKeyboardTypeChanged(KeyboardType type)
1190 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
1192 e.KeyboardType = type;
1194 if (_keyboardTypeChangedEventHandler != null)
1196 _keyboardTypeChangedEventHandler(this, e);
1200 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1202 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1208 /// The direction of the text.
1210 /// <since_tizen> 3 </since_tizen>
1211 public enum TextDirection
1224 /// Events that are generated by the IMF.
1226 /// <since_tizen> 3 </since_tizen>
1227 public enum ImfEvent
1232 /// <since_tizen> 4 </since_tizen>
1235 /// Pre-Edit changed.
1237 /// <since_tizen> 4 </since_tizen>
1240 /// Commit received.
1242 /// <since_tizen> 4 </since_tizen>
1245 /// An event to delete a range of characters from the string.
1247 /// <since_tizen> 4 </since_tizen>
1250 /// An event to query string and the cursor position.
1252 /// <since_tizen> 4 </since_tizen>
1255 /// Private command sent from the input panel.
1257 /// <since_tizen> 4 </since_tizen>
1262 /// Enumeration for the state of the input panel.
1264 /// <since_tizen> 3 </since_tizen>
1270 /// <since_tizen> 4 </since_tizen>
1273 /// Input panel is shown.
1275 /// <since_tizen> 4 </since_tizen>
1278 /// Input panel is hidden.
1280 /// <since_tizen> 4 </since_tizen>
1283 /// Input panel in process of being shown.
1285 /// <since_tizen> 4 </since_tizen>
1290 /// Enumeration for the types of keyboard.
1292 /// <since_tizen> 4 </since_tizen>
1293 public enum KeyboardType
1296 /// Software keyboard (virtual keyboard) is default.
1298 /// <since_tizen> 4 </since_tizen>
1301 /// Hardware keyboard.
1303 /// <since_tizen> 4 </since_tizen>