2023-07-07 07:10:35 +00:00
|
|
|
/*
|
2024-04-23 03:02:55 +00:00
|
|
|
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
2023-07-07 07:10:35 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @kit ArkUI
|
|
|
|
*/
|
|
|
|
|
2023-07-07 07:10:35 +00:00
|
|
|
import { Callback } from './@ohos.base';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Declares the APIs for dragging management.
|
|
|
|
*
|
2023-08-26 03:51:40 +00:00
|
|
|
* @namespace dragInteraction
|
2023-07-07 07:10:35 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-08-26 03:51:40 +00:00
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
2023-07-10 06:10:13 +00:00
|
|
|
declare namespace dragInteraction {
|
2023-07-07 07:10:35 +00:00
|
|
|
/**
|
|
|
|
* Enumerates the dragging states.
|
|
|
|
*
|
2023-08-26 03:51:40 +00:00
|
|
|
* @enum { number }
|
2023-07-07 07:10:35 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-08-26 03:51:40 +00:00
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
|
|
|
enum DragState {
|
|
|
|
/**
|
|
|
|
* Dragging starts.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
2023-08-26 03:51:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
2023-07-10 03:29:09 +00:00
|
|
|
MSG_DRAG_STATE_START = 1,
|
2023-07-07 07:10:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dragging ends.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
2023-08-26 03:51:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
2023-07-10 03:29:09 +00:00
|
|
|
MSG_DRAG_STATE_STOP = 2,
|
2023-07-07 07:10:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dragging is canceled.
|
|
|
|
*
|
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
2023-08-26 03:51:40 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
2023-07-10 03:29:09 +00:00
|
|
|
MSG_DRAG_STATE_CANCEL = 3,
|
2023-07-07 07:10:35 +00:00
|
|
|
}
|
2023-11-30 07:50:11 +00:00
|
|
|
|
2023-11-29 01:11:27 +00:00
|
|
|
/**
|
2023-11-29 10:35:25 +00:00
|
|
|
* Abstract of the dragged data.
|
2023-11-29 01:11:27 +00:00
|
|
|
*
|
2023-11-30 07:50:11 +00:00
|
|
|
* @interface Summary
|
2023-11-29 01:11:27 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-11-30 07:50:11 +00:00
|
|
|
interface Summary {
|
2023-11-29 01:08:04 +00:00
|
|
|
/**
|
2023-11-29 10:35:25 +00:00
|
|
|
* Type of the dragged object.
|
2023-11-29 01:08:04 +00:00
|
|
|
*
|
|
|
|
* @type { string }
|
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
2023-11-29 01:11:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-11-29 01:08:04 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
2023-11-30 08:29:58 +00:00
|
|
|
dataType: string;
|
2023-11-29 01:08:04 +00:00
|
|
|
|
|
|
|
/**
|
2023-11-29 10:35:25 +00:00
|
|
|
* Data length of the dragged object.
|
2023-11-29 01:08:04 +00:00
|
|
|
*
|
|
|
|
* @type { number }
|
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
2023-11-29 01:11:27 +00:00
|
|
|
* @systemapi Hide this for inner system use.
|
2023-11-29 01:08:04 +00:00
|
|
|
* @since 11
|
|
|
|
*/
|
2023-11-30 08:29:58 +00:00
|
|
|
dataSize: number;
|
2023-11-29 01:08:04 +00:00
|
|
|
}
|
|
|
|
|
2023-07-07 07:10:35 +00:00
|
|
|
/**
|
|
|
|
* Listens for dragging state change events.
|
|
|
|
*
|
2023-08-26 03:51:40 +00:00
|
|
|
* @param { 'drag' } type Indicates the event type.
|
|
|
|
* @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state.
|
2024-04-22 13:40:25 +00:00
|
|
|
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-07-23 02:51:51 +00:00
|
|
|
* <br>2.Incorrect parameter types.3.Parameter verification failed.
|
2023-07-07 07:10:35 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2023-08-26 03:51:40 +00:00
|
|
|
* @since 10
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
|
|
|
/**
|
2024-07-23 02:51:51 +00:00
|
|
|
* Listens for dragging state change events.
|
2023-07-07 07:10:35 +00:00
|
|
|
*
|
2023-08-26 03:51:40 +00:00
|
|
|
* @param { 'drag' } type Indicates the event type.
|
2024-07-23 02:51:51 +00:00
|
|
|
* @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state.
|
2024-07-26 06:12:06 +00:00
|
|
|
* @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
|
2024-04-22 13:40:25 +00:00
|
|
|
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-07-23 02:51:51 +00:00
|
|
|
* <br>2.Incorrect parameter types.3.Parameter verification failed.
|
2023-07-07 07:10:35 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2024-07-23 02:51:51 +00:00
|
|
|
* @since 12
|
2023-07-07 07:10:35 +00:00
|
|
|
*/
|
2024-07-23 02:51:51 +00:00
|
|
|
function on(type: 'drag', callback: Callback<DragState>): void;
|
2023-11-28 06:07:59 +00:00
|
|
|
|
|
|
|
/**
|
2024-07-23 02:51:51 +00:00
|
|
|
* Disables listening for dragging state change events.
|
2023-11-28 06:07:59 +00:00
|
|
|
*
|
2024-07-23 02:51:51 +00:00
|
|
|
* @param { 'drag' } type Indicates the event type.
|
|
|
|
* @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter
|
|
|
|
* is not specified, listening will be disabled for all registered callbacks.
|
|
|
|
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br>2.Incorrect parameter types.3.Parameter verification failed.
|
2023-11-28 06:07:59 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2024-07-23 02:51:51 +00:00
|
|
|
* @since 10
|
2023-11-28 06:07:59 +00:00
|
|
|
*/
|
2024-07-23 02:12:16 +00:00
|
|
|
/**
|
2024-07-23 02:51:51 +00:00
|
|
|
* Disables listening for dragging state change events.
|
2024-07-23 02:12:16 +00:00
|
|
|
*
|
|
|
|
* @param { 'drag' } type Indicates the event type.
|
2024-07-23 02:51:51 +00:00
|
|
|
* @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter
|
|
|
|
* is not specified, listening will be disabled for all registered callbacks.
|
2024-07-26 06:12:06 +00:00
|
|
|
* @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
|
2024-07-23 02:12:16 +00:00
|
|
|
* @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
|
2024-07-23 02:51:51 +00:00
|
|
|
* <br>2.Incorrect parameter types.3.Parameter verification failed.
|
2024-07-23 02:12:16 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-07-23 02:51:51 +00:00
|
|
|
function off(type: 'drag', callback?: Callback<DragState>): void;
|
2024-07-23 02:12:16 +00:00
|
|
|
|
|
|
|
/**
|
2024-07-23 02:51:51 +00:00
|
|
|
* Obtains the abstract of a dragged object.
|
2024-07-23 02:12:16 +00:00
|
|
|
*
|
2024-07-23 02:51:51 +00:00
|
|
|
* @returns { Array<Summary> } Data abstract of the dragged object.
|
2024-07-26 06:12:06 +00:00
|
|
|
* @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
|
2024-07-23 02:12:16 +00:00
|
|
|
* @syscap SystemCapability.Msdp.DeviceStatus.Drag
|
|
|
|
* @systemapi Hide this for inner system use.
|
2024-07-23 02:51:51 +00:00
|
|
|
* @since 11
|
2024-07-23 02:12:16 +00:00
|
|
|
*/
|
2024-07-23 02:51:51 +00:00
|
|
|
function getDataSummary(): Array<Summary>;
|
2023-07-07 07:10:35 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 06:10:13 +00:00
|
|
|
export default dragInteraction;
|