2 * Copyright(c) 2021 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 (IMF) that enables the virtual or hardware keyboards.
27 /// <since_tizen> 5 </since_tizen>
28 public class InputMethodContext : BaseHandle
30 private ActivatedEventCallbackType activatedEventCallback;
31 private EventReceivedEventCallbackType eventReceivedEventCallback;
32 private StatusChangedEventCallbackType statusChangedEventCallback;
33 private ResizedEventCallbackType resizedEventCallback;
34 private LanguageChangedEventCallbackType languageChangedEventCallback;
35 private KeyboardTypeChangedEventCallbackType keyboardTypeChangedEventCallback;
36 private ContentReceivedCallbackType contentReceivedEventCallback;
41 /// <since_tizen> 5 </since_tizen>
42 /// This will be deprecated
43 [Obsolete("Deprecated in API8; Will be removed in API10")]
44 public InputMethodContext() : this(Interop.InputMethodContext.New(), true)
46 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49 internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
53 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
54 private delegate void ActivatedEventCallbackType(IntPtr data);
55 private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
56 private delegate void StatusChangedEventCallbackType(bool statusChanged);
57 private delegate void ResizedEventCallbackType(int resized);
58 private delegate void LanguageChangedEventCallbackType(int languageChanged);
59 private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
60 private delegate void ContentReceivedCallbackType(string content, string description, string mimeType);
62 private event EventHandler<ActivatedEventArgs> activatedEventHandler;
63 private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> eventReceivedEventHandler;
64 private event EventHandler<StatusChangedEventArgs> statusChangedEventHandler;
65 private event EventHandler<ResizedEventArgs> resizedEventHandler;
66 private event EventHandler<LanguageChangedEventArgs> languageChangedEventHandler;
67 private event EventHandler<KeyboardTypeChangedEventArgs> keyboardTypeChangedEventHandler;
68 private event EventHandler<ContentReceivedEventArgs> contentReceivedEventHandler;
71 /// InputMethodContext activated.
73 /// <since_tizen> 5 </since_tizen>
74 public event EventHandler<ActivatedEventArgs> Activated
78 if (activatedEventHandler == null)
80 activatedEventCallback = OnActivated;
81 ActivatedSignal().Connect(activatedEventCallback);
84 activatedEventHandler += value;
88 activatedEventHandler -= value;
90 if (activatedEventHandler == null && activatedEventCallback != null)
92 ActivatedSignal().Disconnect(activatedEventCallback);
98 /// InputMethodContext event received.
100 /// <since_tizen> 5 </since_tizen>
101 public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
105 if (eventReceivedEventHandler == null)
107 eventReceivedEventCallback = OnEventReceived;
108 EventReceivedSignal().Connect(eventReceivedEventCallback);
111 eventReceivedEventHandler += value;
115 eventReceivedEventHandler -= value;
117 if (eventReceivedEventHandler == null && eventReceivedEventCallback != null)
119 EventReceivedSignal().Disconnect(eventReceivedEventCallback);
125 /// InputMethodContext status changed.
127 /// <since_tizen> 5 </since_tizen>
128 public event EventHandler<StatusChangedEventArgs> StatusChanged
132 if (statusChangedEventHandler == null)
134 statusChangedEventCallback = OnStatusChanged;
135 StatusChangedSignal().Connect(statusChangedEventCallback);
138 statusChangedEventHandler += value;
142 statusChangedEventHandler -= value;
144 if (statusChangedEventHandler == null && statusChangedEventCallback != null)
146 StatusChangedSignal().Disconnect(statusChangedEventCallback);
152 /// InputMethodContext resized.
154 /// <since_tizen> 5 </since_tizen>
155 public event EventHandler<ResizedEventArgs> Resized
159 if (resizedEventHandler == null)
161 resizedEventCallback = OnResized;
162 ResizedSignal().Connect(resizedEventCallback);
165 resizedEventHandler += value;
169 resizedEventHandler -= value;
171 if (resizedEventHandler == null && resizedEventCallback != null)
173 ResizedSignal().Disconnect(resizedEventCallback);
179 /// InputMethodContext language changed.
181 /// <since_tizen> 5 </since_tizen>
182 public event EventHandler<LanguageChangedEventArgs> LanguageChanged
186 if (languageChangedEventHandler == null)
188 languageChangedEventCallback = OnLanguageChanged;
189 LanguageChangedSignal().Connect(languageChangedEventCallback);
192 languageChangedEventHandler += value;
196 languageChangedEventHandler -= value;
198 if (languageChangedEventHandler == null && languageChangedEventCallback != null)
200 LanguageChangedSignal().Disconnect(languageChangedEventCallback);
206 /// InputMethodContext keyboard type changed.
208 /// <since_tizen> 5 </since_tizen>
209 public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
213 if (keyboardTypeChangedEventHandler == null)
215 keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
216 KeyboardTypeChangedSignal().Connect(keyboardTypeChangedEventCallback);
219 keyboardTypeChangedEventHandler += value;
223 keyboardTypeChangedEventHandler -= value;
225 if (keyboardTypeChangedEventHandler == null && keyboardTypeChangedEventCallback != null)
227 KeyboardTypeChangedSignal().Disconnect(keyboardTypeChangedEventCallback);
233 /// InputMethodContext content received.
235 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public event EventHandler<ContentReceivedEventArgs> ContentReceived
241 if (contentReceivedEventHandler == null)
243 contentReceivedEventCallback = OnContentReceived;
244 ContentReceivedSignal().Connect(contentReceivedEventCallback);
247 contentReceivedEventHandler += value;
251 contentReceivedEventHandler -= value;
253 if (contentReceivedEventHandler == null && contentReceivedEventCallback != null)
255 ContentReceivedSignal().Disconnect(contentReceivedEventCallback);
261 /// The direction of the text.
263 /// <since_tizen> 5 </since_tizen>
264 public enum TextDirection
277 /// Events that are generated by the IMF.
279 /// <since_tizen> 5 </since_tizen>
280 public enum EventType
285 /// <since_tizen> 5 </since_tizen>
288 /// Pre-edit changed.
290 /// <since_tizen> 5 </since_tizen>
295 /// <since_tizen> 5 </since_tizen>
298 /// An event to delete a range of characters from the string.
300 /// <since_tizen> 5 </since_tizen>
303 /// An event to query string and the cursor position.
305 /// <since_tizen> 5 </since_tizen>
308 /// Private command sent from the input panel.
310 /// <since_tizen> 5 </since_tizen>
315 /// Enumeration for the state of the input panel.
317 /// <since_tizen> 5 </since_tizen>
323 /// <since_tizen> 5 </since_tizen>
326 /// Input panel is shown.
328 /// <since_tizen> 5 </since_tizen>
331 /// Input panel is hidden.
333 /// <since_tizen> 5 </since_tizen>
336 /// Input panel in process of being shown.
338 /// <since_tizen> 5 </since_tizen>
343 /// Enumeration for the types of keyboard.
345 /// <since_tizen> 5 </since_tizen>
346 public enum KeyboardType
349 /// Software keyboard (virtual keyboard) is default.
351 /// <since_tizen> 5 </since_tizen>
354 /// Hardware keyboard.
356 /// <since_tizen> 5 </since_tizen>
361 /// Enumeration for the language mode of the input panel.
363 /// <since_tizen> 8 </since_tizen>
364 public enum InputPanelLanguage
367 /// IME Language is automatically set depending on the system display.
369 /// <since_tizen> 8 </since_tizen>
372 /// Latin alphabet. (default)
373 /// This value can be changed according to OSD(On Screen Display) language.
375 /// <since_tizen> 8 </since_tizen>
380 /// Gets or sets whether the IM context allows to use the text prediction.
382 /// <since_tizen> 8 </since_tizen>
383 public bool TextPrediction
387 return IsTextPredictionAllowed();
391 AllowTextPrediction(value);
396 /// Destroys the context of the IMF.<br/>
398 /// <since_tizen> 5 </since_tizen>
399 public void DestroyContext()
401 Interop.InputMethodContext.Finalize(SwigCPtr);
402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406 /// Activates the IMF.<br/>
407 /// It means that the text editing has started.<br/>
408 /// If the hardware keyboard is not connected, then it shows the virtual keyboard.
410 /// <since_tizen> 5 </since_tizen>
411 public void Activate()
413 Interop.InputMethodContext.Activate(SwigCPtr);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418 /// Deactivates the IMF.<br/>
419 /// It means that the text editing is complete.
421 /// <since_tizen> 5 </since_tizen>
422 public void Deactivate()
424 Interop.InputMethodContext.Deactivate(SwigCPtr);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429 /// Gets the restoration status, which controls if the keyboard is restored after the focus is lost and then regained.<br/>
430 /// If true, then the keyboard will be restored (activated) after the focus is regained.
432 /// <returns>The restoration status.</returns>
433 /// <since_tizen> 5 </since_tizen>
434 public bool RestoreAfterFocusLost()
436 bool ret = Interop.InputMethodContext.RestoreAfterFocusLost(SwigCPtr);
437 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442 /// Sets the status whether the IMF has to restore the keyboard after losing focus.
444 /// <param name="toggle">True means that keyboard must be restored after the focus is lost and regained.</param>
445 /// <since_tizen> 5 </since_tizen>
446 public void SetRestoreAfterFocusLost(bool toggle)
448 Interop.InputMethodContext.SetRestoreAfterFocusLost(SwigCPtr, toggle);
449 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
453 /// Sends a message reset to the pre-edit state or the IMF module.
455 /// <since_tizen> 5 </since_tizen>
456 public new void Reset()
458 Interop.InputMethodContext.Reset(SwigCPtr);
459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463 /// Notifies the IMF context that the cursor position has changed, required for features such as auto-capitalization.
465 /// <since_tizen> 5 </since_tizen>
466 public void NotifyCursorPosition()
468 Interop.InputMethodContext.NotifyCursorPosition(SwigCPtr);
469 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473 /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
475 /// <param name="cursorPosition">The position of the cursor.</param>
476 /// <since_tizen> 5 </since_tizen>
477 public void SetCursorPosition(uint cursorPosition)
479 Interop.InputMethodContext.SetCursorPosition(SwigCPtr, cursorPosition);
480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
484 /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
486 /// <returns>The current position of the cursor.</returns>
487 /// <since_tizen> 5 </since_tizen>
488 public uint GetCursorPosition()
490 uint ret = Interop.InputMethodContext.GetCursorPosition(SwigCPtr);
491 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
496 /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
498 /// <param name="text">The text string surrounding the current cursor point.</param>
499 /// <since_tizen> 5 </since_tizen>
500 public void SetSurroundingText(string text)
502 Interop.InputMethodContext.SetSurroundingText(SwigCPtr, text);
503 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507 /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
509 /// <returns>The surrounding text.</returns>
510 /// <since_tizen> 5 </since_tizen>
511 public string GetSurroundingText()
513 string ret = Interop.InputMethodContext.GetSurroundingText(SwigCPtr);
514 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 /// Notifies the IMF context that text input is set to multiline or not.
521 /// <param name="multiLine">True if multiline text input is used.</param>
522 /// <since_tizen> 5 </since_tizen>
523 public void NotifyTextInputMultiLine(bool multiLine)
525 Interop.InputMethodContext.NotifyTextInputMultiLine(SwigCPtr, multiLine);
526 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 /// Returns the text direction of the current input language of the keyboard.
532 /// <returns>The direction of the text.</returns>
533 /// <since_tizen> 5 </since_tizen>
534 public InputMethodContext.TextDirection GetTextDirection()
536 InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)Interop.InputMethodContext.GetTextDirection(SwigCPtr);
537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 /// Provides the size and the position of the keyboard.<br/>
543 /// The position is relative to whether the keyboard is visible or not.<br/>
544 /// If the keyboard is not visible, then the position will be off the screen.<br/>
545 /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
546 /// the values then taken down. So ideally, GetInputMethodArea() must be called after Show().
548 /// <returns>Rectangle which is keyboard panel x, y, width, and height.</returns>
549 /// <since_tizen> 5 </since_tizen>
550 public Rectangle GetInputMethodArea()
552 Rectangle ret = new Rectangle(Interop.InputMethodContext.GetInputMethodArea(SwigCPtr), true);
553 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
558 /// Sets up the input panel specific data.
560 /// <param name="text">The specific data to be set to the input panel.</param>
561 /// <since_tizen> 5 </since_tizen>
562 public void SetInputPanelUserData(string text)
564 Interop.InputMethodContext.SetInputPanelUserData(SwigCPtr, text);
565 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
569 /// Gets the specific data of the current active input panel.
571 /// <param name="text">The specific data to be received from the input panel.</param>
572 /// <since_tizen> 5 </since_tizen>
573 public void GetInputPanelUserData(out string text)
575 Interop.InputMethodContext.GetInputPanelUserData(SwigCPtr, out text);
576 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
580 /// Gets the state of the current active input panel.
582 /// <returns>The state of the input panel.</returns>
583 /// <since_tizen> 5 </since_tizen>
584 public InputMethodContext.State GetInputPanelState()
586 InputMethodContext.State ret = (InputMethodContext.State)Interop.InputMethodContext.GetInputPanelState(SwigCPtr);
587 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592 /// Sets the return key on the input panel to be visible or invisible.<br/>
593 /// The default value is true.
595 /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
596 /// <since_tizen> 5 </since_tizen>
597 public void SetReturnKeyState(bool visible)
599 Interop.InputMethodContext.SetReturnKeyState(SwigCPtr, visible);
600 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
604 /// Enables to show the input panel automatically when focused.
606 /// <param name="enabled">If true, the input panel will be shown when focused.</param>
607 /// <since_tizen> 5 </since_tizen>
608 public void AutoEnableInputPanel(bool enabled)
610 Interop.InputMethodContext.AutoEnableInputPanel(SwigCPtr, enabled);
611 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
615 /// Shows the input panel.
617 /// <since_tizen> 5 </since_tizen>
618 public void ShowInputPanel()
620 Interop.InputMethodContext.ShowInputPanel(SwigCPtr);
621 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625 /// Hides the input panel.
627 /// <since_tizen> 5 </since_tizen>
628 public void HideInputPanel()
630 Interop.InputMethodContext.HideInputPanel(SwigCPtr);
631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
635 /// Gets the keyboard type.<br/>
636 /// The default keyboard type is SoftwareKeyboard.
638 /// <returns>The keyboard type.</returns>
639 /// <since_tizen> 5 </since_tizen>
640 public InputMethodContext.KeyboardType GetKeyboardType()
642 InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)Interop.InputMethodContext.GetKeyboardType(SwigCPtr);
643 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648 /// Gets the current language locale of the input panel.<br/>
649 /// For example, en_US, en_GB, en_PH, fr_FR, and so on.
651 /// <returns>The current language locale of the input panel.</returns>
652 /// <since_tizen> 5 </since_tizen>
653 public string GetInputPanelLocale()
655 string ret = Interop.InputMethodContext.GetInputPanelLocale(SwigCPtr);
656 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
661 /// Sets the allowed MIME Type to deliver to the input panel. <br/>
662 /// For example, string mimeType = "text/plain,image/png,image/gif,application/pdf";
664 /// <param name="mimeType">The allowed MIME type.</param>
665 /// <since_tizen> 8 </since_tizen>
666 public void SetMIMEType(string mimeType)
668 Interop.InputMethodContext.SetMIMEType(SwigCPtr, mimeType);
669 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
673 /// Sets the x,y coordinates of the input panel.
675 /// <param name="x">The top-left x coordinate of the input panel.</param>
676 /// <param name="y">The top-left y coordinate of the input panel.</param>
677 /// <since_tizen> 8 </since_tizen>
678 public void SetInputPanelPosition(uint x, uint y)
680 Interop.InputMethodContext.SetInputPanelPosition(SwigCPtr, x, y);
681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685 /// Sets the language of the input panel.
687 /// <param name="language">The language to be set to the input panel</param>
688 /// <since_tizen> 8 </since_tizen>
689 public void SetInputPanelLanguage(InputMethodContext.InputPanelLanguage language)
691 Interop.InputMethodContext.SetInputPanelLanguage(SwigCPtr, (int)language);
692 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
696 /// Gets the language of the input panel.
698 /// <returns>The language of the input panel</returns>
699 /// <since_tizen> 8 </since_tizen>
700 public InputMethodContext.InputPanelLanguage GetInputPanelLanguage()
702 InputMethodContext.InputPanelLanguage ret = (InputMethodContext.InputPanelLanguage)Interop.InputMethodContext.GetInputPanelLanguage(SwigCPtr);
703 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
707 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
709 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.SwigCPtr;
712 internal InputMethodContext(InputMethodContext inputMethodContext) : this(Interop.InputMethodContext.NewInputMethodContext(InputMethodContext.getCPtr(inputMethodContext)), true)
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
717 internal InputMethodContext Assign(InputMethodContext inputMethodContext)
719 InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.Assign(SwigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
720 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724 internal static InputMethodContext DownCast(BaseHandle handle)
726 InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.DownCast(BaseHandle.getCPtr(handle)), true);
727 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
731 internal void ApplyOptions(InputMethodOptions options)
733 Interop.InputMethodContext.ApplyOptions(SwigCPtr, InputMethodOptions.getCPtr(options));
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 internal void AllowTextPrediction(bool prediction)
739 Interop.InputMethodContext.AllowTextPrediction(SwigCPtr, prediction);
740 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
743 internal bool IsTextPredictionAllowed()
745 bool ret = Interop.InputMethodContext.IsTextPredictionAllowed(SwigCPtr);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750 internal ActivatedSignalType ActivatedSignal()
752 ActivatedSignalType ret = new ActivatedSignalType(Interop.InputMethodContext.ActivatedSignal(SwigCPtr), false);
753 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
757 internal KeyboardEventSignalType EventReceivedSignal()
759 KeyboardEventSignalType ret = new KeyboardEventSignalType(Interop.InputMethodContext.EventReceivedSignal(SwigCPtr), false);
760 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
764 internal StatusSignalType StatusChangedSignal()
766 StatusSignalType ret = new StatusSignalType(Interop.InputMethodContext.StatusChangedSignal(SwigCPtr), false);
767 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
771 internal KeyboardResizedSignalType ResizedSignal()
773 KeyboardResizedSignalType ret = new KeyboardResizedSignalType(Interop.InputMethodContext.ResizedSignal(SwigCPtr), false);
774 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778 internal LanguageChangedSignalType LanguageChangedSignal()
780 LanguageChangedSignalType ret = new LanguageChangedSignalType(Interop.InputMethodContext.LanguageChangedSignal(SwigCPtr), false);
781 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
785 internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
787 KeyboardTypeSignalType ret = new KeyboardTypeSignalType(Interop.InputMethodContext.KeyboardTypeChangedSignal(SwigCPtr), false);
788 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
792 internal ContentReceivedSignalType ContentReceivedSignal()
794 ContentReceivedSignalType ret = new ContentReceivedSignalType(Interop.InputMethodContext.ContentReceivedSignal(SwigCPtr), false);
795 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
800 /// You can override it to clean-up your own resources.
802 /// <param name="type">Dispose Type</param>
803 /// <since_tizen> 5 </since_tizen>
804 /// Do not use! This will be deprecated!
805 /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
806 [EditorBrowsable(EditorBrowsableState.Never)]
807 protected override void Dispose(DisposeTypes type)
814 //Release your own unmanaged resources here.
815 //You should not access any managed member here except static instance
816 //because the execution order of Finalizes is non-deterministic.
818 if (keyboardTypeChangedEventCallback != null)
820 KeyboardTypeChangedSignal().Disconnect(keyboardTypeChangedEventCallback);
826 /// This will not be public opened.
827 [EditorBrowsable(EditorBrowsableState.Never)]
828 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
830 Interop.InputMethodContext.DeleteInputMethodContext(swigCPtr);
833 private void OnActivated(IntPtr data)
835 ActivatedEventArgs e = new ActivatedEventArgs();
837 if (data != IntPtr.Zero)
839 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
842 if (activatedEventHandler != null)
844 activatedEventHandler(this, e);
848 private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
850 CallbackData callbackData = null;
852 EventReceivedEventArgs e = new EventReceivedEventArgs();
854 if (inputMethodContext != IntPtr.Zero)
856 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
858 if (eventData != IntPtr.Zero)
860 e.EventData = EventData.GetEventDataFromPtr(eventData);
863 if (eventReceivedEventHandler != null)
865 callbackData = eventReceivedEventHandler(this, e);
867 if (callbackData != null)
869 return callbackData.GetCallbackDataPtr();
873 return new CallbackData().GetCallbackDataPtr();
877 private void OnStatusChanged(bool statusChanged)
879 StatusChangedEventArgs e = new StatusChangedEventArgs();
881 e.StatusChanged = statusChanged;
883 if (statusChangedEventHandler != null)
885 statusChangedEventHandler(this, e);
889 private void OnResized(int resized)
891 ResizedEventArgs e = new ResizedEventArgs();
894 if (resizedEventHandler != null)
896 resizedEventHandler(this, e);
900 private void OnLanguageChanged(int languageChanged)
902 LanguageChangedEventArgs e = new LanguageChangedEventArgs();
903 e.LanguageChanged = languageChanged;
905 if (languageChangedEventHandler != null)
907 languageChangedEventHandler(this, e);
911 private void OnKeyboardTypeChanged(KeyboardType type)
913 KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
915 e.KeyboardType = type;
917 if (keyboardTypeChangedEventHandler != null)
919 keyboardTypeChangedEventHandler(this, e);
923 private void OnContentReceived(string content, string description, string mimeType)
925 ContentReceivedEventArgs e = new ContentReceivedEventArgs();
927 e.Description = description;
928 e.MimeType = mimeType;
930 if (contentReceivedEventHandler != null)
932 contentReceivedEventHandler(this, e);
937 /// This structure is used to pass on data from the IMF regarding predictive text.
939 /// <since_tizen> 5 </since_tizen>
940 public class EventData : Disposable
943 /// The state if it owns memory
945 /// <since_tizen> 5 </since_tizen>
946 [Obsolete("This has been deprecated in API9 and will be removed in API11. Use swigCMemOwn that is declared in the parent class")]
947 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "<Pending>")]
948 protected bool swigCMemOwn;
949 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
952 /// The default constructor.
954 /// <since_tizen> 5 </since_tizen>
955 public EventData() : this(Interop.InputMethodContext.NewInputMethodContextEventData(), true)
957 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963 /// <param name="aEventName">The name of the event from the IMF.</param>
964 /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
965 /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
966 /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
967 /// <since_tizen> 5 </since_tizen>
968 public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(Interop.InputMethodContext.NewInputMethodContextEventData((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
970 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973 internal EventData(IntPtr cPtr, bool cMemoryOwn)
975 swigCMemOwn = cMemoryOwn;
976 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
980 /// The pre-edit or the commit string.
982 /// <since_tizen> 5 </since_tizen>
983 public string PredictiveString
987 Interop.InputMethodContext.EventDataPredictiveStringSet(swigCPtr, value);
988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
992 string ret = Interop.InputMethodContext.EventDataPredictiveStringGet(swigCPtr);
993 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
999 /// The name of the event from the IMF.
1001 /// <since_tizen> 5 </since_tizen>
1002 public InputMethodContext.EventType EventName
1006 Interop.InputMethodContext.EventDataEventNameSet(swigCPtr, (int)value);
1007 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1011 InputMethodContext.EventType ret = (InputMethodContext.EventType)Interop.InputMethodContext.EventDataEventNameGet(swigCPtr);
1012 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1018 /// The start position from the current cursor position to start deleting characters.
1020 /// <since_tizen> 5 </since_tizen>
1021 public int CursorOffset
1025 Interop.InputMethodContext.EventDataCursorOffsetSet(swigCPtr, value);
1026 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1030 int ret = Interop.InputMethodContext.EventDataCursorOffsetGet(swigCPtr);
1031 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1037 /// The number of characters to delete from the cursorOffset.
1039 /// <since_tizen> 5 </since_tizen>
1040 public int NumberOfChars
1044 Interop.InputMethodContext.EventDataNumberOfCharsSet(swigCPtr, value);
1045 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1049 int ret = Interop.InputMethodContext.EventDataNumberOfCharsGet(swigCPtr);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1055 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
1057 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
1060 internal static EventData GetEventDataFromPtr(IntPtr cPtr)
1062 EventData ret = new EventData(cPtr, false);
1063 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068 /// You can override it to clean-up your own resources.
1070 /// <since_tizen> 5 </since_tizen>
1071 protected override void Dispose(DisposeTypes type)
1078 //Release your own unmanaged resources here.
1079 //You should not access any managed member here except static instance.
1080 //because the execution order of Finalizes is non-deterministic.
1082 if (swigCPtr.Handle != IntPtr.Zero)
1086 swigCMemOwn = false;
1087 Interop.InputMethodContext.DeleteInputMethodContextEventData(swigCPtr);
1089 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
1097 /// Data required by the IMF from the callback.
1099 /// <since_tizen> 5 </since_tizen>
1100 public class CallbackData : Disposable
1103 /// The state if it owns memory
1105 /// <since_tizen> 5 </since_tizen>
1106 [Obsolete("This has been deprecated in API9 and will be removed in API11. Use SwigCMemOwn that is declared in the parent class")]
1107 [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "<Pending>")]
1108 protected bool swigCMemOwn;
1109 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
1112 /// The default constructor.
1114 /// <since_tizen> 5 </since_tizen>
1115 public CallbackData() : this(Interop.InputMethodContext.NewInputMethodContextCallbackData(), true)
1117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1121 /// The constructor.
1123 /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
1124 /// <param name="aCursorPosition">The new position of the cursor.</param>
1125 /// <param name="aCurrentText">The current text string.</param>
1126 /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
1127 /// <since_tizen> 5 </since_tizen>
1128 public CallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(Interop.InputMethodContext.NewInputMethodContextCallbackData(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
1130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1134 /// The current text string.
1136 /// <since_tizen> 5 </since_tizen>
1137 public string CurrentText
1141 Interop.InputMethodContext.CallbackDataCurrentTextSet(swigCPtr, value);
1142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1146 string ret = Interop.InputMethodContext.CallbackDataCurrentTextGet(swigCPtr);
1147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1153 /// The current cursor position.
1155 /// <since_tizen> 5 </since_tizen>
1156 public int CursorPosition
1160 Interop.InputMethodContext.CallbackDataCursorPositionSet(swigCPtr, value);
1161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1165 int ret = Interop.InputMethodContext.CallbackDataCursorPositionGet(swigCPtr);
1166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1172 /// The state if the cursor position needs to be updated.
1174 /// <since_tizen> 5 </since_tizen>
1179 Interop.InputMethodContext.CallbackDataUpdateSet(swigCPtr, value);
1180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1184 bool ret = Interop.InputMethodContext.CallbackDataUpdateGet(swigCPtr);
1185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1191 /// Flags if the pre-edit reset is required.
1193 /// <since_tizen> 5 </since_tizen>
1194 public bool PreeditResetRequired
1198 Interop.InputMethodContext.CallbackDataPreeditResetRequiredSet(swigCPtr, value);
1199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1203 bool ret = Interop.InputMethodContext.CallbackDataPreeditResetRequiredGet(swigCPtr);
1204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1209 internal IntPtr GetCallbackDataPtr()
1211 return (IntPtr)swigCPtr;
1214 internal CallbackData(IntPtr cPtr, bool cMemoryOwn)
1216 swigCMemOwn = cMemoryOwn;
1217 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1220 internal static CallbackData GetCallbackDataFromPtr(IntPtr cPtr)
1222 CallbackData ret = new CallbackData(cPtr, false);
1223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1228 /// You can override it to clean-up your own resources.
1230 /// <since_tizen> 5 </since_tizen>
1231 protected override void Dispose(DisposeTypes type)
1238 //Release your own unmanaged resources here.
1239 //You should not access any managed member here except static instance.
1240 //Because the execution order of Finalizes is non-deterministic.
1242 if (swigCPtr.Handle != IntPtr.Zero)
1246 swigCMemOwn = false;
1247 Interop.InputMethodContext.DeleteInputMethodContextCallbackData(swigCPtr);
1249 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
1257 /// InputMethodContext activated event arguments.
1259 /// <since_tizen> 5 </since_tizen>
1260 public class ActivatedEventArgs : EventArgs
1263 /// The instance of InputMethodContext
1265 /// <since_tizen> 5 </since_tizen>
1266 public InputMethodContext InputMethodContext
1274 /// InputMethodContext event receives event arguments.
1276 /// <since_tizen> 5 </since_tizen>
1277 public class EventReceivedEventArgs : EventArgs
1280 /// The instance of InputMethodContext
1282 /// <since_tizen> 5 </since_tizen>
1283 public InputMethodContext InputMethodContext
1290 /// The event data of IMF
1292 /// <since_tizen> 5 </since_tizen>
1293 public EventData EventData
1301 /// InputMethodContext status changed event arguments.
1303 /// <since_tizen> 5 </since_tizen>
1304 public class StatusChangedEventArgs : EventArgs
1307 /// InputMethodContext status.
1309 /// <since_tizen> 5 </since_tizen>
1310 public bool StatusChanged
1318 /// InputMethodContext resized event arguments.
1320 /// <since_tizen> 5 </since_tizen>
1321 public class ResizedEventArgs : EventArgs
1324 /// The state if the IMF resized.
1326 /// <since_tizen> 5 </since_tizen>
1335 /// InputMethodContext language changed event arguments.
1337 /// <since_tizen> 5 </since_tizen>
1338 public class LanguageChangedEventArgs : EventArgs
1341 /// Language changed.
1343 /// <since_tizen> 5 </since_tizen>
1344 public int LanguageChanged
1352 /// InputMethodContext keyboard type changed event arguments.
1354 /// <since_tizen> 5 </since_tizen>
1355 public class KeyboardTypeChangedEventArgs : EventArgs
1358 /// InputMethodContext keyboard type.
1360 /// <since_tizen> 5 </since_tizen>
1361 public KeyboardType KeyboardType
1369 /// InputMethodContext content received event arguments.
1371 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1372 [EditorBrowsable(EditorBrowsableState.Never)]
1373 public class ContentReceivedEventArgs : EventArgs
1376 /// The content, such as images, of input method
1378 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1379 [EditorBrowsable(EditorBrowsableState.Never)]
1380 public string Content
1386 /// The description of content
1388 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1389 [EditorBrowsable(EditorBrowsableState.Never)]
1390 public string Description
1396 /// The mime type of content, such as jpg, png, and so on
1398 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1399 [EditorBrowsable(EditorBrowsableState.Never)]
1400 public string MimeType