/
InputMethodContext.cs
executable file
·1482 lines (1332 loc) · 58.1 KB
/
InputMethodContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright(c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace Tizen.NUI
{
/// <summary>
/// Specifically manages the input method framework (IMF) that enables the virtual or hardware keyboards.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public class InputMethodContext : BaseHandle
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private ActivatedEventCallbackType _activatedEventCallback;
private EventReceivedEventCallbackType _eventReceivedEventCallback;
private StatusChangedEventCallbackType _statusChangedEventCallback;
private ResizedEventCallbackType _resizedEventCallback;
private LanguageChangedEventCallbackType _languageChangedEventCallback;
private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback;
private ContentReceivedCallbackType _contentReceivedEventCallback;
/// <summary>
/// Constructor.<br/>
/// </summary>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext() : this(Interop.InputMethodContext.InputMethodContext_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal InputMethodContext(IntPtr cPtr, bool cMemoryOwn) : base(Interop.InputMethodContext.InputMethodContext_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void ActivatedEventCallbackType(IntPtr data);
private delegate IntPtr EventReceivedEventCallbackType(IntPtr inputMethodContext, IntPtr eventData);
private delegate void StatusChangedEventCallbackType(bool statusChanged);
private delegate void ResizedEventCallbackType(int resized);
private delegate void LanguageChangedEventCallbackType(int languageChanged);
private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type);
private delegate void ContentReceivedCallbackType(string content, string description, string mimeType);
private event EventHandler<ActivatedEventArgs> _activatedEventHandler;
private event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> _eventReceivedEventHandler;
private event EventHandler<StatusChangedEventArgs> _statusChangedEventHandler;
private event EventHandler<ResizedEventArgs> _resizedEventHandler;
private event EventHandler<LanguageChangedEventArgs> _languageChangedEventHandler;
private event EventHandler<KeyboardTypeChangedEventArgs> _keyboardTypeChangedEventHandler;
private event EventHandler<ContentReceivedEventArgs> _contentReceivedEventHandler;
/// <summary>
/// InputMethodContext activated.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandler<ActivatedEventArgs> Activated
{
add
{
if (_activatedEventHandler == null)
{
_activatedEventCallback = OnActivated;
ActivatedSignal().Connect(_activatedEventCallback);
}
_activatedEventHandler += value;
}
remove
{
_activatedEventHandler -= value;
if (_activatedEventHandler == null && _activatedEventCallback != null)
{
ActivatedSignal().Disconnect(_activatedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext event received.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandlerWithReturnType<object, EventReceivedEventArgs, CallbackData> EventReceived
{
add
{
if (_eventReceivedEventHandler == null)
{
_eventReceivedEventCallback = OnEventReceived;
EventReceivedSignal().Connect(_eventReceivedEventCallback);
}
_eventReceivedEventHandler += value;
}
remove
{
_eventReceivedEventHandler -= value;
if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null)
{
EventReceivedSignal().Disconnect(_eventReceivedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext status changed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandler<StatusChangedEventArgs> StatusChanged
{
add
{
if (_statusChangedEventHandler == null)
{
_statusChangedEventCallback = OnStatusChanged;
StatusChangedSignal().Connect(_statusChangedEventCallback);
}
_statusChangedEventHandler += value;
}
remove
{
_statusChangedEventHandler -= value;
if (_statusChangedEventHandler == null && _statusChangedEventCallback != null)
{
StatusChangedSignal().Disconnect(_statusChangedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext resized.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandler<ResizedEventArgs> Resized
{
add
{
if (_resizedEventHandler == null)
{
_resizedEventCallback = OnResized;
ResizedSignal().Connect(_resizedEventCallback);
}
_resizedEventHandler += value;
}
remove
{
_resizedEventHandler -= value;
if (_resizedEventHandler == null && _resizedEventCallback != null)
{
ResizedSignal().Disconnect(_resizedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext language changed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandler<LanguageChangedEventArgs> LanguageChanged
{
add
{
if (_languageChangedEventHandler == null)
{
_languageChangedEventCallback = OnLanguageChanged;
LanguageChangedSignal().Connect(_languageChangedEventCallback);
}
_languageChangedEventHandler += value;
}
remove
{
_languageChangedEventHandler -= value;
if (_languageChangedEventHandler == null && _languageChangedEventCallback != null)
{
LanguageChangedSignal().Disconnect(_languageChangedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext keyboard type changed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public event EventHandler<KeyboardTypeChangedEventArgs> KeyboardTypeChanged
{
add
{
if (_keyboardTypeChangedEventHandler == null)
{
_keyboardTypeChangedEventCallback = OnKeyboardTypeChanged;
KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback);
}
_keyboardTypeChangedEventHandler += value;
}
remove
{
_keyboardTypeChangedEventHandler -= value;
if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null)
{
KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
}
}
}
/// <summary>
/// InputMethodContext content received.
/// </summary>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler<ContentReceivedEventArgs> ContentReceived
{
add
{
if (_contentReceivedEventHandler == null)
{
_contentReceivedEventCallback = OnContentReceived;
ContentReceivedSignal().Connect(_contentReceivedEventCallback);
}
_contentReceivedEventHandler += value;
}
remove
{
_contentReceivedEventHandler -= value;
if (_contentReceivedEventHandler == null && _contentReceivedEventCallback != null)
{
ContentReceivedSignal().Disconnect(_contentReceivedEventCallback);
}
}
}
/// <summary>
/// The direction of the text.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public enum TextDirection
{
/// <summary>
/// Left to right.
/// </summary>
LeftToRight,
/// <summary>
/// Right to left.
/// </summary>
RightToLeft
}
/// <summary>
/// Events that are generated by the IMF.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public enum EventType
{
/// <summary>
/// No event.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Void,
/// <summary>
/// Pre-edit changed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Preedit,
/// <summary>
/// Commit received.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Commit,
/// <summary>
/// An event to delete a range of characters from the string.
/// </summary>
/// <since_tizen> 5 </since_tizen>
DeleteSurrounding,
/// <summary>
/// An event to query string and the cursor position.
/// </summary>
/// <since_tizen> 5 </since_tizen>
GetSurrounding,
/// <summary>
/// Private command sent from the input panel.
/// </summary>
/// <since_tizen> 5 </since_tizen>
PrivateCommand
}
/// <summary>
/// Enumeration for the state of the input panel.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public enum State
{
/// <summary>
/// Unknown state.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Default = 0,
/// <summary>
/// Input panel is shown.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Show,
/// <summary>
/// Input panel is hidden.
/// </summary>
/// <since_tizen> 5 </since_tizen>
Hide,
/// <summary>
/// Input panel in process of being shown.
/// </summary>
/// <since_tizen> 5 </since_tizen>
WillShow
}
/// <summary>
/// Enumeration for the types of keyboard.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public enum KeyboardType
{
/// <summary>
/// Software keyboard (virtual keyboard) is default.
/// </summary>
/// <since_tizen> 5 </since_tizen>
SoftwareKeyboard,
/// <summary>
/// Hardware keyboard.
/// </summary>
/// <since_tizen> 5 </since_tizen>
HardwareKeyboard
}
/// <summary>
/// Gets or sets whether the IM context allows to use the text prediction.
/// </summary>
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool TextPrediction
{
get
{
return IsTextPredictionAllowed();
}
set
{
AllowTextPrediction(value);
}
}
/// <summary>
/// Destroys the context of the IMF.<br/>
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void DestroyContext()
{
Interop.InputMethodContext.InputMethodContext_Finalize(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Activates the IMF.<br/>
/// It means that the text editing has started.<br/>
/// If the hardware keyboard is not connected, then it shows the virtual keyboard.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void Activate()
{
Interop.InputMethodContext.InputMethodContext_Activate(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Deactivates the IMF.<br/>
/// It means that the text editing is complete.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void Deactivate()
{
Interop.InputMethodContext.InputMethodContext_Deactivate(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the restoration status, which controls if the keyboard is restored after the focus is lost and then regained.<br/>
/// If true, then the keyboard will be restored (activated) after the focus is regained.
/// </summary>
/// <returns>The restoration status.</returns>
/// <since_tizen> 5 </since_tizen>
public bool RestoreAfterFocusLost()
{
bool ret = Interop.InputMethodContext.InputMethodContext_RestoreAfterFocusLost(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Sets the status whether the IMF has to restore the keyboard after losing focus.
/// </summary>
/// <param name="toggle">True means that keyboard must be restored after the focus is lost and regained.</param>
/// <since_tizen> 5 </since_tizen>
public void SetRestoreAfterFocusLost(bool toggle)
{
Interop.InputMethodContext.InputMethodContext_SetRestoreAfterFocusLost(swigCPtr, toggle);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Sends a message reset to the pre-edit state or the IMF module.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public new void Reset()
{
Interop.InputMethodContext.InputMethodContext_Reset(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Notifies the IMF context that the cursor position has changed, required for features such as auto-capitalization.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void NotifyCursorPosition()
{
Interop.InputMethodContext.InputMethodContext_NotifyCursorPosition(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Sets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
/// </summary>
/// <param name="cursorPosition">The position of the cursor.</param>
/// <since_tizen> 5 </since_tizen>
public void SetCursorPosition(uint cursorPosition)
{
Interop.InputMethodContext.InputMethodContext_SetCursorPosition(swigCPtr, cursorPosition);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the cursor position stored in VirtualKeyboard, this is required by the IMF context.
/// </summary>
/// <returns>The current position of the cursor.</returns>
/// <since_tizen> 5 </since_tizen>
public uint GetCursorPosition()
{
uint ret = Interop.InputMethodContext.InputMethodContext_GetCursorPosition(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// A method to store the string required by the IMF, this is used to provide predictive word suggestions.
/// </summary>
/// <param name="text">The text string surrounding the current cursor point.</param>
/// <since_tizen> 5 </since_tizen>
public void SetSurroundingText(string text)
{
Interop.InputMethodContext.InputMethodContext_SetSurroundingText(swigCPtr, text);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the current text string set within the IMF manager, this is used to offer predictive suggestions.
/// </summary>
/// <returns>The surrounding text.</returns>
/// <since_tizen> 5 </since_tizen>
public string GetSurroundingText()
{
string ret = Interop.InputMethodContext.InputMethodContext_GetSurroundingText(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Notifies the IMF context that text input is set to multiline or not.
/// </summary>
/// <param name="multiLine">True if multiline text input is used.</param>
/// <since_tizen> 5 </since_tizen>
public void NotifyTextInputMultiLine(bool multiLine)
{
Interop.InputMethodContext.InputMethodContext_NotifyTextInputMultiLine(swigCPtr, multiLine);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Returns the text direction of the current input language of the keyboard.
/// </summary>
/// <returns>The direction of the text.</returns>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext.TextDirection GetTextDirection()
{
InputMethodContext.TextDirection ret = (InputMethodContext.TextDirection)Interop.InputMethodContext.InputMethodContext_GetTextDirection(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Provides the size and the position of the keyboard.<br/>
/// The position is relative to whether the keyboard is visible or not.<br/>
/// If the keyboard is not visible, then the position will be off the screen.<br/>
/// If the keyboard is not being shown when this method is called, the keyboard is partially setup (IMFContext) to get/>
/// the values then taken down. So ideally, GetInputMethodArea() must be called after Show().
/// </summary>
/// <returns>Rectangle which is keyboard panel x, y, width, and height.</returns>
/// <since_tizen> 5 </since_tizen>
public Rectangle GetInputMethodArea()
{
Rectangle ret = new Rectangle(Interop.InputMethodContext.InputMethodContext_GetInputMethodArea(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Sets up the input panel specific data.
/// </summary>
/// <param name="text">The specific data to be set to the input panel.</param>
/// <since_tizen> 5 </since_tizen>
public void SetInputPanelUserData(string text)
{
Interop.InputMethodContext.InputMethodContext_SetInputPanelUserData(swigCPtr, text);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the specific data of the current active input panel.
/// </summary>
/// <param name="text">The specific data to be received from the input panel.</param>
/// <since_tizen> 5 </since_tizen>
public void GetInputPanelUserData(out string text)
{
Interop.InputMethodContext.InputMethodContext_GetInputPanelUserData(swigCPtr, out text);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the state of the current active input panel.
/// </summary>
/// <returns>The state of the input panel.</returns>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext.State GetInputPanelState()
{
InputMethodContext.State ret = (InputMethodContext.State)Interop.InputMethodContext.InputMethodContext_GetInputPanelState(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Sets the return key on the input panel to be visible or invisible.<br/>
/// The default value is true.
/// </summary>
/// <param name="visible">True if the return key is visible (enabled), false otherwise.</param>
/// <since_tizen> 5 </since_tizen>
public void SetReturnKeyState(bool visible)
{
Interop.InputMethodContext.InputMethodContext_SetReturnKeyState(swigCPtr, visible);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Enables to show the input panel automatically when focused.
/// </summary>
/// <param name="enabled">If true, the input panel will be shown when focused.</param>
/// <since_tizen> 5 </since_tizen>
public void AutoEnableInputPanel(bool enabled)
{
Interop.InputMethodContext.InputMethodContext_AutoEnableInputPanel(swigCPtr, enabled);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Shows the input panel.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void ShowInputPanel()
{
Interop.InputMethodContext.InputMethodContext_ShowInputPanel(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Hides the input panel.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public void HideInputPanel()
{
Interop.InputMethodContext.InputMethodContext_HideInputPanel(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Gets the keyboard type.<br/>
/// The default keyboard type is SoftwareKeyboard.
/// </summary>
/// <returns>The keyboard type.</returns>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext.KeyboardType GetKeyboardType()
{
InputMethodContext.KeyboardType ret = (InputMethodContext.KeyboardType)Interop.InputMethodContext.InputMethodContext_GetKeyboardType(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Gets the current language locale of the input panel.<br/>
/// For example, en_US, en_GB, en_PH, fr_FR, and so on.
/// </summary>
/// <returns>The current language locale of the input panel.</returns>
/// <since_tizen> 5 </since_tizen>
public string GetInputPanelLocale()
{
string ret = Interop.InputMethodContext.InputMethodContext_GetInputPanelLocale(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Sets the allowed MIME Type to deliver to the input panel. <br/>
/// For example, string mimeType = "text/plain,image/png,image/gif,application/pdf";
/// </summary>
/// <param name="mimeType">The allowed MIME type.</param>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetMIMEType(string mimeType)
{
Interop.InputMethodContext.InputMethodContext_SetMIMEType(swigCPtr, mimeType);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Sets the x,y coordinates of the input panel.
/// </summary>
/// <param name="x">The top-left x coordinate of the input panel.</param>
/// <param name="y">The top-left y coordinate of the input panel.</param>
/// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetInputPanelPosition(uint x, uint y)
{
Interop.InputMethodContext.InputMethodContext_SetInputPanelPosition(swigCPtr, x, y);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodContext obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
internal InputMethodContext(InputMethodContext inputMethodContext) : this(Interop.InputMethodContext.new_InputMethodContext__SWIG_1(InputMethodContext.getCPtr(inputMethodContext)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal InputMethodContext Assign(InputMethodContext inputMethodContext)
{
InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_Assign(swigCPtr, InputMethodContext.getCPtr(inputMethodContext)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal static InputMethodContext DownCast(BaseHandle handle)
{
InputMethodContext ret = new InputMethodContext(Interop.InputMethodContext.InputMethodContext_DownCast(BaseHandle.getCPtr(handle)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal void ApplyOptions(InputMethodOptions options)
{
Interop.InputMethodContext.InputMethodContext_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal void AllowTextPrediction(bool prediction)
{
Interop.InputMethodContext.InputMethodContext_AllowTextPrediction(swigCPtr, prediction);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal bool IsTextPredictionAllowed()
{
bool ret = Interop.InputMethodContext.InputMethodContext_IsTextPredictionAllowed(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ActivatedSignalType ActivatedSignal()
{
ActivatedSignalType ret = new ActivatedSignalType(Interop.InputMethodContext.InputMethodContext_ActivatedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal KeyboardEventSignalType EventReceivedSignal()
{
KeyboardEventSignalType ret = new KeyboardEventSignalType(Interop.InputMethodContext.InputMethodContext_EventReceivedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal StatusSignalType StatusChangedSignal()
{
StatusSignalType ret = new StatusSignalType(Interop.InputMethodContext.InputMethodContext_StatusChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal KeyboardResizedSignalType ResizedSignal()
{
KeyboardResizedSignalType ret = new KeyboardResizedSignalType(Interop.InputMethodContext.InputMethodContext_ResizedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal LanguageChangedSignalType LanguageChangedSignal()
{
LanguageChangedSignalType ret = new LanguageChangedSignalType(Interop.InputMethodContext.InputMethodContext_LanguageChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal KeyboardTypeSignalType KeyboardTypeChangedSignal()
{
KeyboardTypeSignalType ret = new KeyboardTypeSignalType(Interop.InputMethodContext.InputMethodContext_KeyboardTypeChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ContentReceivedSignalType ContentReceivedSignal()
{
ContentReceivedSignalType ret = new ContentReceivedSignalType(Interop.InputMethodContext.InputMethodContext_ContentReceivedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// You can override it to clean-up your own resources.
/// </summary>
/// <param name="type">Dispose Type</param>
/// <since_tizen> 5 </since_tizen>
/// Please do not use! This will be deprecated!
/// Dispose() method in Singletone classes (ex: FocusManager, StyleManager, VisualFactory, InputMethodContext, TtsPlayer, Window) is not required.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
return;
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance
//because the execution order of Finalizes is non-deterministic.
if (_keyboardTypeChangedEventCallback != null)
{
KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback);
}
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
Interop.InputMethodContext.delete_InputMethodContext(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero);
}
base.Dispose(type);
}
private void OnActivated(IntPtr data)
{
ActivatedEventArgs e = new ActivatedEventArgs();
if (data != null)
{
e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(data) as InputMethodContext;
}
if (_activatedEventHandler != null)
{
_activatedEventHandler(this, e);
}
}
private IntPtr OnEventReceived(IntPtr inputMethodContext, IntPtr eventData)
{
CallbackData callbackData = null;
EventReceivedEventArgs e = new EventReceivedEventArgs();
if (inputMethodContext != null)
{
e.InputMethodContext = Registry.GetManagedBaseHandleFromNativePtr(inputMethodContext) as InputMethodContext;
}
if (eventData != null)
{
e.EventData = EventData.GetEventDataFromPtr(eventData);
}
if (_eventReceivedEventHandler != null)
{
callbackData = _eventReceivedEventHandler(this, e);
}
if (callbackData != null)
{
return callbackData.GetCallbackDataPtr();
}
else
{
return new CallbackData().GetCallbackDataPtr();
}
}
private void OnStatusChanged(bool statusChanged)
{
StatusChangedEventArgs e = new StatusChangedEventArgs();
e.StatusChanged = statusChanged;
if (_statusChangedEventHandler != null)
{
_statusChangedEventHandler(this, e);
}
}
private void OnResized(int resized)
{
ResizedEventArgs e = new ResizedEventArgs();
e.Resized = resized;
if (_resizedEventHandler != null)
{
_resizedEventHandler(this, e);
}
}
private void OnLanguageChanged(int languageChanged)
{
LanguageChangedEventArgs e = new LanguageChangedEventArgs();
e.LanguageChanged = languageChanged;
if (_languageChangedEventHandler != null)
{
_languageChangedEventHandler(this, e);
}
}
private void OnKeyboardTypeChanged(KeyboardType type)
{
KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs();
e.KeyboardType = type;
if (_keyboardTypeChangedEventHandler != null)
{
_keyboardTypeChangedEventHandler(this, e);
}
}
private void OnContentReceived(string content, string description, string mimeType)
{
ContentReceivedEventArgs e = new ContentReceivedEventArgs();
e.Content = content;
e.Description = description;
e.MimeType = mimeType;
if (_contentReceivedEventHandler != null)
{
_contentReceivedEventHandler(this, e);
}
}
/// <summary>
/// This structure is used to pass on data from the IMF regarding predictive text.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public class EventData : global::System.IDisposable
{
/// <summary>
/// The state if it owns memory
/// </summary>
/// <since_tizen> 5 </since_tizen>
protected bool swigCMemOwn;
/// <summary>
/// A flag to check if it is already disposed.
/// </summary>
/// <since_tizen> 5 </since_tizen>
protected bool disposed = false;
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
//A flag to check who called Dispose(). (By User or DisposeQueue)
private bool isDisposeQueued = false;
/// <summary>
/// The default constructor.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public EventData() : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_0(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// The constructor.
/// </summary>
/// <param name="aEventName">The name of the event from the IMF.</param>
/// <param name="aPredictiveString">The pre-edit or the commit string.</param>
/// <param name="aCursorOffset">Start the position from the current cursor position to start deleting characters.</param>
/// <param name="aNumberOfChars">The number of characters to delete from the cursorOffset.</param>
/// <since_tizen> 5 </since_tizen>
public EventData(InputMethodContext.EventType aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(Interop.InputMethodContext.new_InputMethodContext_EventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal EventData(IntPtr cPtr, bool cMemoryOwn)
{
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
/// <summary>
/// Releases the resource.
/// </summary>
/// <since_tizen> 5 </since_tizen>
~EventData()
{
if (!isDisposeQueued)
{
isDisposeQueued = true;
DisposeQueue.Instance.Add(this);
}
}
/// <summary>
/// The pre-edit or the commit string.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public string PredictiveString
{
set
{
Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
string ret = Interop.InputMethodContext.InputMethodContext_EventData_predictiveString_get(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
/// <summary>
/// The name of the event from the IMF.
/// </summary>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext.EventType EventName
{
set
{
Interop.InputMethodContext.InputMethodContext_EventData_eventName_set(swigCPtr, (int)value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
{
InputMethodContext.EventType ret = (InputMethodContext.EventType)Interop.InputMethodContext.InputMethodContext_EventData_eventName_get(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;