Control events about IME.
*Events provided for IME to subscribe with callback function. When those events occur, the corresponding callback * will be invoked.
* * @interface InputMethodAbility * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ interface InputMethodAbility { /** * Subscribe 'inputStart' event. * * @param { 'inputStart' } type - the type of subscribe event. * @param { function } callback - the callback of on('inputStart'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void; /** * Unsubscribe 'inputStart' event. * * @param { 'inputStart' } type - the type of unsubscribe event. * @param { function } [callback] - optional, the callback of off('inputStart'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void; /** * Subscribe 'inputStop'. * * @param { 'inputStop' } type - the type of subscribe event. * @param { function } callback - the callback of on('inputStop'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ on(type: 'inputStop', callback: () => void): void; /** * Unsubscribe 'inputStop'. * * @param { 'inputStop' } type - the type of unsubscribe event. * @param { function } callback - the callback of off('inputStop'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ off(type: 'inputStop', callback: () => void): void; /** * Subscribe 'setCallingWindow'. * * @param { 'setCallingWindow' } type - the type of subscribe event. * @param { function } callback - the callback of on('setCallingWindow'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ on(type: 'setCallingWindow', callback: (wid: number) => void): void; /** * Unsubscribe 'setCallingWindow'. * * @param { 'setCallingWindow' } type - the type of unsubscribe event. * @param { function } callback - the callback of off('setCallingWindow'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ off(type: 'setCallingWindow', callback: (wid: number) => void): void; /** * Subscribe 'keyboardShow'|'keyboardHide'. * * @param { 'keyboardShow' | 'keyboardHide' } type - the type of subscribe event. * @param { function } callback - the callback of on('keyboardShow'|'keyboardHide'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void; /** * Unsubscribe 'keyboardShow'|'keyboardHide'. * * @param { 'keyboardShow' | 'keyboardHide' } type - the type of unsubscribe event. * @param { function } [callback] - the callback of off('keyboardShow'|'keyboardHide'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void; /** * Subscribe 'setSubtype'. * * @param { 'setSubtype' } type - the type of subscribe event. * @param { function } callback - the callback of on('setSubtype'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void; /** * Unsubscribe 'setSubtype'. * * @param { 'setSubtype' } type - the type of subscribe event. * @param { function } [callback] - the callback of off('setSubtype'). * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 9 */ off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; /** * Subscribe 'securityModeChange' event. * * @param { 'securityModeChange' } type - the type of subscribe event. * @param { CallbackThe system only allows one soft keyboard and one status bar to be created.
* * @param { BaseContext } ctx - indicates the context on which the window depends. * @param { PanelInfo } info - the info of panel to be created. * @param { AsyncCallbackThe system only allows one soft keyboard and one status bar to be created.
* * @param { BaseContext } ctx - indicates the context on which the window depends. * @param { PanelInfo } info - the info of panel to be created. * @returns { PromiseWhen this method is executed successfully, the content of panel will be replaced.
* * @param { string } path - the path of ui content. * @param { AsyncCallbackWhen this method is executed successfully, the content of panel will be replaced.
* * @param { string } path - the path of ui content. * @returns { PromiseWhen this method is executed successfully, the content of panel will be replaced.
* * @param { string } path - the path of ui content. * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel. * @param { AsyncCallbackWhen this method is executed successfully, the content of panel will be replaced.
* * @param { string } path - the path of ui content. * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel. * @returns { PromiseIt's unusable for SOFT_KEYBOARD panel with FLG_FIXED.
* * @param { number } x - the x-coordinate of the new position. * @param { number } y - the y-coordinate of the new position. * @param { AsyncCallbackIt's unusable for SOFT_KEYBOARD panel with FLG_FIXED.
* * @param { number } x - the x-coordinate of the new position. * @param { number } y - the y-coordinate of the new position. * @returns { PromiseThe "show" events are triggered when the panel is shown.
* * @param { 'show' } type - events type. * @param { function } callback - the callback will be called when events are triggered. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ on(type: 'show', callback: () => void): void; /** * Unregisters panel show event. * * @param { 'show' } type - events type. * @param { function } [callback] - the callback to Unregister. * @throws { BusinessError } 401 - parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ off(type: 'show', callback?: () => void): void; /** * Registers panel hide event. *The "hide" events are triggered when the panel is hidden.
* * @param { 'hide' } type - events type. * @param { function } callback - the callback will be called when events are triggered. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ on(type: 'hide', callback: () => void): void; /** * Unregisters panel hide event. * * @param { 'hide' } type - events type. * @param { function } [callback] - the callback to Unregister. * @throws { BusinessError } 401 - parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ off(type: 'hide', callback?: () => void): void; /** * Changes panel flag. *Before flag is changed, Developers should hide the panel.After that, developers can change the content, size, point of the panel * and show it again at appropriate opportunity.
* * @param { PanelFlag } flag - the callback of changeFlag. * @throws { BusinessError } 401 - parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ changeFlag(flag: PanelFlag): void; /** * Sets ime panel private mode or not. * * @permission ohos.permission.PRIVACY_WINDOW * @param { boolean } isPrivacyMode - if the value is true, the privacy mode will be set, * otherwise the non-privacy mode will be set. * @throws { BusinessError } 201 - permissions check fails. * @throws { BusinessError } 401 - parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ setPrivacyMode(isPrivacyMode: boolean): void; /** * Adjust the rect of soft keyboard panel for landscape and portrait orientations. *It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.
* * @param { PanelFlag } flag - panel flag. * @param { PanelRect } rect - panel rect. * @throws { BusinessError } 401 - parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. * @throws { BusinessError } 12800013 - window manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ adjustPanelRect(flag: PanelFlag, rect: PanelRect): void; /** * Subscribe 'sizeChange' event. *It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.
* * @param { 'sizeChange' } type - the type of subscribe event. * @param { CallbackIt's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.
* * @param { 'sizeChange' } type - the type of unsubscribe event. * @param { CallbackIt's provided for the panel with type of SOFT_KEYBOARD. * When the flag is set, the soft keyboard is fixed at the bottom of the screen.
* * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ FLG_FIXED = 0, /** * Floating style. *It's provided for the panel with type of SOFT_KEYBOARD. * When the flag is set, the soft keyboard is floating.
* * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ FLG_FLOATING } /** *Panel types provided for input method applications.
*Input method application developers should select the appropriate panel type according to the user scenario.
* * @enum { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export enum PanelType { /** * Panel for displaying a virtual software keyboard. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ SOFT_KEYBOARD = 0, /** * Panel for displaying status bar. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ STATUS_BAR } /** * Panel information. * * @typedef PanelInfo * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export interface PanelInfo { /** * Panel type. * * @type { PanelType } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ type: PanelType; /** *Flag of Panel.
*Currently only using for SOFT_KEYBOARD panel.
* * @type { ?PanelFlag } * @default FLG_FIXED * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ flag?: PanelFlag; } /** * Enumerates the moving direction of cursor * * @enum { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export enum Direction { /** * Cursor moves up * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ CURSOR_UP = 1, /** * Cursor moves down * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ CURSOR_DOWN, /** * Cursor moves left * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ CURSOR_LEFT, /** * Cursor moves right * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ CURSOR_RIGHT } /** * Enumerates the security mode. * * @enum { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ export enum SecurityMode { /** * Basic security mode * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ BASIC = 0, /** * Full security mode * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 11 */ FULL } /** * Range of selected text. * * @interface Range * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export interface Range { /** * Indicates the index of the first character of the selected text. * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ start: number; /** * Indicates the index of the last character of the selected text. * * @type { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ end: number; } /** * Movement of cursor. * * @interface Movement * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export interface Movement { /** * Indicates the direction of cursor movement * * @type { Direction } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ direction: Direction; } /** * Enumerates the extend action. * * @enum { number } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ export enum ExtendAction { /** * Select all text. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ SELECT_ALL = 0, /** * Cut selecting text. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ CUT = 3, /** * Copy selecting text. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ COPY = 4, /** * Paste from paste board. * * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 10 */ PASTE = 5 } /** * Window info. * * @interface WindowInfo * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ export interface WindowInfo { /** * Rectangle. * * @type { window.Rect } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ rect: window.Rect; /** * Window status. * * @type { window.WindowStatusType } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ status: window.WindowStatusType; } /** * Panel Rect. * * @interface PanelRect * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ export interface PanelRect { /** * Panel rect in landscape orientation. * * @type { window.Rect } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ landscapeRect: window.Rect; /** * Panel rect in portrait orientation. * * @type { window.Rect } * @syscap SystemCapability.MiscServices.InputMethodFramework * @since 12 */ portraitRect: window.Rect; } } export default inputMethodEngine;