Revert "[Tizen] Add obsolete attribute for deprecated apis, backward compatibility"
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / ImfManager.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 using System;
17 using System.Runtime.InteropServices;
18
19 namespace Tizen.NUI
20 {
21     /// <summary>
22     /// Specifically manages the ecore input method framework which enables the virtual or hardware keyboards.
23     /// </summary>
24     public class ImfManager : BaseHandle
25     {
26         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27
28         internal ImfManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ImfManager_SWIGUpcast(cPtr), cMemoryOwn)
29         {
30             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31         }
32
33         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj)
34         {
35             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36         }
37
38         protected override void Dispose(DisposeTypes type)
39         {
40             if (disposed)
41             {
42                 return;
43             }
44
45             if (type == DisposeTypes.Explicit)
46             {
47                 //Called by User
48                 //Release your own managed resources here.
49                 //You should release all of your own disposable objects here.
50
51             }
52
53             //Release your own unmanaged resources here.
54             //You should not access any managed member here except static instance.
55             //because the execution order of Finalizes is non-deterministic.
56
57             if (swigCPtr.Handle != global::System.IntPtr.Zero)
58             {
59                 if (swigCMemOwn)
60                 {
61                     swigCMemOwn = false;
62                     NDalicManualPINVOKE.delete_ImfManager(swigCPtr);
63                 }
64                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
65             }
66
67             base.Dispose(type);
68         }
69
70         /// <summary>
71         /// This structure is used to pass on data from the IMF regarding predictive text.
72         /// </summary>
73         public class ImfEventData : global::System.IDisposable
74         {
75             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
76             protected bool swigCMemOwn;
77
78             internal ImfEventData(global::System.IntPtr cPtr, bool cMemoryOwn)
79             {
80                 swigCMemOwn = cMemoryOwn;
81                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
82             }
83
84             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj)
85             {
86                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
87             }
88
89             //A Flag to check who called Dispose(). (By User or DisposeQueue)
90             private bool isDisposeQueued = false;
91             //A Flat to check if it is already disposed.
92             protected bool disposed = false;
93
94
95             ~ImfEventData()
96             {
97                 if (!isDisposeQueued)
98                 {
99                     isDisposeQueued = true;
100                     DisposeQueue.Instance.Add(this);
101                 }
102             }
103
104             /// <summary>
105             /// Dispose pattern
106             /// </summary>
107             public void Dispose()
108             {
109                 //Throw excpetion if Dispose() is called in separate thread.
110                 if (!Window.IsInstalled())
111                 {
112                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
113                 }
114
115                 if (isDisposeQueued)
116                 {
117                     Dispose(DisposeTypes.Implicit);
118                 }
119                 else
120                 {
121                     Dispose(DisposeTypes.Explicit);
122                     System.GC.SuppressFinalize(this);
123                 }
124             }
125
126             protected virtual void Dispose(DisposeTypes type)
127             {
128                 if (disposed)
129                 {
130                     return;
131                 }
132
133                 if (type == DisposeTypes.Explicit)
134                 {
135                     //Called by User
136                     //Release your own managed resources here.
137                     //You should release all of your own disposable objects here.
138
139                 }
140
141                 //Release your own unmanaged resources here.
142                 //You should not access any managed member here except static instance.
143                 //because the execution order of Finalizes is non-deterministic.
144
145                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
146                 {
147                     if (swigCMemOwn)
148                     {
149                         swigCMemOwn = false;
150                         NDalicManualPINVOKE.delete_ImfManager_ImfEventData(swigCPtr);
151                     }
152                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
153                 }
154
155                 disposed = true;
156             }
157
158             internal static ImfEventData GetImfEventDataFromPtr(global::System.IntPtr cPtr)
159             {
160                 ImfEventData ret = new ImfEventData(cPtr, false);
161                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162                 return ret;
163             }
164
165             /// <summary>
166             /// Default Constructor
167             /// </summary>
168             public ImfEventData() : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_0(), true)
169             {
170                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171             }
172
173             /// <summary>
174             /// Constructor
175             /// </summary>
176             /// <param name="aEventName">The name of the event from the IMF.</param>
177             /// <param name="aPredictiveString">The pre-edit or commit string.</param>
178             /// <param name="aCursorOffset">Start position from the current cursor position to start deleting characters.</param>
179             /// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
180             public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
181             {
182                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183             }
184
185             /// <summary>
186             /// The pre-edit or commit string.
187             /// </summary>
188             public string PredictiveString
189             {
190                 set
191                 {
192                     NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value);
193                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194                 }
195                 get
196                 {
197                     string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr);
198                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199                     return ret;
200                 }
201             }
202
203             /// <summary>
204             /// The name of the event from the IMF.
205             /// </summary>
206             public ImfManager.ImfEvent EventName
207             {
208                 set
209                 {
210                     NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value);
211                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212                 }
213                 get
214                 {
215                     ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr);
216                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217                     return ret;
218                 }
219             }
220
221             /// <summary>
222             /// Start position from the current cursor position to start deleting characters.
223             /// </summary>
224             public int CursorOffset
225             {
226                 set
227                 {
228                     NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value);
229                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230                 }
231                 get
232                 {
233                     int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr);
234                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235                     return ret;
236                 }
237             }
238
239             /// <summary>
240             /// Number of characters to delete from the cursorOffset.
241             /// </summary>
242             public int NumberOfChars
243             {
244                 set
245                 {
246                     NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value);
247                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248                 }
249                 get
250                 {
251                     int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr);
252                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253                     return ret;
254                 }
255             }
256
257         }
258
259         /// <summary>
260         /// Data required by IMF from the callback.
261         /// </summary>
262         public class ImfCallbackData : global::System.IDisposable
263         {
264             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
265             protected bool swigCMemOwn;
266
267             internal IntPtr GetImfCallbackDataPtr()
268             {
269                 return (IntPtr)swigCPtr;
270             }
271
272             internal ImfCallbackData(global::System.IntPtr cPtr, bool cMemoryOwn)
273             {
274                 swigCMemOwn = cMemoryOwn;
275                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
276             }
277
278             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj)
279             {
280                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
281             }
282
283             //A Flag to check who called Dispose(). (By User or DisposeQueue)
284             private bool isDisposeQueued = false;
285             //A Flat to check if it is already disposed.
286             protected bool disposed = false;
287
288
289             ~ImfCallbackData()
290             {
291                 if (!isDisposeQueued)
292                 {
293                     isDisposeQueued = true;
294                     DisposeQueue.Instance.Add(this);
295                 }
296             }
297
298             /// <summary>
299             /// Dispose pattern
300             /// </summary>
301             public void Dispose()
302             {
303                 //Throw excpetion if Dispose() is called in separate thread.
304                 if (!Window.IsInstalled())
305                 {
306                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
307                 }
308
309                 if (isDisposeQueued)
310                 {
311                     Dispose(DisposeTypes.Implicit);
312                 }
313                 else
314                 {
315                     Dispose(DisposeTypes.Explicit);
316                     System.GC.SuppressFinalize(this);
317                 }
318             }
319
320             protected virtual void Dispose(DisposeTypes type)
321             {
322                 if (disposed)
323                 {
324                     return;
325                 }
326
327                 if (type == DisposeTypes.Explicit)
328                 {
329                     //Called by User
330                     //Release your own managed resources here.
331                     //You should release all of your own disposable objects here.
332
333                 }
334
335                 //Release your own unmanaged resources here.
336                 //You should not access any managed member here except static instance.
337                 //because the execution order of Finalizes is non-deterministic.
338
339                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
340                 {
341                     if (swigCMemOwn)
342                     {
343                         swigCMemOwn = false;
344                         NDalicManualPINVOKE.delete_ImfManager_ImfCallbackData(swigCPtr);
345                     }
346                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
347                 }
348
349                 disposed = true;
350             }
351
352             internal static ImfCallbackData GetImfCallbackDataFromPtr(global::System.IntPtr cPtr)
353             {
354                 ImfCallbackData ret = new ImfCallbackData(cPtr, false);
355                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
356                 return ret;
357             }
358
359             /// <summary>
360             /// Default Constructor
361             /// </summary>
362             public ImfCallbackData() : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_0(), true)
363             {
364                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
365             }
366
367             /// <summary>
368             /// Constructor
369             /// </summary>
370             /// <param name="aUpdate">True if cursor position needs to be updated.</param>
371             /// <param name="aCursorPosition">New position of cursor.</param>
372             /// <param name="aCurrentText">Current text string.</param>
373             /// <param name="aPreeditResetRequired">Flag if preedit reset is required.</param>
374             public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true)
375             {
376                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377             }
378
379             /// <summary>
380             /// Current text string.
381             /// </summary>
382             public string CurrentText
383             {
384                 set
385                 {
386                     NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value);
387                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388                 }
389                 get
390                 {
391                     string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr);
392                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393                     return ret;
394                 }
395             }
396
397             /// <summary>
398             /// Current text string.
399             /// </summary>
400             public int CursorPosition
401             {
402                 set
403                 {
404                     NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value);
405                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
406                 }
407                 get
408                 {
409                     int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr);
410                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411                     return ret;
412                 }
413             }
414
415             /// <summary>
416             /// If cursor position needs to be updated.
417             /// </summary>
418             public bool Update
419             {
420                 set
421                 {
422                     NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value);
423                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
424                 }
425                 get
426                 {
427                     bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr);
428                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429                     return ret;
430                 }
431             }
432
433             /// <summary>
434             /// Flag if preedit reset is required.
435             /// </summary>
436             public bool PreeditResetRequired
437             {
438                 set
439                 {
440                     NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value);
441                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
442                 }
443                 get
444                 {
445                     bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr);
446                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
447                     return ret;
448                 }
449             }
450
451         }
452
453         /// <summary>
454         /// Retrieve a handle to the instance of ImfManager.
455         /// </summary>
456         /// <returns>A handle to the ImfManager.</returns>
457         public static ImfManager Get()
458         {
459             ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true);
460             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
461             return ret;
462         }
463
464         /// <summary>
465         /// Activate the IMF.<br/>
466         /// It means that the text editing is started at somewhere.<br/>
467         /// If the H/W keyboard isn't connected then it will show the virtual keyboard.
468         /// </summary>
469         public void Activate()
470         {
471             NDalicManualPINVOKE.ImfManager_Activate(swigCPtr);
472             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
473         }
474
475         /// <summary>
476         /// Deactivate the IMF.<br/>
477         /// It means that the text editing is finished at somewhere.
478         /// </summary>
479         public void Deactivate()
480         {
481             NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr);
482             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
483         }
484
485         /// <summary>
486         /// Get the restoration status, which controls if the keyboard is restored after the focus lost then regained.<br/>
487         /// If true then keyboard will be restored (activated) after focus is regained.
488         /// </summary>
489         /// <returns>Restoration status.</returns>
490         public bool RestoreAfterFocusLost()
491         {
492             bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr);
493             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
494             return ret;
495         }
496
497         /// <summary>
498         /// Set status whether the IMF has to restore the keyboard after losing focus.
499         /// </summary>
500         /// <param name="toggle">True means that keyboard should be restored after focus lost and regained.</param>
501         public void SetRestoreAfterFocusLost(bool toggle)
502         {
503             NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle);
504             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505         }
506
507         /// <summary>
508         /// Send message reset the pred-edit state / imf module.
509         /// </summary>
510         public new void Reset()
511         {
512             NDalicManualPINVOKE.ImfManager_Reset(swigCPtr);
513             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514         }
515
516         /// <summary>
517         /// Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation.
518         /// </summary>
519         public void NotifyCursorPosition()
520         {
521             NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr);
522             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523         }
524
525         /// <summary>
526         /// Sets cursor position stored in VirtualKeyboard, this is required by the IMF context.
527         /// </summary>
528         /// <param name="cursorPosition">Position of cursor.</param>
529         public void SetCursorPosition(uint cursorPosition)
530         {
531             NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition);
532             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
533         }
534
535         /// <summary>
536         /// Gets cursor position stored in VirtualKeyboard, this is required by the IMF context.
537         /// </summary>
538         /// <returns>Current position of cursor</returns>
539         public uint GetCursorPosition()
540         {
541             uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr);
542             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543             return ret;
544         }
545
546         /// <summary>
547         /// Method to store the string required by the IMF, this is used to provide predictive word suggestions.
548         /// </summary>
549         /// <param name="text">The text string surrounding the current cursor point.</param>
550         public void SetSurroundingText(string text)
551         {
552             NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text);
553             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
554         }
555
556         /// <summary>
557         /// Gets current text string set within the IMF manager, this is used to offer predictive suggestions.
558         /// </summary>
559         /// <returns>Surrounding text.</returns>
560         public string GetSurroundingText()
561         {
562             string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr);
563             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564             return ret;
565         }
566
567         /// <summary>
568         /// Notifies IMF context that text input is set to multi line or not.
569         /// </summary>
570         /// <param name="multiLine">True if multiline text input is used.</param>
571         public void NotifyTextInputMultiLine(bool multiLine)
572         {
573             NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine);
574             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575         }
576
577         /// <summary>
578         /// Returns text direction of the keyboard's current input language.
579         /// </summary>
580         /// <returns>The direction of the text.</returns>
581         public ImfManager.TextDirection GetTextDirection()
582         {
583             ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr);
584             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
585             return ret;
586         }
587
588         /// <summary>
589         /// Provides size and position of keyboard.<br/>
590         /// Position is relative to whether keyboard is visible or not.<br/>
591         /// If keyboard is not visible then position will be off the screen.<br/>
592         /// If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get<br/>
593         /// the values then taken down.  So ideally GetInputMethodArea() should be called after Show().
594         /// </summary>
595         /// <returns>Rectangle which is keyboard panel x, y, width, height</returns>
596         public Rectangle GetInputMethodArea()
597         {
598             Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true);
599             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
600             return ret;
601         }
602
603         internal void ApplyOptions(InputMethodOptions options)
604         {
605             NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
606             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607         }
608
609         /// <summary>
610         /// Sets up the input-panel specific data.
611         /// </summary>
612         /// <param name="text">The specific data to be set to the input panel.</param>
613         public void SetInputPanelUserData(string text)
614         {
615             NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text);
616             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
617         }
618
619         /// <summary>
620         /// Gets the specific data of the current active input panel.
621         /// </summary>
622         /// <param name="text">The specific data to be got from the input panel.</param>
623         public void GetInputPanelUserData(out string text)
624         {
625             NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text);
626             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
627         }
628
629         /// <summary>
630         /// Gets the state of the current active input panel.
631         /// </summary>
632         /// <returns>The state of the input panel.</returns>
633         public ImfManager.State GetInputPanelState()
634         {
635             ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr);
636             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
637             return ret;
638         }
639
640         /// <summary>
641         /// Sets the return key on the input panel to be visible or invisible.<br/>
642         /// The default is true.
643         /// </summary>
644         /// <param name="visible">True if the return key is visible(enabled), false otherwise.</param>
645         public void SetReturnKeyState(bool visible)
646         {
647             NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible);
648             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649         }
650
651         /// <summary>
652         /// Enable to show the input panel automatically when focused.
653         /// </summary>
654         /// <param name="enabled">If true, the input panel will be shown when focused.</param>
655         public void AutoEnableInputPanel(bool enabled)
656         {
657             NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled);
658             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659         }
660
661         /// <summary>
662         /// Shows the input panel.
663         /// </summary>
664         public void ShowInputPanel()
665         {
666             NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr);
667             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
668         }
669
670         /// <summary>
671         /// Hides the input panel.
672         /// </summary>
673         public void HideInputPanel()
674         {
675             NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr);
676             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677         }
678
679         /// <summary>
680         /// Gets the keyboard type.<br/>
681         /// The default keyboard type is SoftwareKeyboard.
682         /// </summary>
683         /// <returns>The keyboard type</returns>
684         public ImfManager.KeyboardType GetKeyboardType()
685         {
686             ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr);
687             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688             return ret;
689         }
690
691         /// <summary>
692         /// Gets the current language locale of the input panel.<br/>
693         /// Ex) en_US, en_GB, en_PH, fr_FR, ...
694         /// </summary>
695         /// <returns>The current language locale of the input panel.</returns>
696         public string GetInputPanelLocale()
697         {
698             string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr);
699             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700             return ret;
701         }
702
703         /// <summary>
704         /// Constructor
705         /// </summary>
706         public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true)
707         {
708             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
709         }
710
711         internal static ImfManager GetImfManagerFromPtr(global::System.IntPtr cPtr)
712         {
713             ImfManager ret = new ImfManager(cPtr, false);
714             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
715             return ret;
716         }
717
718         /// <summary>
719         /// ImfManager activated event arguments.
720         /// </summary>
721         public class ImfManagerActivatedEventArgs : EventArgs
722         {
723             public ImfManager ImfManager
724             {
725                 get;
726                 set;
727             }
728         }
729
730         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
731         private delegate void ImfManagerActivatedEventCallbackType(global::System.IntPtr data);
732         private ImfManagerActivatedEventCallbackType _imfManagerActivatedEventCallback;
733
734         private event EventHandler<ImfManagerActivatedEventArgs> _imfManagerActivatedEventHandler;
735
736         /// <summary>
737         /// ImfManager activated.
738         /// </summary>
739         public event EventHandler<ImfManagerActivatedEventArgs> ImfManagerActivated
740         {
741             add
742             {
743                 if (_imfManagerActivatedEventHandler == null)
744                 {
745                     _imfManagerActivatedEventCallback = OnImfManagerActivated;
746                     ActivatedSignal().Connect(_imfManagerActivatedEventCallback);
747                 }
748
749                 _imfManagerActivatedEventHandler += value;
750             }
751             remove
752             {
753                 _imfManagerActivatedEventHandler -= value;
754
755                 if (_imfManagerActivatedEventHandler == null && _imfManagerActivatedEventCallback != null)
756                 {
757                     ActivatedSignal().Disconnect(_imfManagerActivatedEventCallback);
758                 }
759             }
760         }
761
762         private void OnImfManagerActivated(global::System.IntPtr data)
763         {
764             ImfManagerActivatedEventArgs e = new ImfManagerActivatedEventArgs();
765
766             e.ImfManager = ImfManager.GetImfManagerFromPtr(data);
767
768             if (_imfManagerActivatedEventHandler != null)
769             {
770                 _imfManagerActivatedEventHandler(this, e);
771             }
772         }
773
774         internal ActivatedSignalType ActivatedSignal()
775         {
776             ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false);
777             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
778             return ret;
779         }
780
781         /// <summary>
782         /// ImfManager event received event arguments.
783         /// </summary>
784         public class ImfManagerEventReceivedEventArgs : EventArgs
785         {
786             public ImfManager ImfManager
787             {
788                 get;
789                 set;
790             }
791
792             public ImfEventData ImfEventData
793             {
794                 get;
795                 set;
796             }
797         }
798
799         private delegate global::System.IntPtr ImfManagerEventReceivedEventCallbackType(global::System.IntPtr imfManager, global::System.IntPtr imfEventData);
800         private ImfManagerEventReceivedEventCallbackType _imfManagerEventReceivedEventCallback;
801
802         private event EventHandlerWithReturnType<object, ImfManagerEventReceivedEventArgs, ImfCallbackData> _imfManagerEventReceivedEventHandler;
803         /// <summary>
804         /// ImfManager event received.
805         /// </summary>
806         public event EventHandlerWithReturnType<object, ImfManagerEventReceivedEventArgs, ImfCallbackData> ImfManagerEventReceived
807         {
808             add
809             {
810                 if (_imfManagerEventReceivedEventHandler == null)
811                 {
812                     _imfManagerEventReceivedEventCallback = OnImfManagerEventReceived;
813                     EventReceivedSignal().Connect(_imfManagerEventReceivedEventCallback);
814                 }
815
816                 _imfManagerEventReceivedEventHandler += value;
817             }
818             remove
819             {
820                 _imfManagerEventReceivedEventHandler -= value;
821
822                 if (_imfManagerEventReceivedEventHandler == null && _imfManagerEventReceivedEventCallback != null)
823                 {
824                     EventReceivedSignal().Disconnect(_imfManagerEventReceivedEventCallback);
825                 }
826             }
827         }
828
829         private global::System.IntPtr OnImfManagerEventReceived(global::System.IntPtr imfManager, global::System.IntPtr imfEventData)
830         {
831             ImfCallbackData imfCallbackData = null;
832
833             ImfManagerEventReceivedEventArgs e = new ImfManagerEventReceivedEventArgs();
834
835             e.ImfManager = ImfManager.GetImfManagerFromPtr(imfManager);
836             e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData);
837
838             if (_imfManagerEventReceivedEventHandler != null)
839             {
840                 imfCallbackData = _imfManagerEventReceivedEventHandler(this, e);
841             }
842             if (imfCallbackData != null)
843             {
844                 return imfCallbackData.GetImfCallbackDataPtr();
845             }
846             else
847             {
848                 return new ImfCallbackData().GetImfCallbackDataPtr();
849             }
850         }
851
852         internal ImfEventSignalType EventReceivedSignal()
853         {
854             ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false);
855             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856             return ret;
857         }
858
859         /// <summary>
860         /// ImfManager status changed event arguments.
861         /// </summary>
862         public class ImfManagerStatusChangedEventArgs : EventArgs
863         {
864             public bool StatusChanged
865             {
866                 get;
867                 set;
868             }
869         }
870
871         private delegate void ImfManagerStatusChangedEventCallbackType(bool statusChanged);
872         private ImfManagerStatusChangedEventCallbackType _imfManagerStatusChangedEventCallback;
873
874         private event EventHandler<ImfManagerStatusChangedEventArgs> _imfManagerStatusChangedEventHandler;
875         /// <summary>
876         /// ImfManager status changed.
877         /// </summary>
878         public event EventHandler<ImfManagerStatusChangedEventArgs> ImfManagerStatusChanged
879         {
880             add
881             {
882                 if (_imfManagerStatusChangedEventHandler == null)
883                 {
884                     _imfManagerStatusChangedEventCallback = OnImfManagerStatusChanged;
885                     StatusChangedSignal().Connect(_imfManagerStatusChangedEventCallback);
886                 }
887
888                 _imfManagerStatusChangedEventHandler += value;
889             }
890             remove
891             {
892                 _imfManagerStatusChangedEventHandler -= value;
893
894                 if (_imfManagerStatusChangedEventHandler == null && _imfManagerStatusChangedEventCallback != null)
895                 {
896                     StatusChangedSignal().Disconnect(_imfManagerStatusChangedEventCallback);
897                 }
898             }
899         }
900
901         private void OnImfManagerStatusChanged(bool statusChanged)
902         {
903             ImfManagerStatusChangedEventArgs e = new ImfManagerStatusChangedEventArgs();
904
905             e.StatusChanged = statusChanged;
906
907             if (_imfManagerStatusChangedEventHandler != null)
908             {
909                 _imfManagerStatusChangedEventHandler(this, e);
910             }
911         }
912
913         internal StatusSignalType StatusChangedSignal()
914         {
915             StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false);
916             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
917             return ret;
918         }
919
920         private delegate void ImfManagerResizedEventCallbackType();
921         private ImfManagerResizedEventCallbackType _imfManagerResizedEventCallback;
922
923         private event EventHandler _imfManagerResizedEventHandler;
924         /// <summary>
925         /// ImfManager resized.
926         /// </summary>
927         public event EventHandler ImfManagerResized
928         {
929             add
930             {
931                 if (_imfManagerResizedEventHandler == null)
932                 {
933                     _imfManagerResizedEventCallback = OnImfManagerResized;
934                     ResizedSignal().Connect(_imfManagerResizedEventCallback);
935                 }
936
937                 _imfManagerResizedEventHandler += value;
938             }
939             remove
940             {
941                 _imfManagerResizedEventHandler -= value;
942
943                 if (_imfManagerResizedEventHandler == null && _imfManagerResizedEventCallback != null)
944                 {
945                     ResizedSignal().Disconnect(_imfManagerResizedEventCallback);
946                 }
947             }
948         }
949
950         private void OnImfManagerResized()
951         {
952             if (_imfManagerResizedEventHandler != null)
953             {
954                 _imfManagerResizedEventHandler(this, null);
955             }
956         }
957
958         internal ImfVoidSignalType ResizedSignal()
959         {
960             ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), true);
961             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
962             return ret;
963         }
964
965         private delegate void ImfManagerLanguageChangedEventCallbackType();
966         private ImfManagerLanguageChangedEventCallbackType _imfManagerLanguageChangedEventCallback;
967
968         private event EventHandler _imfManagerLanguageChangedEventHandler;
969         /// <summary>
970         /// ImfManager language changed.
971         /// </summary>
972         public event EventHandler ImfManagerLanguageChanged
973         {
974             add
975             {
976                 if (_imfManagerLanguageChangedEventHandler == null)
977                 {
978                     _imfManagerLanguageChangedEventCallback = OnImfManagerLanguageChanged;
979                     LanguageChangedSignal().Connect(_imfManagerLanguageChangedEventCallback);
980                 }
981
982                 _imfManagerLanguageChangedEventHandler += value;
983             }
984             remove
985             {
986                 _imfManagerLanguageChangedEventHandler -= value;
987
988                 if (_imfManagerLanguageChangedEventHandler == null && _imfManagerLanguageChangedEventCallback != null)
989                 {
990                     LanguageChangedSignal().Disconnect(_imfManagerLanguageChangedEventCallback);
991                 }
992             }
993         }
994
995         private void OnImfManagerLanguageChanged()
996         {
997             if (_imfManagerLanguageChangedEventHandler != null)
998             {
999                 _imfManagerLanguageChangedEventHandler(this, null);
1000             }
1001         }
1002
1003         internal ImfVoidSignalType LanguageChangedSignal()
1004         {
1005             ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), true);
1006             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1007             return ret;
1008         }
1009
1010         /// <summary>
1011         /// ImfManager keyboard type changed event arguments.
1012         /// </summary>
1013         public class ImfKeyboardTypeChangedEventArgs : EventArgs
1014         {
1015             public KeyboardType KeyboardType
1016             {
1017                 get;
1018                 set;
1019             }
1020         }
1021
1022         private delegate void ImfKeyboardTypeChangedEventCallbackType(KeyboardType type);
1023         private ImfKeyboardTypeChangedEventCallbackType _imfKeyboardTypeChangedEventCallback;
1024
1025         private event EventHandler<ImfKeyboardTypeChangedEventArgs> _imfKeyboardTypeChangedEventHandler;
1026         /// <summary>
1027         /// ImfManager keyboard type changed.
1028         /// </summary>
1029         public event EventHandler<ImfKeyboardTypeChangedEventArgs> ImfKeyboardTypeChanged
1030         {
1031             add
1032             {
1033                 if (_imfKeyboardTypeChangedEventHandler == null)
1034                 {
1035                     _imfKeyboardTypeChangedEventCallback = OnImfKeyboardTypeChanged;
1036                     KeyboardTypeChangedSignal().Connect(_imfKeyboardTypeChangedEventCallback);
1037                 }
1038
1039                 _imfKeyboardTypeChangedEventHandler += value;
1040             }
1041             remove
1042             {
1043                 _imfKeyboardTypeChangedEventHandler -= value;
1044
1045                 if (_imfKeyboardTypeChangedEventHandler == null && _imfKeyboardTypeChangedEventCallback != null)
1046                 {
1047                     KeyboardTypeChangedSignal().Disconnect(_imfKeyboardTypeChangedEventCallback);
1048                 }
1049             }
1050         }
1051
1052         private void OnImfKeyboardTypeChanged(KeyboardType type)
1053         {
1054             ImfKeyboardTypeChangedEventArgs e = new ImfKeyboardTypeChangedEventArgs();
1055
1056             e.KeyboardType = type;
1057
1058             if (_imfKeyboardTypeChangedEventHandler != null)
1059             {
1060                 _imfKeyboardTypeChangedEventHandler(this, e);
1061             }
1062         }
1063
1064         internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
1065         {
1066             KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false);
1067             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1068             return ret;
1069         }
1070
1071         /// <summary>
1072         /// The direction of text.
1073         /// </summary>
1074         public enum TextDirection
1075         {
1076             /// <summary>
1077             /// Left to right.
1078             /// </summary>
1079             LeftToRight,
1080             /// <summary>
1081             /// Right to left.
1082             /// </summary>
1083             RightToLeft
1084         }
1085
1086         /// <summary>
1087         /// Events that are generated by the IMF.
1088         /// </summary>
1089         public enum ImfEvent
1090         {
1091             /// <summary>
1092             /// No event.
1093             /// </summary>
1094             Void,
1095             /// <summary>
1096             /// Pre-Edit changed.
1097             /// </summary>
1098             Preedit,
1099             /// <summary>
1100             /// Commit recieved.
1101             /// </summary>
1102             Commit,
1103             /// <summary>
1104             /// Event to delete a range of characters from the string.
1105             /// </summary>
1106             DeleteSurrounding,
1107             /// <summary>
1108             /// Event to query string and cursor position.
1109             /// </summary>
1110             GetSurrounding,
1111             /// <summary>
1112             /// Private command sent from the input panel.
1113             /// </summary>
1114             PrivateCommand
1115         }
1116
1117         /// <summary>
1118         /// Enumeration for state of the input panel.
1119         /// </summary>
1120         public enum State
1121         {
1122             /// <summary>
1123             /// Unknown state.
1124             /// </summary>
1125             Default = 0,
1126             /// <summary>
1127             /// Input panel is shown.
1128             /// </summary>
1129             Show,
1130             /// <summary>
1131             /// Input panel is hidden.
1132             /// </summary>
1133             Hide,
1134             /// <summary>
1135             /// Input panel in process of being shown.
1136             /// </summary>
1137             WillShow
1138         }
1139
1140         /// <summary>
1141         /// Enumeration for the type of Keyboard.
1142         /// </summary>
1143         public enum KeyboardType
1144         {
1145             /// <summary>
1146             /// Software keyboard (Virtual keyboard) is default.
1147             /// </summary>
1148             SoftwareKeyboard,
1149             /// <summary>
1150             /// Hardware keyboard.
1151             /// </summary>
1152             HardwareKeyboard
1153         }
1154     }
1155 }