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