46 Star 173 Fork 4.7K

OpenHarmony/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.inputMethodEngine.d.ts 107.21 KB
一键复制 编辑 原始数据 按行查看 历史
guojin31 提交于 15天前 . 修改单词拼写错误
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001
/*
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit IMEKit
*/
import type { AsyncCallback, Callback } from './@ohos.base';
import type { KeyEvent as InputKeyEvent } from './@ohos.multimodalInput.keyEvent';
import InputMethodSubtype from './@ohos.InputMethodSubtype';
import BaseContext from './application/BaseContext';
import window from './@ohos.window';
/**
* Input method engine
*
* @namespace inputMethodEngine
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
declare namespace inputMethodEngine {
/**
* When "enter" key is pressed, there is no action
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_UNSPECIFIED: number;
/**
* When "enter" key is pressed, it means GO
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_GO: number;
/**
* When "enter" key is pressed, it means SEARCH
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_SEARCH: number;
/**
* When "enter" key is pressed, it means SEND
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_SEND: number;
/**
* When "enter" key is pressed, it means NEXT
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_NEXT: number;
/**
* When "enter" key is pressed, it means DONE
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_DONE: number;
/**
* When "enter" key is pressed, it means PREVIOUS
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const ENTER_KEY_TYPE_PREVIOUS: number;
/**
* When "enter" key is pressed, it means NEWLINE
*
* @constant
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
const ENTER_KEY_TYPE_NEWLINE: 8;
/**
* Editor with no special function
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_NULL: number;
/**
* Editor of type TEXT
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_TEXT: number;
/**
* Editor of type NUMBER
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_NUMBER: number;
/**
* Editor of type PHONE NUMBER
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_PHONE: number;
/**
* Editor of type DATETIME
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_DATETIME: number;
/**
* Editor of type EMAIL
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_EMAIL: number;
/**
* Editor of type URI
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_URI: number;
/**
* Editor of type PASSWORD
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const PATTERN_PASSWORD: number;
/**
* Editor of type SCREEN LOCK PASSWORD
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
const PATTERN_PASSWORD_SCREEN_LOCK: number;
/**
* Editor of type NUMBER PASSWORD
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
const PATTERN_PASSWORD_NUMBER: number;
/**
* Editor of type PATTERN_USER_NAME
*
* @constant
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
const PATTERN_USER_NAME: number = 10;
/**
* Editor of type PATTERN_NEW_PASSWORD
*
* @constant
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
const PATTERN_NEW_PASSWORD: number = 11;
/**
* Editor of type PATTERN_NUMBER_DECIMAL
*
* @constant
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
const PATTERN_NUMBER_DECIMAL: number = 12;
/**
* Editor of type PATTERN_ONE_TIME_CODE
*
* @constant
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
const PATTERN_ONE_TIME_CODE: number = 13;
/**
* Editor in SELECTING state
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const FLAG_SELECTING: number;
/**
* Editor in SINGLE_LINE state
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const FLAG_SINGLE_LINE: number;
/**
* The Editor displays in PART mode
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const DISPLAY_MODE_PART: number;
/**
* The Editor displays in FULL mode
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const DISPLAY_MODE_FULL: number;
/**
* Allows ASCII to be inputted
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_ASCII: number;
/**
* Do not specify Editor's input type
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_NONE: number;
/**
* Allows CHARACTERS to be inputted
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_AUTO_CAP_CHARACTERS: number;
/**
* Allows SENTENCES to be inputted
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_AUTO_CAP_SENTENCES: number;
/**
* Allows WORDS to be inputted
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_AUTO_WORDS: number;
/**
* Allows MULTI_LINE to be inputted
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_MULTI_LINE: number;
/**
* Half-screen mode
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const OPTION_NO_FULLSCREEN: number;
/**
* The move direction of cursor: UP
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
const CURSOR_UP: number;
/**
* The move direction of cursor: DOWN
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
const CURSOR_DOWN: number;
/**
* The move direction of cursor: LEFT
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
const CURSOR_LEFT: number;
/**
* The move direction of cursor: RIGHT
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
const CURSOR_RIGHT: number;
/**
* The window styles for input method ability.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;
/**
* Get InputMethodAbility object to subscribe events about IME.
*
* @returns { InputMethodAbility } the object of the InputMethodAbility.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getInputMethodAbility(): InputMethodAbility;
/**
* @returns { InputMethodEngine }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine#getInputMethodAbility
*/
function getInputMethodEngine(): InputMethodEngine;
/**
* Get KeyboardDelegate object to subscribe key event or events about editor.
*
* @returns { KeyboardDelegate } the object of KeyboardDelegate.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getKeyboardDelegate(): KeyboardDelegate;
/**
* @returns { KeyboardDelegate }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine#getKeyboardDelegate
*/
function createKeyboardDelegate(): KeyboardDelegate;
/**
* Indicates the possible data types of the command.
* @typedef { number | string | boolean }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
type CommandDataType = number | string | boolean;
/**
* The callback of 'sizeUpdate' event.
*
* @typedef { function } SizeUpdateCallback.
* @param { window.Size } size - panel size.
* @param { KeyboardArea } keyboardArea - keyboard area.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 14
*/
export type SizeUpdateCallback = (size: window.Size, keyboardArea: KeyboardArea) => void;
/**
* The callback of 'sizeChange' event.
*
* @typedef { function } SizeChangeCallback.
* @param { window.Size } size - panel size.
* @param { KeyboardArea } keyboardArea - keyboard area.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export type SizeChangeCallback = (size: window.Size, keyboardArea?: KeyboardArea) => void;
/**
* @interface KeyboardController
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface KeyboardController {
/**
* Hide soft keyboard
*
* @param { AsyncCallback<void> } callback - indicates the callback function of hide.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
hide(callback: AsyncCallback<void>): void;
/**
* Hide soft keyboard
*
* @returns { Promise<void> } the promise returned by the function
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
hide(): Promise<void>;
/**
* @param { AsyncCallback<void> } callback - indicates the callback function of hideKeyboard.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.KeyboardController#hide
*/
hideKeyboard(callback: AsyncCallback<void>): void;
/**
* @returns { Promise<void> } the promise returned by the function
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.KeyboardController#hide
*/
hideKeyboard(): Promise<void>;
/**
* Exit the current input type. This function can only be called by default input method configured by system.
*
* @param { AsyncCallback<void> } callback - the callback of exitCurrentInputType.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800010 - not the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
exitCurrentInputType(callback: AsyncCallback<void>): void;
/**
* Exit the current input type. This function can only be called by default input method configured by system.
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800010 - not the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
exitCurrentInputType(): Promise<void>;
}
/**
* @interface InputMethodEngine
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface InputMethodEngine {
/**
* Subscribe 'inputStart'
*
* @param { 'inputStart' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback of on('inputStart').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(
type: 'inputStart',
callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void
): void;
/**
* Unsubscribe 'inputStart'
*
* @param { 'inputStart' } type - indicates the type of subscribe event.
* @param { function } callback - optional, indicates the callback of off('inputStart').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(
type: 'inputStart',
callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void
): void;
/**
* Subscribe 'keyboardShow'|'keyboardHide'
*
* @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback of on('keyboardShow'|'keyboardHide').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void;
/**
* Unsubscribe 'keyboardShow'|'keyboardHide'
*
* @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event.
* @param { function } [callback] - optional, indicates the callback of off('keyboardShow'|'keyboardHide').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void;
}
/**
* <p>Control events about IME.</p>
* <p>Events provided for IME to subscribe with callback function. When those events occur, the corresponding callback
* will be invoked.</p>
*
* @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 { Callback<SecurityMode> } callback - the callback of on('securityModeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
on(type: 'securityModeChange', callback: Callback<SecurityMode>): void;
/**
* Unsubscribe 'securityModeChange' event.
*
* @param { 'securityModeChange' } type - the type of unsubscribe event.
* @param { Callback<SecurityMode> } [callback] - optional, the callback of off('securityModeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
off(type: 'securityModeChange', callback?: Callback<SecurityMode>): void;
/**
* Subscribe 'privateCommand'.This function can only be called by default input method configured by system.
*
* @param { 'privateCommand' } type - indicates the type of subscribe event.
* @param { Callback<Record<string, CommandDataType>> } callback - indicates the callback of on('privateCommand').
* @throws { BusinessError } 12800010 - not the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
on(type: 'privateCommand', callback: Callback<Record<string, CommandDataType>>): void;
/**
* Unsubscribe 'privateCommand'.This function can only be called by default input method configured by system.
*
* @param { 'privateCommand' } type - indicates the type of subscribe event.
* @param { Callback<Record<string, CommandDataType>> } [callback] - optional,
* indicates the callback of off('privateCommand').
* @throws { BusinessError } 12800010 - not the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
off(type: 'privateCommand', callback?: Callback<Record<string, CommandDataType>>): void;
/**
* Subscribe 'callingDisplayDidChange' event.
*
* @param { 'callingDisplayDidChange' } type - indicates the type of subscribe event.
* @param { Callback<number> } callback - indicates the callback of on('callingDisplayDidChange').
* @throws { BusinessError } 801 - capability not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 18
*/
on(type: 'callingDisplayDidChange', callback: Callback<number>): void;
/**
* Unsubscribe 'callingDisplayDidChange' event.
*
* @param { 'callingDisplayDidChange' } type - indicates the type of subscribe event.
* @param { Callback<number> } [callback] - optional, indicates the callback of off('callingDisplayDidChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 18
*/
off(type: 'callingDisplayDidChange', callback?: Callback<number>): void;
/**
* Subscribe 'discardTypingText'.
*
* @param { 'discardTypingText' } type - the type of subscribe event.
* @param { Callback<void> } callback - the callback of on('discardTypingText').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
on(type: 'discardTypingText', callback: Callback<void>): void;
/**
* Unsubscribe 'discardTypingText'.
*
* @param { 'discardTypingText' } type - the type of unsubscribe event.
* @param { Callback<void> } callback - the callback of off('discardTypingText').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
off(type: 'discardTypingText', callback?: Callback<void>): void;
/**
* Get input method's security mode.
*
* @returns { SecurityMode } return security mode.
* @throws { BusinessError } 12800004 - not an input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
getSecurityMode(): SecurityMode;
/**
* Creates a panel.
* <p>The system only allows one soft keyboard and one status bar to be created.</p>
*
* @param { BaseContext } ctx - indicates the context on which the window depends.
* @param { PanelInfo } info - the info of panel to be created.
* @param { AsyncCallback<Panel> } callback - the callback of createPanel.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
* @throws { BusinessError } 12800004 - not an input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback<Panel>): void;
/**
* Creates a panel.
* <p>The system only allows one soft keyboard and one status bar to be created.</p>
*
* @param { BaseContext } ctx - indicates the context on which the window depends.
* @param { PanelInfo } info - the info of panel to be created.
* @returns { Promise<Panel> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
* @throws { BusinessError } 12800004 - not an input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
createPanel(ctx: BaseContext, info: PanelInfo): Promise<Panel>;
/**
* Destroys a panel.
*
* @param { Panel } panel - to be destroyed.
* @param { AsyncCallback<void> } callback - the callback of destroyPanel.
* @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
*/
destroyPanel(panel: Panel, callback: AsyncCallback<void>): void;
/**
* Destroys a panel.
*
* @param { Panel } panel - to be destroyed.
* @returns { Promise<void> } the promise returned by the function.
* @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
*/
destroyPanel(panel: Panel): Promise<void>;
}
/**
* @interface TextInputClient
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine#InputClient
*/
interface TextInputClient {
/**
* @param { number } action - action indicates the function of "enter" key.
* @param { AsyncCallback<boolean> } callback - the callback of sendKeyFunction.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#sendKeyFunction
*/
sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
/**
* @param { number } action - action indicates the function of "enter" key.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#sendKeyFunction
*/
sendKeyFunction(action: number): Promise<boolean>;
/**
* @param { number } length - length of text which will be deleted forward.
* @param { AsyncCallback<boolean> } callback - the callback of deleteForward.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#deleteForward
*/
deleteForward(length: number, callback: AsyncCallback<boolean>): void;
/**
* @param { number } length - length of text which will be deleted forward.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#deleteForward
*/
deleteForward(length: number): Promise<boolean>;
/**
* @param { number } length - length of text which will be deleted backward.
* @param { AsyncCallback<boolean> } callback - the callback of deleteBackward.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#deleteBackward
*/
deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
/**
* @param { number } length - length of text which will be deleted backward.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#deleteBackward
*/
deleteBackward(length: number): Promise<boolean>;
/**
* @param { string } text - text which will be inserted.
* @param { AsyncCallback<boolean> } callback - the callback of insertText.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#insertText
*/
insertText(text: string, callback: AsyncCallback<boolean>): void;
/**
* @param { string } text - text which will be inserted.
* @returns { Promise<boolean> } the promise returned by the function
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#insertText
*/
insertText(text: string): Promise<boolean>;
/**
* @param { number } length - the length of text which will be got.
* @param { AsyncCallback<string> } callback - the callback of getForward.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getForward
*/
getForward(length: number, callback: AsyncCallback<string>): void;
/**
* @param { number } length - the length of text which will be got.
* @returns { Promise<string> } the promise returned by the function
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getForward
*/
getForward(length: number): Promise<string>;
/**
* @param { number } length - the length of text which will be got.
* @param { AsyncCallback<string> } callback - the callback of getBackward.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getBackward
*/
getBackward(length: number, callback: AsyncCallback<string>): void;
/**
* @param { number } length - the length of text which will be got.
* @returns { Promise<string> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getBackward
*/
getBackward(length: number): Promise<string>;
/**
* @param { AsyncCallback<EditorAttribute> } callback - the callback of getEditorAttribute.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getEditorAttribute
*/
getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
/**
* @returns { Promise<EditorAttribute> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethodEngine.InputClient#getEditorAttribute
*/
getEditorAttribute(): Promise<EditorAttribute>;
}
/**
* Control events about Editor.
*
* @interface InputClient
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
interface InputClient {
/**
* Send the function of the key.
*
* @param { number } action - action indicates the function of "enter" key.
* @param { AsyncCallback<boolean> } callback - the callback of sendKeyFunction.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
/**
* Send the function of the key.
*
* @param { number } action - action indicates the function of "enter" key.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
sendKeyFunction(action: number): Promise<boolean>;
/**
* Delete text forward.
*
* @param { number } length - length of text which will be deleted forward. It can't be less than 0.
* @param { AsyncCallback<boolean> } callback - the callback of deleteForward.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
deleteForward(length: number, callback: AsyncCallback<boolean>): void;
/**
* Delete text forward.
*
* @param { number } length - length of text which will be deleted forward. It can't be less than 0.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
deleteForward(length: number): Promise<boolean>;
/**
* Delete text forward.
*
* @param { number } length - length of text which will be deleted forward. It can't be less than 0.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
deleteForwardSync(length: number): void;
/**
* Delete text backward.
*
* @param { number } length - length of text which will be deleted backward. It can't be less than 0.
* @param { AsyncCallback<boolean> } callback - the callback of deleteBackward.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
/**
* Delete text backward.
*
* @param { number } length - length of text which will be deleted backward. It can't be less than 0.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
deleteBackward(length: number): Promise<boolean>;
/**
* Delete text backward.
*
* @param { number } length - length of text which will be deleted backward. It can't be less than 0.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
deleteBackwardSync(length: number): void;
/**
* Insert text into Editor.
*
* @param { string } text - text which will be inserted.
* @param { AsyncCallback<boolean> } callback - the callback of insertText.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
insertText(text: string, callback: AsyncCallback<boolean>): void;
/**
* Insert text into Editor.
*
* @param { string } text - text which will be inserted.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
insertText(text: string): Promise<boolean>;
/**
* Insert text into Editor.
*
* @param { string } text - text which will be inserted.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
insertTextSync(text: string): void;
/**
* Get the text before cursor.
*
* @param { number } length - the length of text which will be got. It can't be less than 0.
* @param { AsyncCallback<string> } callback - the callback of getForward.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getForward(length: number, callback: AsyncCallback<string>): void;
/**
* Get the text before cursor.
*
* @param { number } length - the length of text which will be got. It can't be less than 0.
* @returns { Promise<string> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getForward(length: number): Promise<string>;
/**
* Get the text before cursor.
*
* @param { number } length - the length of text which will be got. It can't be less than 0.
* @returns { string } the text string before cursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getForwardSync(length: number): string;
/**
* Get the text after cursor.
*
* @param { number } length - the length of text which will be got.It can't be less than 0.
* @param { AsyncCallback<string> } callback - the callback of getBackward.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getBackward(length: number, callback: AsyncCallback<string>): void;
/**
* Get the text after cursor.
*
* @param { number } length - the length of text which will be got.It can't be less than 0.
* @returns { Promise<string> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getBackward(length: number): Promise<string>;
/**
* Get the text after cursor.
*
* @param { number } length - the length of text which will be got. It can't be less than 0.
* @returns { string } the text string after cursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getBackwardSync(length: number): string;
/**
* Get attribute about editor.
*
* @param { AsyncCallback<EditorAttribute> } callback - the callback of getEditorAttribute.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
/**
* Get attribute about editor.
*
* @returns { Promise<EditorAttribute> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getEditorAttribute(): Promise<EditorAttribute>;
/**
* Get attribute about editor.
*
* @returns { EditorAttribute } the attribute of editor.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getEditorAttributeSync(): EditorAttribute;
/**
* Move cursor from input method.
*
* @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
* @param { AsyncCallback<void> } callback - the callback of moveCursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
moveCursor(direction: number, callback: AsyncCallback<void>): void;
/**
* Move cursor from input method.
*
* @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
moveCursor(direction: number): Promise<void>;
/**
* Move cursor from input method.
*
* @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
moveCursorSync(direction: number): void;
/**
* Select text in editor by range.
*
* @param { Range } range - indicates the range of selected text in editor.
* @param { AsyncCallback<void> } callback - the callback of selectByRange.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByRange(range: Range, callback: AsyncCallback<void>): void;
/**
* Select text in editor by range.
*
* @param { Range } range - indicates the range of selected text in editor.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByRange(range: Range): Promise<void>;
/**
* Select text in editor by range.
*
* @param { Range } range - indicates the range of selected text in editor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByRangeSync(range: Range): void;
/**
* Select text in editor by cursor movement.
*
* @param { Movement } movement - indicates the movement of cursor when selecting.
* @param { AsyncCallback<void> } callback - the callback of selectByMovement.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByMovement(movement: Movement, callback: AsyncCallback<void>): void;
/**
* Select text in editor by cursor movement.
*
* @param { Movement } movement - indicates the movement of cursor when selecting.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByMovement(movement: Movement): Promise<void>;
/**
* Select text in editor by cursor movement.
*
* @param { Movement } movement - indicates the movement of cursor when selecting.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selectByMovementSync(movement: Movement): void;
/**
* Get the index number of text at cursor.
*
* @param { AsyncCallback<number> } callback - the callback of getTextIndexAtCursor, number represents the index
* number of text at cursor.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getTextIndexAtCursor(callback: AsyncCallback<number>): void;
/**
* Get the index number of text at cursor.
*
* @returns { Promise<number> } the promise returned by the function, number represents the index number of text
* at cursor.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getTextIndexAtCursor(): Promise<number>;
/**
* Get the index number of text at cursor.
*
* @returns { number } the index number of text at cursor.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
getTextIndexAtCursorSync(): number;
/**
* Send extend action code.
*
* @param { ExtendAction } action - action code which will be send.
* @param { AsyncCallback<void> } callback - the callback of sendExtendAction.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
sendExtendAction(action: ExtendAction, callback: AsyncCallback<void>): void;
/**
* Send extend action code.
*
* @param { ExtendAction } action - action code which will be send.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
sendExtendAction(action: ExtendAction): Promise<void>;
/**
* Send private command.This function can only be called by default input method configured by system.
*
* @param { Record<string, CommandDataType> } commandData - command data which will be send.Max size 32KB.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800010 - not the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
sendPrivateCommand(commandData: Record<string, CommandDataType>): Promise<void>;
/**
* Get info of the calling window.
*
* @returns { Promise<WindowInfo> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800012 - the input method panel does not exist.
* @throws { BusinessError } 12800013 - window manager service error.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
getCallingWindowInfo(): Promise<WindowInfo>;
/**
* Insert the provided text as preview text.
*
* @param { string } text - the text to be previewed.
* @param { Range } range - the range of the text to be replaced by the preview text.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800011 - text preview not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
setPreviewText(text: string, range: Range): Promise<void>;
/**
* Insert the provided text as preview text.
*
* @param { string } text - the text to be previewed.
* @param { Range } range - the range of the text to be replaced by the preview text.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800011 - text preview not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
setPreviewTextSync(text: string, range: Range): void;
/**
* Finish the text preview.
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800011 - text preview not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
finishTextPreview(): Promise<void>;
/**
* Finish the text preview.
*
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800011 - text preview not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
finishTextPreviewSync(): void;
/**
* Send message to edit box.
*
* @param { string } msgId - the identifier of the message. Max size is 256B.
* @param { ?ArrayBuffer } [msgParam] - the param of the custom message. Max size is 128KB.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1. Incorrect parameter types. 2. Incorrect parameter length.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800009 - input method client detached.
* @throws { BusinessError } 12800014 - the input method is in basic mode.
* @throws { BusinessError } 12800015 - the other side does not accept the request.
* @throws { BusinessError } 12800016 - input method client is not editable.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
sendMessage(msgId: string, msgParam?: ArrayBuffer): Promise<void>;
/**
* Start receiving message from edit box.
*
* @param { ?MessageHandler } [msgHandler] - optional, the handler of the custom message.
* @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
recvMessage(msgHandler?: MessageHandler): void;
/**
* Get input attachOptions.
*
* @returns { AttachOptions } return attach options.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
/**
* Get input attachOptions.
*
* @returns { AttachOptions } return attach options.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
getAttachOptions(): AttachOptions;
/**
* Subscribe 'attachOptionsDidChange' event.
*
* @param { 'attachOptionsDidChange' } type - the type of subscribe event.
* @param { Callback<AttachOptions> } callback - the callback of on('attachOptionsDidChange').
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
/**
* Subscribe 'attachOptionsDidChange' event.
*
* @param { 'attachOptionsDidChange' } type - the type of subscribe event.
* @param { Callback<AttachOptions> } callback - the callback of on('attachOptionsDidChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
on(type: 'attachOptionsDidChange', callback: Callback<AttachOptions>): void;
/**
* Unsubscribe 'attachOptionsDidChange' event.
*
* @param { 'attachOptionsDidChange' } type - the type of unsubscribe event.
* @param { Callback<AttachOptions> } [callback] - optional, the callback of off('attachOptionsDidChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
off(type: 'attachOptionsDidChange', callback?: Callback<AttachOptions>): void;
}
/**
* @interface KeyboardDelegate
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface KeyboardDelegate {
/**
* Subscribe key up or down event
*
* @param { 'keyDown' | 'keyUp' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function of on('keyDown'|'keyUp').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(type: 'keyDown' | 'keyUp', callback: (event: KeyEvent) => boolean): void;
/**
* Unsubscribe key up or down event
*
* @param { 'keyDown' | 'keyUp' } type - indicates the type of unsubscribe event.
* @param { function } [callback] - optional, indicates the callback function of off('keyDown'|'keyUp').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(type: 'keyDown' | 'keyUp', callback?: (event: KeyEvent) => boolean): void;
/**
* Subscribe key event.
*
* @param { 'keyEvent' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function of on('keyEvent').
* If the key is processed by event subscriber, callback should be return true, else return false.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'keyEvent', callback: (event: InputKeyEvent) => boolean): void;
/**
* Unsubscribe key event.
*
* @param { 'keyEvent' } type - indicates the type of unsubscribe event.
* @param { function } [callback] - optional, indicates the callback function of off('keyEvent').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'keyEvent', callback?: (event: InputKeyEvent) => boolean): void;
/**
* Subscribe cursor context change
*
* @param { 'cursorContextChange' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function of on('cursorContextChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;
/**
* Unsubscribe cursor context change
*
* @param { 'cursorContextChange' } type - indicates the type of unsubscribe event.
* @param { function } [callback] - optional, indicates the callback function of off('cursorContextChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;
/**
* Subscribe selection change
*
* @param { 'selectionChange' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function
* of on('selectionChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(
type: 'selectionChange',
callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void
): void;
/**
* Unsubscribe selection change
*
* @param { 'selectionChange' } type - indicates the type of unsubscribe event.
* @param { function } [callback] - optional,
* indicates the callback function of off('selectionChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(
type: 'selectionChange',
callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void
): void;
/**
* Subscribe text change
*
* @param { 'textChange' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function of on('textChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
on(type: 'textChange', callback: (text: string) => void): void;
/**
* Unsubscribe text change
*
* @param { 'textChange' } type - indicates the type of unsubscribe event.
* @param { function } [callback] - optional, indicates the callback function of off('textChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
off(type: 'textChange', callback?: (text: string) => void): void;
/**
* Subscribe input text attribute change
*
* @param { 'editorAttributeChanged' } type - indicates the type of subscribe event.
* @param { function } callback - indicates the callback function of on('editorAttributeChanged').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'editorAttributeChanged', callback: (attr: EditorAttribute) => void): void;
/**
* Unsubscribe input text attribute change
*
* @param { 'editorAttributeChanged' } type - indicates the type of subscribe event.
* @param { function } [callback] - indicates the callback function of off('editorAttributeChanged').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'editorAttributeChanged', callback?: (attr: EditorAttribute) => void): void;
}
/**
* Defines the immersive mode.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export enum ImmersiveMode {
/**
* Default immersive mode, the panel is not in immersive mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
NONE_IMMERSIVE = 0,
/**
* Immersive mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
IMMERSIVE,
/**
* Light immersive mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
LIGHT_IMMERSIVE,
/**
* Dark immersive mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
DARK_IMMERSIVE
}
/**
* Gradient mode.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
export enum GradientMode {
/**
* Disable gradient mode.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
NONE = 0,
/**
* Linear gradient mode.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
LINEAR_GRADIENT = 1,
}
/**
* Fluid light mode.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
export enum FluidLightMode {
/**
* Disable fluid light mode.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
NONE = 0,
/**
* Background fluid light mode.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
BACKGROUND_FLUID_LIGHT = 1,
}
/**
* Defines the immersive effect.
*
* @interface ImmersiveEffect
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
interface ImmersiveEffect {
/**
* The height of the gradient effect.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
gradientHeight: number;
/**
* Gradient mode.
*
* @type { GradientMode }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
gradientMode: GradientMode;
/**
* Fluid light mode.
*
* @type { ?FluidLightMode }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
fluidLightMode?: FluidLightMode;
}
/**
* RequestKeyboardReason of input click.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
export enum RequestKeyboardReason {
/**
* The request keyboard reason is NONE.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
NONE = 0,
/**
* The request keyboard reason is MOUSE.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
MOUSE = 1,
/**
* The request keyboard reason is TOUCH.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
TOUCH = 2,
/**
* The request keyboard reason is OTHER.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
OTHER = 20
}
/**
* A panel is a container used to hold soft keyboard, candidate list, or status bar.
*
* @interface Panel
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
interface Panel {
/**
* Sets ui content.
* <p>When this method is executed successfully, the content of panel will be replaced.</p>
*
* @param { string } path - the path of ui content.
* @param { AsyncCallback<void> } callback - the callback of setUiContent.
* @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
*/
setUiContent(path: string, callback: AsyncCallback<void>): void;
/**
* Sets ui content.
* <p>When this method is executed successfully, the content of panel will be replaced.</p>
*
* @param { string } path - the path of ui content.
* @returns { Promise<void> } the promise returned by the function.
* @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
*/
setUiContent(path: string): Promise<void>;
/**
* Sets ui content.
* <p>When this method is executed successfully, the content of panel will be replaced.</p>
*
* @param { string } path - the path of ui content.
* @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel.
* @param { AsyncCallback<void> } callback - the callback of setUiContent.
* @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
*/
setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback<void>): void;
/**
* Sets ui content.
* <p>When this method is executed successfully, the content of panel will be replaced.</p>
*
* @param { string } path - the path of ui content.
* @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel.
* @returns { Promise<void> } the promise returned by the function.
* @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
*/
setUiContent(path: string, storage: LocalStorage): Promise<void>;
/**
* Resizes a panel.
*
* @param { number } width - the new width of the panel.
* @param { number } height - the new height of the panel.
* @param { AsyncCallback<void> } callback - the callback of resize.
* @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
*/
resize(width: number, height: number, callback: AsyncCallback<void>): void;
/**
* Resizes a panel.
*
* @param { number } width - the new width of the panel.
* @param { number } height - the new height of the panel.
* @returns { Promise<void> } the promise returned by the function.
* @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
*/
resize(width: number, height: number): Promise<void>;
/**
* Moves a panel.
* <p>It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.</p>
*
* @param { number } x - the x-coordinate of the new position.
* @param { number } y - the y-coordinate of the new position.
* @param { AsyncCallback<void> } callback - the callback of moveTo.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
moveTo(x: number, y: number, callback: AsyncCallback<void>): void;
/**
* Moves a panel.
* <p>It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.</p>
*
* @param { number } x - the x-coordinate of the new position.
* @param { number } y - the y-coordinate of the new position.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
moveTo(x: number, y: number): Promise<void>;
/**
* Starts moving a panel. The panel starts moving when pressed with finger or mouse and stops moving when released.
* <p>It's Only used for STATUS_BAR panel.</p>
*
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @throws { BusinessError } 12800017 - invalid panel type or panel flag.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
/**
* Starts moving a panel. The panel starts moving when pressed with finger or mouse and stops moving when released.
* <p>It's Only used for STATUS_BAR panel.</p>
*
* @throws { BusinessError } 801 - capability not supported.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @throws { BusinessError } 12800017 - invalid panel type or panel flag.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 18
*/
/**
* Starts moving a panel. The panel starts moving when pressed with finger or mouse and stops moving when released.
* <p>It's only used for STATUS_BAR panel or SOFT_KEYBOARD panel with FLG_FLOATING or FLAG_CANDIDATE.</p>
*
* @throws { BusinessError } 801 - capability not supported.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @throws { BusinessError } 12800017 - invalid panel type or panel flag.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
startMoving(): void;
/**
* Get the ID of the display where the input method panel is located.
*
* @returns { Promise<number> } the promise returned by the function.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
getDisplayId(): Promise<number>;
/**
* Shows panel.
*
* @param { AsyncCallback<void> } callback - the callback of show.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
show(callback: AsyncCallback<void>): void;
/**
* Shows panel.
*
* @returns { Promise<void> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
show(): Promise<void>;
/**
* Hides panel.
*
* @param { AsyncCallback<void> } callback - the callback of hide.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
hide(callback: AsyncCallback<void>): void;
/**
* Hides panel.
*
* @returns { Promise<void> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
hide(): Promise<void>;
/**
* Registers panel show event.
* <p>The "show" events are triggered when the panel is shown.</p>
*
* @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.
* <p>The "hide" events are triggered when the panel is hidden.</p>
*
* @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.
* <p>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.</p>
*
* @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.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @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;
/**
* Adjust the rect of soft keyboard panel for landscape and portrait orientations.
* <p>It's only used for SOFT_KEYBOARD panel with fixed or floating flag.</p>
*
* @param { PanelFlag } flag - panel flag.
* @param { EnhancedPanelRect } 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.
* @throws { BusinessError } 12800017 - invalid panel type or panel flag.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
adjustPanelRect(flag: PanelFlag, rect: EnhancedPanelRect): void;
/**
* <p>Update the region in the panel which accepts input events.</p>
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag.</p>
*
* @param { Array<window.Rect> } inputRegion - region in the panel which accepts input event. The size of the array must range from 1 to 4.
* @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.
* @throws { BusinessError } 12800017 - invalid panel type or panel flag.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
updateRegion(inputRegion: Array<window.Rect>): void;
/**
* Subscribe 'sizeChange' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeChange' } type - the type of subscribe event.
* @param { Callback<window.Size> } callback - the callback of on('sizeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
/**
* Subscribe 'sizeChange' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeChange' } type - the type of subscribe event.
* @param { SizeChangeCallback } callback - the callback of on('sizeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
on(type: 'sizeChange', callback: SizeChangeCallback): void;
/**
* Unsubscribe 'sizeChange' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeChange' } type - the type of unsubscribe event.
* @param { ?Callback<window.Size> } [callback] - optional, the callback of off('sizeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
/**
* Unsubscribe 'sizeChange' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeChange' } type - the type of unsubscribe event.
* @param { ?SizeChangeCallback } [callback] - optional, the callback of off('sizeChange').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
off(type: 'sizeChange', callback?: SizeChangeCallback): void;
/**
* Subscribe 'sizeUpdate' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeUpdate' } type - the type of subscribe event.
* @param { SizeUpdateCallback } callback - the callback of on('sizeUpdate').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 14
*/
on(type: 'sizeUpdate', callback: SizeUpdateCallback): void;
/**
* Unsubscribe 'sizeUpdate' event.
* <p>It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.</p>
*
* @param { 'sizeUpdate' } type - the type of unsubscribe event.
* @param { ?SizeUpdateCallback } [callback] - optional, the callback of off('sizeUpdate').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 14
*/
off(type: 'sizeUpdate', callback?: SizeUpdateCallback): void;
/**
* Set immersive mode.
*
* @param { ImmersiveMode } mode - Immersive mode.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Incorrect parameter types; 2.Parameter verification failed.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1.input method panel not created. 2.the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
setImmersiveMode(mode: ImmersiveMode): void;
/**
* Get immersive mode.
*
* @returns { ImmersiveMode } Immersive mode.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
getImmersiveMode(): ImmersiveMode;
/**
* Set immersive effect.
* If a normal application uses the fluidLightMode property and sets it to a value other than NONE,
* the interface will throw 202.
*
* @param { ImmersiveEffect } effect - immersive effect.
* @throws { BusinessError } 801 - capability not supported.
* @throws { BusinessError } 12800002 - input method engine error. Possible causes:
* 1. input method panel not created. 2. the input method application does not subscribe to related events.
* @throws { BusinessError } 12800013 - window manager service error.
* @throws { BusinessError } 12800020 - invalid immersive effect.
* 1. The gradient mode and the fluid light mode can only be used when the immersive mode is enabled.
* 2. The fluid light mode can only be used when the gradient mode is enabled.
* 3. When the gradient mode is not enabled, the gradient height can only be 0.
* @throws { BusinessError } 12800021 - this operation is allowed only after adjustPanelRect or resize is called.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
setImmersiveEffect(effect: ImmersiveEffect): void;
/**
* Set keep screen on.
* This setting takes effect when the panel is showing and becomes invalid when the panel is hidden.
*
* @param { boolean } isKeepScreenOn - is keep screen on.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800013 - window manager service error.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
setKeepScreenOn(isKeepScreenOn: boolean): Promise<void>;
}
/**
* @interface EditorAttribute
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface EditorAttribute {
/**
* Editor's pattern
*
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
readonly inputPattern: number;
/**
* Editor's key type
*
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
readonly enterKeyType: number;
/**
* Indicates whether the editor supports the text preview.
*
* @type { boolean }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
isTextPreviewSupported: boolean;
/**
* Editor's bundle name.
*
* @type { ?string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 14
*/
readonly bundleName?: string;
/**
* Immersive mode.
*
* @type { ?ImmersiveMode }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
readonly immersiveMode?: ImmersiveMode;
/**
* Indicates the ID of the window where the edit box is located.
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 18
*/
readonly windowId?: number;
/**
* Indicates the ID of the display where the edit box is located.
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 18
*/
readonly displayId?: number;
/**
* Placeholder text in the edit box.
*
* @type { ?string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
readonly placeholder?: string;
/**
* The name of the ability where the edit box is located.
*
* @type { ?string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
readonly abilityName?: string;
/**
* Editor's capitalization mode.
*
* @type { ?CapitalizeMode }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
readonly capitalizeMode?: CapitalizeMode;
/**
* Gradient mode.
*
* @type { ?GradientMode }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
readonly gradientMode?: GradientMode;
/**
* Fluid light mode.
*
* @type { ?FluidLightMode }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
readonly fluidLightMode?: FluidLightMode;
}
/**
* @interface KeyEvent
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface KeyEvent {
/**
* Key code
*
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
readonly keyCode: number;
/**
* Key action
*
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
readonly keyAction: number;
}
/**
* Enumerates the flags of panel
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum PanelFlag {
/**
* Fixed style.
* <p>It'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.</p>
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
FLG_FIXED = 0,
/**
* Floating style.
* <p>It's provided for the panel with type of SOFT_KEYBOARD.
* When the flag is set, the soft keyboard is floating.</p>
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
FLG_FLOATING,
/**
* Candidate style.
* <p>It's provided for the panel with type of SOFT_KEYBOARD.
* When the flag is set, the soft keyboard is a candidate window which will show the possible characters when user types a input code.
* Panel with candidate style will not be automatically shown or hidden by input method service.
* Input method application developers are supposed to control the panel status on their own.</p>
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
FLAG_CANDIDATE
}
/**
* <p>Panel types provided for input method applications.</p>
* <p>Input method application developers should select the appropriate panel type according to the user scenario.</p>
*
* @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;
/**
* <p>Flag of Panel.</p>
* <p>Currently only using for SOFT_KEYBOARD panel.</p>
*
* @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;
}
/**
* <p>Custom message handler.</p>
* <p>Implement this interface to respond to custem messages.</p>
*
* @interface MessageHandler
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
interface MessageHandler {
/**
* This method is called when a custom message is received.
*
* @param { string } msgId - the identifier of the message.
* @param { ?ArrayBuffer } [msgParam] - the parameter of the custom message.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
onMessage(msgId: string, msgParam?: ArrayBuffer): void;
/**
* This method is called when a new message handler is set.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
onTerminated(): void;
}
/**
* Enhanced panel rect information.
*
* @interface EnhancedPanelRect
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export interface EnhancedPanelRect {
/**
* <p>Panel rect in landscape orientation.</p>
* <p>It must be filled when fullScreenMode is flase or not specified.</p>
*
* @type { ?window.Rect }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
landscapeRect?: window.Rect;
/**
* <p>Panel rect in portrait orientation.</P>
* <p>It must be filled when fullScreenMode is flase or not specified.</p>
*
* @type { ?window.Rect }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
portraitRect?: window.Rect;
/**
* The distance between the top of the panel and the top of the avoidance area in landscape orientation.
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag.</p>
*
* @type { ?number }
* @default 0
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
landscapeAvoidY?: number;
/**
* <p>Region in the panel that accepts input events in landsacpe mode.</p>
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag. Max array size is 4.</p>
* <p>Defaults to entire panel area if not specifed.</p>
*
* @type { ?Array<window.Rect> }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
landscapeInputRegion?: Array<window.Rect>;
/**
* The distance between the top of the panel and the top of the avoidance area in portrait orientation.
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag.</p>
*
* @type { ?number }
* @default 0
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
portraitAvoidY?: number;
/**
* <p>Region in the panel that accepts input events in portrait mode.</p>
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag. Max array size is 4.</p>
* <p>Defaults to entire panel area if not specifed.</p>
*
* @type { ?Array<window.Rect> }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
portraitInputRegion?: Array<window.Rect>;
/**
* <p>Enter the full screen mode.</p>
* <p>It's only used for SOFT_KEYBOARD panel with fixed flag or floating flag.</p>
*
* @type { ?boolean }
* @default false
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
fullScreenMode?: boolean;
}
/**
* Keyboard area.
*
* @interface KeyboardArea
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export interface KeyboardArea {
/**
* Top of the keyboard area in the panel.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
top: number;
/**
* Bottom of the keyboard area in the panel.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
bottom: number;
/**
* Left of the keyboard area in the panel.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
left: number;
/**
* Right of the keyboard area in the panel.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
right: number;
}
/**
* Attach options.
*
* @interface AttachOptions
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
export interface AttachOptions {
/**
* The reason for request keyboard.
*
* @type { ?RequestKeyboardReason }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 19
*/
requestKeyboardReason?: RequestKeyboardReason;
/**
* Is simple keyboard enabled.
*
* @type { ?boolean }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
isSimpleKeyboardEnabled?: boolean;
}
/**
* Enumerates the capitalization mode.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
export enum CapitalizeMode {
/**
* Capitalize nothing.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
NONE = 0,
/**
* Capitalize the first letter of each sentence.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
SENTENCES,
/**
* Capitalize the first letter of each word.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
WORDS,
/**
* Capitalize each letter.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
CHARACTERS
}
}
export default inputMethodEngine;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助