• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2024 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
16/**
17 * @file
18 * @kit IMEKit
19 */
20import type { AsyncCallback, Callback } from './@ohos.base';
21import type { KeyEvent as InputKeyEvent } from './@ohos.multimodalInput.keyEvent';
22import InputMethodSubtype from './@ohos.InputMethodSubtype';
23import BaseContext from './application/BaseContext';
24import window from './@ohos.window';
25
26/**
27 * Input method engine
28 *
29 * @namespace inputMethodEngine
30 * @syscap SystemCapability.MiscServices.InputMethodFramework
31 * @since 8
32 */
33declare namespace inputMethodEngine {
34  /**
35   * When "enter" key is pressed, there is no action
36   *
37   * @constant
38   * @syscap SystemCapability.MiscServices.InputMethodFramework
39   * @since 8
40   */
41  const ENTER_KEY_TYPE_UNSPECIFIED: number;
42
43  /**
44   * When "enter" key is pressed, it means GO
45   *
46   * @constant
47   * @syscap SystemCapability.MiscServices.InputMethodFramework
48   * @since 8
49   */
50  const ENTER_KEY_TYPE_GO: number;
51
52  /**
53   * When "enter" key is pressed, it means SEARCH
54   *
55   * @constant
56   * @syscap SystemCapability.MiscServices.InputMethodFramework
57   * @since 8
58   */
59  const ENTER_KEY_TYPE_SEARCH: number;
60
61  /**
62   * When "enter" key is pressed, it means SEND
63   *
64   * @constant
65   * @syscap SystemCapability.MiscServices.InputMethodFramework
66   * @since 8
67   */
68  const ENTER_KEY_TYPE_SEND: number;
69
70  /**
71   * When "enter" key is pressed, it means NEXT
72   *
73   * @constant
74   * @syscap SystemCapability.MiscServices.InputMethodFramework
75   * @since 8
76   */
77  const ENTER_KEY_TYPE_NEXT: number;
78
79  /**
80   * When "enter" key is pressed, it means DONE
81   *
82   * @constant
83   * @syscap SystemCapability.MiscServices.InputMethodFramework
84   * @since 8
85   */
86  const ENTER_KEY_TYPE_DONE: number;
87
88  /**
89   * When "enter" key is pressed, it means PREVIOUS
90   *
91   * @constant
92   * @syscap SystemCapability.MiscServices.InputMethodFramework
93   * @since 8
94   */
95  const ENTER_KEY_TYPE_PREVIOUS: number;
96
97  /**
98   * When "enter" key is pressed, it means NEWLINE
99   *
100   * @constant
101   * @syscap SystemCapability.MiscServices.InputMethodFramework
102   * @since 12
103   */
104  const ENTER_KEY_TYPE_NEWLINE: 8;
105
106  /**
107   * Editor with no special function
108   *
109   * @constant
110   * @syscap SystemCapability.MiscServices.InputMethodFramework
111   * @since 8
112   */
113  const PATTERN_NULL: number;
114
115  /**
116   * Editor of type TEXT
117   *
118   * @constant
119   * @syscap SystemCapability.MiscServices.InputMethodFramework
120   * @since 8
121   */
122  const PATTERN_TEXT: number;
123
124  /**
125   * Editor of type NUMBER
126   *
127   * @constant
128   * @syscap SystemCapability.MiscServices.InputMethodFramework
129   * @since 8
130   */
131  const PATTERN_NUMBER: number;
132
133  /**
134   * Editor of type PHONE NUMBER
135   *
136   * @constant
137   * @syscap SystemCapability.MiscServices.InputMethodFramework
138   * @since 8
139   */
140  const PATTERN_PHONE: number;
141
142  /**
143   * Editor of type DATETIME
144   *
145   * @constant
146   * @syscap SystemCapability.MiscServices.InputMethodFramework
147   * @since 8
148   */
149  const PATTERN_DATETIME: number;
150
151  /**
152   * Editor of type EMAIL
153   *
154   * @constant
155   * @syscap SystemCapability.MiscServices.InputMethodFramework
156   * @since 8
157   */
158  const PATTERN_EMAIL: number;
159
160  /**
161   * Editor of type URI
162   *
163   * @constant
164   * @syscap SystemCapability.MiscServices.InputMethodFramework
165   * @since 8
166   */
167  const PATTERN_URI: number;
168
169  /**
170   * Editor of type PASSWORD
171   *
172   * @constant
173   * @syscap SystemCapability.MiscServices.InputMethodFramework
174   * @since 8
175   */
176  const PATTERN_PASSWORD: number;
177
178  /**
179   * Editor of type SCREEN LOCK PASSWORD
180   *
181   * @constant
182   * @syscap SystemCapability.MiscServices.InputMethodFramework
183   * @since 11
184   */
185  const PATTERN_PASSWORD_SCREEN_LOCK: number;
186
187  /**
188   * Editor of type NUMBER PASSWORD
189   *
190   * @constant
191   * @syscap SystemCapability.MiscServices.InputMethodFramework
192   * @since 11
193   */
194  const PATTERN_PASSWORD_NUMBER: number;
195
196  /**
197   * Editor in SELECTING state
198   *
199   * @constant
200   * @syscap SystemCapability.MiscServices.InputMethodFramework
201   * @since 8
202   */
203  const FLAG_SELECTING: number;
204
205  /**
206   * Editor in SINGLE_LINE state
207   *
208   * @constant
209   * @syscap SystemCapability.MiscServices.InputMethodFramework
210   * @since 8
211   */
212  const FLAG_SINGLE_LINE: number;
213
214  /**
215   * The Editor displays in PART mode
216   *
217   * @constant
218   * @syscap SystemCapability.MiscServices.InputMethodFramework
219   * @since 8
220   */
221  const DISPLAY_MODE_PART: number;
222
223  /**
224   * The Editor displays in FULL mode
225   *
226   * @constant
227   * @syscap SystemCapability.MiscServices.InputMethodFramework
228   * @since 8
229   */
230  const DISPLAY_MODE_FULL: number;
231
232  /**
233   * Allows ASCII to be inputted
234   *
235   * @constant
236   * @syscap SystemCapability.MiscServices.InputMethodFramework
237   * @since 8
238   */
239  const OPTION_ASCII: number;
240
241  /**
242   * Do not specify Editor's input type
243   *
244   * @constant
245   * @syscap SystemCapability.MiscServices.InputMethodFramework
246   * @since 8
247   */
248  const OPTION_NONE: number;
249
250  /**
251   * Allows CHARACTERS to be inputted
252   *
253   * @constant
254   * @syscap SystemCapability.MiscServices.InputMethodFramework
255   * @since 8
256   */
257  const OPTION_AUTO_CAP_CHARACTERS: number;
258
259  /**
260   * Allows SENTENCES to be inputted
261   *
262   * @constant
263   * @syscap SystemCapability.MiscServices.InputMethodFramework
264   * @since 8
265   */
266  const OPTION_AUTO_CAP_SENTENCES: number;
267
268  /**
269   * Allows WORDS to be inputted
270   *
271   * @constant
272   * @syscap SystemCapability.MiscServices.InputMethodFramework
273   * @since 8
274   */
275  const OPTION_AUTO_WORDS: number;
276
277  /**
278   * Allows MULTI_LINE to be inputted
279   *
280   * @constant
281   * @syscap SystemCapability.MiscServices.InputMethodFramework
282   * @since 8
283   */
284  const OPTION_MULTI_LINE: number;
285
286  /**
287   * Half-screen mode
288   *
289   * @constant
290   * @syscap SystemCapability.MiscServices.InputMethodFramework
291   * @since 8
292   */
293  const OPTION_NO_FULLSCREEN: number;
294
295  /**
296   * The move direction of cursor: UP
297   *
298   * @constant
299   * @syscap SystemCapability.MiscServices.InputMethodFramework
300   * @since 9
301   */
302  const CURSOR_UP: number;
303
304  /**
305   * The move direction of cursor: DOWN
306   *
307   * @constant
308   * @syscap SystemCapability.MiscServices.InputMethodFramework
309   * @since 9
310   */
311  const CURSOR_DOWN: number;
312
313  /**
314   * The move direction of cursor: LEFT
315   *
316   * @constant
317   * @syscap SystemCapability.MiscServices.InputMethodFramework
318   * @since 9
319   */
320  const CURSOR_LEFT: number;
321
322  /**
323   * The move direction of cursor: RIGHT
324   *
325   * @constant
326   * @syscap SystemCapability.MiscServices.InputMethodFramework
327   * @since 9
328   */
329  const CURSOR_RIGHT: number;
330
331  /**
332   * The window styles for input method ability.
333   *
334   * @constant
335   * @syscap SystemCapability.MiscServices.InputMethodFramework
336   * @since 9
337   */
338  const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;
339
340  /**
341   * Get InputMethodAbility object to subscribe events about IME.
342   *
343   * @returns { InputMethodAbility } the object of the InputMethodAbility.
344   * @syscap SystemCapability.MiscServices.InputMethodFramework
345   * @since 9
346   */
347  function getInputMethodAbility(): InputMethodAbility;
348
349  /**
350   * @returns { InputMethodEngine }
351   * @syscap SystemCapability.MiscServices.InputMethodFramework
352   * @since 8
353   * @deprecated since 9
354   * @useinstead inputMethodEngine#getInputMethodAbility
355   */
356  function getInputMethodEngine(): InputMethodEngine;
357
358  /**
359   * Get KeyboardDelegate object to subscribe key event or events about editor.
360   *
361   * @returns { KeyboardDelegate } the object of KeyboardDelegate.
362   * @syscap SystemCapability.MiscServices.InputMethodFramework
363   * @since 9
364   */
365  function getKeyboardDelegate(): KeyboardDelegate;
366
367  /**
368   * @returns { KeyboardDelegate }
369   * @syscap SystemCapability.MiscServices.InputMethodFramework
370   * @since 8
371   * @deprecated since 9
372   * @useinstead inputMethodEngine#getKeyboardDelegate
373   */
374  function createKeyboardDelegate(): KeyboardDelegate;
375
376  /**
377   * Indicates the possible data types of the command.
378   * @typedef { number | string | boolean }
379   * @syscap SystemCapability.MiscServices.InputMethodFramework
380   * @since 12
381   */
382  type CommandDataType = number | string | boolean;
383
384  /**
385   * @interface KeyboardController
386   * @syscap SystemCapability.MiscServices.InputMethodFramework
387   * @since 8
388   */
389  interface KeyboardController {
390    /**
391     * Hide soft keyboard
392     *
393     * @param { AsyncCallback<void> } callback - indicates the callback function of hide.
394     * @throws { BusinessError } 12800003 - input method client error.
395     * @syscap SystemCapability.MiscServices.InputMethodFramework
396     * @since 9
397     */
398    hide(callback: AsyncCallback<void>): void;
399
400    /**
401     * Hide soft keyboard
402     *
403     * @returns { Promise<void> } the promise returned by the function
404     * @throws { BusinessError } 12800003 - input method client error.
405     * @syscap SystemCapability.MiscServices.InputMethodFramework
406     * @since 9
407     */
408    hide(): Promise<void>;
409
410    /**
411     * @param { AsyncCallback<void> } callback - indicates the callback function of hideKeyboard.
412     * @syscap SystemCapability.MiscServices.InputMethodFramework
413     * @since 8
414     * @deprecated since 9
415     * @useinstead inputMethodEngine.KeyboardController#hide
416     */
417    hideKeyboard(callback: AsyncCallback<void>): void;
418
419    /**
420     * @returns { Promise<void> } the promise returned by the function
421     * @syscap SystemCapability.MiscServices.InputMethodFramework
422     * @since 8
423     * @deprecated since 9
424     * @useinstead inputMethodEngine.KeyboardController#hide
425     */
426    hideKeyboard(): Promise<void>;
427
428    /**
429     * Exit the current input type. This function can only be called by default input method configured by system.
430     *
431     * @param { AsyncCallback<void> } callback - the callback of exitCurrentInputType.
432     * @throws { BusinessError } 12800008 - input method manager service error.
433     * @throws { BusinessError } 12800010 - not default input method configured by system.
434     * @syscap SystemCapability.MiscServices.InputMethodFramework
435     * @since 11
436     */
437    exitCurrentInputType(callback: AsyncCallback<void>): void;
438
439    /**
440     * Exit the current input type. This function can only be called by default input method configured by system.
441     *
442     * @returns { Promise<void> } the promise returned by the function.
443     * @throws { BusinessError } 12800008 - input method manager service error.
444     * @throws { BusinessError } 12800010 - not default input method configured by system.
445     * @syscap SystemCapability.MiscServices.InputMethodFramework
446     * @since 11
447     */
448    exitCurrentInputType(): Promise<void>;
449  }
450
451  /**
452   * @interface InputMethodEngine
453   * @syscap SystemCapability.MiscServices.InputMethodFramework
454   * @since 8
455   */
456  interface InputMethodEngine {
457    /**
458     * Subscribe 'inputStart'
459     *
460     * @param { 'inputStart' } type - indicates the type of subscribe event.
461     * @param { function } callback - indicates the callback of on('inputStart').
462     * @syscap SystemCapability.MiscServices.InputMethodFramework
463     * @since 8
464     */
465    on(
466      type: 'inputStart',
467      callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void
468    ): void;
469
470    /**
471     * Unsubscribe 'inputStart'
472     *
473     * @param { 'inputStart' } type - indicates the type of subscribe event.
474     * @param { function } callback - optional, indicates the callback of off('inputStart').
475     * @syscap SystemCapability.MiscServices.InputMethodFramework
476     * @since 8
477     */
478    off(
479      type: 'inputStart',
480      callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void
481    ): void;
482
483    /**
484     * Subscribe 'keyboardShow'|'keyboardHide'
485     *
486     * @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event.
487     * @param { function } callback - indicates the callback of on('keyboardShow'|'keyboardHide').
488     * @syscap SystemCapability.MiscServices.InputMethodFramework
489     * @since 8
490     */
491    on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void;
492
493    /**
494     * Unsubscribe 'keyboardShow'|'keyboardHide'
495     *
496     * @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event.
497     * @param { function } [callback] - optional, indicates the callback of off('keyboardShow'|'keyboardHide').
498     * @syscap SystemCapability.MiscServices.InputMethodFramework
499     * @since 8
500     */
501    off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void;
502  }
503
504  /**
505   * <p>Control events about IME.</p>
506   * <p>Events provided for IME to subscribe with callback function. When those events occur, the corresponding callback
507   * will be invoked.</p>
508   *
509   * @interface InputMethodAbility
510   * @syscap SystemCapability.MiscServices.InputMethodFramework
511   * @since 9
512   */
513  interface InputMethodAbility {
514    /**
515     * Subscribe 'inputStart' event.
516     *
517     * @param { 'inputStart' } type - the type of subscribe event.
518     * @param { function } callback - the callback of on('inputStart').
519     * @syscap SystemCapability.MiscServices.InputMethodFramework
520     * @since 9
521     */
522    on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void;
523
524    /**
525     * Unsubscribe 'inputStart' event.
526     *
527     * @param { 'inputStart' } type - the type of unsubscribe event.
528     * @param { function } [callback] - optional, the callback of off('inputStart').
529     * @syscap SystemCapability.MiscServices.InputMethodFramework
530     * @since 9
531     */
532    off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void;
533
534    /**
535     * Subscribe 'inputStop'.
536     *
537     * @param { 'inputStop' } type - the type of subscribe event.
538     * @param { function } callback - the callback of on('inputStop').
539     * @syscap SystemCapability.MiscServices.InputMethodFramework
540     * @since 9
541     */
542    on(type: 'inputStop', callback: () => void): void;
543
544    /**
545     * Unsubscribe 'inputStop'.
546     *
547     * @param { 'inputStop' } type - the type of unsubscribe event.
548     * @param { function } callback - the callback of off('inputStop').
549     * @syscap SystemCapability.MiscServices.InputMethodFramework
550     * @since 9
551     */
552    off(type: 'inputStop', callback: () => void): void;
553
554    /**
555     * Subscribe 'setCallingWindow'.
556     *
557     * @param { 'setCallingWindow' } type - the type of subscribe event.
558     * @param { function } callback - the callback of on('setCallingWindow').
559     * @syscap SystemCapability.MiscServices.InputMethodFramework
560     * @since 9
561     */
562    on(type: 'setCallingWindow', callback: (wid: number) => void): void;
563
564    /**
565     * Unsubscribe 'setCallingWindow'.
566     *
567     * @param { 'setCallingWindow' } type - the type of unsubscribe event.
568     * @param { function } callback - the callback of off('setCallingWindow').
569     * @syscap SystemCapability.MiscServices.InputMethodFramework
570     * @since 9
571     */
572    off(type: 'setCallingWindow', callback: (wid: number) => void): void;
573
574    /**
575     * Subscribe 'keyboardShow'|'keyboardHide'.
576     *
577     * @param { 'keyboardShow' | 'keyboardHide' } type - the type of subscribe event.
578     * @param { function } callback - the callback of on('keyboardShow'|'keyboardHide').
579     * @syscap SystemCapability.MiscServices.InputMethodFramework
580     * @since 9
581     */
582    on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void;
583
584    /**
585     * Unsubscribe 'keyboardShow'|'keyboardHide'.
586     *
587     * @param { 'keyboardShow' | 'keyboardHide' } type - the type of unsubscribe event.
588     * @param { function } [callback] - the callback of off('keyboardShow'|'keyboardHide').
589     * @syscap SystemCapability.MiscServices.InputMethodFramework
590     * @since 9
591     */
592    off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void;
593
594    /**
595     * Subscribe 'setSubtype'.
596     *
597     * @param { 'setSubtype' } type - the type of subscribe event.
598     * @param { function } callback - the callback of on('setSubtype').
599     * @syscap SystemCapability.MiscServices.InputMethodFramework
600     * @since 9
601     */
602    on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;
603
604    /**
605     * Unsubscribe 'setSubtype'.
606     *
607     * @param { 'setSubtype' } type - the type of subscribe event.
608     * @param { function } [callback] - the callback of off('setSubtype').
609     * @syscap SystemCapability.MiscServices.InputMethodFramework
610     * @since 9
611     */
612    off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;
613
614    /**
615     * Subscribe 'securityModeChange' event.
616     *
617     * @param { 'securityModeChange' } type - the type of subscribe event.
618     * @param { Callback<SecurityMode> } callback - the callback of on('securityModeChange').
619     * @syscap SystemCapability.MiscServices.InputMethodFramework
620     * @since 11
621     */
622    on(type: 'securityModeChange', callback: Callback<SecurityMode>): void;
623
624    /**
625     * Unsubscribe 'securityModeChange' event.
626     *
627     * @param { 'securityModeChange' } type - the type of unsubscribe event.
628     * @param { Callback<SecurityMode> } [callback] - optional, the callback of off('securityModeChange').
629     * @syscap SystemCapability.MiscServices.InputMethodFramework
630     * @since 11
631     */
632    off(type: 'securityModeChange', callback?: Callback<SecurityMode>): void;
633
634    /**
635     * Subscribe 'privateCommand'.This function can only be called by default input method configured by system.
636     *
637     * @param { 'privateCommand' } type - indicates the type of subscribe event.
638     * @param { Callback<Record<string, CommandDataType>> } callback - indicates the callback of on('privateCommand').
639     * @throws { BusinessError } 12800010 - not default input method configured by system.
640     * @syscap SystemCapability.MiscServices.InputMethodFramework
641     * @since 12
642     */
643    on(type: 'privateCommand', callback: Callback<Record<string, CommandDataType>>): void;
644
645    /**
646     * Unsubscribe 'privateCommand'.This function can only be called by default input method configured by system.
647     *
648     * @param { 'privateCommand' } type - indicates the type of subscribe event.
649     * @param { Callback<Record<string, CommandDataType>> } [callback] - optional,
650     * indicates the callback of off('privateCommand').
651     * @throws { BusinessError } 12800010 - not default input method configured by system.
652     * @syscap SystemCapability.MiscServices.InputMethodFramework
653     * @since 12
654     */
655    off(type: 'privateCommand', callback?: Callback<Record<string, CommandDataType>>): void;
656
657    /**
658     * Get input method's security mode.
659     *
660     * @returns { SecurityMode } return security mode.
661     * @throws { BusinessError } 12800004 - not an input method extension.
662     * @syscap SystemCapability.MiscServices.InputMethodFramework
663     * @since 11
664     */
665    getSecurityMode(): SecurityMode;
666
667    /**
668     * Creates a panel.
669     * <p>The system only allows one soft keyboard and one status bar to be created.</p>
670     *
671     * @param { BaseContext } ctx - indicates the context on which the window depends.
672     * @param { PanelInfo } info - the info of panel to be created.
673     * @param { AsyncCallback<Panel> } callback - the callback of createPanel.
674     * @throws { BusinessError } 401 - parameter error. Possible causes:
675     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
676     * @throws { BusinessError } 12800004 - not an input method extension.
677     * @syscap SystemCapability.MiscServices.InputMethodFramework
678     * @since 10
679     */
680    createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback<Panel>): void;
681
682    /**
683     * Creates a panel.
684     * <p>The system only allows one soft keyboard and one status bar to be created.</p>
685     *
686     * @param { BaseContext } ctx - indicates the context on which the window depends.
687     * @param { PanelInfo } info - the info of panel to be created.
688     * @returns { Promise<Panel> } the promise returned by the function.
689     * @throws { BusinessError } 401 - parameter error. Possible causes:
690     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
691     * @throws { BusinessError } 12800004 - not an input method extension.
692     * @syscap SystemCapability.MiscServices.InputMethodFramework
693     * @since 10
694     */
695    createPanel(ctx: BaseContext, info: PanelInfo): Promise<Panel>;
696
697    /**
698     * Destroys a panel.
699     *
700     * @param { Panel } panel - to be destroyed.
701     * @param { AsyncCallback<void> } callback - the callback of destroyPanel.
702     * @throws { BusinessError } 401 - parameter error. Possible causes:
703     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
704     * @syscap SystemCapability.MiscServices.InputMethodFramework
705     * @since 10
706     */
707    destroyPanel(panel: Panel, callback: AsyncCallback<void>): void;
708
709    /**
710     * Destroys a panel.
711     *
712     * @param { Panel } panel - to be destroyed.
713     * @returns { Promise<void> } the promise returned by the function.
714     * @throws { BusinessError } 401 - parameter error. Possible causes:
715     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
716     * @syscap SystemCapability.MiscServices.InputMethodFramework
717     * @since 10
718     */
719    destroyPanel(panel: Panel): Promise<void>;
720  }
721
722  /**
723   * @interface TextInputClient
724   * @syscap SystemCapability.MiscServices.InputMethodFramework
725   * @since 8
726   * @deprecated since 9
727   * @useinstead inputMethodEngine#InputClient
728   */
729  interface TextInputClient {
730    /**
731     * @param { number } action - action indicates the function of "enter" key.
732     * @param { AsyncCallback<boolean> } callback - the callback of sendKeyFunction.
733     * @syscap SystemCapability.MiscServices.InputMethodFramework
734     * @since 8
735     * @deprecated since 9
736     * @useinstead inputMethodEngine.InputClient#sendKeyFunction
737     */
738    sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
739
740    /**
741     * @param { number } action - action indicates the function of "enter" key.
742     * @returns { Promise<boolean> } the promise returned by the function.
743     * @syscap SystemCapability.MiscServices.InputMethodFramework
744     * @since 8
745     * @deprecated since 9
746     * @useinstead inputMethodEngine.InputClient#sendKeyFunction
747     */
748    sendKeyFunction(action: number): Promise<boolean>;
749
750    /**
751     * @param { number } length - length of text which will be deleted forward.
752     * @param { AsyncCallback<boolean> } callback - the callback of deleteForward.
753     * @syscap SystemCapability.MiscServices.InputMethodFramework
754     * @since 8
755     * @deprecated since 9
756     * @useinstead inputMethodEngine.InputClient#deleteForward
757     */
758    deleteForward(length: number, callback: AsyncCallback<boolean>): void;
759
760    /**
761     * @param { number } length - length of text which will be deleted forward.
762     * @returns { Promise<boolean> } the promise returned by the function.
763     * @syscap SystemCapability.MiscServices.InputMethodFramework
764     * @since 8
765     * @deprecated since 9
766     * @useinstead inputMethodEngine.InputClient#deleteForward
767     */
768    deleteForward(length: number): Promise<boolean>;
769
770    /**
771     * @param { number } length - length of text which will be deleted backward.
772     * @param { AsyncCallback<boolean> } callback - the callback of deleteBackward.
773     * @syscap SystemCapability.MiscServices.InputMethodFramework
774     * @since 8
775     * @deprecated since 9
776     * @useinstead inputMethodEngine.InputClient#deleteBackward
777     */
778    deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
779
780    /**
781     * @param { number } length - length of text which will be deleted backward.
782     * @returns { Promise<boolean> } the promise returned by the function.
783     * @syscap SystemCapability.MiscServices.InputMethodFramework
784     * @since 8
785     * @deprecated since 9
786     * @useinstead inputMethodEngine.InputClient#deleteBackward
787     */
788    deleteBackward(length: number): Promise<boolean>;
789
790    /**
791     * @param { string } text - text which will be inserted.
792     * @param { AsyncCallback<boolean> } callback - the callback of insertText.
793     * @syscap SystemCapability.MiscServices.InputMethodFramework
794     * @since 8
795     * @deprecated since 9
796     * @useinstead inputMethodEngine.InputClient#insertText
797     */
798    insertText(text: string, callback: AsyncCallback<boolean>): void;
799
800    /**
801     * @param { string } text - text which will be inserted.
802     * @returns { Promise<boolean> } the promise returned by the function
803     * @syscap SystemCapability.MiscServices.InputMethodFramework
804     * @since 8
805     * @deprecated since 9
806     * @useinstead inputMethodEngine.InputClient#insertText
807     */
808    insertText(text: string): Promise<boolean>;
809
810    /**
811     * @param { number } length - the length of text which will be got.
812     * @param { AsyncCallback<string> } callback - the callback of getForward.
813     * @syscap SystemCapability.MiscServices.InputMethodFramework
814     * @since 8
815     * @deprecated since 9
816     * @useinstead inputMethodEngine.InputClient#getForward
817     */
818    getForward(length: number, callback: AsyncCallback<string>): void;
819
820    /**
821     * @param { number } length - the length of text which will be got.
822     * @returns { Promise<string> } the promise returned by the function
823     * @syscap SystemCapability.MiscServices.InputMethodFramework
824     * @since 8
825     * @deprecated since 9
826     * @useinstead inputMethodEngine.InputClient#getForward
827     */
828    getForward(length: number): Promise<string>;
829
830    /**
831     * @param { number } length - the length of text which will be got.
832     * @param { AsyncCallback<string> } callback - the callback of getBackward.
833     * @syscap SystemCapability.MiscServices.InputMethodFramework
834     * @since 8
835     * @deprecated since 9
836     * @useinstead inputMethodEngine.InputClient#getBackward
837     */
838    getBackward(length: number, callback: AsyncCallback<string>): void;
839
840    /**
841     * @param { number } length - the length of text which will be got.
842     * @returns { Promise<string> } the promise returned by the function.
843     * @syscap SystemCapability.MiscServices.InputMethodFramework
844     * @since 8
845     * @deprecated since 9
846     * @useinstead inputMethodEngine.InputClient#getBackward
847     */
848    getBackward(length: number): Promise<string>;
849
850    /**
851     * @param { AsyncCallback<EditorAttribute> } callback - the callback of getEditorAttribute.
852     * @syscap SystemCapability.MiscServices.InputMethodFramework
853     * @since 8
854     * @deprecated since 9
855     * @useinstead inputMethodEngine.InputClient#getEditorAttribute
856     */
857    getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
858
859    /**
860     * @returns { Promise<EditorAttribute> } the promise returned by the function.
861     * @syscap SystemCapability.MiscServices.InputMethodFramework
862     * @since 8
863     * @deprecated since 9
864     * @useinstead inputMethodEngine.InputClient#getEditorAttribute
865     */
866    getEditorAttribute(): Promise<EditorAttribute>;
867  }
868
869  /**
870   * Control events about Editor.
871   *
872   * @interface InputClient
873   * @syscap SystemCapability.MiscServices.InputMethodFramework
874   * @since 9
875   */
876  interface InputClient {
877    /**
878     * Send the function of the key.
879     *
880     * @param { number } action - action indicates the function of "enter" key.
881     * @param { AsyncCallback<boolean> } callback - the callback of sendKeyFunction.
882     * @throws { BusinessError } 401 - parameter error. Possible causes:
883     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
884     * @throws { BusinessError } 12800003 - input method client error.
885     * @syscap SystemCapability.MiscServices.InputMethodFramework
886     * @since 9
887     */
888    sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
889
890    /**
891     * Send the function of the key.
892     *
893     * @param { number } action - action indicates the function of "enter" key.
894     * @returns { Promise<boolean> } the promise returned by the function.
895     * @throws { BusinessError } 401 - parameter error. Possible causes:
896     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
897     * @throws { BusinessError } 12800003 - input method client error.
898     * @syscap SystemCapability.MiscServices.InputMethodFramework
899     * @since 9
900     */
901    sendKeyFunction(action: number): Promise<boolean>;
902
903    /**
904     * Delete text forward.
905     *
906     * @param { number } length - length of text which will be deleted forward. It can't be less than 0.
907     * @param { AsyncCallback<boolean> } callback - the callback of deleteForward.
908     * @throws { BusinessError } 401 - parameter error. Possible causes:
909     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
910     * @throws { BusinessError } 12800002 - Input method engine error.
911     * @throws { BusinessError } 12800003 - input method client error.
912     * @syscap SystemCapability.MiscServices.InputMethodFramework
913     * @since 9
914     */
915    deleteForward(length: number, callback: AsyncCallback<boolean>): void;
916
917    /**
918     * Delete text forward.
919     *
920     * @param { number } length - length of text which will be deleted forward. It can't be less than 0.
921     * @returns { Promise<boolean> } the promise returned by the function.
922     * @throws { BusinessError } 401 - parameter error. Possible causes:
923     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
924     * @throws { BusinessError } 12800002 - Input method engine error.
925     * @throws { BusinessError } 12800003 - input method client error.
926     * @syscap SystemCapability.MiscServices.InputMethodFramework
927     * @since 9
928     */
929    deleteForward(length: number): Promise<boolean>;
930
931    /**
932     * Delete text forward.
933     *
934     * @param { number } length - length of text which will be deleted forward. It can't be less than 0.
935     * @throws { BusinessError } 401 - parameter error. Possible causes:
936     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
937     * @throws { BusinessError } 12800002 - input method engine error.
938     * @throws { BusinessError } 12800003 - input method client error.
939     * @syscap SystemCapability.MiscServices.InputMethodFramework
940     * @since 10
941     */
942    deleteForwardSync(length: number): void;
943
944    /**
945     * Delete text backward.
946     *
947     * @param { number } length - length of text which will be deleted backward. It can't be less than 0.
948     * @param { AsyncCallback<boolean> } callback - the callback of deleteBackward.
949     * @throws { BusinessError } 401 - parameter error. Possible causes:
950     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
951     * @throws { BusinessError } 12800002 - Input method engine error.
952     * @throws { BusinessError } 12800003 - input method client error.
953     * @syscap SystemCapability.MiscServices.InputMethodFramework
954     * @since 9
955     */
956    deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
957
958    /**
959     * Delete text backward.
960     *
961     * @param { number } length - length of text which will be deleted backward. It can't be less than 0.
962     * @returns { Promise<boolean> } the promise returned by the function.
963     * @throws { BusinessError } 401 - parameter error. Possible causes:
964     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
965     * @throws { BusinessError } 12800002 - Input method engine error.
966     * @throws { BusinessError } 12800003 - input method client error.
967     * @syscap SystemCapability.MiscServices.InputMethodFramework
968     * @since 9
969     */
970    deleteBackward(length: number): Promise<boolean>;
971
972    /**
973     * Delete text backward.
974     *
975     * @param { number } length - length of text which will be deleted backward. It can't be less than 0.
976     * @throws { BusinessError } 401 - parameter error. Possible causes:
977     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
978     * @throws { BusinessError } 12800002 - input method engine error.
979     * @throws { BusinessError } 12800003 - input method client error.
980     * @syscap SystemCapability.MiscServices.InputMethodFramework
981     * @since 10
982     */
983    deleteBackwardSync(length: number): void;
984
985    /**
986     * Insert text into Editor.
987     *
988     * @param { string } text - text which will be inserted.
989     * @param { AsyncCallback<boolean> } callback - the callback of insertText.
990     * @throws { BusinessError } 401 - parameter error. Possible causes:
991     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
992     * @throws { BusinessError } 12800002 - Input method engine error.
993     * @throws { BusinessError } 12800003 - input method client error.
994     * @syscap SystemCapability.MiscServices.InputMethodFramework
995     * @since 9
996     */
997    insertText(text: string, callback: AsyncCallback<boolean>): void;
998
999    /**
1000     * Insert text into Editor.
1001     *
1002     * @param { string } text - text which will be inserted.
1003     * @returns { Promise<boolean> } the promise returned by the function.
1004     * @throws { BusinessError } 401 - parameter error. Possible causes:
1005     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1006     * @throws { BusinessError } 12800002 - Input method engine error.
1007     * @throws { BusinessError } 12800003 - input method client error.
1008     * @syscap SystemCapability.MiscServices.InputMethodFramework
1009     * @since 9
1010     */
1011    insertText(text: string): Promise<boolean>;
1012
1013    /**
1014     * Insert text into Editor.
1015     *
1016     * @param { string } text - text which will be inserted.
1017     * @throws { BusinessError } 401 - parameter error. Possible causes:
1018     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1019     * @throws { BusinessError } 12800002 - input method engine error.
1020     * @throws { BusinessError } 12800003 - input method client error.
1021     * @syscap SystemCapability.MiscServices.InputMethodFramework
1022     * @since 10
1023     */
1024    insertTextSync(text: string): void;
1025
1026    /**
1027     * Get the text before cursor.
1028     *
1029     * @param { number } length - the length of text which will be got. It can't be less than 0.
1030     * @param { AsyncCallback<string> } callback - the callback of getForward.
1031     * @throws { BusinessError } 401 - parameter error. Possible causes:
1032     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1033     * @throws { BusinessError } 12800003 - input method client error.
1034     * @throws { BusinessError } 12800006 - Input method controller error.
1035     * @syscap SystemCapability.MiscServices.InputMethodFramework
1036     * @since 9
1037     */
1038    getForward(length: number, callback: AsyncCallback<string>): void;
1039
1040    /**
1041     * Get the text before cursor.
1042     *
1043     * @param { number } length - the length of text which will be got. It can't be less than 0.
1044     * @returns { Promise<string> } the promise returned by the function.
1045     * @throws { BusinessError } 401 - parameter error. Possible causes:
1046     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1047     * @throws { BusinessError } 12800003 - input method client error.
1048     * @throws { BusinessError } 12800006 - Input method controller error.
1049     * @syscap SystemCapability.MiscServices.InputMethodFramework
1050     * @since 9
1051     */
1052    getForward(length: number): Promise<string>;
1053
1054    /**
1055     * Get the text before cursor.
1056     *
1057     * @param { number } length - the length of text which will be got. It can't be less than 0.
1058     * @returns { string } the text string before cursor.
1059     * @throws { BusinessError } 401 - parameter error. Possible causes:
1060     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1061     * @throws { BusinessError } 12800003 - input method client error.
1062     * @throws { BusinessError } 12800006 - input method controller error.
1063     * @syscap SystemCapability.MiscServices.InputMethodFramework
1064     * @since 10
1065     */
1066    getForwardSync(length: number): string;
1067
1068    /**
1069     * Get the text after cursor.
1070     *
1071     * @param { number } length - the length of text which will be got.It can't be less than 0.
1072     * @param { AsyncCallback<string> } callback - the callback of getBackward.
1073     * @throws { BusinessError } 401 - parameter error. Possible causes:
1074     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1075     * @throws { BusinessError } 12800003 - input method client error.
1076     * @throws { BusinessError } 12800006 - Input method controller error.
1077     * @syscap SystemCapability.MiscServices.InputMethodFramework
1078     * @since 9
1079     */
1080    getBackward(length: number, callback: AsyncCallback<string>): void;
1081
1082    /**
1083     * Get the text after cursor.
1084     *
1085     * @param { number } length - the length of text which will be got.It can't be less than 0.
1086     * @returns { Promise<string> } the promise returned by the function.
1087     * @throws { BusinessError } 401 - parameter error. Possible causes:
1088     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1089     * @throws { BusinessError } 12800003 - input method client error.
1090     * @throws { BusinessError } 12800006 - Input method controller error.
1091     * @syscap SystemCapability.MiscServices.InputMethodFramework
1092     * @since 9
1093     */
1094    getBackward(length: number): Promise<string>;
1095
1096    /**
1097     * Get the text after cursor.
1098     *
1099     * @param { number } length - the length of text which will be got. It can't be less than 0.
1100     * @returns { string } the text string after cursor.
1101     * @throws { BusinessError } 401 - parameter error. Possible causes:
1102     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1103     * @throws { BusinessError } 12800003 - input method client error.
1104     * @throws { BusinessError } 12800006 - input method controller error.
1105     * @syscap SystemCapability.MiscServices.InputMethodFramework
1106     * @since 10
1107     */
1108    getBackwardSync(length: number): string;
1109
1110    /**
1111     * Get attribute about editor.
1112     *
1113     * @param { AsyncCallback<EditorAttribute> } callback - the callback of getEditorAttribute.
1114     * @throws { BusinessError } 12800003 - input method client error.
1115     * @syscap SystemCapability.MiscServices.InputMethodFramework
1116     * @since 9
1117     */
1118    getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
1119
1120    /**
1121     * Get attribute about editor.
1122     *
1123     * @returns { Promise<EditorAttribute> } the promise returned by the function.
1124     * @throws { BusinessError } 12800003 - input method client error.
1125     * @syscap SystemCapability.MiscServices.InputMethodFramework
1126     * @since 9
1127     */
1128    getEditorAttribute(): Promise<EditorAttribute>;
1129
1130    /**
1131     * Get attribute about editor.
1132     *
1133     * @returns { EditorAttribute } the attribute of editor.
1134     * @throws { BusinessError } 12800003 - input method client error.
1135     * @syscap SystemCapability.MiscServices.InputMethodFramework
1136     * @since 10
1137     */
1138    getEditorAttributeSync(): EditorAttribute;
1139
1140    /**
1141     * Move cursor from input method.
1142     *
1143     * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
1144     * @param { AsyncCallback<void> } callback - the callback of moveCursor.
1145     * @throws { BusinessError } 401 - parameter error. Possible causes:
1146     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1147     * @throws { BusinessError } 12800003 - input method client error.
1148     * @syscap SystemCapability.MiscServices.InputMethodFramework
1149     * @since 9
1150     */
1151    moveCursor(direction: number, callback: AsyncCallback<void>): void;
1152
1153    /**
1154     * Move cursor from input method.
1155     *
1156     * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
1157     * @returns { Promise<void> } the promise returned by the function.
1158     * @throws { BusinessError } 401 - parameter error. Possible causes:
1159     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1160     * @throws { BusinessError } 12800003 - input method client error.
1161     * @syscap SystemCapability.MiscServices.InputMethodFramework
1162     * @since 9
1163     */
1164    moveCursor(direction: number): Promise<void>;
1165
1166    /**
1167     * Move cursor from input method.
1168     *
1169     * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
1170     * @throws { BusinessError } 401 - parameter error. Possible causes:
1171     *    1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1172     * @throws { BusinessError } 12800003 - input method client error.
1173     * @syscap SystemCapability.MiscServices.InputMethodFramework
1174     * @since 10
1175     */
1176    moveCursorSync(direction: number): void;
1177
1178    /**
1179     * Select text in editor by range.
1180     *
1181     * @param { Range } range - indicates the range of selected text in editor.
1182     * @param { AsyncCallback<void> } callback - the callback of selectByRange.
1183     * @throws { BusinessError } 401 - parameter error. Possible causes:
1184     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1185     * @throws { BusinessError } 12800003 - input method client error.
1186     * @syscap SystemCapability.MiscServices.InputMethodFramework
1187     * @since 10
1188     */
1189    selectByRange(range: Range, callback: AsyncCallback<void>): void;
1190
1191    /**
1192     * Select text in editor by range.
1193     *
1194     * @param { Range } range - indicates the range of selected text in editor.
1195     * @returns { Promise<void> } the promise returned by the function.
1196     * @throws { BusinessError } 401 - parameter error. Possible causes:
1197     *    1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1198     * @throws { BusinessError } 12800003 - input method client error.
1199     * @syscap SystemCapability.MiscServices.InputMethodFramework
1200     * @since 10
1201     */
1202    selectByRange(range: Range): Promise<void>;
1203
1204    /**
1205     * Select text in editor by range.
1206     *
1207     * @param { Range } range - indicates the range of selected text in editor.
1208     * @throws { BusinessError } 401 - parameter error. Possible causes:
1209     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1210     * @throws { BusinessError } 12800003 - input method client error.
1211     * @syscap SystemCapability.MiscServices.InputMethodFramework
1212     * @since 10
1213     */
1214    selectByRangeSync(range: Range): void;
1215
1216    /**
1217     * Select text in editor by cursor movement.
1218     *
1219     * @param { Movement } movement - indicates the movement of cursor when selecting.
1220     * @param { AsyncCallback<void> } callback - the callback of selectByMovement.
1221     * @throws { BusinessError } 401 - parameter error. Possible causes:
1222     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1223     * @throws { BusinessError } 12800003 - input method client error.
1224     * @syscap SystemCapability.MiscServices.InputMethodFramework
1225     * @since 10
1226     */
1227    selectByMovement(movement: Movement, callback: AsyncCallback<void>): void;
1228
1229    /**
1230     * Select text in editor by cursor movement.
1231     *
1232     * @param { Movement } movement - indicates the movement of cursor when selecting.
1233     * @returns { Promise<void> } the promise returned by the function.
1234     * @throws { BusinessError } 401 - parameter error. Possible causes:
1235     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1236     * @throws { BusinessError } 12800003 - input method client error.
1237     * @syscap SystemCapability.MiscServices.InputMethodFramework
1238     * @since 10
1239     */
1240    selectByMovement(movement: Movement): Promise<void>;
1241
1242    /**
1243     * Select text in editor by cursor movement.
1244     *
1245     * @param { Movement } movement - indicates the movement of cursor when selecting.
1246     * @throws { BusinessError } 401 - parameter error. Possible causes:
1247     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1248     * @throws { BusinessError } 12800003 - input method client error.
1249     * @syscap SystemCapability.MiscServices.InputMethodFramework
1250     * @since 10
1251     */
1252    selectByMovementSync(movement: Movement): void;
1253
1254    /**
1255     * Get the index number of text at cursor.
1256     *
1257     * @param { AsyncCallback<number> } callback - the callback of getTextIndexAtCursor, number represents the index
1258     *        number of text at cursor.
1259     * @throws { BusinessError } 12800003 - input method client error.
1260     * @throws { BusinessError } 12800006 - Input method controller error.
1261     * @syscap SystemCapability.MiscServices.InputMethodFramework
1262     * @since 10
1263     */
1264    getTextIndexAtCursor(callback: AsyncCallback<number>): void;
1265
1266    /**
1267     * Get the index number of text at cursor.
1268     *
1269     * @returns { Promise<number> } the promise returned by the function, number represents the index number of text
1270     *          at cursor.
1271     * @throws { BusinessError } 12800003 - input method client error.
1272     * @throws { BusinessError } 12800006 - Input method controller error.
1273     * @syscap SystemCapability.MiscServices.InputMethodFramework
1274     * @since 10
1275     */
1276    getTextIndexAtCursor(): Promise<number>;
1277
1278    /**
1279     * Get the index number of text at cursor.
1280     *
1281     * @returns { number } the index number of text at cursor.
1282     * @throws { BusinessError } 12800003 - input method client error.
1283     * @throws { BusinessError } 12800006 - Input method controller error.
1284     * @syscap SystemCapability.MiscServices.InputMethodFramework
1285     * @since 10
1286     */
1287    getTextIndexAtCursorSync(): number;
1288
1289    /**
1290     * Send extend action code.
1291     *
1292     * @param { ExtendAction } action - action code which will be send.
1293     * @param { AsyncCallback<void> } callback - the callback of sendExtendAction.
1294     * @throws { BusinessError } 401 - parameter error. Possible causes:
1295     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types
1296     * @throws { BusinessError } 12800003 - input method client error.
1297     * @throws { BusinessError } 12800006 - Input method controller error.
1298     * @syscap SystemCapability.MiscServices.InputMethodFramework
1299     * @since 10
1300     */
1301    sendExtendAction(action: ExtendAction, callback: AsyncCallback<void>): void;
1302
1303    /**
1304     * Send extend action code.
1305     *
1306     * @param { ExtendAction } action - action code which will be send.
1307     * @returns { Promise<void> } the promise returned by the function.
1308     * @throws { BusinessError } 401 - parameter error. Possible causes:
1309     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types
1310     * @throws { BusinessError } 12800003 - input method client error.
1311     * @throws { BusinessError } 12800006 - Input method controller error.
1312     * @syscap SystemCapability.MiscServices.InputMethodFramework
1313     * @since 10
1314     */
1315    sendExtendAction(action: ExtendAction): Promise<void>;
1316
1317    /**
1318     * Send private command.This function can only be called by default input method configured by system.
1319     *
1320     * @param { Record<string, CommandDataType> } commandData - command data which will be send.Max size 32KB.
1321     * @returns { Promise<void> } the promise returned by the function.
1322     * @throws { BusinessError } 401 - parameter error. Possible causes:
1323     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1324     * @throws { BusinessError } 12800003 - input method client error.
1325     * @throws { BusinessError } 12800010 - not default input method configured by system.
1326     * @syscap SystemCapability.MiscServices.InputMethodFramework
1327     * @since 12
1328     */
1329    sendPrivateCommand(commandData: Record<string, CommandDataType>): Promise<void>;
1330
1331    /**
1332     * Get info of the calling window.
1333     *
1334     * @returns { Promise<WindowInfo> } the promise returned by the function.
1335     * @throws { BusinessError } 12800003 - input method client error.
1336     * @throws { BusinessError } 12800012 - input method panel doesn't exist.
1337     * @throws { BusinessError } 12800013 - window manager service error.
1338     * @syscap SystemCapability.MiscServices.InputMethodFramework
1339     * @since 12
1340     */
1341    getCallingWindowInfo(): Promise<WindowInfo>;
1342
1343    /**
1344     * Insert the provided text as preview text.
1345     *
1346     * @param { string } text - the text to be previewed.
1347     * @param { Range } range - the range of the text to be replaced by the preview text.
1348     * @returns { Promise<void> } the promise returned by the function.
1349     * @throws { BusinessError } 401 - parameter error. Possible causes:
1350     *    1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1351     * @throws { BusinessError } 12800003 - input method client error.
1352     * @throws { BusinessError } 12800011 - text preview is not supported.
1353     * @syscap SystemCapability.MiscServices.InputMethodFramework
1354     * @since 12
1355     */
1356    setPreviewText(text: string, range: Range): Promise<void>;
1357
1358    /**
1359     * Insert the provided text as preview text.
1360     *
1361     * @param { string } text - the text to be previewed.
1362     * @param { Range } range - the range of the text to be replaced by the preview text.
1363     * @throws { BusinessError } 401 - parameter error. Possible causes:
1364     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1365     * @throws { BusinessError } 12800003 - input method client error.
1366     * @throws { BusinessError } 12800011 - text preview is not supported.
1367     * @syscap SystemCapability.MiscServices.InputMethodFramework
1368     * @since 12
1369     */
1370    setPreviewTextSync(text: string, range: Range): void;
1371
1372    /**
1373     * Finish the text preview.
1374     *
1375     * @returns { Promise<void> } the promise returned by the function.
1376     * @throws { BusinessError } 12800003 - input method client error.
1377     * @throws { BusinessError } 12800011 - text preview is not supported.
1378     * @syscap SystemCapability.MiscServices.InputMethodFramework
1379     * @since 12
1380     */
1381    finishTextPreview(): Promise<void>;
1382
1383    /**
1384     * Finish the text preview.
1385     *
1386     * @throws { BusinessError } 12800003 - input method client error.
1387     * @throws { BusinessError } 12800011 - text preview is not supported.
1388     * @syscap SystemCapability.MiscServices.InputMethodFramework
1389     * @since 12
1390     */
1391    finishTextPreviewSync(): void;
1392  }
1393
1394  /**
1395   * @interface KeyboardDelegate
1396   * @syscap SystemCapability.MiscServices.InputMethodFramework
1397   * @since 8
1398   */
1399  interface KeyboardDelegate {
1400    /**
1401     * Subscribe key up or down event
1402     *
1403     * @param { 'keyDown' | 'keyUp' } type - indicates the type of subscribe event.
1404     * @param { function } callback - indicates the callback function of on('keyDown'|'keyUp').
1405     * @syscap SystemCapability.MiscServices.InputMethodFramework
1406     * @since 8
1407     */
1408    on(type: 'keyDown' | 'keyUp', callback: (event: KeyEvent) => boolean): void;
1409
1410    /**
1411     * Unsubscribe key up or down event
1412     *
1413     * @param { 'keyDown' | 'keyUp' } type - indicates the type of unsubscribe event.
1414     * @param { function } [callback] - optional, indicates the callback function of off('keyDown'|'keyUp').
1415     * @syscap SystemCapability.MiscServices.InputMethodFramework
1416     * @since 8
1417     */
1418    off(type: 'keyDown' | 'keyUp', callback?: (event: KeyEvent) => boolean): void;
1419
1420    /**
1421     * Subscribe key event.
1422     *
1423     * @param { 'keyEvent' } type - indicates the type of subscribe event.
1424     * @param { function } callback - indicates the callback function of on('keyEvent').
1425     *     If the key is processed by event subscriber, callback should be return true, else return false.
1426     * @syscap SystemCapability.MiscServices.InputMethodFramework
1427     * @since 10
1428     */
1429    on(type: 'keyEvent', callback: (event: InputKeyEvent) => boolean): void;
1430
1431    /**
1432     * Unsubscribe key event.
1433     *
1434     * @param { 'keyEvent' } type - indicates the type of unsubscribe event.
1435     * @param { function } [callback] - optional, indicates the callback function of off('keyEvent').
1436     * @syscap SystemCapability.MiscServices.InputMethodFramework
1437     * @since 10
1438     */
1439    off(type: 'keyEvent', callback?: (event: InputKeyEvent) => boolean): void;
1440
1441    /**
1442     * Subscribe cursor context change
1443     *
1444     * @param { 'cursorContextChange' } type - indicates the type of subscribe event.
1445     * @param { function } callback - indicates the callback function of on('cursorContextChange').
1446     * @syscap SystemCapability.MiscServices.InputMethodFramework
1447     * @since 8
1448     */
1449    on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;
1450
1451    /**
1452     * Unsubscribe cursor context change
1453     *
1454     * @param { 'cursorContextChange' } type - indicates the type of unsubscribe event.
1455     * @param { function } [callback] - optional, indicates the callback function of off('cursorContextChange').
1456     * @syscap SystemCapability.MiscServices.InputMethodFramework
1457     * @since 8
1458     */
1459    off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;
1460
1461    /**
1462     * Subscribe selection change
1463     *
1464     * @param { 'selectionChange' } type - indicates the type of subscribe event.
1465     * @param { function } callback - indicates the callback function
1466     * of on('selectionChange').
1467     * @syscap SystemCapability.MiscServices.InputMethodFramework
1468     * @since 8
1469     */
1470    on(
1471      type: 'selectionChange',
1472      callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void
1473    ): void;
1474
1475    /**
1476     * Unsubscribe selection change
1477     *
1478     * @param { 'selectionChange' } type - indicates the type of unsubscribe event.
1479     * @param { function } [callback] - optional,
1480     * indicates the callback function of off('selectionChange').
1481     * @syscap SystemCapability.MiscServices.InputMethodFramework
1482     * @since 8
1483     */
1484    off(
1485      type: 'selectionChange',
1486      callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void
1487    ): void;
1488
1489    /**
1490     * Subscribe text change
1491     *
1492     * @param { 'textChange' } type - indicates the type of subscribe event.
1493     * @param { function } callback - indicates the callback function of on('textChange').
1494     * @syscap SystemCapability.MiscServices.InputMethodFramework
1495     * @since 8
1496     */
1497    on(type: 'textChange', callback: (text: string) => void): void;
1498
1499    /**
1500     * Unsubscribe text change
1501     *
1502     * @param { 'textChange' } type - indicates the type of unsubscribe event.
1503     * @param { function } [callback] - optional, indicates the callback function of off('textChange').
1504     * @syscap SystemCapability.MiscServices.InputMethodFramework
1505     * @since 8
1506     */
1507    off(type: 'textChange', callback?: (text: string) => void): void;
1508
1509    /**
1510     * Subscribe input text attribute change
1511     *
1512     * @param { 'editorAttributeChanged' } type - indicates the type of subscribe event.
1513     * @param { function } callback - indicates the callback function of on('editorAttributeChanged').
1514     * @syscap SystemCapability.MiscServices.InputMethodFramework
1515     * @since 10
1516     */
1517    on(type: 'editorAttributeChanged', callback: (attr: EditorAttribute) => void): void;
1518
1519    /**
1520     * Unsubscribe input text attribute change
1521     *
1522     * @param { 'editorAttributeChanged' } type - indicates the type of subscribe event.
1523     * @param { function } [callback] - indicates the callback function of off('editorAttributeChanged').
1524     * @syscap SystemCapability.MiscServices.InputMethodFramework
1525     * @since 10
1526     */
1527    off(type: 'editorAttributeChanged', callback?: (attr: EditorAttribute) => void): void;
1528  }
1529
1530  /**
1531   * A panel is a container used to hold soft keyboard, candidate list, or status bar.
1532   *
1533   * @interface Panel
1534   * @syscap SystemCapability.MiscServices.InputMethodFramework
1535   * @since 10
1536   */
1537  interface Panel {
1538    /**
1539     * Sets ui content.
1540     * <p>When this method is executed successfully, the content of panel will be replaced.</p>
1541     *
1542     * @param { string } path - the path of ui content.
1543     * @param { AsyncCallback<void> } callback - the callback of setUiContent.
1544     * @throws { BusinessError } 401 - parameter error. Possible causes:
1545     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1546     * @syscap SystemCapability.MiscServices.InputMethodFramework
1547     * @since 10
1548     */
1549    setUiContent(path: string, callback: AsyncCallback<void>): void;
1550
1551    /**
1552     * Sets ui content.
1553     * <p>When this method is executed successfully, the content of panel will be replaced.</p>
1554     *
1555     * @param { string } path - the path of ui content.
1556     * @returns { Promise<void> } the promise returned by the function.
1557     * @throws { BusinessError } 401 - parameter error. Possible causes:
1558     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1559     * @syscap SystemCapability.MiscServices.InputMethodFramework
1560     * @since 10
1561     */
1562    setUiContent(path: string): Promise<void>;
1563
1564    /**
1565     * Sets ui content.
1566     * <p>When this method is executed successfully, the content of panel will be replaced.</p>
1567     *
1568     * @param { string } path - the path of ui content.
1569     * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel.
1570     * @param { AsyncCallback<void> } callback - the callback of setUiContent.
1571     * @throws { BusinessError } 401 - parameter error. Possible causes:
1572     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1573     * @syscap SystemCapability.MiscServices.InputMethodFramework
1574     * @since 10
1575     */
1576    setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback<void>): void;
1577
1578    /**
1579     * Sets ui content.
1580     * <p>When this method is executed successfully, the content of panel will be replaced.</p>
1581     *
1582     * @param { string } path - the path of ui content.
1583     * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel.
1584     * @returns { Promise<void> } the promise returned by the function.
1585     * @throws { BusinessError } 401 - parameter error. Possible causes:
1586     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1587     * @syscap SystemCapability.MiscServices.InputMethodFramework
1588     * @since 10
1589     */
1590    setUiContent(path: string, storage: LocalStorage): Promise<void>;
1591
1592    /**
1593     * Resizes a panel.
1594     *
1595     * @param { number } width - the new width of the panel.
1596     * @param { number } height - the new height of the panel.
1597     * @param { AsyncCallback<void> } callback - the callback of resize.
1598     * @throws { BusinessError } 401 - parameter error. Possible causes:
1599     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1600     * @syscap SystemCapability.MiscServices.InputMethodFramework
1601     * @since 10
1602     */
1603    resize(width: number, height: number, callback: AsyncCallback<void>): void;
1604
1605    /**
1606     * Resizes a panel.
1607     *
1608     * @param { number } width - the new width of the panel.
1609     * @param { number } height - the new height of the panel.
1610     * @returns { Promise<void> } the promise returned by the function.
1611     * @throws { BusinessError } 401 - parameter error. Possible causes:
1612     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1613     * @syscap SystemCapability.MiscServices.InputMethodFramework
1614     * @since 10
1615     */
1616    resize(width: number, height: number): Promise<void>;
1617
1618    /**
1619     * Moves a panel.
1620     * <p>It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.</p>
1621     *
1622     * @param { number } x - the x-coordinate of the new position.
1623     * @param { number } y - the y-coordinate of the new position.
1624     * @param { AsyncCallback<void> } callback - the callback of moveTo.
1625     * @throws { BusinessError } 401 - parameter error. Possible causes:
1626     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1627     * @syscap SystemCapability.MiscServices.InputMethodFramework
1628     * @since 10
1629     */
1630    moveTo(x: number, y: number, callback: AsyncCallback<void>): void;
1631
1632    /**
1633     * Moves a panel.
1634     * <p>It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.</p>
1635     *
1636     * @param { number } x - the x-coordinate of the new position.
1637     * @param { number } y - the y-coordinate of the new position.
1638     * @returns { Promise<void> } the promise returned by the function.
1639     * @throws { BusinessError } 401 - parameter error. Possible causes:
1640     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1641     * @syscap SystemCapability.MiscServices.InputMethodFramework
1642     * @since 10
1643     */
1644    moveTo(x: number, y: number): Promise<void>;
1645
1646    /**
1647     * Shows panel.
1648     *
1649     * @param { AsyncCallback<void> } callback - the callback of show.
1650     * @syscap SystemCapability.MiscServices.InputMethodFramework
1651     * @since 10
1652     */
1653    show(callback: AsyncCallback<void>): void;
1654
1655    /**
1656     * Shows panel.
1657     *
1658     * @returns { Promise<void> } the promise returned by the function.
1659     * @syscap SystemCapability.MiscServices.InputMethodFramework
1660     * @since 10
1661     */
1662    show(): Promise<void>;
1663
1664    /**
1665     * Hides panel.
1666     *
1667     * @param { AsyncCallback<void> } callback - the callback of hide.
1668     * @syscap SystemCapability.MiscServices.InputMethodFramework
1669     * @since 10
1670     */
1671    hide(callback: AsyncCallback<void>): void;
1672
1673    /**
1674     * Hides panel.
1675     *
1676     * @returns { Promise<void> } the promise returned by the function.
1677     * @syscap SystemCapability.MiscServices.InputMethodFramework
1678     * @since 10
1679     */
1680    hide(): Promise<void>;
1681
1682    /**
1683     * Registers panel show event.
1684     * <p>The "show" events are triggered when the panel is shown.</p>
1685     *
1686     * @param { 'show' } type - events type.
1687     * @param { function } callback - the callback will be called when events are triggered.
1688     * @syscap SystemCapability.MiscServices.InputMethodFramework
1689     * @since 10
1690     */
1691    on(type: 'show', callback: () => void): void;
1692
1693    /**
1694     * Unregisters panel show event.
1695     *
1696     * @param { 'show' } type - events type.
1697     * @param { function } [callback] - the callback to Unregister.
1698     * @throws { BusinessError } 401 - parameter error. Possible causes:
1699     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1700     * @syscap SystemCapability.MiscServices.InputMethodFramework
1701     * @since 10
1702     */
1703    off(type: 'show', callback?: () => void): void;
1704
1705    /**
1706     * Registers panel hide event.
1707     * <p>The "hide" events are triggered when the panel is hidden.</p>
1708     *
1709     * @param { 'hide' } type - events type.
1710     * @param { function } callback - the callback will be called when events are triggered.
1711     * @syscap SystemCapability.MiscServices.InputMethodFramework
1712     * @since 10
1713     */
1714    on(type: 'hide', callback: () => void): void;
1715
1716    /**
1717     * Unregisters panel hide event.
1718     *
1719     * @param { 'hide' } type - events type.
1720     * @param { function } [callback] - the callback to Unregister.
1721     * @throws { BusinessError } 401 - parameter error. Possible causes:
1722     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1723     * @syscap SystemCapability.MiscServices.InputMethodFramework
1724     * @since 10
1725     */
1726    off(type: 'hide', callback?: () => void): void;
1727
1728    /**
1729     * Changes panel flag.
1730     * <p>Before flag is changed, Developers should hide the panel.After that, developers can change the content, size, point of the panel
1731     *    and show it again at appropriate opportunity.</p>
1732     *
1733     * @param { PanelFlag } flag - the callback of changeFlag.
1734     * @throws { BusinessError } 401 - parameter error. Possible causes:
1735     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1736     * @syscap SystemCapability.MiscServices.InputMethodFramework
1737     * @since 10
1738     */
1739    changeFlag(flag: PanelFlag): void;
1740
1741    /**
1742     * Sets ime panel private mode or not.
1743     *
1744     * @permission ohos.permission.PRIVACY_WINDOW
1745     * @param { boolean } isPrivacyMode - if the value is true, the privacy mode will be set,
1746     * otherwise the non-privacy mode will be set.
1747     * @throws { BusinessError } 201 - permissions check fails.
1748     * @throws { BusinessError } 401 - parameter error. Possible causes:
1749     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
1750     * @syscap SystemCapability.MiscServices.InputMethodFramework
1751     * @since 11
1752     */
1753    setPrivacyMode(isPrivacyMode: boolean): void;
1754
1755    /**
1756     * Adjust the rect of soft keyboard panel for landscape and portrait orientations.
1757     * <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
1758     *
1759     * @param { PanelFlag } flag - panel flag.
1760     * @param { PanelRect } rect - panel rect.
1761     * @throws { BusinessError } 401 - parameter error. Possible causes:
1762     *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
1763     * @throws { BusinessError } 12800013 - window manager service error.
1764     * @syscap SystemCapability.MiscServices.InputMethodFramework
1765     * @since 12
1766     */
1767    adjustPanelRect(flag: PanelFlag, rect: PanelRect): void;
1768
1769    /**
1770     * Subscribe 'sizeChange' event.
1771     * <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
1772     *
1773     * @param { 'sizeChange' } type - the type of subscribe event.
1774     * @param { Callback<window.Size> } callback - the callback of on('sizeChange').
1775     * @syscap SystemCapability.MiscServices.InputMethodFramework
1776     * @since 12
1777     */
1778    on(type: 'sizeChange', callback: Callback<window.Size>): void;
1779
1780    /**
1781     * Unsubscribe 'sizeChange' event.
1782     * <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
1783     *
1784     * @param { 'sizeChange' } type - the type of unsubscribe event.
1785     * @param { Callback<window.Size> } [callback] - optional, the callback of off('sizeChange').
1786     * @syscap SystemCapability.MiscServices.InputMethodFramework
1787     * @since 12
1788     */
1789    off(type: 'sizeChange', callback?: Callback<window.Size>): void;
1790  }
1791
1792  /**
1793   * @interface EditorAttribute
1794   * @syscap SystemCapability.MiscServices.InputMethodFramework
1795   * @since 8
1796   */
1797  interface EditorAttribute {
1798    /**
1799     * Editor's pattern
1800     *
1801     * @type { number }
1802     * @syscap SystemCapability.MiscServices.InputMethodFramework
1803     * @since 8
1804     */
1805    readonly inputPattern: number;
1806
1807    /**
1808     * Editor's key type
1809     *
1810     * @type { number }
1811     * @syscap SystemCapability.MiscServices.InputMethodFramework
1812     * @since 8
1813     */
1814    readonly enterKeyType: number;
1815
1816    /**
1817     * Indicates whether the editor supports the text preview.
1818     *
1819     * @type { boolean }
1820     * @syscap SystemCapability.MiscServices.InputMethodFramework
1821     * @since 12
1822     */
1823    isTextPreviewSupported: boolean;
1824  }
1825
1826  /**
1827   * @interface KeyEvent
1828   * @syscap SystemCapability.MiscServices.InputMethodFramework
1829   * @since 8
1830   */
1831  interface KeyEvent {
1832    /**
1833     * Key code
1834     *
1835     * @type { number }
1836     * @syscap SystemCapability.MiscServices.InputMethodFramework
1837     * @since 8
1838     */
1839    readonly keyCode: number;
1840
1841    /**
1842     * Key action
1843     *
1844     * @type { number }
1845     * @syscap SystemCapability.MiscServices.InputMethodFramework
1846     * @since 8
1847     */
1848    readonly keyAction: number;
1849  }
1850
1851  /**
1852   * Enumerates the flags of panel
1853   *
1854   * @enum { number }
1855   * @syscap SystemCapability.MiscServices.InputMethodFramework
1856   * @since 10
1857   */
1858  export enum PanelFlag {
1859    /**
1860     * Fixed style.
1861     * <p>It's provided for the panel with type of SOFT_KEYBOARD.
1862     * When the flag is set, the soft keyboard is fixed at the bottom of the screen.</p>
1863     *
1864     * @syscap SystemCapability.MiscServices.InputMethodFramework
1865     * @since 10
1866     */
1867    FLG_FIXED = 0,
1868
1869    /**
1870     * Floating style.
1871     * <p>It's provided for the panel with type of SOFT_KEYBOARD.
1872     * When the flag is set, the soft keyboard is floating.</p>
1873     *
1874     * @syscap SystemCapability.MiscServices.InputMethodFramework
1875     * @since 10
1876     */
1877    FLG_FLOATING
1878  }
1879
1880  /**
1881   * <p>Panel types provided for input method applications.</p>
1882   * <p>Input method application developers should select the appropriate panel type according to the user scenario.</p>
1883   *
1884   * @enum { number }
1885   * @syscap SystemCapability.MiscServices.InputMethodFramework
1886   * @since 10
1887   */
1888  export enum PanelType {
1889    /**
1890     * Panel for displaying a virtual software keyboard.
1891     *
1892     * @syscap SystemCapability.MiscServices.InputMethodFramework
1893     * @since 10
1894     */
1895    SOFT_KEYBOARD = 0,
1896
1897    /**
1898     * Panel for displaying status bar.
1899     *
1900     * @syscap SystemCapability.MiscServices.InputMethodFramework
1901     * @since 10
1902     */
1903    STATUS_BAR
1904  }
1905
1906  /**
1907   * Panel information.
1908   *
1909   * @typedef PanelInfo
1910   * @syscap SystemCapability.MiscServices.InputMethodFramework
1911   * @since 10
1912   */
1913  export interface PanelInfo {
1914    /**
1915     * Panel type.
1916     *
1917     * @type { PanelType }
1918     * @syscap SystemCapability.MiscServices.InputMethodFramework
1919     * @since 10
1920     */
1921    type: PanelType;
1922
1923    /**
1924     * <p>Flag of Panel.</p>
1925     * <p>Currently only using for SOFT_KEYBOARD panel.</p>
1926     *
1927     * @type { ?PanelFlag }
1928     * @default FLG_FIXED
1929     * @syscap SystemCapability.MiscServices.InputMethodFramework
1930     * @since 10
1931     */
1932    flag?: PanelFlag;
1933  }
1934
1935  /**
1936   * Enumerates the moving direction of cursor
1937   *
1938   * @enum { number }
1939   * @syscap SystemCapability.MiscServices.InputMethodFramework
1940   * @since 10
1941   */
1942  export enum Direction {
1943    /**
1944     * Cursor moves up
1945     *
1946     * @syscap SystemCapability.MiscServices.InputMethodFramework
1947     * @since 10
1948     */
1949    CURSOR_UP = 1,
1950
1951    /**
1952     * Cursor moves down
1953     *
1954     * @syscap SystemCapability.MiscServices.InputMethodFramework
1955     * @since 10
1956     */
1957    CURSOR_DOWN,
1958
1959    /**
1960     * Cursor moves left
1961     *
1962     * @syscap SystemCapability.MiscServices.InputMethodFramework
1963     * @since 10
1964     */
1965    CURSOR_LEFT,
1966
1967    /**
1968     * Cursor moves right
1969     *
1970     * @syscap SystemCapability.MiscServices.InputMethodFramework
1971     * @since 10
1972     */
1973    CURSOR_RIGHT
1974  }
1975
1976  /**
1977   * Enumerates the security mode.
1978   *
1979   * @enum { number }
1980   * @syscap SystemCapability.MiscServices.InputMethodFramework
1981   * @since 11
1982   */
1983  export enum SecurityMode {
1984    /**
1985     * Basic security mode
1986     *
1987     * @syscap SystemCapability.MiscServices.InputMethodFramework
1988     * @since 11
1989     */
1990    BASIC = 0,
1991    /**
1992     * Full security mode
1993     *
1994     * @syscap SystemCapability.MiscServices.InputMethodFramework
1995     * @since 11
1996     */
1997    FULL
1998  }
1999
2000  /**
2001   * Range of selected text.
2002   *
2003   * @interface Range
2004   * @syscap SystemCapability.MiscServices.InputMethodFramework
2005   * @since 10
2006   */
2007  export interface Range {
2008    /**
2009     * Indicates the index of the first character of the selected text.
2010     *
2011     * @type { number }
2012     * @syscap SystemCapability.MiscServices.InputMethodFramework
2013     * @since 10
2014     */
2015    start: number;
2016
2017    /**
2018     * Indicates the index of the last character of the selected text.
2019     *
2020     * @type { number }
2021     * @syscap SystemCapability.MiscServices.InputMethodFramework
2022     * @since 10
2023     */
2024    end: number;
2025  }
2026
2027  /**
2028   * Movement of cursor.
2029   *
2030   * @interface Movement
2031   * @syscap SystemCapability.MiscServices.InputMethodFramework
2032   * @since 10
2033   */
2034  export interface Movement {
2035    /**
2036     * Indicates the direction of cursor movement
2037     *
2038     * @type { Direction }
2039     * @syscap SystemCapability.MiscServices.InputMethodFramework
2040     * @since 10
2041     */
2042    direction: Direction;
2043  }
2044
2045  /**
2046   * Enumerates the extend action.
2047   *
2048   * @enum { number }
2049   * @syscap SystemCapability.MiscServices.InputMethodFramework
2050   * @since 10
2051   */
2052  export enum ExtendAction {
2053    /**
2054     * Select all text.
2055     *
2056     * @syscap SystemCapability.MiscServices.InputMethodFramework
2057     * @since 10
2058     */
2059    SELECT_ALL = 0,
2060
2061    /**
2062     * Cut selecting text.
2063     *
2064     * @syscap SystemCapability.MiscServices.InputMethodFramework
2065     * @since 10
2066     */
2067    CUT = 3,
2068
2069    /**
2070     * Copy selecting text.
2071     *
2072     * @syscap SystemCapability.MiscServices.InputMethodFramework
2073     * @since 10
2074     */
2075    COPY = 4,
2076
2077    /**
2078     * Paste from paste board.
2079     *
2080     * @syscap SystemCapability.MiscServices.InputMethodFramework
2081     * @since 10
2082     */
2083    PASTE = 5
2084  }
2085
2086  /**
2087   * Window info.
2088   *
2089   * @interface WindowInfo
2090   * @syscap SystemCapability.MiscServices.InputMethodFramework
2091   * @since 12
2092   */
2093  export interface WindowInfo {
2094    /**
2095     * Rectangle.
2096     *
2097     * @type { window.Rect }
2098     * @syscap SystemCapability.MiscServices.InputMethodFramework
2099     * @since 12
2100     */
2101    rect: window.Rect;
2102
2103    /**
2104     * Window status.
2105     *
2106     * @type { window.WindowStatusType }
2107     * @syscap SystemCapability.MiscServices.InputMethodFramework
2108     * @since 12
2109     */
2110    status: window.WindowStatusType;
2111  }
2112
2113  /**
2114   * Panel Rect.
2115   *
2116   * @interface PanelRect
2117   * @syscap SystemCapability.MiscServices.InputMethodFramework
2118   * @since 12
2119   */
2120  export interface PanelRect {
2121    /**
2122     * Panel rect in landscape orientation.
2123     *
2124     * @type { window.Rect }
2125     * @syscap SystemCapability.MiscServices.InputMethodFramework
2126     * @since 12
2127     */
2128    landscapeRect: window.Rect;
2129
2130    /**
2131     * Panel rect in portrait orientation.
2132     *
2133     * @type { window.Rect }
2134     * @syscap SystemCapability.MiscServices.InputMethodFramework
2135     * @since 12
2136     */
2137    portraitRect: window.Rect;
2138  }
2139}
2140
2141export default inputMethodEngine;
2142