mmi_JSDoc

Signed-off-by: houchengyu2022 <houchengyu@huawei.com>
This commit is contained in:
yuanxinying 2023-04-11 19:37:02 +08:00
parent c8a3731b73
commit 52caa1800e
10 changed files with 1045 additions and 434 deletions

View File

@ -1,71 +1,104 @@
/*
* Copyright (C) 2021 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.
*/
* Copyright (C) 2021 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.
*/
import { Callback } from './@ohos.base';
/**
/**
* The event of key input management module is configured to subscribe and unsubscribe system keys.
*
* @since 8
* @namespace inputConsumer
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @since 8
*/
declare namespace inputConsumer {
/**
* Defines event of key that user want to subscribe or unsubscribe.
*
* @interface KeyOptions
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @since 8
*/
interface KeyOptions {
/**
* Defines event of key that user want to subscribe or unsubscribe.
* The pre-keys that want to subscribe or unsubscribe.
*
* @type { Array<number> }
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @param preKeys The pre-keys that want to subscribe or unsubscribe.
* @param finalKey The post position key that want to subscribe or unsubscribe.
* @param isFinalKeyDown The final key press down or up.
* @param finalKeyDownDuration Duration of final key press.
* @since 8
*/
interface KeyOptions {
preKeys: Array<number>;
finalKey: number;
isFinalKeyDown: boolean;
finalKeyDownDuration: number;
}
preKeys: Array<number>;
/**
* Subscribe system keys.
* The post position key that want to subscribe or unsubscribe.
*
* @since 8
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @param type type of the inputevent about input which is to be subscribed.
* @param keyOptions the key events about input which is to be subscribed.
* @param callback callback function, receive reported data.
* @throws {BusinessError} 401 - Parameter error.
* @since 8
*/
function on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void;
finalKey: number;
/**
* Subscribe system keys.
* The final key press down or up.
*
* @since 8
* @type { boolean }
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @param type type of the inputevent about input which is to be subscribed.
* @param keyOptions the key events about input which is to be subscribed.
* @param callback callback function, receive reported data.
* @throws {BusinessError} 401 - Parameter error.
* @since 8
*/
function off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void;
isFinalKeyDown: boolean;
/**
* Duration of final key press.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @since 8
*/
finalKeyDownDuration: number;
}
/**
* Subscribe system keys.
*
* @param { 'key' } type - type of the inputevent about input which is to be subscribed.
* @param { KeyOptions } keyOptions - the key events about input which is to be subscribed.
* @param { Callback<KeyOptions> } callback - callback function, receive reported data.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @since 8
*/
function on(type: 'key', keyOptions: KeyOptions, callback: Callback<KeyOptions>): void;
/**
* Subscribe system keys.
*
* @param { 'key' } type - type of the inputevent about input which is to be subscribed.
* @param { KeyOptions } keyOptions - the key events about input which is to be subscribed.
* @param { Callback<KeyOptions> } callback - callback function, receive reported data.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputConsumer
* @systemapi hide for inner use
* @since 8
*/
function off(type: 'key', keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void;
}
export default inputConsumer;

View File

@ -1,26 +1,27 @@
/*
* Copyright (c) 2021-2023 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.
*/
* Copyright (c) 2021-2023 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.
*/
import { Callback, AsyncCallback } from "./@ohos.base";
import { KeyCode } from "./@ohos.multimodalInput.keyCode"
import { Callback, AsyncCallback } from './basic';
import { KeyCode } from './@ohos.multimodalInput.keyCode';
/**
* The input device management module is configured to obtain an ID and device information of an input device.
*
* @since 8
* @namespace inputDevice
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
declare namespace inputDevice {
/**
@ -39,125 +40,191 @@ declare namespace inputDevice {
* @since 9
* Axis Type of the input event
*/
type AxisType = 'touchmajor' | 'touchminor' | 'orientation' | 'x' | 'y' | 'pressure' | 'toolminor' | 'toolmajor' | 'null';
type AxisType =
| 'touchmajor'
| 'touchminor'
| 'orientation'
| 'x'
| 'y'
| 'pressure'
| 'toolminor'
| 'toolmajor'
| 'null';
/**
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
enum KeyboardType {
/**
* None
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
NONE = 0,
/**
* Unknown key
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
UNKNOWN = 1,
/**
* Alphabetical keyboard
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
ALPHABETIC_KEYBOARD = 2,
/**
* Digital keyboard
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
DIGITAL_KEYBOARD = 3,
/**
* Stylus
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
HANDWRITING_PEN = 4,
/**
* Remote control
*
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
REMOTE_CONTROL = 5,
REMOTE_CONTROL = 5
}
/**
* Defines the listener for input device events.
*
* @since 9
*
* @interface DeviceListener
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param type Type of the input device event. The options are add and remove.
* @param deviceId ID of the input device for the reported input device event.
* @since 9
*/
interface DeviceListener {
/**
* Type of the input device event. The options are add and remove.
*
* @type { ChangedType }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
type: ChangedType;
/**
* ID of the input device for the reported input device event.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
deviceId: number;
}
/**
* Starts listening for an input device event.
*
* @since 9
*
* @param { 'change' } type - Type of the input device event, which is **change**.
* @param { Callback<DeviceListener> } listener - Callback for the input device event.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param type Type of the input device event, which is **change**.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function on(type: "change", listener: Callback<DeviceListener>): void;
function on(type: 'change', listener: Callback<DeviceListener>): void;
/**
* Stops listening for an input device event.
*
* @since 9
*
* @param { 'change' } type - Type of the input device event, which is **change**.
* @param { Callback<DeviceListener> } listener - Callback for the input device event.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param type Type of the input device event, which is **change**.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function off(type: "change", listener?: Callback<DeviceListener>): void;
function off(type: 'change', listener?: Callback<DeviceListener>): void;
/**
* Defines axis information about events that can be reported by an input device.
* For example, a touchscreen may report information such as x, y, and pressure,
* which indicate the x-axis coordinate, y-axis coordinate, and pressure, respectively.
*
* @since 8
* @interface AxisRange
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param source Input source type of the axis. For example, if a mouse reports an x-axis event, the source of the x-axis is the mouse.
* @param axis Type of the axis. for example, the x-axis, y-axis, and pressure axis.
* @param max Maximum value of the data reported on this axis.
* @param min Minimum value of the data reported on this axis.
* @param fuzz Fuzz value of the data reported on this axis.
* @param flat Flat value of the data reported on this axis.
* @param resolution Resolution value of the data reported on this axis.
* @since 8
*/
interface AxisRange {
/**
* Input source type of the axis. For example, if a mouse reports an x-axis event,
* the source of the x-axis is the mouse.
*
* @type { SourceType }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
source: SourceType;
/**
* Type of the axis. for example, the x-axis, y-axis, and pressure axis.
*
* @type { AxisType }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
axis: AxisType;
/**
* Maximum value of the data reported on this axis.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
max: number;
/**
* Minimum value of the data reported on this axis.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
min: number;
/**
* Fuzz value of the data reported on this axis.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
fuzz: number;
/**
* Flat value of the data reported on this axis.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
flat: number;
/**
* Resolution value of the data reported on this axis.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
resolution: number;
@ -166,65 +233,98 @@ declare namespace inputDevice {
/**
* Defines the information about an input device.
*
* @since 8
* @interface InputDeviceData
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param name Name of the input device.
* @param sources Source type supported by the input device. For example, if a keyboard is attached with a touchpad, the device has two input sources: keyboard and touchpad.
* @param axisRanges Axis range of the input device.
* @param bus Bus of the input device.
* @param product Product of the input device.
* @param vendor Vendor of the input device.
* @param version Version of the input device.
* @param phys Physical path of the input device.
* @param uniq Unique identifier of the input device.
* @since 8
*/
interface InputDeviceData {
/**
* Id of the input device.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
id: number;
/**
* Name of the input device.
*
* @type { string }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
name: string;
/**
* Source type supported by the input device. For example, if a keyboard is attached with a touchpad,
* the device has two input sources: keyboard and touchpad.
*
* @type { Array<SourceType> }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
sources: Array<SourceType>;
/**
* Axis range of the input device.
*
* @type { Array<AxisRange> }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
*/
axisRanges: Array<AxisRange>;
/**
* Bus of the input device.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
bus: number;
/**
* Product of the input device.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
product: number;
/**
* Vendor of the input device.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
vendor: number;
/**
* Version of the input device.
*
* @type { number }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
version: number;
/**
* Physical path of the input device.
*
* @type { string }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
phys: string;
/**
* Unique identifier of the input device.
*
* @type { string }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
uniq: string;
@ -233,9 +333,9 @@ declare namespace inputDevice {
/**
* Obtains the IDs of all input devices.
*
* @since 8
* @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param callback Callback function, receive reported data
* @since 8
* @deprecated since 9
* @useinstead ohos.multimodalInput.inputDevice#getDeviceList
*/
@ -244,8 +344,9 @@ declare namespace inputDevice {
/**
* Obtains the IDs of all input devices.
*
* @since 8
* @returns { Promise<Array<number>> }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 8
* @deprecated since 9
* @useinstead ohos.multimodalInput.inputDevice#getDeviceList
*/
@ -254,10 +355,10 @@ declare namespace inputDevice {
/**
* Obtain the information about an input device.
*
* @since 8
* @param { number } deviceId - ID of the input device whose information is to be obtained.
* @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device whose information is to be obtained.
* @param callback Callback function, receive reported data
* @since 8
* @deprecated since 9
* @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo
*/
@ -266,9 +367,10 @@ declare namespace inputDevice {
/**
* Obtain the information about an input device.
*
* @since 8
* @param { number } deviceId - ID of the input device whose information is to be obtained.
* @returns { Promise<InputDeviceData> }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device whose information is to be obtained.
* @since 8
* @deprecated since 9
* @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo
*/
@ -277,85 +379,87 @@ declare namespace inputDevice {
/**
* Obtains the IDs of all input devices.
*
* @since 9
* @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param callback Callback function, receive reported data
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getDeviceList(callback: AsyncCallback<Array<number>>): void;
/**
* Obtains the IDs of all input devices.
*
* @since 9
* @returns { Promise<Array<number>> }
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
function getDeviceList(): Promise<Array<number>>;
/**
* Obtain the information about an input device.
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device whose information is to be obtained.
* @param callback Callback function, receive reported data
* @throws {BusinessError} 401 - Parameter error.
*/
* Obtain the information about an input device.
*
* @param { number } deviceId - ID of the input device whose information is to be obtained.
* @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
function getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void;
/**
* Obtain the information about an input device.
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device whose information is to be obtained.
* @throws {BusinessError} 401 - Parameter error.
*/
* Obtain the information about an input device.
*
* @param { number } deviceId - ID of the input device whose information is to be obtained.
* @returns { Promise<InputDeviceData> }
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @since 9
*/
function getDeviceInfo(deviceId: number): Promise<InputDeviceData>;
/**
* Checks whether the specified key codes of an input device are supported.
*
* @since 9
* @param { number } deviceId - ID of the input device.
* @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time.
* @param { AsyncCallback<Array<boolean>> } callback -Indicates whether the specified key codes are supported.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device.
* @param keys Key codes of the input device, You can query a maximum of five key codes at a time.
* @returns Returns a result indicating whether the specified key codes are supported.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void;
/**
* Checks whether the specified key codes of an input device are supported.
*
* @since 9
* @param { number } deviceId - ID of the input device.
* @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time.
* @returns { Promise<Array<boolean>> } Returns a result indicating whether the specified key codes are supported.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the input device.
* @param keys Key codes of the input device, You can query a maximum of five key codes at a time.
* @returns Returns a result indicating whether the specified key codes are supported.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>;
/**
* Query the keyboard type of the input device.
*
* @since 9
* @param { number } deviceId - ID of the specified input device.
* @param { AsyncCallback<KeyboardType> } callback - Returns the keyboard type.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the specified input device.
* @returns Returns the keyboard type.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void;
/**
* Query the keyboard type of the input device.
*
* @since 9
* @param { number } deviceId - ID of the specified input device.
* @returns { Promise<KeyboardType> } Returns the keyboard type.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputDevice
* @param deviceId ID of the specified input device.
* @returns Returns the keyboard type.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getKeyboardType(deviceId: number): Promise<KeyboardType>;
}

View File

@ -1,47 +1,63 @@
/*
* Copyright (c) 2022 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.
*/
* Copyright (c) 2022 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.
*/
/**
* InputEvent
*
* @since 9
* @interface InputEvent
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface InputEvent {
/**
* Unique event ID generated by the server
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
id: number;
/**
* ID of the device that reports the input event
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
deviceId: number;
/**
* Occurrence time of the input event
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
actionTime: number;
/**
* ID of the target screen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
screenId: number;
/**
* ID of the target window
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
windowId: number;
}

View File

@ -1,55 +1,83 @@
/*
* Copyright (C) 2021 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.
*/
/**
* Global Key Event Injection
* Copyright (C) 2021 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
*
* @since 8
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* 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.
*/
/**
* Global Key Event Injection
*
* @namespace inputEventClient
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @since 8
*/
declare namespace inputEventClient {
/**
* Defines event of key that user want to inject.
*
* @interface KeyEvent
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @since 8
*/
interface KeyEvent {
/**
* Defines event of key that user want to inject.
* The status of key.
*
* @since 8
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @param isPressed The status of key.
* @param keyCode The keyCode value of key.
* @param keyDownDuration Key hold duration.
* @param isIntercepted Whether the key is blocked.
* @since 8
*/
interface KeyEvent {
isPressed: boolean;
keyCode: number;
keyDownDuration: number;
isIntercepted: boolean;
}
isPressed: boolean;
/**
* Inject system keys.
* The keyCode value of key.
*
* @since 8
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @param KeyEvent the key event to be injected.
* @throws {BusinessError} 401 - Parameter error.
* @since 8
*/
function injectEvent({KeyEvent: KeyEvent}): void;
keyCode: number;
/**
* Key hold duration.
*
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @since 8
*/
keyDownDuration: number;
/**
* Whether the key is blocked.
*
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @since 8
*/
isIntercepted: boolean;
}
/**
* Inject system keys.
*
* @param { { KeyEvent } } KeyEvent - the key event to be injected.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.InputSimulator
* @systemapi hide for inner use
* @since 8
*/
function injectEvent({ KeyEvent: KeyEvent }): void;
}
export default inputEventClient;

View File

@ -19,80 +19,82 @@ import { MouseEvent } from './@ohos.multimodalInput.mouseEvent';
/**
* Global input event listener
* System API, available only to system processes
* @since 7
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
*
* @namespace inputMonitor
* @permission ohos.permission.INPUT_MONITORING
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 7
*/
declare namespace inputMonitor {
/**
* Callback used to receive touch input events. If **true** is returned, the touch input is consumed, and the system performs the closing operation.
* @since 7
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
*/
interface TouchEventReceiver {
(touchEvent:TouchEvent): Boolean;
}
/**
* Callback used to receive touch input events. If **true** is returned, the touch input is consumed,
* and the system performs the closing operation.
*
* @interface TouchEventReceiver
* @permission ohos.permission.INPUT_MONITORING
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 7
*/
interface TouchEventReceiver {
(touchEvent: TouchEvent): Boolean;
}
/**
* Listens for touch input events.
*
* @since 7
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @permission ohos.permission.INPUT_MONITORING
* @param type Event type, which is **touch**.
* @param receiver Callback used to receive the reported data.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @throws {BusinessError} 201 - Permission denied.
*/
function on(type:"touch", receiver:TouchEventReceiver):void;
/**
* Listens for touch input events.
*
* @permission ohos.permission.INPUT_MONITORING
* @param { 'touch' } type - Event type, which is **touch**.
* @param { TouchEventReceiver } receiver - Callback used to receive the reported data.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 201 - Permission denied.
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 7
*/
function on(type: 'touch', receiver: TouchEventReceiver): void;
/**
* Listens for mouse input events.
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @permission ohos.permission.INPUT_MONITORING
* @param type Event type, which is **mouse**.
* @param receiver Callback used to receive the reported data.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @throws {BusinessError} 201 - Permission denied.
*/
function on(type:"mouse", receiver:Callback<MouseEvent>):void;
/**
* Listens for mouse input events.
*
* @permission ohos.permission.INPUT_MONITORING
* @param { 'mouse' } type - Event type, which is **mouse**.
* @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 201 - Permission denied.
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 9
*/
function on(type: 'mouse', receiver: Callback<MouseEvent>): void;
/**
* Cancel listening for touch input events.
*
* @since 7
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @permission ohos.permission.INPUT_MONITORING
* @param type Event type, which is **touch**.
* @param receiver Callback used to receive the reported data.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @throws {BusinessError} 201 - Permission denied.
*/
function off(type:"touch", receiver?:TouchEventReceiver):void;
/**
* Cancel listening for touch input events.
*
* @permission ohos.permission.INPUT_MONITORING
* @param { 'touch' } type - Event type, which is **touch**.
* @param { TouchEventReceiver } receiver - Callback used to receive the reported data.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 201 - Permission denied.
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 7
*/
function off(type: 'touch', receiver?: TouchEventReceiver): void;
/**
* Cancel listening for mouse input events.
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @permission ohos.permission.INPUT_MONITORING
* @param type Event type, which is **mouse**.
* @param receiver Callback used to receive the reported data.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @throws {BusinessError} 201 - Permission denied.
*/
function off(type:"mouse", receiver?:Callback<MouseEvent>):void;
/**
* Cancel listening for mouse input events.
*
* @permission ohos.permission.INPUT_MONITORING
* @param { 'mouse' } type - Event type, which is **mouse**.
* @param { Callback<MouseEvent> } receiver - Callback used to receive the reported data.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 201 - Permission denied.
* @syscap SystemCapability.MultimodalInput.Input.InputMonitor
* @systemapi hide for inner use
* @since 9
*/
function off(type: 'mouse', receiver?: Callback<MouseEvent>): void;
}
export default inputMonitor;

View File

@ -1,25 +1,25 @@
/*
* Copyright (c) 2022 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.
*/
* Copyright (c) 2022 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.
*/
/**
* KeyCode
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.Core
*/
* KeyCode
*
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum KeyCode {
KEYCODE_FN = 0,
KEYCODE_UNKNOWN = -1,
@ -350,5 +350,5 @@ export declare enum KeyCode {
KEYCODE_BTN_6 = 3106,
KEYCODE_BTN_7 = 3107,
KEYCODE_BTN_8 = 3108,
KEYCODE_BTN_9 = 3109,
KEYCODE_BTN_9 = 3109
}

View File

@ -1,129 +1,187 @@
/*
* Copyright (c) 2022 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.
*/
import { InputEvent } from "./@ohos.multimodalInput.inputEvent"
import { KeyCode } from "./@ohos.multimodalInput.keyCode"
* Copyright (c) 2022 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.
*/
import { InputEvent } from './@ohos.multimodalInput.inputEvent';
import { KeyCode } from './@ohos.multimodalInput.keyCode';
/**
* Action
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.Core
*/
* Action
*
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum Action {
/**
* Cancel key
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
CANCEL = 0,
/**
* Down key
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
DOWN = 1,
/**
* Up key
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
UP = 2,
UP = 2
}
/**
* Key
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.Core
*/
* Key
*
* @interface Key
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface Key {
/**
* Key code
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
code: KeyCode;
/**
* Time when the key is pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
pressedTime: number;
/**
* Device to which the key belongs
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
deviceId: number;
}
/**
* KeyEvent
*
* @since 9
* @syscap SystemCapability.MultimodalInput.Input.Core
*/
* KeyEvent
*
* @interface KeyEvent
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface KeyEvent extends InputEvent {
/**
* Key action
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
action: Action;
/**
* Key that has changed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
key: Key;
/**
* Unicode character corresponding to the key
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
unicodeChar: number;
/**
* List of pressed keys
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
keys: Key[];
/**
* Whether ctrlKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
ctrlKey: boolean;
/**
* Whether altKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
altKey: boolean;
/**
* Whether shiftKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
shiftKey: boolean;
/**
* Whether logoKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
logoKey: boolean;
/**
* Whether fnKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
fnKey: boolean;
/**
* Whether capsLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
capsLock: boolean;
/**
* Whether numLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
numLock: boolean;
/**
* Whether scrollLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
scrollLock: boolean;
}

View File

@ -1,107 +1,155 @@
/*
* Copyright (c) 2022 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.
*/
import { InputEvent } from "./@ohos.multimodalInput.inputEvent"
import { KeyCode } from "./@ohos.multimodalInput.keyCode"
* Copyright (c) 2022 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.
*/
import { InputEvent } from './@ohos.multimodalInput.inputEvent';
import { KeyCode } from './@ohos.multimodalInput.keyCode';
/**
* Action
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum Action {
/**
* Cancel
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
CANCEL = 0,
/**
* Moving of the mouse pointer
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
MOVE = 1,
/**
* Pressing down of the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
BUTTON_DOWN = 2,
/**
* Lifting of the mouse button
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
BUTTON_UP = 3,
/**
* Beginning of the axis event associated with the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
AXIS_BEGIN = 4,
/**
* Updating of the axis event associated with the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
AXIS_UPDATE = 5,
/**
* Ending of the axis event associated with the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
AXIS_END = 6,
AXIS_END = 6
}
/**
* Mouse button
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum Button {
/**
* Left button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
LEFT = 0,
/**
* Middle button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
MIDDLE = 1,
/**
* Right button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
RIGHT = 2,
/**
* Side button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
SIDE = 3,
/**
* Extended button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
EXTRA = 4,
/**
* Forward button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
FORWARD = 5,
/**
* Back button on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
BACK = 6,
/**
* Task key on the mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
TASK = 7
}
@ -109,143 +157,219 @@ export declare enum Button {
/**
* Axis
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum Axis {
/**
* Vertical scroll axis
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
SCROLL_VERTICAL = 0,
/**
* Horizontal scroll axis
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
SCROLL_HORIZONTAL = 1,
/**
* Pinch axis
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
PINCH = 2,
PINCH = 2
}
/**
* AxisValue
*
* @since 9
* @interface AxisValue
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface AxisValue {
/**
* Axis type
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
axis: Axis;
/**
* Axis value
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
value: number
value: number;
}
/**
* MouseEvent
*
* @since 9
* @interface MouseEvent
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface MouseEvent extends InputEvent {
/**
* Mouse event action
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
action: Action;
/**
* X coordinate of the mouse pointer on the screen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
screenX: number;
/**
* Y coordinate of the mouse pointer on the screen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
screenY: number;
/**
* X coordinate of the mouse pointer in the window
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
windowX: number;
/**
* Y coordinate of the mouse pointer in the window
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
windowY: number;
/**
* X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
* X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at
* the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
rawDeltaX: number;
/**
* Y axis offset relative to the previous reported mouse pointer position
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
rawDeltaY: number;
/**
* Button that is currently pressed or released
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
button: Button;
/**
* Button that is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
pressedButtons: Button[];
/**
* All axis data contained in the event
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
axes: AxisValue[];
/**
* List of pressed keys
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
pressedKeys: KeyCode[];
/**
* Whether ctrlKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
ctrlKey: boolean;
/**
* Whether altKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
altKey: boolean;
/**
* Whether shiftKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
shiftKey: boolean;
/**
* Whether logoKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
logoKey: boolean;
/**
* Whether fnKey is being pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
fnKey:boolean
fnKey: boolean;
/**
* Whether capsLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
capsLock:boolean
capsLock: boolean;
/**
* Whether numLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
numLock:boolean
numLock: boolean;
/**
* Whether scrollLock is active
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
scrollLock:boolean
scrollLock: boolean;
}

View File

@ -1,232 +1,352 @@
/*
* Copyright (c) 2022-2023 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.
*/
* Copyright (c) 2022-2023 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.
*/
import { AsyncCallback } from "./@ohos.base";
import { AsyncCallback } from './basic';
/**
* Declares interfaces related to mouse pointer attributes.
*
* @since 9
* @namespace pointer
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
declare namespace pointer {
/**
* Pointer style.
*
* @since 9
*
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
enum PointerStyle {
/**
* Default
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
DEFAULT,
/**
* East arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
EAST,
/**
* West arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
WEST,
/**
* South arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
SOUTH,
/**
* North arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH,
/**
* East-west arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
WEST_EAST,
/**
* North-south arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH_SOUTH,
/**
* North-east arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH_EAST,
/**
* North-west arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH_WEST,
/**
* South-east arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
SOUTH_EAST,
/**
* South-west arrow
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
SOUTH_WEST,
/**
* Northeast and southwest adjustment
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH_EAST_SOUTH_WEST,
/**
* Northwest and southeast adjustment
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
NORTH_WEST_SOUTH_EAST,
/**
* Cross (accurate selection)
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
CROSS,
/**
* Copy
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
CURSOR_COPY,
/**
* Forbid
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
CURSOR_FORBID,
/**
* Sucker
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
COLOR_SUCKER,
/**
* Grabbing hand
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
HAND_GRABBING,
/**
* Opening hand
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
HAND_OPEN,
/**
* Hand-shaped pointer
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
HAND_POINTING,
/**
* Help
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
HELP,
/**
* Move
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MOVE,
/**
* Left and right resizing
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
RESIZE_LEFT_RIGHT,
/**
* Up and down resizing
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
RESIZE_UP_DOWN,
/**
* Screenshot crosshair
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
SCREENSHOT_CHOOSE,
/**
* Screenshot
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
SCREENSHOT_CURSOR,
/**
* Text selection
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
TEXT_CURSOR,
/**
* Zoom in
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
ZOOM_IN,
/**
* Zoom out
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
ZOOM_OUT,
/**
* Scrolling east
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_EAST,
/**
* Scrolling west
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_WEST,
/**
* Scrolling south
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_SOUTH,
/**
* Scrolling north
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_NORTH,
/**
* Scrolling north and south
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_NORTH_SOUTH,
/**
* Scrolling northeast
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_NORTH_EAST,
/**
* Scrolling northwest
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_NORTH_WEST,
/**
* Scrolling southeast
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_SOUTH_EAST,
/**
* Scrolling southwest
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_SOUTH_WEST,
/**
* Moving as a cone in four directions
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 9
*/
MIDDLE_BTN_NORTH_SOUTH_WEST_EAST,
MIDDLE_BTN_NORTH_SOUTH_WEST_EAST
}
/**
* Mouse button.
*
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 10
@ -234,12 +354,14 @@ declare namespace pointer {
enum PrimaryButton {
/**
* Left mouse button
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 10
*/
LEFT = 0,
/**
* Right mouse button
*
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @since 10
*/
@ -248,141 +370,144 @@ declare namespace pointer {
/**
* Sets the pointer moving speed.
*
* @since 9
*
* @param { number } speed - Pointer moving speed, which is any number.
* @param { AsyncCallback<void> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @systemapi hide for inner use
* @param speed Pointer moving speed, which is any number.
* @param callback Callback used to return the result.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerSpeed(speed: number, callback: AsyncCallback<void>): void;
/**
* Sets the pointer moving speed.
*
* @since 9
*
* @param { number } speed - Pointer moving speed, which is any number.
* @returns { Promise<void> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @systemapi hide for inner use
* @param speed Pointer moving speed, which is any number.
* @returns Returns the result through a promise.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerSpeed(speed: number): Promise<void>;
/**
* Queries the pointer moving speed.
*
* @since 9
*
* @param { AsyncCallback<number> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @systemapi hide for inner use
* @param callback Callback used to return the result.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getPointerSpeed(callback: AsyncCallback<number>): void;
/**
* Queries the pointer moving speed.
*
* @since 9
*
* @returns { Promise<number> } Returns the result through a promise.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @systemapi hide for inner use
* @returns Returns the result through a promise.
* @since 9
*/
function getPointerSpeed(): Promise<number>;
/**
* Sets the pointer style.
*
* @since 9
*
* @param { number } windowId - Window ID.
* @param { PointerStyle } pointerStyle - Pointer style.
* @param { AsyncCallback<void> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param windowId Window ID.
* @param pointerStyle Pointer style.
* @param callback Callback used to return the result.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void;
/**
* Sets the pointer style.
*
* @since 9
*
* @param { number } windowId - Window ID.
* @param { PointerStyle } pointerStyle - Pointer style.
* @returns { Promise<void> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param windowId Window ID.
* @param pointerStyle Pointer style.
* @returns Returns the result through a promise.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void>;
/**
* Queries the pointer style.
*
* @since 9
*
* @param { number } windowId - Window ID.
* @param { AsyncCallback<PointerStyle> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param windowId Window ID.
* @param callback Callback used to return the result.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void;
/**
* Queries the pointer style.
*
* @since 9
*
* @param { number } windowId - Window ID.
* @returns { Promise<PointerStyle> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param windowId Window ID.
* @returns Returns the result through a promise.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function getPointerStyle(windowId: number): Promise<PointerStyle>;
/**
* Sets whether the pointer icon is visible.
*
* @since 9
* @param { boolean } visible Whether the pointer icon is visible. The value true indicates that the pointer
* icon is visible, and the value false indicates the opposite.
* @param { AsyncCallback<void> } callback - Callback for the input device event.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param visible Whether the pointer icon is visible. The value true indicates that the pointer icon is visible,
* and the value false indicates the opposite.
* @returns Callback for the input device event.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void;
/**
* Sets whether the pointer icon is visible.
*
* @since 9
* @param { boolean } visible Whether the pointer icon is visible. The value true indicates that the pointer
* icon is visible, and the value false indicates the opposite.
* @returns { Promise<void> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @param visible Whether the pointer icon is visible. The value true indicates that the pointer icon is visible,
* and the value false indicates the opposite.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function setPointerVisible(visible: boolean): Promise<void>;
/**
* Checks whether the pointer icon is visible.
*
* @since 9
* @param { AsyncCallback<boolean> } callback - Returns <b>true</b> if the pointer icon is visible,
* returns <b>false</b> otherwise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @returns Returns <b>true</b> if the pointer icon is visible; returns <b>false</b> otherwise.
* @throws {BusinessError} 401 - Parameter error.
* @since 9
*/
function isPointerVisible(callback: AsyncCallback<boolean>): void;
/**
* Checks whether the pointer icon is visible.
*
* @since 9
* @returns { Promise<boolean> } Returns <b>true</b> if the pointer icon is visible; returns <b>false</b> otherwise.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
* @returns Returns <b>true</b> if the pointer icon is visible; returns <b>false</b> otherwise.
* @since 9
*/
function isPointerVisible(): Promise<boolean>;
/**
* Sets mouse primary button.
* @param { PrimaryButton } primary - Indicates mouse primary button. The value LEFT indicates that mouse primary button is
* left button, and the value RIGHT indicates that mouse primary button is right button.
*
* @param { PrimaryButton } primary - Indicates mouse primary button. The value LEFT indicates that mouse primary
* button is left button, and the value RIGHT indicates that mouse primary button is right button.
* @param { AsyncCallback<void> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
@ -393,8 +518,9 @@ declare namespace pointer {
/**
* Sets mouse primary button.
* @param { PrimaryButton } primary - Indicates mouse primary button. The value LEFT indicates that mouse primary button is
* left button, and the value RIGHT indicates that mouse primary button is right button.
*
* @param { PrimaryButton } primary - Indicates mouse primary button. The value LEFT indicates that mouse primary
* button is left button, and the value RIGHT indicates that mouse primary button is right button.
* @returns { Promise<void> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
@ -405,6 +531,7 @@ declare namespace pointer {
/**
* Gets mouse primary button.
*
* @param { AsyncCallback<PrimaryButton> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
@ -415,6 +542,7 @@ declare namespace pointer {
/**
* Gets mouse primary button.
*
* @returns { Promise<PrimaryButton> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
@ -425,6 +553,7 @@ declare namespace pointer {
/**
* Sets whether the mouse hover scroll is enabled in inactive window.
*
* @param { boolean } state - Indicates whether the mouse hover scroll is enabled in inactive window. The value true
* indicates that the mouse hover scroll is enabled, and the value false indicates the opposite.
* @param { AsyncCallback<void> } callback - Callback used to return the result.
@ -437,6 +566,7 @@ declare namespace pointer {
/**
* Sets whether mouse hover scroll is enabled in inactive window.
*
* @param { boolean } state - Indicates whether the mouse hover scroll is enabled in inactive window. The value true
* indicates that the mouse hover scroll is enabled, and the value false indicates the opposite.
* @returns { Promise<void> } Returns the result through a promise.
@ -449,6 +579,7 @@ declare namespace pointer {
/**
* Gets a status whether the mouse hover scroll is enabled in inactive window.
*
* @param { AsyncCallback<boolean> } callback - Callback used to return the result.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer
@ -459,6 +590,7 @@ declare namespace pointer {
/**
* Gets a status whether mouse hover scroll is enabled in inactive window.
*
* @returns { Promise<boolean> } Returns the result through a promise.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.MultimodalInput.Input.Pointer

View File

@ -1,209 +1,310 @@
/*
* Copyright (c) 2022 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.
*/
import { InputEvent } from './@ohos.multimodalInput.inputEvent'
* Copyright (c) 2022 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.
*/
import { InputEvent } from './@ohos.multimodalInput.inputEvent';
/**
* Action
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum Action {
/**
* Touch cancelled
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
CANCEL = 0,
/**
* Touch pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
DOWN = 1,
/**
* Touch moved
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
MOVE = 2,
/**
* Touch lifted
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
UP = 3,
UP = 3
}
/**
* ToolType
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum ToolType {
/**
* Finger
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
FINGER = 0,
/**
* Stylus
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
PEN = 1,
/**
* Rubber
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
RUBBER = 2,
/**
* Brush
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
BRUSH = 3,
/**
* Pencil
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
PENCIL = 4,
/**
* Air brush
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
AIRBRUSH = 5,
/**
* Mouse
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
MOUSE = 6,
LENS = 7,
LENS = 7
}
/**
* SourceType
*
* @since 9
* @enum { number }
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare enum SourceType {
/**
* Touchscreen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
TOUCH_SCREEN = 0,
/**
* Stylus
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
PEN = 1,
/**
* Touchpad
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
TOUCH_PAD = 2,
TOUCH_PAD = 2
}
/**
* Touch
*
* @since 9
* @interface Touch
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface Touch {
/**
* Pointer identifier
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
id: number;
/**
* Time stamp when touch is pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
pressedTime: number;
/**
* X coordinate of the touch position on the screen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
screenX: number;
/**
* Y coordinate of the touch position on the screen
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
screenY: number;
/**
* X coordinate of the touch position in the window
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
windowX: number;
/**
* Y coordinate of the touch position in the window
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
windowY: number;
/**
* Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported.
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
pressure: number;
/**
* Width of the contact area when touch is pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
width: number;
/**
* Height of the contact area when touch is pressed
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
height: number;
/**
* Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt.
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
tiltX: number;
/**
* Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt.
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
tiltY: number;
/**
* Center point X of the tool area
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
toolX: number;
/**
* Center point Y of the tool area
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
toolY: number;
/**
* Width of the tool area
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
toolWidth: number;
/**
* Height of the tool area
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
toolHeight: number;
/**
* X coordinate of the input device
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
rawX: number;
/**
* Y coordinate of the input device
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
rawY: number;
/**
* Tool type
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
toolType: ToolType;
}
@ -211,27 +312,40 @@ export declare interface Touch {
/**
* TouchEvent
*
* @since 9
* @interface TouchEvent
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
export declare interface TouchEvent extends InputEvent {
/**
* Touch action
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
action: Action;
/**
* Current touch point
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
touch: Touch;
/**
* All touch points
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
touches: Touch[];
/**
* Device type of the touch source
*
* @syscap SystemCapability.MultimodalInput.Input.Core
* @since 9
*/
sourceType: SourceType;
}