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