161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { Callback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Declares the APIs for dragging management. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace dragInteraction 2761847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 2861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace dragInteraction { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Enumerates the dragging states. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @enum { number } 3661847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 3761847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 3861847f8eSopenharmony_ci * @since 10 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_ci enum DragState { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Dragging starts. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 4561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 4661847f8eSopenharmony_ci * @since 10 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci MSG_DRAG_STATE_START = 1, 4961847f8eSopenharmony_ci 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * Dragging ends. 5261847f8eSopenharmony_ci * 5361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 5461847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 5561847f8eSopenharmony_ci * @since 10 5661847f8eSopenharmony_ci */ 5761847f8eSopenharmony_ci MSG_DRAG_STATE_STOP = 2, 5861847f8eSopenharmony_ci 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * Dragging is canceled. 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 6361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 6461847f8eSopenharmony_ci * @since 10 6561847f8eSopenharmony_ci */ 6661847f8eSopenharmony_ci MSG_DRAG_STATE_CANCEL = 3, 6761847f8eSopenharmony_ci } 6861847f8eSopenharmony_ci 6961847f8eSopenharmony_ci /** 7061847f8eSopenharmony_ci * Abstract of the dragged data. 7161847f8eSopenharmony_ci * 7261847f8eSopenharmony_ci * @interface Summary 7361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 7461847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 7561847f8eSopenharmony_ci * @since 11 7661847f8eSopenharmony_ci */ 7761847f8eSopenharmony_ci interface Summary { 7861847f8eSopenharmony_ci /** 7961847f8eSopenharmony_ci * Type of the dragged object. 8061847f8eSopenharmony_ci * 8161847f8eSopenharmony_ci * @type { string } 8261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 8361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 8461847f8eSopenharmony_ci * @since 11 8561847f8eSopenharmony_ci */ 8661847f8eSopenharmony_ci dataType: string; 8761847f8eSopenharmony_ci 8861847f8eSopenharmony_ci /** 8961847f8eSopenharmony_ci * Data length of the dragged object. 9061847f8eSopenharmony_ci * 9161847f8eSopenharmony_ci * @type { number } 9261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 9361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 9461847f8eSopenharmony_ci * @since 11 9561847f8eSopenharmony_ci */ 9661847f8eSopenharmony_ci dataSize: number; 9761847f8eSopenharmony_ci } 9861847f8eSopenharmony_ci 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Listens for dragging state change events. 10161847f8eSopenharmony_ci * 10261847f8eSopenharmony_ci * @param { 'drag' } type Indicates the event type. 10361847f8eSopenharmony_ci * @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state. 10461847f8eSopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 10561847f8eSopenharmony_ci * <br>2.Incorrect parameter types.3.Parameter verification failed. 10661847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 10761847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 10861847f8eSopenharmony_ci * @since 10 10961847f8eSopenharmony_ci */ 11061847f8eSopenharmony_ci /** 11161847f8eSopenharmony_ci * Listens for dragging state change events. 11261847f8eSopenharmony_ci * 11361847f8eSopenharmony_ci * @param { 'drag' } type Indicates the event type. 11461847f8eSopenharmony_ci * @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state. 11561847f8eSopenharmony_ci * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 11661847f8eSopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 11761847f8eSopenharmony_ci * <br>2.Incorrect parameter types.3.Parameter verification failed. 11861847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 11961847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 12061847f8eSopenharmony_ci * @since 12 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci function on(type: 'drag', callback: Callback<DragState>): void; 12361847f8eSopenharmony_ci 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * Disables listening for dragging state change events. 12661847f8eSopenharmony_ci * 12761847f8eSopenharmony_ci * @param { 'drag' } type Indicates the event type. 12861847f8eSopenharmony_ci * @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter 12961847f8eSopenharmony_ci * is not specified, listening will be disabled for all registered callbacks. 13061847f8eSopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 13161847f8eSopenharmony_ci * <br>2.Incorrect parameter types.3.Parameter verification failed. 13261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 13361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 13461847f8eSopenharmony_ci * @since 10 13561847f8eSopenharmony_ci */ 13661847f8eSopenharmony_ci /** 13761847f8eSopenharmony_ci * Disables listening for dragging state change events. 13861847f8eSopenharmony_ci * 13961847f8eSopenharmony_ci * @param { 'drag' } type Indicates the event type. 14061847f8eSopenharmony_ci * @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter 14161847f8eSopenharmony_ci * is not specified, listening will be disabled for all registered callbacks. 14261847f8eSopenharmony_ci * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 14361847f8eSopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 14461847f8eSopenharmony_ci * <br>2.Incorrect parameter types.3.Parameter verification failed. 14561847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 14661847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 14761847f8eSopenharmony_ci * @since 12 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci function off(type: 'drag', callback?: Callback<DragState>): void; 15061847f8eSopenharmony_ci 15161847f8eSopenharmony_ci /** 15261847f8eSopenharmony_ci * Obtains the abstract of a dragged object. 15361847f8eSopenharmony_ci * 15461847f8eSopenharmony_ci * @returns { Array<Summary> } Data abstract of the dragged object. 15561847f8eSopenharmony_ci * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 15661847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Drag 15761847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 15861847f8eSopenharmony_ci * @since 11 15961847f8eSopenharmony_ci */ 16061847f8eSopenharmony_ci function getDataSummary(): Array<Summary>; 16161847f8eSopenharmony_ci} 16261847f8eSopenharmony_ci 16361847f8eSopenharmony_ciexport default dragInteraction;