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