[NUI] Reduce code duplication - refactor dispose codes (#1010)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / InputMethodContext.cs
1 /*
2  * Copyright(c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
21
22 namespace Tizen.NUI
23 {
24     /// <summary>
25     /// Specifically manages the input method framework (IMF) that enables the virtual or hardware keyboards.
26     /// </summary>
27     /// <since_tizen> 5 </since_tizen>
28     public class InputMethodContext : BaseHandle
29     {
30         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31
32         private ActivatedEventCallbackType _activatedEventCallback;
33         private EventReceivedEventCallbackType _eventReceivedEventCallback;
34         private StatusChangedEventCallbackType _statusChangedEventCallback;
35         private ResizedEventCallbackType _resizedEventCallback;
36         private LanguageChangedEventCallbackType _languageChangedEventCallback;
37         private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
38         private ContentReceivedCallbackType _contentReceivedEventCallback;
39
40         /// <summary>
41         /// Constructor.<br/>
42         /// </summary>
43         /// <since_tizen> 5 </since_tizen>
44         public InputMethodContext() : this(Interop.InputMethodContext.InputMethodContext_New(), true)
45         {
46             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
47
48         }
49
50         internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(Interop.InputMethodContext.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
51         {
52             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
53         }
54
55         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
56         private delegate void ActivatedEventCallbackType(IntPtr data);
57         private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
58         private delegate void StatusChangedEventCallbackType(bool statusChanged);
59         private delegate void ResizedEventCallbackType(int resized);
60         private delegate void LanguageChangedEventCallbackType(int languageChanged);
61         private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
62         private delegate void ContentReceivedCallbackType(string content, string description, string mimeType);
63
64         private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
65         private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> _eventReceivedEventHandler;
66         private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
67         private event EventHandler<ResizedEventArgs> _resizedEventHandler;
68         private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
69         private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
70         private event EventHandler<ContentReceivedEventArgs> _contentReceivedEventHandler;
71
72         /// <summary>
73         /// InputMethodContext activated.
74         /// </summary>
75         /// <since_tizen> 5 </since_tizen>
76         public event EventHandler<ActivatedEventArgs> Activated
77         {
78             add
79             {
80                 if (_activatedEventHandler == null)
81                 {
82                     _activatedEventCallback = OnActivated;
83                     ActivatedSignal().Connect(_activatedEventCallback);
84                 }
85
86                 _activatedEventHandler += value;
87             }
88             remove
89             {
90                 _activatedEventHandler -= value;
91
92                 if (_activatedEventHandler == null && _activatedEventCallback != null)
93                 {
94                     ActivatedSignal().Disconnect(_activatedEventCallback);
95                 }
96             }
97         }
98
99         /// <summary>
100         /// InputMethodContext event received.
101         /// </summary>
102         /// <since_tizen> 5 </since_tizen>
103         public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
104         {
105             add
106             {
107                 if (_eventReceivedEventHandler == null)
108                 {
109                     _eventReceivedEventCallback = OnEventReceived;
110                     EventReceivedSignal().Connect(_eventReceivedEventCallback);
111                 }
112
113                 _eventReceivedEventHandler += value;
114             }
115             remove
116             {
117                 _eventReceivedEventHandler -= value;
118
119                 if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
120                 {
121                     EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
122                 }
123             }
124         }
125
126         /// <summary>
127         /// InputMethodContext status changed.
128         /// </summary>
129         /// <since_tizen> 5 </since_tizen>
130         public event EventHandler<StatusChangedEventArgs> StatusChanged
131         {
132             add
133             {
134                 if (_statusChangedEventHandler == null)
135                 {
136                     _statusChangedEventCallback = OnStatusChanged;
137                     StatusChangedSignal().Connect(_statusChangedEventCallback);
138                 }
139
140                 _statusChangedEventHandler += value;
141             }
142             remove
143             {
144                 _statusChangedEventHandler -= value;
145
146                 if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
147                 {
148                     StatusChangedSignal().Disconnect(_statusChangedEventCallback);
149                 }
150             }
151         }
152
153         /// <summary>
154         /// InputMethodContext resized.
155         /// </summary>
156         /// <since_tizen> 5 </since_tizen>
157         public event EventHandler<ResizedEventArgs> Resized
158         {
159             add
160             {
161                 if (_resizedEventHandler == null)
162                 {
163                     _resizedEventCallback = OnResized;
164                     ResizedSignal().Connect(_resizedEventCallback);
165                 }
166
167                 _resizedEventHandler += value;
168             }
169             remove
170             {
171                 _resizedEventHandler -= value;
172
173                 if (_resizedEventHandler == null && _resizedEventCallback != null)
174                 {
175                     ResizedSignal().Disconnect(_resizedEventCallback);
176                 }
177             }
178         }
179
180         /// <summary>
181         /// InputMethodContext language changed.
182         /// </summary>
183         /// <since_tizen> 5 </since_tizen>
184         public event EventHandler<LanguageChangedEventArgs> LanguageChanged
185         {
186             add
187             {
188                 if (_languageChangedEventHandler == null)
189                 {
190                     _languageChangedEventCallback = OnLanguageChanged;
191                     LanguageChangedSignal().Connect(_languageChangedEventCallback);
192                 }
193
194                 _languageChangedEventHandler += value;
195             }
196             remove
197             {
198                 _languageChangedEventHandler -= value;
199
200                 if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
201                 {
202                     LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
203                 }
204             }
205         }
206
207         /// <summary>
208         /// InputMethodContext keyboard type changed.
209         /// </summary>
210         /// <since_tizen> 5 </since_tizen>
211         public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
212         {
213             add
214             {
215                 if (_keyboardTypeChangedEventHandler == null)
216                 {
217                     _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
218                     KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
219                 }
220
221                 _keyboardTypeChangedEventHandler += value;
222             }
223             remove
224             {
225                 _keyboardTypeChangedEventHandler -= value;
226
227                 if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
228                 {
229                     KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
230                 }
231             }
232         }
233
234         /// <summary>
235         /// InputMethodContext content received.
236         /// </summary>
237         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
238         [EditorBrowsable(EditorBrowsableState.Never)]
239         public event EventHandler<ContentReceivedEventArgs> ContentReceived
240         {
241             add
242             {
243                 if (_contentReceivedEventHandler == null)
244                 {
245                     _contentReceivedEventCallback = OnContentReceived;
246                     ContentReceivedSignal().Connect(_contentReceivedEventCallback);
247                 }
248
249                 _contentReceivedEventHandler += value;
250             }
251             remove
252             {
253                 _contentReceivedEventHandler -= value;
254
255                 if (_contentReceivedEventHandler == null && _contentReceivedEventCallback != null)
256                 {
257                     ContentReceivedSignal().Disconnect(_contentReceivedEventCallback);
258                 }
259             }
260         }
261
262         /// <summary>
263         /// The direction of the text.
264         /// </summary>
265         /// <since_tizen> 5 </since_tizen>
266         public enum TextDirection
267         {
268             /// <summary>
269             /// Left to right.
270             /// </summary>
271             LeftToRight,
272             /// <summary>
273             /// Right to left.
274             /// </summary>
275             RightToLeft
276         }
277
278         /// <summary>
279         /// Events that are generated by the IMF.
280         /// </summary>
281         /// <since_tizen> 5 </since_tizen>
282         public enum EventType
283         {
284             /// <summary>
285             /// No event.
286             /// </summary>
287             /// <since_tizen> 5 </since_tizen>
288             Void,
289             /// <summary>
290             /// Pre-edit changed.
291             /// </summary>
292             /// <since_tizen> 5 </since_tizen>
293             Preedit,
294             /// <summary>
295             /// Commit received.
296             /// </summary>
297             /// <since_tizen> 5 </since_tizen>
298             Commit,
299             /// <summary>
300             /// An event to delete a range of characters from the string.
301             /// </summary>
302             /// <since_tizen> 5 </since_tizen>
303             DeleteSurrounding,
304             /// <summary>
305             /// An event to query string and the cursor position.
306             /// </summary>
307             /// <since_tizen> 5 </since_tizen>
308             GetSurrounding,
309             /// <summary>
310             /// Private command sent from the input panel.
311             /// </summary>
312             /// <since_tizen> 5 </since_tizen>
313             PrivateCommand
314         }
315
316         /// <summary>
317         /// Enumeration for the state of the input panel.
318         /// </summary>
319         /// <since_tizen> 5 </since_tizen>
320         public enum State
321         {
322             /// <summary>
323             /// Unknown state.
324             /// </summary>
325             /// <since_tizen> 5 </since_tizen>
326             Default = 0,
327             /// <summary>
328             /// Input panel is shown.
329             /// </summary>
330             /// <since_tizen> 5 </since_tizen>
331             Show,
332             /// <summary>
333             /// Input panel is hidden.
334             /// </summary>
335             /// <since_tizen> 5 </since_tizen>
336             Hide,
337             /// <summary>
338             /// Input panel in process of being shown.
339             /// </summary>
340             /// <since_tizen> 5 </since_tizen>
341             WillShow
342         }
343
344         /// <summary>
345         /// Enumeration for the types of keyboard.
346         /// </summary>
347         /// <since_tizen> 5 </since_tizen>
348         public enum KeyboardType
349         {
350             /// <summary>
351             /// Software keyboard (virtual keyboard) is default.
352             /// </summary>
353             /// <since_tizen> 5 </since_tizen>
354             SoftwareKeyboard,
355             /// <summary>
356             /// Hardware keyboard.
357             /// </summary>
358             /// <since_tizen> 5 </since_tizen>
359             HardwareKeyboard
360         }
361
362         /// <summary>
363         /// Gets or sets whether the IM context allows to use the text prediction.
364         /// </summary>
365         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
366         [EditorBrowsable(EditorBrowsableState.Never)]
367         public bool TextPrediction
368         {
369             get
370             {
371                 return IsTextPredictionAllowed();
372             }
373             set
374             {
375                 AllowTextPrediction(value);
376             }
377         }
378
379         /// <summary>
380         /// Destroys the context of the IMF.<br/>
381         /// </summary>
382         /// <since_tizen> 5 </since_tizen>
383         public void DestroyContext()
384         {
385             Interop.InputMethodContext.InputMethodContext_Finalize(swigCPtr);
386             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387         }
388
389         /// <summary>
390         /// Activates the IMF.<br/>
391         /// It means that the text editing has started.<br/>
392         /// If the hardware keyboard is not connected, then it shows the virtual keyboard.
393         /// </summary>
394         /// <since_tizen> 5 </since_tizen>
395         public void Activate()
396         {
397             Interop.InputMethodContext.InputMethodContext_Activate(swigCPtr);
398             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399         }
400
401         /// <summary>
402         /// Deactivates the IMF.<br/>
403         /// It means that the text editing is complete.
404         /// </summary>
405         /// <since_tizen> 5 </since_tizen>
406         public void Deactivate()
407         {
408             Interop.InputMethodContext.InputMethodContext_Deactivate(swigCPtr);
409             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410         }
411
412         /// <summary>
413         /// Gets the restoration status, which controls if the keyboard is restored after the focus is lost and then regained.<br/>
414         /// If true, then the keyboard will be restored (activated) after the focus is regained.
415         /// </summary>
416         /// <returns>The restoration status.</returns>
417         /// <since_tizen> 5 </since_tizen>
418         public bool RestoreAfterFocusLost()
419         {
420             bool ret = Interop.InputMethodContext.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
421             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
422             return ret;
423         }
424
425         /// <summary>
426         /// Sets the status whether the IMF has to restore the keyboard after losing focus.
427         /// </summary>
428         /// <param name="toggle">True means that keyboard must be restored after the focus is lost and regained.</param>
429         /// <since_tizen> 5 </since_tizen>
430         public void SetRestoreAfterFocusLost(bool toggle)
431         {
432             Interop.InputMethodContext.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
433             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
434         }
435
436         /// <summary>
437         /// Sends a message reset to the pre-edit state or the IMF module.
438         /// </summary>
439         /// <since_tizen> 5 </since_tizen>
440         public new void Reset()
441         {
442             Interop.InputMethodContext.InputMethodContext_Reset(swigCPtr);
443             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
444         }
445
446         /// <summary>
447         /// Notifies the IMF context that the cursor position has changed, required for features such as auto-capitalization.
448         /// </summary>
449         /// <since_tizen> 5 </since_tizen>
450         public void NotifyCursorPosition()
451         {
452             Interop.InputMethodContext.InputMethodContext_NotifyCursorPosition(swigCPtr);
453             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454         }
455
456         /// <summary>
457         /// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
458         /// </summary>
459         /// <param name="cursorPosition">The position of the cursor.</param>
460         /// <since_tizen> 5 </since_tizen>
461         public void SetCursorPosition(uint cursorPosition)
462         {
463             Interop.InputMethodContext.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
464             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465         }
466
467         /// <summary>
468         /// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
469         /// </summary>
470         /// <returns>The current position of the cursor.</returns>
471         /// <since_tizen> 5 </since_tizen>
472         public uint GetCursorPosition()
473         {
474             uint ret = Interop.InputMethodContext.InputMethodContext_GetCursorPosition(swigCPtr);
475             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476             return ret;
477         }
478
479         /// <summary>
480         /// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
481         /// </summary>
482         /// <param name="text">The text string surrounding the current cursor point.</param>
483         /// <since_tizen> 5 </since_tizen>
484         public void SetSurroundingText(string text)
485         {
486             Interop.InputMethodContext.InputMethodContext_SetSurroundingText(swigCPtr, text);
487             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
488         }
489
490         /// <summary>
491         /// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
492         /// </summary>
493         /// <returns>The surrounding text.</returns>
494         /// <since_tizen> 5 </since_tizen>
495         public string GetSurroundingText()
496         {
497             string ret = Interop.InputMethodContext.InputMethodContext_GetSurroundingText(swigCPtr);
498             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499             return ret;
500         }
501
502         /// <summary>
503         /// Notifies the IMF context that text input is set to multiline or not.
504         /// </summary>
505         /// <param name="multiLine">True if multiline text input is used.</param>
506         /// <since_tizen> 5 </since_tizen>
507         public void NotifyTextInputMultiLine(bool multiLine)
508         {
509             Interop.InputMethodContext.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
510             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
511         }
512
513         /// <summary>
514         /// Returns the text direction of the current input language of the keyboard.
515         /// </summary>
516         /// <returns>The direction of the text.</returns>
517         /// <since_tizen> 5 </since_tizen>
518         public InputMethodContext.TextDirection GetTextDirection()
519         {
520             InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)Interop.InputMethodContext.InputMethodContext_GetTextDirection(swigCPtr);
521             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
522             return ret;
523         }
524
525         /// <summary>
526         /// Provides the size and the position of the keyboard.<br/>
527         /// The position is relative to whether the keyboard is visible or not.<br/>
528         /// If the keyboard is not visible, then the position will be off the screen.<br/>
529         /// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
530         /// the values then taken down. So ideally, GetInputMethodArea() must be called after Show().
531         /// </summary>
532         /// <returns>Rectangle which is keyboard panel x, y, width, and height.</returns>
533         /// <since_tizen> 5 </since_tizen>
534         public Rectangle GetInputMethodArea()
535         {
536             Rectangle ret = new Rectangle(Interop.InputMethodContext.InputMethodContext_GetInputMethodArea(swigCPtr), true);
537             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
538             return ret;
539         }
540
541         /// <summary>
542         /// Sets up the input panel specific data.
543         /// </summary>
544         /// <param name="text">The specific data to be set to the input panel.</param>
545         /// <since_tizen> 5 </since_tizen>
546         public void SetInputPanelUserData(string text)
547         {
548             Interop.InputMethodContext.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
549             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
550         }
551
552         /// <summary>
553         /// Gets the specific data of the current active input panel.
554         /// </summary>
555         /// <param name="text">The specific data to be received from the input panel.</param>
556         /// <since_tizen> 5 </since_tizen>
557         public void GetInputPanelUserData(out string text)
558         {
559             Interop.InputMethodContext.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
560             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561         }
562
563         /// <summary>
564         /// Gets the state of the current active input panel.
565         /// </summary>
566         /// <returns>The state of the input panel.</returns>
567         /// <since_tizen> 5 </since_tizen>
568         public InputMethodContext.State GetInputPanelState()
569         {
570             InputMethodContext.State ret = (InputMethodContext.State)Interop.InputMethodContext.InputMethodContext_GetInputPanelState(swigCPtr);
571             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
572             return ret;
573         }
574
575         /// <summary>
576         /// Sets the return key on the input panel to be visible or invisible.<br/>
577         /// The default value is true.
578         /// </summary>
579         /// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
580         /// <since_tizen> 5 </since_tizen>
581         public void SetReturnKeyState(bool visible)
582         {
583             Interop.InputMethodContext.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585         }
586
587         /// <summary>
588         /// Enables to show the input panel automatically when focused.
589         /// </summary>
590         /// <param name="enabled">If true, the input panel will be shown when focused.</param>
591         /// <since_tizen> 5 </since_tizen>
592         public void AutoEnableInputPanel(bool enabled)
593         {
594             Interop.InputMethodContext.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
595             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596         }
597
598         /// <summary>
599         /// Shows the input panel.
600         /// </summary>
601         /// <since_tizen> 5 </since_tizen>
602         public void ShowInputPanel()
603         {
604             Interop.InputMethodContext.InputMethodContext_ShowInputPanel(swigCPtr);
605             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606         }
607
608         /// <summary>
609         /// Hides the input panel.
610         /// </summary>
611         /// <since_tizen> 5 </since_tizen>
612         public void HideInputPanel()
613         {
614             Interop.InputMethodContext.InputMethodContext_HideInputPanel(swigCPtr);
615             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
616         }
617
618         /// <summary>
619         /// Gets the keyboard type.<br/>
620         /// The default keyboard type is SoftwareKeyboard.
621         /// </summary>
622         /// <returns>The keyboard type.</returns>
623         /// <since_tizen> 5 </since_tizen>
624         public InputMethodContext.KeyboardType GetKeyboardType()
625         {
626             InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)Interop.InputMethodContext.InputMethodContext_GetKeyboardType(swigCPtr);
627             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
628             return ret;
629         }
630
631         /// <summary>
632         /// Gets the current language locale of the input panel.<br/>
633         /// For example, en_US, en_GB, en_PH, fr_FR, and so on.
634         /// </summary>
635         /// <returns>The current language locale of the input panel.</returns>
636         /// <since_tizen> 5 </since_tizen>
637         public string GetInputPanelLocale()
638         {
639             string ret = Interop.InputMethodContext.InputMethodContext_GetInputPanelLocale(swigCPtr);
640             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641             return ret;
642         }
643
644         /// <summary>
645         /// Sets the allowed MIME Type to deliver to the input panel. <br/>
646         /// For example, string mimeType = "text/plain,image/png,image/gif,application/pdf";
647         /// </summary>
648         /// <param name="mimeType">The allowed MIME type.</param>
649         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
650         [EditorBrowsable(EditorBrowsableState.Never)]
651         public void SetMIMEType(string mimeType)
652         {
653             Interop.InputMethodContext.InputMethodContext_SetMIMEType(swigCPtr, mimeType);
654             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
655         }
656
657         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
658         {
659             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
660         }
661
662         internal InputMethodContext(InputMethodContext inputMethodContext) : this(Interop.InputMethodContext.new_InputMethodContext__SWIG_1(InputMethodContext.getCPtr(inputMethodContext)), true)
663         {
664             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665         }
666
667         internal InputMethodContext Assign(InputMethodContext inputMethodContext)
668         {
669             InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_Assign(swigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
670             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671             return ret;
672         }
673
674         internal static InputMethodContext DownCast(BaseHandle handle)
675         {
676             InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
677             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
678             return ret;
679         }
680
681         internal void ApplyOptions(InputMethodOptions options)
682         {
683             Interop.InputMethodContext.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
684             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685         }
686
687         internal void AllowTextPrediction(bool prediction)
688         {
689             Interop.InputMethodContext.InputMethodContext_AllowTextPrediction(swigCPtr, prediction);
690             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
691         }
692
693         internal bool IsTextPredictionAllowed()
694         {
695             bool ret = Interop.InputMethodContext.InputMethodContext_IsTextPredictionAllowed(swigCPtr);
696             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
697             return ret;
698         }
699
700         internal ActivatedSignalType ActivatedSignal()
701         {
702             ActivatedSignalType ret = new ActivatedSignalType(Interop.InputMethodContext.InputMethodContext_ActivatedSignal(swigCPtr), false);
703             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
704             return ret;
705         }
706
707         internal KeyboardEventSignalType EventReceivedSignal()
708         {
709             KeyboardEventSignalType ret = new KeyboardEventSignalType(Interop.InputMethodContext.InputMethodContext_EventReceivedSignal(swigCPtr), false);
710             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711             return ret;
712         }
713
714         internal StatusSignalType StatusChangedSignal()
715         {
716             StatusSignalType ret = new StatusSignalType(Interop.InputMethodContext.InputMethodContext_StatusChangedSignal(swigCPtr), false);
717             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718             return ret;
719         }
720
721         internal KeyboardResizedSignalType ResizedSignal()
722         {
723             KeyboardResizedSignalType ret = new KeyboardResizedSignalType(Interop.InputMethodContext.InputMethodContext_ResizedSignal(swigCPtr), false);
724             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725             return ret;
726         }
727
728         internal LanguageChangedSignalType LanguageChangedSignal()
729         {
730             LanguageChangedSignalType ret = new LanguageChangedSignalType(Interop.InputMethodContext.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
731             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732             return ret;
733         }
734
735         internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
736         {
737             KeyboardTypeSignalType ret = new KeyboardTypeSignalType(Interop.InputMethodContext.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
738             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
739             return ret;
740         }
741
742         internal ContentReceivedSignalType ContentReceivedSignal()
743         {
744             ContentReceivedSignalType ret = new ContentReceivedSignalType(Interop.InputMethodContext.InputMethodContext_ContentReceivedSignal(swigCPtr), false);
745             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746             return ret;
747         }
748
749         /// <summary>
750         /// You can override it to clean-up your own resources.
751         /// </summary>
752         /// <param name="type">Dispose Type</param>
753         /// <since_tizen> 5 </since_tizen>
754         /// Please do not use! This will be deprecated!
755         /// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
756         [EditorBrowsable(EditorBrowsableState.Never)]
757         protected override void Dispose(DisposeTypes type)
758         {
759             if (disposed)
760             {
761                 return;
762             }
763
764             //Release your own unmanaged resources here.
765             //You should not access any managed member here except static instance
766             //because the execution order of Finalizes is non-deterministic.
767
768             if (_keyboardTypeChangedEventCallback != null)
769             {
770                 KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
771             }
772
773             if (swigCPtr.Handle != global::System.IntPtr.Zero)
774             {
775                 if (swigCMemOwn)
776                 {
777                     swigCMemOwn = false;
778                     Interop.InputMethodContext.delete_InputMethodContext(swigCPtr);
779                 }
780                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
781             }
782
783             base.Dispose(type);
784         }
785
786         private void OnActivated(IntPtr data)
787         {
788             ActivatedEventArgs e = new ActivatedEventArgs();
789
790             if (data != null)
791             {
792                 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
793             }
794
795             if (_activatedEventHandler != null)
796             {
797                 _activatedEventHandler(this, e);
798             }
799         }
800
801         private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
802         {
803             CallbackData callbackData = null;
804
805             EventReceivedEventArgs e = new EventReceivedEventArgs();
806
807             if (inputMethodContext != null)
808             {
809                 e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
810             }
811             if (eventData != null)
812             {
813                 e.EventData = EventData.GetEventDataFromPtr(eventData);
814             }
815
816             if (_eventReceivedEventHandler != null)
817             {
818                 callbackData = _eventReceivedEventHandler(this, e);
819             }
820             if (callbackData != null)
821             {
822                 return callbackData.GetCallbackDataPtr();
823             }
824             else
825             {
826                 return new CallbackData().GetCallbackDataPtr();
827             }
828         }
829
830         private void OnStatusChanged(bool statusChanged)
831         {
832             StatusChangedEventArgs e = new StatusChangedEventArgs();
833
834             e.StatusChanged = statusChanged;
835
836             if (_statusChangedEventHandler != null)
837             {
838                 _statusChangedEventHandler(this, e);
839             }
840         }
841
842         private void OnResized(int resized)
843         {
844             ResizedEventArgs e = new ResizedEventArgs();
845             e.Resized = resized;
846
847             if (_resizedEventHandler != null)
848             {
849                 _resizedEventHandler(this, e);
850             }
851         }
852
853         private void OnLanguageChanged(int languageChanged)
854         {
855             LanguageChangedEventArgs e = new LanguageChangedEventArgs();
856             e.LanguageChanged = languageChanged;
857
858             if (_languageChangedEventHandler != null)
859             {
860                 _languageChangedEventHandler(this, e);
861             }
862         }
863
864         private void OnKeyboardTypeChanged(KeyboardType type)
865         {
866             KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
867
868             e.KeyboardType = type;
869
870             if (_keyboardTypeChangedEventHandler != null)
871             {
872                 _keyboardTypeChangedEventHandler(this, e);
873             }
874         }
875
876         private void OnContentReceived(string content, string description, string mimeType)
877         {
878             ContentReceivedEventArgs e = new ContentReceivedEventArgs();
879             e.Content = content;
880             e.Description = description;
881             e.MimeType = mimeType;
882
883             if (_contentReceivedEventHandler != null)
884             {
885                 _contentReceivedEventHandler(this, e);
886             }
887         }
888
889         /// <summary>
890         /// This structure is used to pass on data from the IMF regarding predictive text.
891         /// </summary>
892         /// <since_tizen> 5 </since_tizen>
893         public class EventData : global::System.IDisposable
894         {
895             /// <summary>
896             /// The state if it owns memory
897             /// </summary>
898             /// <since_tizen> 5 </since_tizen>
899             protected bool swigCMemOwn;
900
901             /// <summary>
902             /// A flag to check if it is already disposed.
903             /// </summary>
904             /// <since_tizen> 5 </since_tizen>
905             protected bool disposed = false;
906
907             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
908
909             //A flag to check who called Dispose(). (By User or DisposeQueue)
910             private bool isDisposeQueued = false;
911
912             /// <summary>
913             /// The default constructor.
914             /// </summary>
915             /// <since_tizen> 5 </since_tizen>
916             public EventData() : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_0(), true)
917             {
918                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
919             }
920
921             /// <summary>
922             /// The constructor.
923             /// </summary>
924             /// <param name="aEventName">The name of the event from the IMF.</param>
925             /// <param name="aPredictiveString">The pre-edit or the commit string.</param>
926             /// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
927             /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
928             /// <since_tizen> 5 </since_tizen>
929             public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
930             {
931                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932             }
933
934             internal EventData(IntPtr cPtr, bool cMemoryOwn)
935             {
936                 swigCMemOwn = cMemoryOwn;
937                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
938             }
939
940             /// <summary>
941             /// Releases the resource.
942             /// </summary>
943             /// <since_tizen> 5 </since_tizen>
944             ~EventData()
945             {
946                 if (!isDisposeQueued)
947                 {
948                     isDisposeQueued = true;
949                     DisposeQueue.Instance.Add(this);
950                 }
951             }
952
953             /// <summary>
954             /// The pre-edit or the commit string.
955             /// </summary>
956             /// <since_tizen> 5 </since_tizen>
957             public string PredictiveString
958             {
959                 set
960                 {
961                     Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
962                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963                 }
964                 get
965                 {
966                     string ret = Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_get(swigCPtr);
967                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
968                     return ret;
969                 }
970             }
971
972             /// <summary>
973             /// The name of the event from the IMF.
974             /// </summary>
975             /// <since_tizen> 5 </since_tizen>
976             public InputMethodContext.EventType EventName
977             {
978                 set
979                 {
980                     Interop.InputMethodContext.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
981                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
982                 }
983                 get
984                 {
985                     InputMethodContext.EventType ret = (InputMethodContext.EventType)Interop.InputMethodContext.InputMethodContext_EventData_eventName_get(swigCPtr);
986                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
987                     return ret;
988                 }
989             }
990
991             /// <summary>
992             /// The start position from the current cursor position to start deleting characters.
993             /// </summary>
994             /// <since_tizen> 5 </since_tizen>
995             public int CursorOffset
996             {
997                 set
998                 {
999                     Interop.InputMethodContext.InputMethodContext_EventData_cursorOffset_set(swigCPtr, value);
1000                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1001                 }
1002                 get
1003                 {
1004                     int ret = Interop.InputMethodContext.InputMethodContext_EventData_cursorOffset_get(swigCPtr);
1005                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1006                     return ret;
1007                 }
1008             }
1009
1010             /// <summary>
1011             /// The number of characters to delete from the cursorOffset.
1012             /// </summary>
1013             /// <since_tizen> 5 </since_tizen>
1014             public int NumberOfChars
1015             {
1016                 set
1017                 {
1018                     Interop.InputMethodContext.InputMethodContext_EventData_numberOfChars_set(swigCPtr, value);
1019                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1020                 }
1021                 get
1022                 {
1023                     int ret = Interop.InputMethodContext.InputMethodContext_EventData_numberOfChars_get(swigCPtr);
1024                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1025                     return ret;
1026                 }
1027             }
1028
1029             /// <summary>
1030             /// The dispose pattern.
1031             /// </summary>
1032             /// <since_tizen> 5 </since_tizen>
1033             public void Dispose()
1034             {
1035                 //Throw excpetion if Dispose() is called in separate thread.
1036                 if (!Window.IsInstalled())
1037                 {
1038                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
1039                 }
1040
1041                 if (isDisposeQueued)
1042                 {
1043                     Dispose(DisposeTypes.Implicit);
1044                 }
1045                 else
1046                 {
1047                     Dispose(DisposeTypes.Explicit);
1048                     System.GC.SuppressFinalize(this);
1049                 }
1050             }
1051
1052             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventData obj)
1053             {
1054                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
1055             }
1056
1057             internal static EventData GetEventDataFromPtr(IntPtr cPtr)
1058             {
1059                 EventData ret = new EventData(cPtr, false);
1060                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1061                 return ret;
1062             }
1063
1064             /// <summary>
1065             /// You can override it to clean-up your own resources.
1066             /// </summary>
1067             /// <since_tizen> 5 </since_tizen>
1068             protected virtual void Dispose(DisposeTypes type)
1069             {
1070                 if (disposed)
1071                 {
1072                     return;
1073                 }
1074
1075                 if (type == DisposeTypes.Explicit)
1076                 {
1077                     //Called by User.
1078                     //Release your own managed resources here.
1079                     //You should release all of your own disposable objects here.
1080
1081                 }
1082
1083                 //Release your own unmanaged resources here.
1084                 //You should not access any managed member here except static instance.
1085                 //because the execution order of Finalizes is non-deterministic.
1086
1087                 if (swigCPtr.Handle != IntPtr.Zero)
1088                 {
1089                     if (swigCMemOwn)
1090                     {
1091                         swigCMemOwn = false;
1092                         Interop.InputMethodContext.delete_InputMethodContext_EventData(swigCPtr);
1093                     }
1094                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
1095                 }
1096
1097                 disposed = true;
1098             }
1099         }
1100
1101         /// <summary>
1102         /// Data required by the IMF from the callback.
1103         /// </summary>
1104         /// <since_tizen> 5 </since_tizen>
1105         public class CallbackData : global::System.IDisposable
1106         {
1107             /// <summary>
1108             /// The state if it owns memory
1109             /// </summary>
1110             /// <since_tizen> 5 </since_tizen>
1111             protected bool swigCMemOwn;
1112
1113             /// <summary>
1114             /// A Flag to check if it is already disposed.
1115             /// </summary>
1116             /// <since_tizen> 5 </since_tizen>
1117             protected bool disposed = false;
1118
1119             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
1120
1121             //A flag to check who called Dispose(). (By User or DisposeQueue)
1122             private bool isDisposeQueued = false;
1123
1124             /// <summary>
1125             /// The default constructor.
1126             /// </summary>
1127             /// <since_tizen> 5 </since_tizen>
1128             public CallbackData() : this(Interop.InputMethodContext.new_InputMethodContext_CallbackData__SWIG_0(), true)
1129             {
1130                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1131             }
1132
1133             /// <summary>
1134             /// The constructor.
1135             /// </summary>
1136             /// <param name="aUpdate">True if the cursor position needs to be updated.</param>
1137             /// <param name="aCursorPosition">The new position of the cursor.</param>
1138             /// <param name="aCurrentText">The current text string.</param>
1139             /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
1140             /// <since_tizen> 5 </since_tizen>
1141             public CallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(Interop.InputMethodContext.new_InputMethodContext_CallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
1142             {
1143                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1144             }
1145
1146             /// <summary>
1147             /// Releases the resource.
1148             /// </summary>
1149             /// <since_tizen> 5 </since_tizen>
1150             ~CallbackData()
1151             {
1152                 if (!isDisposeQueued)
1153                 {
1154                     isDisposeQueued = true;
1155                     DisposeQueue.Instance.Add(this);
1156                 }
1157             }
1158
1159             /// <summary>
1160             /// The current text string.
1161             /// </summary>
1162             /// <since_tizen> 5 </since_tizen>
1163             public string CurrentText
1164             {
1165                 set
1166                 {
1167                     Interop.InputMethodContext.InputMethodContext_CallbackData_currentText_set(swigCPtr, value);
1168                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169                 }
1170                 get
1171                 {
1172                     string ret = Interop.InputMethodContext.InputMethodContext_CallbackData_currentText_get(swigCPtr);
1173                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1174                     return ret;
1175                 }
1176             }
1177
1178             /// <summary>
1179             /// The current cursor position.
1180             /// </summary>
1181             /// <since_tizen> 5 </since_tizen>
1182             public int CursorPosition
1183             {
1184                 set
1185                 {
1186                     Interop.InputMethodContext.InputMethodContext_CallbackData_cursorPosition_set(swigCPtr, value);
1187                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188                 }
1189                 get
1190                 {
1191                     int ret = Interop.InputMethodContext.InputMethodContext_CallbackData_cursorPosition_get(swigCPtr);
1192                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1193                     return ret;
1194                 }
1195             }
1196
1197             /// <summary>
1198             /// The state if the cursor position needs to be updated.
1199             /// </summary>
1200             /// <since_tizen> 5 </since_tizen>
1201             public bool Update
1202             {
1203                 set
1204                 {
1205                     Interop.InputMethodContext.InputMethodContext_CallbackData_update_set(swigCPtr, value);
1206                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207                 }
1208                 get
1209                 {
1210                     bool ret = Interop.InputMethodContext.InputMethodContext_CallbackData_update_get(swigCPtr);
1211                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212                     return ret;
1213                 }
1214             }
1215
1216             /// <summary>
1217             /// Flags if the pre-edit reset is required.
1218             /// </summary>
1219             /// <since_tizen> 5 </since_tizen>
1220             public bool PreeditResetRequired
1221             {
1222                 set
1223                 {
1224                     Interop.InputMethodContext.InputMethodContext_CallbackData_preeditResetRequired_set(swigCPtr, value);
1225                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1226                 }
1227                 get
1228                 {
1229                     bool ret = Interop.InputMethodContext.InputMethodContext_CallbackData_preeditResetRequired_get(swigCPtr);
1230                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231                     return ret;
1232                 }
1233             }
1234
1235             /// <summary>
1236             /// The dispose pattern.
1237             /// </summary>
1238             /// <since_tizen> 5 </since_tizen>
1239             public void Dispose()
1240             {
1241                 //Throw excpetion if Dispose() is called in separate thread.
1242                 if (!Window.IsInstalled())
1243                 {
1244                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
1245                 }
1246
1247                 if (isDisposeQueued)
1248                 {
1249                     Dispose(DisposeTypes.Implicit);
1250                 }
1251                 else
1252                 {
1253                     Dispose(DisposeTypes.Explicit);
1254                     System.GC.SuppressFinalize(this);
1255                 }
1256             }
1257
1258             internal IntPtr GetCallbackDataPtr()
1259             {
1260                 return (IntPtr)swigCPtr;
1261             }
1262
1263             internal CallbackData(IntPtr cPtr, bool cMemoryOwn)
1264             {
1265                 swigCMemOwn = cMemoryOwn;
1266                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1267             }
1268
1269             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CallbackData obj)
1270             {
1271                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
1272             }
1273
1274             internal static CallbackData GetCallbackDataFromPtr(IntPtr cPtr)
1275             {
1276                 CallbackData ret = new CallbackData(cPtr, false);
1277                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1278                 return ret;
1279             }
1280
1281             /// <summary>
1282             /// You can override it to clean-up your own resources.
1283             /// </summary>
1284             /// <since_tizen> 5 </since_tizen>
1285             protected virtual void Dispose(DisposeTypes type)
1286             {
1287                 if (disposed)
1288                 {
1289                     return;
1290                 }
1291
1292                 if (type == DisposeTypes.Explicit)
1293                 {
1294                     //Called by User.
1295                     //Release your own managed resources here.
1296                     //You should release all of your own disposable objects here.
1297
1298                 }
1299
1300                 //Release your own unmanaged resources here.
1301                 //You should not access any managed member here except static instance.
1302                 //Because the execution order of Finalizes is non-deterministic.
1303
1304                 if (swigCPtr.Handle != IntPtr.Zero)
1305                 {
1306                     if (swigCMemOwn)
1307                     {
1308                         swigCMemOwn = false;
1309                         Interop.InputMethodContext.delete_InputMethodContext_CallbackData(swigCPtr);
1310                     }
1311                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
1312                 }
1313
1314                 disposed = true;
1315             }
1316         }
1317
1318         /// <summary>
1319         /// InputMethodContext activated event arguments.
1320         /// </summary>
1321         /// <since_tizen> 5 </since_tizen>
1322         public class ActivatedEventArgs : EventArgs
1323         {
1324             /// <summary>
1325             /// The instance of InputMethodContext
1326             /// </summary>
1327             /// <since_tizen> 5 </since_tizen>
1328             public InputMethodContext InputMethodContext
1329             {
1330                 get;
1331                 set;
1332             }
1333         }
1334
1335         /// <summary>
1336         /// InputMethodContext event receives event arguments.
1337         /// </summary>
1338         /// <since_tizen> 5 </since_tizen>
1339         public class EventReceivedEventArgs : EventArgs
1340         {
1341             /// <summary>
1342             /// The instance of InputMethodContext
1343             /// </summary>
1344             /// <since_tizen> 5 </since_tizen>
1345             public InputMethodContext InputMethodContext
1346             {
1347                 get;
1348                 set;
1349             }
1350
1351             /// <summary>
1352             /// The event data of IMF
1353             /// </summary>
1354             /// <since_tizen> 5 </since_tizen>
1355             public EventData EventData
1356             {
1357                 get;
1358                 set;
1359             }
1360         }
1361
1362         /// <summary>
1363         /// InputMethodContext status changed event arguments.
1364         /// </summary>
1365         /// <since_tizen> 5 </since_tizen>
1366         public class StatusChangedEventArgs : EventArgs
1367         {
1368             /// <summary>
1369             /// InputMethodContext status.
1370             /// </summary>
1371             /// <since_tizen> 5 </since_tizen>
1372             public bool StatusChanged
1373             {
1374                 get;
1375                 set;
1376             }
1377         }
1378
1379         /// <summary>
1380         /// InputMethodContext resized event arguments.
1381         /// </summary>
1382         /// <since_tizen> 5 </since_tizen>
1383         public class ResizedEventArgs : EventArgs
1384         {
1385             /// <summary>
1386             /// The state if the IMF resized.
1387             /// </summary>
1388             /// <since_tizen> 5 </since_tizen>
1389             public int Resized
1390             {
1391                 get;
1392                 set;
1393             }
1394         }
1395
1396         /// <summary>
1397         /// InputMethodContext language changed event arguments.
1398         /// </summary>
1399         /// <since_tizen> 5 </since_tizen>
1400         public class LanguageChangedEventArgs : EventArgs
1401         {
1402             /// <summary>
1403             /// Language changed.
1404             /// </summary>
1405             /// <since_tizen> 5 </since_tizen>
1406             public int LanguageChanged
1407             {
1408                 get;
1409                 set;
1410             }
1411         }
1412
1413         /// <summary>
1414         /// InputMethodContext keyboard type changed event arguments.
1415         /// </summary>
1416         /// <since_tizen> 5 </since_tizen>
1417         public class KeyboardTypeChangedEventArgs : EventArgs
1418         {
1419             /// <summary>
1420             /// InputMethodContext keyboard type.
1421             /// </summary>
1422             /// <since_tizen> 5 </since_tizen>
1423             public KeyboardType KeyboardType
1424             {
1425                 get;
1426                 set;
1427             }
1428         }
1429
1430         /// <summary>
1431         /// InputMethodContext content received event arguments.
1432         /// </summary>
1433         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1434         [EditorBrowsable(EditorBrowsableState.Never)]
1435         public class ContentReceivedEventArgs : EventArgs
1436         {
1437             /// <summary>
1438             /// The content, such as images, of input method
1439             /// </summary>
1440             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1441             [EditorBrowsable(EditorBrowsableState.Never)]
1442             public string Content
1443             {
1444                 get;
1445                 set;
1446             }
1447             /// <summary>
1448             /// The description of content
1449             /// </summary>
1450             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1451             [EditorBrowsable(EditorBrowsableState.Never)]
1452             public string Description
1453             {
1454                 get;
1455                 set;
1456             }
1457             /// <summary>
1458             /// The mime type of content, such as jpg, png, and so on
1459             /// </summary>
1460             /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1461             [EditorBrowsable(EditorBrowsableState.Never)]
1462             public string MimeType
1463             {
1464                 get;
1465                 set;
1466             }
1467         }
1468     }
1469 }