• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
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
16import type { Callback, AsyncCallback } from './@ohos.base';
17import InputMethodSubtype from './@ohos.InputMethodSubtype';
18
19/**
20 * Input method
21 *
22 * @namespace inputMethod
23 * @syscap SystemCapability.MiscServices.InputMethodFramework
24 * @since 6
25 */
26declare namespace inputMethod {
27  /**
28   * Keyboard max number
29   *
30   * @constant
31   * @syscap SystemCapability.MiscServices.InputMethodFramework
32   * @since 8
33   */
34  const MAX_TYPE_NUM: number;
35
36  /**
37   * Input method setting
38   *
39   * @returns { InputMethodSetting } the object of InputMethodSetting
40   * @syscap SystemCapability.MiscServices.InputMethodFramework
41   * @since 8
42   * @deprecated since 9
43   * @useinstead inputMethod#getSetting
44   */
45  function getInputMethodSetting(): InputMethodSetting;
46
47  /**
48   * Input method controller
49   *
50   * @returns { InputMethodController } the object of InputMethodController.
51   * @syscap SystemCapability.MiscServices.InputMethodFramework
52   * @since 6
53   * @deprecated since 9
54   * @useinstead inputMethod#getController
55   */
56  function getInputMethodController(): InputMethodController;
57
58  /**
59   * Input method setting
60   *
61   * @returns { InputMethodSetting } the object of InputMethodSetting.
62   * @throws { BusinessError } 12800007 - settings extension error.
63   * @syscap SystemCapability.MiscServices.InputMethodFramework
64   * @since 9
65   */
66  function getSetting(): InputMethodSetting;
67
68  /**
69   * Input method controller
70   *
71   * @returns { InputMethodController } the object of InputMethodController.
72   * @throws { BusinessError } 12800006 - input method controller error.
73   * @syscap SystemCapability.MiscServices.InputMethodFramework
74   * @since 9
75   */
76  function getController(): InputMethodController;
77
78  /**
79   * Switch input method
80   *
81   * @permission ohos.permission.CONNECT_IME_ABILITY
82   * @param { InputMethodProperty } target - indicates the input method which will replace the current one.
83   * @param { AsyncCallback<boolean> } callback - the callback of switchInputMethod.
84   * @throws { BusinessError } 201 - permissions check fails.
85   * @throws { BusinessError } 401 - parameter error.
86   * @throws { BusinessError } 12800005 - configuration persisting error.
87   * @throws { BusinessError } 12800008 - input method manager service error.
88   * @syscap SystemCapability.MiscServices.InputMethodFramework
89   * @since 9
90   */
91  function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolean>): void;
92
93  /**
94   * Switch input method
95   *
96   * @permission ohos.permission.CONNECT_IME_ABILITY
97   * @param { InputMethodProperty } target - Indicates the input method which will replace the current one.
98   * @returns { Promise<boolean> } the promise returned by the function.
99   * @throws { BusinessError } 201 - permissions check fails.
100   * @throws { BusinessError } 401 - parameter error.
101   * @throws { BusinessError } 12800005 - configuration persisting error.
102   * @throws { BusinessError } 12800008 - input method manager service error.
103   * @syscap SystemCapability.MiscServices.InputMethodFramework
104   * @since 9
105   */
106  function switchInputMethod(target: InputMethodProperty): Promise<boolean>;
107
108  /**
109   * Get current input method
110   *
111   * @returns { InputMethodProperty } the property of current inputmethod.
112   * @syscap SystemCapability.MiscServices.InputMethodFramework
113   * @since 9
114   */
115  function getCurrentInputMethod(): InputMethodProperty;
116
117  /**
118   * Switch current input method subtype
119   *
120   * @permission ohos.permission.CONNECT_IME_ABILITY
121   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
122   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
123   * @throws { BusinessError } 201 - permissions check fails.
124   * @throws { BusinessError } 401 - parameter error.
125   * @throws { BusinessError } 12800005 - configuration persisting error.
126   * @throws { BusinessError } 12800008 - input method manager service error.
127   * @syscap SystemCapability.MiscServices.InputMethodFramework
128   * @since 9
129   */
130  /**
131   * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
132   *
133   * @permission ohos.permission.CONNECT_IME_ABILITY
134   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
135   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
136   * @throws { BusinessError } 201 - permissions check fails.
137   * @throws { BusinessError } 401 - parameter error.
138   * @throws { BusinessError } 12800005 - configuration persisting error.
139   * @throws { BusinessError } 12800008 - input method manager service error.
140   * @syscap SystemCapability.MiscServices.InputMethodFramework
141   * @since 10
142   */
143  function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback<boolean>): void;
144
145  /**
146   * Switch current input method subtype
147   *
148   * @permission ohos.permission.CONNECT_IME_ABILITY
149   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
150   * @returns { Promise<boolean> } the promise returned by the function.
151   * @throws { BusinessError } 201 - permissions check fails.
152   * @throws { BusinessError } 401 - parameter error.
153   * @throws { BusinessError } 12800005 - configuration persisting error.
154   * @throws { BusinessError } 12800008 - input method manager service error.
155   * @syscap SystemCapability.MiscServices.InputMethodFramework
156   * @since 9
157   */
158  /**
159   * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
160   *
161   * @permission ohos.permission.CONNECT_IME_ABILITY
162   * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
163   * @returns { Promise<boolean> } the promise returned by the function.
164   * @throws { BusinessError } 201 - permissions check fails.
165   * @throws { BusinessError } 401 - parameter error.
166   * @throws { BusinessError } 12800005 - configuration persisting error.
167   * @throws { BusinessError } 12800008 - input method manager service error.
168   * @syscap SystemCapability.MiscServices.InputMethodFramework
169   * @since 10
170   */
171  function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean>;
172
173  /**
174   * Get the current input method subtype
175   *
176   * @returns { InputMethodSubtype } the subtype of the current input method.
177   * @syscap SystemCapability.MiscServices.InputMethodFramework
178   * @since 9
179   */
180  function getCurrentInputMethodSubtype(): InputMethodSubtype;
181
182  /**
183   * Switch input method and subtype
184   *
185   * @permission ohos.permission.CONNECT_IME_ABILITY
186   * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
187   * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
188   * @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodAndSubtype.
189   * @throws { BusinessError } 201 - permissions check fails.
190   * @throws { BusinessError } 401 - parameter error.
191   * @throws { BusinessError } 12800005 - configuration persisting error.
192   * @throws { BusinessError } 12800008 - input method manager service error.
193   * @syscap SystemCapability.MiscServices.InputMethodFramework
194   * @since 9
195   */
196  function switchCurrentInputMethodAndSubtype(
197    inputMethodProperty: InputMethodProperty,
198    inputMethodSubtype: InputMethodSubtype,
199    callback: AsyncCallback<boolean>
200  ): void;
201
202  /**
203   * Switch input method and subtype.
204   *
205   * @permission ohos.permission.CONNECT_IME_ABILITY
206   * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
207   * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
208   * @returns { Promise<boolean> } the promise returned by the function.
209   * @throws { BusinessError } 201 - permissions check fails.
210   * @throws { BusinessError } 401 - parameter error.
211   * @throws { BusinessError } 12800005 - configuration persisting error.
212   * @throws { BusinessError } 12800008 - input method manager service error.
213   * @syscap SystemCapability.MiscServices.InputMethodFramework
214   * @since 9
215   */
216  function switchCurrentInputMethodAndSubtype(
217    inputMethodProperty: InputMethodProperty,
218    inputMethodSubtype: InputMethodSubtype
219  ): Promise<boolean>;
220
221  /**
222   * @interface InputMethodSetting
223   * @syscap SystemCapability.MiscServices.InputMethodFramework
224   * @since 8
225   */
226  interface InputMethodSetting {
227    /**
228     * Subscribe input method or subtype change.
229     *
230     * @param { 'imeChange' } type - Indicates the event type.
231     * @param { function } callback - the callback of 'imeChange'
232     * @syscap SystemCapability.MiscServices.InputMethodFramework
233     * @since 9
234     */
235    on(
236      type: 'imeChange',
237      callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
238    ): void;
239
240    /**
241     * Unsubscribe input method or subtype change.
242     *
243     * @param { 'imeChange' } type - Indicates the event type.
244     * @param { function } [callback] - the callback of 'imeChange',
245     *        when subscriber unsubscribes all callback functions of event 'imeChange', this parameter can be left blank.
246     * @syscap SystemCapability.MiscServices.InputMethodFramework
247     * @since 9
248     */
249    off(
250      type: 'imeChange',
251      callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
252    ): void;
253
254    /**
255     * Subscribes to input window show events.
256     *
257     * @param { 'imeShow' } type - Indicates the event type.
258     * @param { function } callback - the callback of 'imeShow'.
259     * @throws { BusinessError } 202 - not system application.
260     * @syscap SystemCapability.MiscServices.InputMethodFramework
261     * @systemapi
262     * @since 10
263     */
264    on(type: 'imeShow', callback: (info: Array<InputWindowInfo>) => void): void;
265
266    /**
267     * Unsubscribe input window show event.
268     *
269     * @param { 'imeShow' } type - Indicates the event type.
270     * @param { function } [callback] - the callback of 'imeShow',
271     *        when subscriber unsubscribes all callback functions of event 'imeShow', this parameter can be left blank.
272     * @syscap SystemCapability.MiscServices.InputMethodFramework
273     * @systemapi
274     * @since 10
275     */
276    off(type: 'imeShow', callback?: (info: Array<InputWindowInfo>) => void): void;
277
278    /**
279     * Subscribes to input window hidden events.
280     *
281     * @param { 'imeHide' } type - Indicates the event type.
282     * @param { function } callback - the callback of 'imeHide'.
283     * @throws { BusinessError } 202 - not system application.
284     * @syscap SystemCapability.MiscServices.InputMethodFramework
285     * @systemapi
286     * @since 10
287     */
288    on(type: 'imeHide', callback: (info: Array<InputWindowInfo>) => void): void;
289
290    /**
291     * Unsubscribe input window hide event.
292     *
293     * @param { 'imeHide' } type - Indicates the event type.
294     * @param { function } [callback] - the callback of 'imeHide',
295     *        when subscriber unsubscribes all callback functions of event 'imeHide', this parameter can be left blank.
296     * @syscap SystemCapability.MiscServices.InputMethodFramework
297     * @systemapi
298     * @since 10
299     */
300    off(type: 'imeHide', callback?: (info: Array<InputWindowInfo>) => void): void;
301
302    /**
303     * List subtype of the specified input method.
304     *
305     * @param { InputMethodProperty } inputMethodProperty - the property of the specified inputmethod.
306     * @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listInputMethodSubtype.
307     * @throws { BusinessError } 401 - parameter error.
308     * @throws { BusinessError } 12800001 - package manager error.
309     * @throws { BusinessError } 12800008 - input method manager service error.
310     * @syscap SystemCapability.MiscServices.InputMethodFramework
311     * @since 9
312     */
313    listInputMethodSubtype(
314      inputMethodProperty: InputMethodProperty,
315      callback: AsyncCallback<Array<InputMethodSubtype>>
316    ): void;
317
318    /**
319     * List subtype of the specified input method.
320     *
321     * @param { InputMethodProperty } inputMethodProperty - Indicates the specified input method.
322     * @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
323     * @throws { BusinessError } 401 - parameter error.
324     * @throws { BusinessError } 12800001 - package manager error.
325     * @throws { BusinessError } 12800008 - input method manager service error.
326     * @syscap SystemCapability.MiscServices.InputMethodFramework
327     * @since 9
328     */
329    listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Array<InputMethodSubtype>>;
330
331    /**
332     * List subtype of current input method
333     *
334     * @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listCurrentInputMethodSubtype.
335     * @throws { BusinessError } 12800001 - package manager error.
336     * @throws { BusinessError } 12800008 - input method manager service error.
337     * @syscap SystemCapability.MiscServices.InputMethodFramework
338     * @since 9
339     */
340    listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSubtype>>): void;
341
342    /**
343     * List subtype of current input method
344     *
345     * @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
346     * @throws { BusinessError } 12800001 - package manager error.
347     * @throws { BusinessError } 12800008 - input method manager service error.
348     * @syscap SystemCapability.MiscServices.InputMethodFramework
349     * @since 9
350     */
351    listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>;
352
353    /**
354     * List input methods
355     *
356     * @param { boolean } enable :
357     *     If true, collect enabled input methods.
358     *     If false, collect disabled input methods.
359     * @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of getInputMethods.
360     * @throws { BusinessError } 401 - parameter error.
361     * @throws { BusinessError } 12800001 - package manager error.
362     * @throws { BusinessError } 12800008 - input method manager service error.
363     * @syscap SystemCapability.MiscServices.InputMethodFramework
364     * @since 9
365     */
366    getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
367
368    /**
369     * List input methods
370     *
371     * @param { boolean } enable :
372     *     If true, collect enabled input methods.
373     *     If false, collect disabled input methods.
374     * @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
375     * @throws { BusinessError } 401 - parameter error.
376     * @throws { BusinessError } 12800001 - package manager error.
377     * @throws { BusinessError } 12800008 - input method manager service error.
378     * @syscap SystemCapability.MiscServices.InputMethodFramework
379     * @since 9
380     */
381    getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
382
383    /**
384     * @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of listInputMethod.
385     * @syscap SystemCapability.MiscServices.InputMethodFramework
386     * @since 8
387     * @deprecated since 9
388     * @useinstead inputMethod.InputMethodSetting#getInputMethods
389     */
390    listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>): void;
391    /**
392     * @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
393     * @syscap SystemCapability.MiscServices.InputMethodFramework
394     * @since 8
395     * @deprecated since 9
396     * @useinstead inputMethod.InputMethodSetting#getInputMethods
397     */
398    listInputMethod(): Promise<Array<InputMethodProperty>>;
399
400    /**
401     * Show input method setting extension dialog
402     *
403     * @param { AsyncCallback<boolean> } callback - the callback of showOptionalInputMethods.
404     * @throws { BusinessError } 12800008 - input method manager service error.
405     * @syscap SystemCapability.MiscServices.InputMethodFramework
406     * @since 9
407     */
408    showOptionalInputMethods(callback: AsyncCallback<boolean>): void;
409
410    /**
411     * Show input method setting extension dialog
412     *
413     * @returns { Promise<boolean> } the promise returned by the function.
414     * @throws { BusinessError } 12800008 - input method manager service error.
415     * @syscap SystemCapability.MiscServices.InputMethodFramework
416     * @since 9
417     */
418    showOptionalInputMethods(): Promise<boolean>;
419
420    /**
421     * @param { AsyncCallback<void> } callback - the callback of displayOptionalInputMethod.
422     * @syscap SystemCapability.MiscServices.InputMethodFramework
423     * @since 8
424     * @deprecated since 9
425     * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
426     */
427    displayOptionalInputMethod(callback: AsyncCallback<void>): void;
428
429    /**
430     * @returns { Promise<void> } the promise returned by the function.
431     * @syscap SystemCapability.MiscServices.InputMethodFramework
432     * @since 8
433     * @deprecated since 9
434     * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
435     */
436    displayOptionalInputMethod(): Promise<void>;
437  }
438
439  /**
440   * @interface InputMethodController
441   * @syscap SystemCapability.MiscServices.InputMethodFramework
442   * @since 6
443   */
444  interface InputMethodController {
445    /**
446     * Attach application to the input method service.
447     *
448     * @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
449     * @param { TextConfig } textConfig - indicates the config of the textInput.
450     * @param { AsyncCallback<void> } callback - the callback of attach.
451     * @throws { BusinessError } 401 - parameter error.
452     * @throws { BusinessError } 12800003 - input method client error.
453     * @throws { BusinessError } 12800008 - input method manager service error.
454     * @syscap SystemCapability.MiscServices.InputMethodFramework
455     * @since 10
456     */
457    attach(showKeyboard: boolean, textConfig: TextConfig, callback: AsyncCallback<void>): void;
458
459    /**
460     * Attach application to the input method service.
461     *
462     * @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
463     * @param { TextConfig } textConfig - indicates the config of the textInput.
464     * @returns { Promise<void> } the promise returned by the function.
465     * @throws { BusinessError } 401 - parameter error.
466     * @throws { BusinessError } 12800003 - input method client error.
467     * @throws { BusinessError } 12800008 - input method manager service error.
468     * @syscap SystemCapability.MiscServices.InputMethodFramework
469     * @since 10
470     */
471    attach(showKeyboard: boolean, textConfig: TextConfig): Promise<void>;
472
473    /**
474     * Show the text input and start typing.
475     *
476     * @param { AsyncCallback<void> } callback - the callback of showTextInput.
477     * @throws { BusinessError } 12800003 - input method client error.
478     * @throws { BusinessError } 12800008 - input method manager service error.
479     * @throws { BusinessError } 12800009 - input method client is detached.
480     * @syscap SystemCapability.MiscServices.InputMethodFramework
481     * @since 10
482     */
483    showTextInput(callback: AsyncCallback<void>): void;
484
485    /**
486     * Show the text input and start typing.
487     *
488     * @returns { Promise<void> } the promise returned by the function.
489     * @throws { BusinessError } 12800003 - input method client error.
490     * @throws { BusinessError } 12800008 - input method manager service error.
491     * @throws { BusinessError } 12800009 - input method client is detached.
492     * @syscap SystemCapability.MiscServices.InputMethodFramework
493     * @since 10
494     */
495    showTextInput(): Promise<void>;
496
497    /**
498     * Hide the text input and stop typing.
499     *
500     * @param { AsyncCallback<void> } callback - the callback of hideTextInput.
501     * @throws { BusinessError } 12800003 - input method client error.
502     * @throws { BusinessError } 12800008 - input method manager service error.
503     * @throws { BusinessError } 12800009 - input method client is detached.
504     * @syscap SystemCapability.MiscServices.InputMethodFramework
505     * @since 10
506     */
507    hideTextInput(callback: AsyncCallback<void>): void;
508
509    /**
510     * Hide the text input and stop typing.
511     *
512     * @returns { Promise<void> } the promise returned by the function.
513     * @throws { BusinessError } 12800003 - input method client error.
514     * @throws { BusinessError } 12800008 - input method manager service error.
515     * @throws { BusinessError } 12800009 - input method client is detached.
516     * @syscap SystemCapability.MiscServices.InputMethodFramework
517     * @since 10
518     */
519    hideTextInput(): Promise<void>;
520
521    /**
522     * Detach the applications from the input method manager service.
523     *
524     * @param { AsyncCallback<void> } callback - the callback of detach.
525     * @throws { BusinessError } 12800003 - input method client error.
526     * @throws { BusinessError } 12800008 - input method manager service error.
527     * @syscap SystemCapability.MiscServices.InputMethodFramework
528     * @since 10
529     */
530    detach(callback: AsyncCallback<void>): void;
531
532    /**
533     * Detach the applications from the input method manager service.
534     *
535     * @returns { Promise<void> } the promise returned by the function.
536     * @throws { BusinessError } 12800003 - input method client error.
537     * @throws { BusinessError } 12800008 - input method manager service error.
538     * @syscap SystemCapability.MiscServices.InputMethodFramework
539     * @since 10
540     */
541    detach(): Promise<void>;
542
543    /**
544     * Inform the system of the window ID of the application currently bound to the input method.
545     * After the correct setting, the window where the client is located can avoid the input method window.
546     *
547     * @param { number } windowId - the window ID of the application currently bound to the input method.
548     * @param { AsyncCallback<void> } callback - the callback of setCallingWindow.
549     * @throws { BusinessError } 401 - parameter error.
550     * @throws { BusinessError } 12800003 - input method client error.
551     * @throws { BusinessError } 12800008 - input method manager service error.
552     * @throws { BusinessError } 12800009 - input method client is detached.
553     * @syscap SystemCapability.MiscServices.InputMethodFramework
554     * @since 10
555     */
556    setCallingWindow(windowId: number, callback: AsyncCallback<void>): void;
557
558    /**
559     * Inform the system of the window ID of the application currently bound to the input method.
560     * After the correct setting, the window where the client is located can avoid the input method window.
561     *
562     * @param { number } windowId - the window ID of the application currently bound to the input method.
563     * @returns { Promise<void> } the promise returned by the function.
564     * @throws { BusinessError } 401 - parameter error.
565     * @throws { BusinessError } 12800003 - input method client error.
566     * @throws { BusinessError } 12800008 - input method manager service error.
567     * @throws { BusinessError } 12800009 - input method client is detached.
568     * @syscap SystemCapability.MiscServices.InputMethodFramework
569     * @since 10
570     */
571    setCallingWindow(windowId: number): Promise<void>;
572
573    /**
574     * Update Cursor and notify the input method that the current application cursor has changed.
575     *
576     * @param { CursorInfo } cursorInfo - the CursorInfo object.
577     * @param { AsyncCallback<void> } callback - the callback of updateCursor.
578     * @throws { BusinessError } 401 - parameter error.
579     * @throws { BusinessError } 12800003 - input method client error.
580     * @throws { BusinessError } 12800008 - input method manager service error.
581     * @throws { BusinessError } 12800009 - input method client is detached.
582     * @syscap SystemCapability.MiscServices.InputMethodFramework
583     * @since 10
584     */
585    updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback<void>): void;
586
587    /**
588     * Update Cursor and notify the input method that the current application cursor has changed.
589     *
590     * @param { CursorInfo } cursorInfo - the CursorInfo object.
591     * @returns { Promise<void> } the promise returned by the function.
592     * @throws { BusinessError } 401 - parameter error.
593     * @throws { BusinessError } 12800003 - input method client error.
594     * @throws { BusinessError } 12800008 - input method manager service error.
595     * @throws { BusinessError } 12800009 - input method client is detached.
596     * @syscap SystemCapability.MiscServices.InputMethodFramework
597     * @since 10
598     */
599    updateCursor(cursorInfo: CursorInfo): Promise<void>;
600
601    /**
602     * Notify the input method the selected text and the selection range of the current application text has changed.
603     *
604     * @param { string } text - the whole input text.
605     * @param { number } start - start position of selected text.
606     * @param { number } end - end position of selected text.
607     * @param { AsyncCallback<void> } callback - the callback of changeSelection.
608     * @throws { BusinessError } 401 - parameter error.
609     * @throws { BusinessError } 12800003 - input method client error.
610     * @throws { BusinessError } 12800008 - input method manager service error.
611     * @throws { BusinessError } 12800009 - input method client is detached.
612     * @syscap SystemCapability.MiscServices.InputMethodFramework
613     * @since 10
614     */
615    changeSelection(text: string, start: number, end: number, callback: AsyncCallback<void>): void;
616
617    /**
618     * Notify the input method the selected text and the selection range of the current application text has changed.
619     *
620     * @param { string } text - the selected text.
621     * @param { number } start - start position of selected text.
622     * @param { number } end - end position of selected text.
623     * @returns { Promise<void> } the promise returned by the function.
624     * @throws { BusinessError } 401 - parameter error.
625     * @throws { BusinessError } 12800003 - input method client error.
626     * @throws { BusinessError } 12800008 - input method manager service error.
627     * @throws { BusinessError } 12800009 - input method client is detached.
628     * @syscap SystemCapability.MiscServices.InputMethodFramework
629     * @since 10
630     */
631    changeSelection(text: string, start: number, end: number): Promise<void>;
632
633    /**
634     * Update InputAttribute information of input text.
635     *
636     * @param { InputAttribute } attribute - the InputAttribute object.
637     * @param { AsyncCallback<void> } callback - the callback of updateAttribute.
638     * @throws { BusinessError } 401 - parameter error.
639     * @throws { BusinessError } 12800003 - input method client error.
640     * @throws { BusinessError } 12800008 - input method manager service error.
641     * @throws { BusinessError } 12800009 - input method client is detached.
642     * @syscap SystemCapability.MiscServices.InputMethodFramework
643     * @since 10
644     */
645    updateAttribute(attribute: InputAttribute, callback: AsyncCallback<void>): void;
646
647    /**
648     * Update InputAttribute information of input text.
649     *
650     * @param { InputAttribute } attribute - the InputAttribute object.
651     * @returns { Promise<void> } the promise returned by the function.
652     * @throws { BusinessError } 401 - parameter error.
653     * @throws { BusinessError } 12800003 - input method client error.
654     * @throws { BusinessError } 12800008 - input method manager service error.
655     * @throws { BusinessError } 12800009 - input method client is detached.
656     * @syscap SystemCapability.MiscServices.InputMethodFramework
657     * @since 10
658     */
659    updateAttribute(attribute: InputAttribute): Promise<void>;
660    /**
661     * Stop input session
662     *
663     * @param { AsyncCallback<boolean> } callback - the callback of stopInputSession.
664     * @throws { BusinessError } 12800003 - input method client error.
665     * @throws { BusinessError } 12800008 - input method manager service error.
666     * @syscap SystemCapability.MiscServices.InputMethodFramework
667     * @since 9
668     */
669    stopInputSession(callback: AsyncCallback<boolean>): void;
670
671    /**
672     * Stop input session
673     *
674     * @returns { Promise<boolean> } the promise returned by the function.
675     * @throws { BusinessError } 12800003 - input method client error.
676     * @throws { BusinessError } 12800008 - input method manager service error.
677     * @syscap SystemCapability.MiscServices.InputMethodFramework
678     * @since 9
679     */
680    stopInputSession(): Promise<boolean>;
681
682    /**
683     * Stop input
684     *
685     * @param { AsyncCallback<boolean> } callback - the callback of stopInput.
686     * @syscap SystemCapability.MiscServices.InputMethodFramework
687     * @since 6
688     * @deprecated since 9
689     * @useinstead inputMethod.InputMethodController#stopInputSession
690     */
691    stopInput(callback: AsyncCallback<boolean>): void;
692
693    /**
694     * Stop input
695     *
696     * @returns { Promise<boolean> } the promise returned by the function.
697     * @syscap SystemCapability.MiscServices.InputMethodFramework
698     * @since 6
699     * @deprecated since 9
700     * @useinstead inputMethod.InputMethodController#stopInputSession
701     */
702    stopInput(): Promise<boolean>;
703
704    /**
705     * Show soft keyboard
706     *
707     * @permission ohos.permission.CONNECT_IME_ABILITY
708     * @param { AsyncCallback<void> } callback - the callback of showSoftKeyboard.
709     * @throws { BusinessError } 201 - permissions check fails.
710     * @throws { BusinessError } 12800003 - input method client error.
711     * @throws { BusinessError } 12800008 - input method manager service error.
712     * @syscap SystemCapability.MiscServices.InputMethodFramework
713     * @since 9
714     */
715    showSoftKeyboard(callback: AsyncCallback<void>): void;
716
717    /**
718     * Show soft keyboard
719     *
720     * @permission ohos.permission.CONNECT_IME_ABILITY
721     * @returns { Promise<void> } the promise returned by the function.
722     * @throws { BusinessError } 201 - permissions check fails.
723     * @throws { BusinessError } 12800003 - input method client error.
724     * @throws { BusinessError } 12800008 - input method manager service error.
725     * @syscap SystemCapability.MiscServices.InputMethodFramework
726     * @since 9
727     */
728    showSoftKeyboard(): Promise<void>;
729
730    /**
731     * Hide soft keyboard
732     *
733     * @permission ohos.permission.CONNECT_IME_ABILITY
734     * @param { AsyncCallback<void> } callback - the callback of hideSoftKeyboard.
735     * @throws { BusinessError } 201 - permissions check fails.
736     * @throws { BusinessError } 12800003 - input method client error.
737     * @throws { BusinessError } 12800008 - input method manager service error.
738     * @syscap SystemCapability.MiscServices.InputMethodFramework
739     * @since 9
740     */
741    hideSoftKeyboard(callback: AsyncCallback<void>): void;
742
743    /**
744     * Hide soft keyboard
745     *
746     * @permission ohos.permission.CONNECT_IME_ABILITY
747     * @returns { Promise<void> } the promise returned by the function.
748     * @throws { BusinessError } 201 - permissions check fails.
749     * @throws { BusinessError } 12800003 - input method client error.
750     * @throws { BusinessError } 12800008 - input method manager service error.
751     * @syscap SystemCapability.MiscServices.InputMethodFramework
752     * @since 9
753     */
754    hideSoftKeyboard(): Promise<void>;
755
756    /**
757     * Register a callback and when IME sends select event with range of selection,
758     * the callback will be invoked.
759     *
760     * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
761     * @param { Callback<Range> } callback - processes selectByRange command. The range of selection is provided for
762     *        this callback, and subscribers are expected to select corresponding text in callback according to
763     *        the range.
764     * @throws { BusinessError } 401 - parameter error.
765     * @syscap SystemCapability.MiscServices.InputMethodFramework
766     * @since 10
767     */
768    on(type: 'selectByRange', callback: Callback<Range>): void;
769
770    /**
771     * Unregister the callback of selectedByRange.
772     *
773     * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
774     * @param { Callback<Range> } [callback] - the callback of 'selectByRange',
775     *        when subscriber unsubscribes all callback functions of event 'selectByRange', this parameter can be left blank.
776     * @syscap SystemCapability.MiscServices.InputMethodFramework
777     * @since 10
778     */
779    off(type: 'selectByRange', callback?: Callback<Range>): void;
780
781    /**
782     * Register a callback and when IME sends select event witch movement of cursor,
783     * the callback will be invoked.
784     *
785     * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
786     * @param { Callback<Movement> } callback - processes selectByMovement command. The movement of cursor is provided
787     *        for this callback, and subscribers are expected to select corresponding text in callback according to
788     *        the movement.
789     * @throws { BusinessError } 401 - parameter error.
790     * @syscap SystemCapability.MiscServices.InputMethodFramework
791     * @since 10
792     */
793    on(type: 'selectByMovement', callback: Callback<Movement>): void;
794
795    /**
796     * Unregister the callback of selectedByMovement.
797     *
798     * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
799     * @param { Callback<Movement> } [callback] - the callback of 'selectByMovement',
800     *        when subscriber unsubscribes all callback functions of event 'selectByMovement', this parameter can be left blank.
801     * @syscap SystemCapability.MiscServices.InputMethodFramework
802     * @since 10
803     */
804    off(type: 'selectByMovement', callback?: Callback<Movement>): void;
805
806    /**
807     * Register a callback and when IME sends insert text event, the callback will be invoked.
808     *
809     * @param { 'insertText' } type - event type, fixed as 'insertText'.
810     * @param { function } callback - processes insertText command. The text of insert is provided for this callback.
811     *        Subscribers are expected to process the inserted text and update changes in editor by changeSelection and updateCursor as needed.
812     * @throws { BusinessError } 401 - parameter error.
813     * @throws { BusinessError } 12800009 - input method client is detached.
814     * @syscap SystemCapability.MiscServices.InputMethodFramework
815     * @since 10
816     */
817    on(type: 'insertText', callback: (text: string) => void): void;
818
819    /**
820     * Unregister the callback of insertText.
821     *
822     * @param { 'insertText' } type - event type, fixed as 'insertText'.
823     * @param { function } [callback] - the callback of 'insertText',
824     *        when subscriber unsubscribes all callback functions of event 'insertText', this parameter can be left blank.
825     * @syscap SystemCapability.MiscServices.InputMethodFramework
826     * @since 10
827     */
828    off(type: 'insertText', callback?: (text: string) => void): void;
829
830    /**
831     * Register a callback and when IME sends delete left event with length,
832     * the callback will be invoked.
833     *
834     * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
835     * @param { function } callback - processes deleteLeft command. The length of
836     *     delete is provided for this callback. Subscribers are expected to delete specified length of text
837     *     to the left of the cursor and update changes in editor by changeSelection and updateCursor as needed.
838     * @throws { BusinessError } 401 - parameter error.
839     * @throws { BusinessError } 12800009 - input method client is detached.
840     * @syscap SystemCapability.MiscServices.InputMethodFramework
841     * @since 10
842     */
843    on(type: 'deleteLeft', callback: (length: number) => void): void;
844
845    /**
846     * Unregister the callback of deleteLeft.
847     *
848     * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
849     * @param { function } [callback] - the callback of 'deleteLeft',
850     *        when subscriber unsubscribes all callback functions of event 'deleteLeft', this parameter can be left blank.
851     * @syscap SystemCapability.MiscServices.InputMethodFramework
852     * @since 10
853     */
854    off(type: 'deleteLeft', callback?: (length: number) => void): void;
855
856    /**
857     * Register a callback and when IME sends delete right event with length,
858     * the callback will be invoked.
859     *
860     * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
861     * @param { function } callback - processes deleteRight command. The length of
862     *     delete is provided for this callback. Subscribers are expected to delete specified length of text
863     *     to the right of the cursor and update changes in editor by changeSelection and updateCursor as needed.
864     * @throws { BusinessError } 401 - parameter error.
865     * @throws { BusinessError } 12800009 - input method client is detached.
866     * @syscap SystemCapability.MiscServices.InputMethodFramework
867     * @since 10
868     */
869    on(type: 'deleteRight', callback: (length: number) => void): void;
870
871    /**
872     * Unregister the callback of deleteRight.
873     *
874     * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
875     * @param { function } [callback] - the callback of 'deleteRight',
876     *        when subscriber unsubscribes all callback functions of event 'deleteRight', this parameter can be left blank.
877     * @syscap SystemCapability.MiscServices.InputMethodFramework
878     * @since 10
879     */
880    off(type: 'deleteRight', callback?: (length: number) => void): void;
881
882    /**
883     * Register a callback and when IME sends keyboard status, the callback will be invoked.
884     *
885     * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
886     * @param { function } callback - processes sendKeyboardStatus command.
887     *     The keyboardStatus is provided for this callback.
888     * @throws { BusinessError } 401 - parameter error.
889     * @throws { BusinessError } 12800009 - input method client is detached.
890     * @syscap SystemCapability.MiscServices.InputMethodFramework
891     * @since 10
892     */
893    on(type: 'sendKeyboardStatus', callback: (keyboardStatus: KeyboardStatus) => void): void;
894
895    /**
896     * Unregister the callback of sendKeyboardStatus.
897     *
898     * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
899     * @param { function } [callback] - the callback of 'sendKeyboardStatus',
900     *        when subscriber unsubscribes all callback functions of event 'sendKeyboardStatus', this parameter can be left blank.
901     * @syscap SystemCapability.MiscServices.InputMethodFramework
902     * @since 10
903     */
904    off(type: 'sendKeyboardStatus', callback?: (keyboardStatus: KeyboardStatus) => void): void;
905
906    /**
907     * Register a callback and when IME sends functionKey, the callback will be invoked.
908     *
909     * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
910     * @param { function } callback - processes sendFunctionKey command.
911     *     The functionKey is provided for this callback.Subscribers are expected to complete the
912     *     corresponding task based on the value of functionKey.
913     * @throws { BusinessError } 401 - parameter error.
914     * @throws { BusinessError } 12800009 - input method client is detached.
915     * @syscap SystemCapability.MiscServices.InputMethodFramework
916     * @since 10
917     */
918    on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void;
919
920    /**
921     * Unregister the callback of sendFunctionKey.
922     *
923     * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
924     * @param { function } [callback] - the callback of 'sendFunctionKey',
925     *        when subscriber unsubscribes all callback functions of event 'sendFunctionKey', this parameter can be left blank.
926     * @syscap SystemCapability.MiscServices.InputMethodFramework
927     * @since 10
928     */
929    off(type: 'sendFunctionKey', callback?: (functionKey: FunctionKey) => void): void;
930
931    /**
932     * Register a callback and when IME sends move cursor, the callback will be invoked.
933     *
934     * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
935     * @param { function } callback - processes moveCursor command. The direction of
936     *     cursor is provided for this callback. Subscribers are expected to move the cursor and update changes
937     *     in editor by changeSelection and updateCursor.
938     * @throws { BusinessError } 401 - parameter error.
939     * @throws { BusinessError } 12800009 - input method client is detached.
940     * @syscap SystemCapability.MiscServices.InputMethodFramework
941     * @since 10
942     */
943    on(type: 'moveCursor', callback: (direction: Direction) => void): void;
944
945    /**
946     * Unregister the callback of moveCursor.
947     *
948     * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
949     * @param { function } [callback] - the callback of 'moveCursor',
950     *        when subscriber unsubscribes all callback functions of event 'moveCursor', this parameter can be left blank.
951     * @syscap SystemCapability.MiscServices.InputMethodFramework
952     * @since 10
953     */
954    off(type: 'moveCursor', callback?: (direction: Direction) => void): void;
955
956    /**
957     * Register a callback and when IME sends extend action code, the callback will be invoked.
958     *
959     * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
960     * @param { function } callback - processes handleExtendAction command. The action code
961     *     is provided for this callback.
962     * @throws { BusinessError } 401 - parameter error.
963     * @throws { BusinessError } 12800009 - input method client is detached.
964     * @syscap SystemCapability.MiscServices.InputMethodFramework
965     * @since 10
966     */
967    on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void;
968
969    /**
970     * Unregister the callback of handleExtendAction.
971     *
972     * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
973     * @param { function } [callback] - the callback of 'handleExtendAction',
974     *        when subscriber unsubscribes all callback functions of event 'handleExtendAction', this parameter can be left blank.
975     * @syscap SystemCapability.MiscServices.InputMethodFramework
976     * @since 10
977     */
978    off(type: 'handleExtendAction', callback?: (action: ExtendAction) => void): void;
979
980    /**
981     * Register a callback and when input method ability gets left text of cursor, the callback will be invoked.
982     *
983     * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
984     * @param { function } callback - processes getLeftTextOfCursor command. The callback
985     *     must be a synchronization method and will block the input method application.
986     * @throws { BusinessError } 401 - parameter error.
987     * @throws { BusinessError } 12800009 - input method client is detached.
988     * @syscap SystemCapability.MiscServices.InputMethodFramework
989     * @since 10
990     */
991    on(type: 'getLeftTextOfCursor', callback: (length: number) => string): void;
992
993    /**
994     * Unregister the callback of getLeftTextOfCursor event.
995     *
996     * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
997     * @param { function } [callback] - the callback of 'getLeftTextOfCursor',
998     *     when subscriber unsubscribes all callback functions of event 'getLeftTextOfCursor', this parameter can be left blank.
999     * @syscap SystemCapability.MiscServices.InputMethodFramework
1000     * @since 10
1001     */
1002    off(type: 'getLeftTextOfCursor', callback?: (length: number) => string): void;
1003
1004    /**
1005     * Register a callback and when input method ability gets right text of cursor, the callback will be invoked.
1006     *
1007     * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
1008     * @param { function } callback - processes getRightTextOfCursor command. The callback
1009     *     must be a synchronization method and will block the input method application.
1010     * @throws { BusinessError } 401 - parameter error.
1011     * @throws { BusinessError } 12800009 - input method client is detached.
1012     * @syscap SystemCapability.MiscServices.InputMethodFramework
1013     * @since 10
1014     */
1015    on(type: 'getRightTextOfCursor', callback: (length: number) => string): void;
1016
1017    /**
1018     * Unregister the callback of getRightTextOfCursor event.
1019     *
1020     * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
1021     * @param { function } [callback] - the callback of 'getRightTextOfCursor',
1022     *     when subscriber unsubscribes all callback functions of event 'getRightTextOfCursor', this parameter can be left blank.
1023     * @syscap SystemCapability.MiscServices.InputMethodFramework
1024     * @since 10
1025     */
1026    off(type: 'getRightTextOfCursor', callback?: (length: number) => string): void;
1027
1028    /**
1029     * Register a callback and when input method ability gets the text index at cursor, the callback will be invoked.
1030     *
1031     * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
1032     * @param { function } callback - processes getTextIndexAtCursor command. The callback
1033     *     must be a synchronization method, and should return the text index at the cursor.
1034     * @throws { BusinessError } 401 - parameter error.
1035     * @throws { BusinessError } 12800009 - input method client is detached.
1036     * @syscap SystemCapability.MiscServices.InputMethodFramework
1037     * @since 10
1038     */
1039    on(type: 'getTextIndexAtCursor', callback: () => number): void;
1040
1041    /**
1042     * Unregister the callback of getTextIndexAtCursor.
1043     *
1044     * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
1045     * @param { function } [callback] - the callback of 'getTextIndexAtCursor',
1046     *     when subscriber unsubscribes all callback functions of event 'getTextIndexAtCursor', this parameter can be left blank.
1047     * @syscap SystemCapability.MiscServices.InputMethodFramework
1048     * @since 10
1049     */
1050    off(type: 'getTextIndexAtCursor', callback?: () => number): void;
1051  }
1052
1053  /**
1054   * input method property
1055   *
1056   * @interface InputMethodProperty
1057   * @syscap SystemCapability.MiscServices.InputMethodFramework
1058   * @since 8
1059   */
1060  interface InputMethodProperty {
1061    /**
1062     * The name of input method
1063     *
1064     * @syscap SystemCapability.MiscServices.InputMethodFramework
1065     * @since 8
1066     * @deprecated since 9
1067     * @useinstead inputMethod.InputMethodProperty#name
1068     */
1069    readonly packageName: string;
1070
1071    /**
1072     * The id of input method
1073     *
1074     * @syscap SystemCapability.MiscServices.InputMethodFramework
1075     * @since 8
1076     * @deprecated since 9
1077     * @useinstead inputMethod.InputMethodProperty#id
1078     */
1079    readonly methodId: string;
1080
1081    /**
1082     * The name of input method
1083     *
1084     * @syscap SystemCapability.MiscServices.InputMethodFramework
1085     * @since 9
1086     */
1087    readonly name: string;
1088
1089    /**
1090     * The id of input method
1091     *
1092     * @syscap SystemCapability.MiscServices.InputMethodFramework
1093     * @since 9
1094     */
1095    readonly id: string;
1096
1097    /**
1098     * The label of input method
1099     *
1100     * @syscap SystemCapability.MiscServices.InputMethodFramework
1101     * @since 9
1102     */
1103    readonly label?: string;
1104
1105    /**
1106     * The label id of input method
1107     *
1108     * @type { ?number }
1109     * @syscap SystemCapability.MiscServices.InputMethodFramework
1110     * @since 10
1111     */
1112    readonly labelId?: number;
1113
1114    /**
1115     * The icon of input method
1116     *
1117     * @syscap SystemCapability.MiscServices.InputMethodFramework
1118     * @since 9
1119     */
1120    readonly icon?: string;
1121
1122    /**
1123     * The icon id of input method
1124     *
1125     * @type { ?number }
1126     * @syscap SystemCapability.MiscServices.InputMethodFramework
1127     * @since 9
1128     */
1129    readonly iconId?: number;
1130
1131    /**
1132     * The extra info of input method
1133     *
1134     * @type { object }
1135     * @syscap SystemCapability.MiscServices.InputMethodFramework
1136     * @since 9
1137     */
1138    /**
1139     * The extra info of input method
1140     *
1141     * @type { ?object }
1142     * @syscap SystemCapability.MiscServices.InputMethodFramework
1143     * @since 10
1144     */
1145    extra?: object;
1146  }
1147
1148  /**
1149   * Enumerates the moving direction of cursor
1150   *
1151   * @enum { number }
1152   * @syscap SystemCapability.MiscServices.InputMethodFramework
1153   * @since 10
1154   */
1155  export enum Direction {
1156    /**
1157     * Cursor moves up
1158     *
1159     * @syscap SystemCapability.MiscServices.InputMethodFramework
1160     * @since 10
1161     */
1162    CURSOR_UP = 1,
1163
1164    /**
1165     * Cursor moves down
1166     *
1167     * @syscap SystemCapability.MiscServices.InputMethodFramework
1168     * @since 10
1169     */
1170    CURSOR_DOWN,
1171
1172    /**
1173     * Cursor moves left
1174     *
1175     * @syscap SystemCapability.MiscServices.InputMethodFramework
1176     * @since 10
1177     */
1178    CURSOR_LEFT,
1179
1180    /**
1181     * Cursor moves right
1182     *
1183     * @syscap SystemCapability.MiscServices.InputMethodFramework
1184     * @since 10
1185     */
1186    CURSOR_RIGHT
1187  }
1188
1189  /**
1190   * Range of selected text.
1191   *
1192   * @typedef Range
1193   * @syscap SystemCapability.MiscServices.InputMethodFramework
1194   * @since 10
1195   */
1196  export interface Range {
1197    /**
1198     * Indicates the index of the first character of the selected text.
1199     *
1200     * @type { number }
1201     * @syscap SystemCapability.MiscServices.InputMethodFramework
1202     * @since 10
1203     */
1204    start: number;
1205
1206    /**
1207     * Indicates the index of the last character of the selected text.
1208     *
1209     * @type { number }
1210     * @syscap SystemCapability.MiscServices.InputMethodFramework
1211     * @since 10
1212     */
1213    end: number;
1214  }
1215
1216  /**
1217   * Movement of cursor.
1218   *
1219   * @typedef Movement
1220   * @syscap SystemCapability.MiscServices.InputMethodFramework
1221   * @since 10
1222   */
1223  export interface Movement {
1224    /**
1225     * Indicates the direction of cursor movement
1226     *
1227     * @type { Direction }
1228     * @syscap SystemCapability.MiscServices.InputMethodFramework
1229     * @since 10
1230     */
1231    direction: Direction;
1232  }
1233
1234  /**
1235   * Enumerates the text input type.
1236   *
1237   * @enum { number }
1238   * @syscap SystemCapability.MiscServices.InputMethodFramework
1239   * @since 10
1240   */
1241  export enum TextInputType {
1242    /**
1243     * The text input type is NONE.
1244     *
1245     * @syscap SystemCapability.MiscServices.InputMethodFramework
1246     * @since 10
1247     */
1248    NONE = -1,
1249
1250    /**
1251     * The text input type is TEXT.
1252     *
1253     * @syscap SystemCapability.MiscServices.InputMethodFramework
1254     * @since 10
1255     */
1256    TEXT = 0,
1257
1258    /**
1259     * The text input type is MULTILINE.
1260     *
1261     * @syscap SystemCapability.MiscServices.InputMethodFramework
1262     * @since 10
1263     */
1264    MULTILINE,
1265
1266    /**
1267     * The text input type is NUMBER.
1268     *
1269     * @syscap SystemCapability.MiscServices.InputMethodFramework
1270     * @since 10
1271     */
1272    NUMBER,
1273
1274    /**
1275     * The text input type is PHONE.
1276     *
1277     * @syscap SystemCapability.MiscServices.InputMethodFramework
1278     * @since 10
1279     */
1280    PHONE,
1281
1282    /**
1283     * The text input type is DATETIME.
1284     *
1285     * @syscap SystemCapability.MiscServices.InputMethodFramework
1286     * @since 10
1287     */
1288    DATETIME,
1289
1290    /**
1291     * The text input type is EMAIL_ADDRESS.
1292     *
1293     * @syscap SystemCapability.MiscServices.InputMethodFramework
1294     * @since 10
1295     */
1296    EMAIL_ADDRESS,
1297
1298    /**
1299     * The text input type is URL.
1300     *
1301     * @syscap SystemCapability.MiscServices.InputMethodFramework
1302     * @since 10
1303     */
1304    URL,
1305
1306    /**
1307     * The text input type is VISIBLE_PASSWORD.
1308     *
1309     * @syscap SystemCapability.MiscServices.InputMethodFramework
1310     * @since 10
1311     */
1312    VISIBLE_PASSWORD
1313  }
1314
1315  /**
1316   * Enumerates the enter key type.
1317   *
1318   * @enum { number }
1319   * @syscap SystemCapability.MiscServices.InputMethodFramework
1320   * @since 10
1321   */
1322  export enum EnterKeyType {
1323    /**
1324     * The enter key type is UNSPECIFIED.
1325     *
1326     * @syscap SystemCapability.MiscServices.InputMethodFramework
1327     * @since 10
1328     */
1329    UNSPECIFIED = 0,
1330
1331    /**
1332     * The enter key type is NONE.
1333     *
1334     * @syscap SystemCapability.MiscServices.InputMethodFramework
1335     * @since 10
1336     */
1337    NONE,
1338
1339    /**
1340     * The enter key type is GO.
1341     *
1342     * @syscap SystemCapability.MiscServices.InputMethodFramework
1343     * @since 10
1344     */
1345    GO,
1346
1347    /**
1348     * The enter key type is SEARCH.
1349     *
1350     * @syscap SystemCapability.MiscServices.InputMethodFramework
1351     * @since 10
1352     */
1353    SEARCH,
1354
1355    /**
1356     * The enter key type is SEND.
1357     *
1358     * @syscap SystemCapability.MiscServices.InputMethodFramework
1359     * @since 10
1360     */
1361    SEND,
1362
1363    /**
1364     * The enter key type is NEXT.
1365     *
1366     * @syscap SystemCapability.MiscServices.InputMethodFramework
1367     * @since 10
1368     */
1369    NEXT,
1370
1371    /**
1372     * The enter key type is DONE.
1373     *
1374     * @syscap SystemCapability.MiscServices.InputMethodFramework
1375     * @since 10
1376     */
1377    DONE,
1378
1379    /**
1380     * The enter key type is PREVIOUS.
1381     *
1382     * @syscap SystemCapability.MiscServices.InputMethodFramework
1383     * @since 10
1384     */
1385    PREVIOUS
1386  }
1387
1388  /**
1389   * Enumerates the keyboard status.
1390   *
1391   * @enum { number }
1392   * @syscap SystemCapability.MiscServices.InputMethodFramework
1393   * @since 10
1394   */
1395  export enum KeyboardStatus {
1396    /**
1397     * The keyboard status is none.
1398     *
1399     * @syscap SystemCapability.MiscServices.InputMethodFramework
1400     * @since 10
1401     */
1402    NONE = 0,
1403
1404    /**
1405     * The keyboard status is hide.
1406     *
1407     * @syscap SystemCapability.MiscServices.InputMethodFramework
1408     * @since 10
1409     */
1410    HIDE = 1,
1411
1412    /**
1413     * The keyboard status is show.
1414     *
1415     * @syscap SystemCapability.MiscServices.InputMethodFramework
1416     * @since 10
1417     */
1418    SHOW = 2
1419  }
1420
1421  /**
1422   * Attribute of Input.
1423   *
1424   * @typedef InputAttribute
1425   * @syscap SystemCapability.MiscServices.InputMethodFramework
1426   * @since 10
1427   */
1428  export interface InputAttribute {
1429    /**
1430     * Indicates the text input type of the input method.
1431     *
1432     * @type { TextInputType }
1433     * @syscap SystemCapability.MiscServices.InputMethodFramework
1434     * @since 10
1435     */
1436    textInputType: TextInputType;
1437
1438    /**
1439     * Indicates the enter key type of the input method.
1440     *
1441     * @type { EnterKeyType }
1442     * @syscap SystemCapability.MiscServices.InputMethodFramework
1443     * @since 10
1444     */
1445    enterKeyType: EnterKeyType;
1446  }
1447
1448  /**
1449   * FunctionKey of Input.
1450   *
1451   * @typedef FunctionKey
1452   * @syscap SystemCapability.MiscServices.InputMethodFramework
1453   * @since 10
1454   */
1455  export interface FunctionKey {
1456    /**
1457     * Indicates the enter key type of the input method.
1458     *
1459     * @type { EnterKeyType }
1460     * @syscap SystemCapability.MiscServices.InputMethodFramework
1461     * @since 10
1462     */
1463    enterKeyType: EnterKeyType;
1464  }
1465
1466  /**
1467   * Information of Cursor.
1468   *
1469   * @typedef CursorInfo
1470   * @syscap SystemCapability.MiscServices.InputMethodFramework
1471   * @since 10
1472   */
1473  export interface CursorInfo {
1474    /**
1475     * Indicates the left point of the cursor info and must be absolute coordinate of the physical screen.
1476     *
1477     * @type { number }
1478     * @syscap SystemCapability.MiscServices.InputMethodFramework
1479     * @since 10
1480     */
1481    left: number;
1482
1483    /**
1484     * Indicates the top point of the cursor info and must be absolute coordinate of the physical screen.
1485     *
1486     * @type { number }
1487     * @syscap SystemCapability.MiscServices.InputMethodFramework
1488     * @since 10
1489     */
1490    top: number;
1491
1492    /**
1493     * Indicates the width point of the cursor info.
1494     *
1495     * @type { number }
1496     * @syscap SystemCapability.MiscServices.InputMethodFramework
1497     * @since 10
1498     */
1499    width: number;
1500
1501    /**
1502     * Indicates the height point of the cursor info.
1503     *
1504     * @type { number }
1505     * @syscap SystemCapability.MiscServices.InputMethodFramework
1506     * @since 10
1507     */
1508    height: number;
1509  }
1510
1511  /**
1512   * Config of editor.
1513   *
1514   * @typedef TextConfig
1515   * @syscap SystemCapability.MiscServices.InputMethodFramework
1516   * @since 10
1517   */
1518  export interface TextConfig {
1519    /**
1520     * Attribute of Input.
1521     *
1522     * @type { InputAttribute }
1523     * @syscap SystemCapability.MiscServices.InputMethodFramework
1524     * @since 10
1525     */
1526    inputAttribute: InputAttribute;
1527
1528    /**
1529     * Cursor information.
1530     *
1531     * @type { ?CursorInfo }
1532     * @syscap SystemCapability.MiscServices.InputMethodFramework
1533     * @since 10
1534     */
1535    cursorInfo?: CursorInfo;
1536
1537    /**
1538     * Selection information.
1539     *
1540     * @type { ?Range }
1541     * @syscap SystemCapability.MiscServices.InputMethodFramework
1542     * @since 10
1543     */
1544    selection?: Range;
1545
1546    /**
1547     * The window ID of the application currently bound to the input method.
1548     *
1549     * @type { ?number }
1550     * @syscap SystemCapability.MiscServices.InputMethodFramework
1551     * @since 10
1552     */
1553    windowId?: number;
1554  }
1555
1556  /**
1557   * Enumerates the extend action.
1558   *
1559   * @enum { number }
1560   * @syscap SystemCapability.MiscServices.InputMethodFramework
1561   * @since 10
1562   */
1563  export enum ExtendAction {
1564    /**
1565     * Select all text.
1566     *
1567     * @syscap SystemCapability.MiscServices.InputMethodFramework
1568     * @since 10
1569     */
1570    SELECT_ALL = 0,
1571
1572    /**
1573     * Cut selecting text.
1574     *
1575     * @syscap SystemCapability.MiscServices.InputMethodFramework
1576     * @since 10
1577     */
1578    CUT = 3,
1579
1580    /**
1581     * Copy selecting text.
1582     *
1583     * @syscap SystemCapability.MiscServices.InputMethodFramework
1584     * @since 10
1585     */
1586    COPY = 4,
1587
1588    /**
1589     * Paste from paste board.
1590     *
1591     * @syscap SystemCapability.MiscServices.InputMethodFramework
1592     * @since 10
1593     */
1594    PASTE = 5
1595  }
1596
1597  /**
1598   * Information of input window.
1599   *
1600   * @typedef InputWindowInfo
1601   * @syscap SystemCapability.MiscServices.InputMethodFramework
1602   * @since 10
1603   */
1604  export interface InputWindowInfo {
1605    /**
1606     * Indicates name of the input window.
1607     *
1608     * @type { string }
1609     * @syscap SystemCapability.MiscServices.InputMethodFramework
1610     * @since 10
1611     */
1612    name: string;
1613
1614    /**
1615     * Indicates the abscissa of the upper-left vertex of input window.
1616     *
1617     * @type { number }
1618     * @syscap SystemCapability.MiscServices.InputMethodFramework
1619     * @since 10
1620     */
1621    left: number;
1622
1623    /**
1624     * Indicates the ordinate of the upper-left vertex of input window.
1625     *
1626     * @type { number }
1627     * @syscap SystemCapability.MiscServices.InputMethodFramework
1628     * @since 10
1629     */
1630    top: number;
1631
1632    /**
1633     * Indicates the width of the input window.
1634     *
1635     * @type { number }
1636     * @syscap SystemCapability.MiscServices.InputMethodFramework
1637     * @since 10
1638     */
1639    width: number;
1640
1641    /**
1642     * Indicates the height of the input window.
1643     *
1644     * @type { number }
1645     * @syscap SystemCapability.MiscServices.InputMethodFramework
1646     * @since 10
1647     */
1648    height: number;
1649  }
1650}
1651
1652export default inputMethod;