161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023 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_ci 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ciimport type { AsyncCallback, BusinessError, Callback } from './@ohos.base'; 2461847f8eSopenharmony_ciimport type unifiedDataChannel from './@ohos.data.unifiedDataChannel'; 2561847f8eSopenharmony_ci 2661847f8eSopenharmony_ci/** 2761847f8eSopenharmony_ci * This module allows developers to trigger a drag event. 2861847f8eSopenharmony_ci * @namespace dragController 2961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3061847f8eSopenharmony_ci * @since 10 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_ci/** 3361847f8eSopenharmony_ci * This module allows developers to trigger a drag event. 3461847f8eSopenharmony_ci * @namespace dragController 3561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3661847f8eSopenharmony_ci * @atomicservice 3761847f8eSopenharmony_ci * @since 12 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_cideclare namespace dragController { 4061847f8eSopenharmony_ci /** 4161847f8eSopenharmony_ci * Defines the Drag Status. 4261847f8eSopenharmony_ci * 4361847f8eSopenharmony_ci * @enum { number } 4461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4561847f8eSopenharmony_ci * @since 11 4661847f8eSopenharmony_ci */ 4761847f8eSopenharmony_ci /** 4861847f8eSopenharmony_ci * Defines the Drag Status. 4961847f8eSopenharmony_ci * 5061847f8eSopenharmony_ci * @enum { number } 5161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5261847f8eSopenharmony_ci * @atomicservice 5361847f8eSopenharmony_ci * @since 12 5461847f8eSopenharmony_ci */ 5561847f8eSopenharmony_ci const enum DragStatus { 5661847f8eSopenharmony_ci /** 5761847f8eSopenharmony_ci * Drag has started. 5861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5961847f8eSopenharmony_ci * @since 11 6061847f8eSopenharmony_ci */ 6161847f8eSopenharmony_ci /** 6261847f8eSopenharmony_ci * Drag has started. 6361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6461847f8eSopenharmony_ci * @atomicservice 6561847f8eSopenharmony_ci * @since 12 6661847f8eSopenharmony_ci */ 6761847f8eSopenharmony_ci STARTED = 0, 6861847f8eSopenharmony_ci /** 6961847f8eSopenharmony_ci * Drag has ended. 7061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7161847f8eSopenharmony_ci * @since 11 7261847f8eSopenharmony_ci */ 7361847f8eSopenharmony_ci /** 7461847f8eSopenharmony_ci * Drag has ended. 7561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7661847f8eSopenharmony_ci * @atomicservice 7761847f8eSopenharmony_ci * @since 12 7861847f8eSopenharmony_ci */ 7961847f8eSopenharmony_ci ENDED = 1, 8061847f8eSopenharmony_ci } 8161847f8eSopenharmony_ci 8261847f8eSopenharmony_ci /** 8361847f8eSopenharmony_ci * Drag and drop information 8461847f8eSopenharmony_ci * 8561847f8eSopenharmony_ci * @interface DragAndDropInfo 8661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8761847f8eSopenharmony_ci * @since 11 8861847f8eSopenharmony_ci */ 8961847f8eSopenharmony_ci /** 9061847f8eSopenharmony_ci * Drag and drop information 9161847f8eSopenharmony_ci * 9261847f8eSopenharmony_ci * @interface DragAndDropInfo 9361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9461847f8eSopenharmony_ci * @atomicservice 9561847f8eSopenharmony_ci * @since 12 9661847f8eSopenharmony_ci */ 9761847f8eSopenharmony_ci interface DragAndDropInfo { 9861847f8eSopenharmony_ci /** 9961847f8eSopenharmony_ci * The drag status. 10061847f8eSopenharmony_ci * @type { DragStatus } 10161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10261847f8eSopenharmony_ci * @since 11 10361847f8eSopenharmony_ci */ 10461847f8eSopenharmony_ci /** 10561847f8eSopenharmony_ci * The drag status. 10661847f8eSopenharmony_ci * @type { DragStatus } 10761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10861847f8eSopenharmony_ci * @atomicservice 10961847f8eSopenharmony_ci * @since 12 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci status: DragStatus; 11261847f8eSopenharmony_ci /** 11361847f8eSopenharmony_ci * The information containing the drag event. 11461847f8eSopenharmony_ci * @type { DragEvent } 11561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11661847f8eSopenharmony_ci * @since 11 11761847f8eSopenharmony_ci */ 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * The information containing the drag event. 12061847f8eSopenharmony_ci * @type { DragEvent } 12161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12261847f8eSopenharmony_ci * @atomicservice 12361847f8eSopenharmony_ci * @since 12 12461847f8eSopenharmony_ci */ 12561847f8eSopenharmony_ci event: DragEvent; 12661847f8eSopenharmony_ci /** 12761847f8eSopenharmony_ci * Additional information about the drag info. 12861847f8eSopenharmony_ci * @type { ?string } 12961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13061847f8eSopenharmony_ci * @since 11 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * Additional information about the drag info. 13461847f8eSopenharmony_ci * @type { ?string } 13561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13661847f8eSopenharmony_ci * @atomicservice 13761847f8eSopenharmony_ci * @since 12 13861847f8eSopenharmony_ci */ 13961847f8eSopenharmony_ci extraParams?: string; 14061847f8eSopenharmony_ci } 14161847f8eSopenharmony_ci 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * One drag action object for drag process 14461847f8eSopenharmony_ci * 14561847f8eSopenharmony_ci * @interface DragAction 14661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14761847f8eSopenharmony_ci * @since 11 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci /** 15061847f8eSopenharmony_ci * One drag action object for drag process 15161847f8eSopenharmony_ci * 15261847f8eSopenharmony_ci * @interface DragAction 15361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15461847f8eSopenharmony_ci * @atomicservice 15561847f8eSopenharmony_ci * @since 12 15661847f8eSopenharmony_ci */ 15761847f8eSopenharmony_ci interface DragAction { 15861847f8eSopenharmony_ci /** 15961847f8eSopenharmony_ci * trigger drag action 16061847f8eSopenharmony_ci * 16161847f8eSopenharmony_ci * @returns { Promise<void> } A Promise can indicate the start result. 16261847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 16361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16461847f8eSopenharmony_ci * @since 11 16561847f8eSopenharmony_ci */ 16661847f8eSopenharmony_ci /** 16761847f8eSopenharmony_ci * trigger drag action 16861847f8eSopenharmony_ci * 16961847f8eSopenharmony_ci * @returns { Promise<void> } A Promise can indicate the start result. 17061847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 17161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17261847f8eSopenharmony_ci * @atomicservice 17361847f8eSopenharmony_ci * @since 12 17461847f8eSopenharmony_ci */ 17561847f8eSopenharmony_ci startDrag(): Promise<void>; 17661847f8eSopenharmony_ci /** 17761847f8eSopenharmony_ci * Registers a callback for listening on drag status changes. 17861847f8eSopenharmony_ci * This callback is triggered when the drag status change. 17961847f8eSopenharmony_ci * 18061847f8eSopenharmony_ci * @param { 'statusChange' } type for status changing 18161847f8eSopenharmony_ci * @param { Callback<DragAndDropInfo> } callback with drag event and status information 18261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18361847f8eSopenharmony_ci * @since 11 18461847f8eSopenharmony_ci */ 18561847f8eSopenharmony_ci /** 18661847f8eSopenharmony_ci * Registers a callback for listening on drag status changes. 18761847f8eSopenharmony_ci * This callback is triggered when the drag status change. 18861847f8eSopenharmony_ci * 18961847f8eSopenharmony_ci * @param { 'statusChange' } type for status changing 19061847f8eSopenharmony_ci * @param { Callback<DragAndDropInfo> } callback with drag event and status information 19161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19261847f8eSopenharmony_ci * @atomicservice 19361847f8eSopenharmony_ci * @since 12 19461847f8eSopenharmony_ci */ 19561847f8eSopenharmony_ci on(type: 'statusChange', callback: Callback<DragAndDropInfo>): void; 19661847f8eSopenharmony_ci 19761847f8eSopenharmony_ci /** 19861847f8eSopenharmony_ci * Deregisters a callback for listening on drag status changes. 19961847f8eSopenharmony_ci * This callback is not triggered when the drag status change. 20061847f8eSopenharmony_ci * 20161847f8eSopenharmony_ci * @param { 'statusChange' } type for status changing 20261847f8eSopenharmony_ci * @param { Callback<DragAndDropInfo> } callback with drag event and status information 20361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 20461847f8eSopenharmony_ci * @since 11 20561847f8eSopenharmony_ci */ 20661847f8eSopenharmony_ci /** 20761847f8eSopenharmony_ci * Deregisters a callback for listening on drag status changes. 20861847f8eSopenharmony_ci * This callback is not triggered when the drag status change. 20961847f8eSopenharmony_ci * 21061847f8eSopenharmony_ci * @param { 'statusChange' } type for status changing 21161847f8eSopenharmony_ci * @param { Callback<DragAndDropInfo> } callback with drag event and status information 21261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21361847f8eSopenharmony_ci * @atomicservice 21461847f8eSopenharmony_ci * @since 12 21561847f8eSopenharmony_ci */ 21661847f8eSopenharmony_ci off(type: 'statusChange', callback?: Callback<DragAndDropInfo>): void; 21761847f8eSopenharmony_ci } 21861847f8eSopenharmony_ci 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * DragInfo object description 22161847f8eSopenharmony_ci * 22261847f8eSopenharmony_ci * @interface DragInfo 22361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 22461847f8eSopenharmony_ci * @since 10 22561847f8eSopenharmony_ci */ 22661847f8eSopenharmony_ci /** 22761847f8eSopenharmony_ci * DragInfo object description 22861847f8eSopenharmony_ci * 22961847f8eSopenharmony_ci * @interface DragInfo 23061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23161847f8eSopenharmony_ci * @atomicservice 23261847f8eSopenharmony_ci * @since 12 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci interface DragInfo { 23561847f8eSopenharmony_ci /** 23661847f8eSopenharmony_ci * A unique identifier to identify which touch point. 23761847f8eSopenharmony_ci * @type { number } 23861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23961847f8eSopenharmony_ci * @since 10 24061847f8eSopenharmony_ci */ 24161847f8eSopenharmony_ci /** 24261847f8eSopenharmony_ci * A unique identifier to identify which touch point. 24361847f8eSopenharmony_ci * @type { number } 24461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24561847f8eSopenharmony_ci * @atomicservice 24661847f8eSopenharmony_ci * @since 12 24761847f8eSopenharmony_ci */ 24861847f8eSopenharmony_ci pointerId: number; 24961847f8eSopenharmony_ci 25061847f8eSopenharmony_ci /** 25161847f8eSopenharmony_ci * Drag data. 25261847f8eSopenharmony_ci * @type { ?unifiedDataChannel.UnifiedData } 25361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 25461847f8eSopenharmony_ci * @since 10 25561847f8eSopenharmony_ci */ 25661847f8eSopenharmony_ci /** 25761847f8eSopenharmony_ci * Drag data. 25861847f8eSopenharmony_ci * @type { ?unifiedDataChannel.UnifiedData } 25961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26061847f8eSopenharmony_ci * @atomicservice 26161847f8eSopenharmony_ci * @since 12 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci data?: unifiedDataChannel.UnifiedData; 26461847f8eSopenharmony_ci 26561847f8eSopenharmony_ci /** 26661847f8eSopenharmony_ci * Additional information about the drag info. 26761847f8eSopenharmony_ci * @type { ?string } 26861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26961847f8eSopenharmony_ci * @since 10 27061847f8eSopenharmony_ci */ 27161847f8eSopenharmony_ci /** 27261847f8eSopenharmony_ci * Additional information about the drag info. 27361847f8eSopenharmony_ci * @type { ?string } 27461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 27561847f8eSopenharmony_ci * @atomicservice 27661847f8eSopenharmony_ci * @since 12 27761847f8eSopenharmony_ci */ 27861847f8eSopenharmony_ci extraParams?: string; 27961847f8eSopenharmony_ci 28061847f8eSopenharmony_ci /** 28161847f8eSopenharmony_ci * Touch point coordinates. 28261847f8eSopenharmony_ci * @type { ?TouchPoint } 28361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 28461847f8eSopenharmony_ci * @since 11 28561847f8eSopenharmony_ci */ 28661847f8eSopenharmony_ci /** 28761847f8eSopenharmony_ci * Touch point coordinates. 28861847f8eSopenharmony_ci * @type { ?TouchPoint } 28961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29061847f8eSopenharmony_ci * @atomicservice 29161847f8eSopenharmony_ci * @since 12 29261847f8eSopenharmony_ci */ 29361847f8eSopenharmony_ci touchPoint?: TouchPoint; 29461847f8eSopenharmony_ci 29561847f8eSopenharmony_ci /** 29661847f8eSopenharmony_ci * Drag preview options. 29761847f8eSopenharmony_ci * @type { ?DragPreviewOptions } 29861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29961847f8eSopenharmony_ci * @since 11 30061847f8eSopenharmony_ci */ 30161847f8eSopenharmony_ci /** 30261847f8eSopenharmony_ci * Drag preview options. 30361847f8eSopenharmony_ci * @type { ?DragPreviewOptions } 30461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 30561847f8eSopenharmony_ci * @atomicservice 30661847f8eSopenharmony_ci * @since 12 30761847f8eSopenharmony_ci */ 30861847f8eSopenharmony_ci previewOptions?: DragPreviewOptions; 30961847f8eSopenharmony_ci } 31061847f8eSopenharmony_ci 31161847f8eSopenharmony_ci /** 31261847f8eSopenharmony_ci * Defines the animation options for drag preview. 31361847f8eSopenharmony_ci * 31461847f8eSopenharmony_ci * @interface AnimationOptions 31561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 31661847f8eSopenharmony_ci * @since 11 31761847f8eSopenharmony_ci */ 31861847f8eSopenharmony_ci /** 31961847f8eSopenharmony_ci * Defines the animation options for drag preview. 32061847f8eSopenharmony_ci * 32161847f8eSopenharmony_ci * @interface AnimationOptions 32261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 32361847f8eSopenharmony_ci * @atomicservice 32461847f8eSopenharmony_ci * @since 12 32561847f8eSopenharmony_ci */ 32661847f8eSopenharmony_ci interface AnimationOptions { 32761847f8eSopenharmony_ci /** 32861847f8eSopenharmony_ci * Animation duration, in ms. 32961847f8eSopenharmony_ci * @type { ?number } 33061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 33161847f8eSopenharmony_ci * @since 11 33261847f8eSopenharmony_ci */ 33361847f8eSopenharmony_ci /** 33461847f8eSopenharmony_ci * Animation duration, in ms. 33561847f8eSopenharmony_ci * @type { ?number } 33661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 33761847f8eSopenharmony_ci * @atomicservice 33861847f8eSopenharmony_ci * @since 12 33961847f8eSopenharmony_ci */ 34061847f8eSopenharmony_ci duration?: number; 34161847f8eSopenharmony_ci /** 34261847f8eSopenharmony_ci * Animation curve. 34361847f8eSopenharmony_ci * @type { ?(Curve | ICurve) } 34461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 34561847f8eSopenharmony_ci * @since 11 34661847f8eSopenharmony_ci */ 34761847f8eSopenharmony_ci /** 34861847f8eSopenharmony_ci * Animation curve. 34961847f8eSopenharmony_ci * @type { ?(Curve | ICurve) } 35061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 35161847f8eSopenharmony_ci * @atomicservice 35261847f8eSopenharmony_ci * @since 12 35361847f8eSopenharmony_ci */ 35461847f8eSopenharmony_ci curve?: Curve | ICurve; 35561847f8eSopenharmony_ci } 35661847f8eSopenharmony_ci 35761847f8eSopenharmony_ci /** 35861847f8eSopenharmony_ci * Provides the functions of setting color or updating animation. 35961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 36061847f8eSopenharmony_ci * @since 11 36161847f8eSopenharmony_ci */ 36261847f8eSopenharmony_ci /** 36361847f8eSopenharmony_ci * Provides the functions of setting color or updating animation. 36461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 36561847f8eSopenharmony_ci * @atomicservice 36661847f8eSopenharmony_ci * @since 12 36761847f8eSopenharmony_ci */ 36861847f8eSopenharmony_ci export class DragPreview { 36961847f8eSopenharmony_ci /** 37061847f8eSopenharmony_ci * change foreground color of preview 37161847f8eSopenharmony_ci * @param { ResourceColor } color - color value 37261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 37361847f8eSopenharmony_ci * @since 11 37461847f8eSopenharmony_ci */ 37561847f8eSopenharmony_ci /** 37661847f8eSopenharmony_ci * change foreground color of preview 37761847f8eSopenharmony_ci * @param { ResourceColor } color - color value 37861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 37961847f8eSopenharmony_ci * @atomicservice 38061847f8eSopenharmony_ci * @since 12 38161847f8eSopenharmony_ci */ 38261847f8eSopenharmony_ci setForegroundColor(color: ResourceColor): void; 38361847f8eSopenharmony_ci /** 38461847f8eSopenharmony_ci * update preview style with animation 38561847f8eSopenharmony_ci * @param { AnimationOptions } options - animation options 38661847f8eSopenharmony_ci * @param { function } handler - change style functions 38761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 38861847f8eSopenharmony_ci * @since 11 38961847f8eSopenharmony_ci */ 39061847f8eSopenharmony_ci /** 39161847f8eSopenharmony_ci * update preview style with animation 39261847f8eSopenharmony_ci * @param { AnimationOptions } options - animation options 39361847f8eSopenharmony_ci * @param { function } handler - change style functions 39461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 39561847f8eSopenharmony_ci * @atomicservice 39661847f8eSopenharmony_ci * @since 12 39761847f8eSopenharmony_ci */ 39861847f8eSopenharmony_ci animate(options: AnimationOptions, handler: () =>void): void; 39961847f8eSopenharmony_ci } 40061847f8eSopenharmony_ci 40161847f8eSopenharmony_ci /** 40261847f8eSopenharmony_ci * Define the drag event paramters 40361847f8eSopenharmony_ci * 40461847f8eSopenharmony_ci * @interface DragEventParam 40561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 40661847f8eSopenharmony_ci * @atomicservice 40761847f8eSopenharmony_ci * @since 12 40861847f8eSopenharmony_ci */ 40961847f8eSopenharmony_ci interface DragEventParam { 41061847f8eSopenharmony_ci 41161847f8eSopenharmony_ci /** 41261847f8eSopenharmony_ci * The information containing the drag event. 41361847f8eSopenharmony_ci * @type { DragEvent } 41461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 41561847f8eSopenharmony_ci * @since 10 41661847f8eSopenharmony_ci */ 41761847f8eSopenharmony_ci /** 41861847f8eSopenharmony_ci * The information containing the drag event. 41961847f8eSopenharmony_ci * @type { DragEvent } 42061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 42161847f8eSopenharmony_ci * @atomicservice 42261847f8eSopenharmony_ci * @since 12 42361847f8eSopenharmony_ci */ 42461847f8eSopenharmony_ci event: DragEvent; 42561847f8eSopenharmony_ci 42661847f8eSopenharmony_ci /** 42761847f8eSopenharmony_ci * Additional information about the drag info. 42861847f8eSopenharmony_ci * @type { string } 42961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 43061847f8eSopenharmony_ci * @since 10 43161847f8eSopenharmony_ci */ 43261847f8eSopenharmony_ci /** 43361847f8eSopenharmony_ci * Additional information about the drag info. 43461847f8eSopenharmony_ci * @type { string } 43561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 43661847f8eSopenharmony_ci * @atomicservice 43761847f8eSopenharmony_ci * @since 12 43861847f8eSopenharmony_ci */ 43961847f8eSopenharmony_ci extraParams: string; 44061847f8eSopenharmony_ci } 44161847f8eSopenharmony_ci 44261847f8eSopenharmony_ci /** 44361847f8eSopenharmony_ci * Execute a drag event. 44461847f8eSopenharmony_ci * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 44561847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 44661847f8eSopenharmony_ci * @param { AsyncCallback<{ event: DragEvent, extraParams: string }> } callback - Callback that contains the drag event information. 44761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 44861847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 44961847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 45061847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 45161847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 45261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 45361847f8eSopenharmony_ci * @since 10 45461847f8eSopenharmony_ci */ 45561847f8eSopenharmony_ci /** 45661847f8eSopenharmony_ci * Execute a drag event. 45761847f8eSopenharmony_ci * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 45861847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 45961847f8eSopenharmony_ci * @param { AsyncCallback<DragEventParam> } callback - Callback that contains the drag event information. 46061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 46161847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 46261847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 46361847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 46461847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 46561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 46661847f8eSopenharmony_ci * @atomicservice 46761847f8eSopenharmony_ci * @since 12 46861847f8eSopenharmony_ci */ 46961847f8eSopenharmony_ci function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo, 47061847f8eSopenharmony_ci callback: AsyncCallback<DragEventParam>): void; 47161847f8eSopenharmony_ci 47261847f8eSopenharmony_ci /** 47361847f8eSopenharmony_ci * Execute a drag event. 47461847f8eSopenharmony_ci * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 47561847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 47661847f8eSopenharmony_ci * @returns { Promise<{ event: DragEvent, extraParams: string }> } A Promise with the drag event information. 47761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 47861847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 47961847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 48061847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 48161847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 48261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 48361847f8eSopenharmony_ci * @since 10 48461847f8eSopenharmony_ci */ 48561847f8eSopenharmony_ci /** 48661847f8eSopenharmony_ci * Execute a drag event. 48761847f8eSopenharmony_ci * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. 48861847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 48961847f8eSopenharmony_ci * @returns { Promise<DragEventParam> } A Promise with the drag event information. 49061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 49161847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 49261847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 49361847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 49461847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 49561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 49661847f8eSopenharmony_ci * @atomicservice 49761847f8eSopenharmony_ci * @since 12 49861847f8eSopenharmony_ci */ 49961847f8eSopenharmony_ci function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo): Promise<DragEventParam>; 50061847f8eSopenharmony_ci 50161847f8eSopenharmony_ci /** 50261847f8eSopenharmony_ci * Create one drag action object, which can be used for starting drag later or monitoring 50361847f8eSopenharmony_ci * the drag status after drag started. 50461847f8eSopenharmony_ci * @param { Array<CustomBuilder | DragItemInfo> } customArray - Objects used for prompts 50561847f8eSopenharmony_ci * displayed when the objects are dragged. 50661847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 50761847f8eSopenharmony_ci * @returns { DragAction } one drag action object 50861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 50961847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 51061847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 51161847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 51261847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 51361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 51461847f8eSopenharmony_ci * @since 11 51561847f8eSopenharmony_ci */ 51661847f8eSopenharmony_ci /** 51761847f8eSopenharmony_ci * Create one drag action object, which can be used for starting drag later or monitoring 51861847f8eSopenharmony_ci * the drag status after drag started. 51961847f8eSopenharmony_ci * @param { Array<CustomBuilder | DragItemInfo> } customArray - Objects used for prompts 52061847f8eSopenharmony_ci * displayed when the objects are dragged. 52161847f8eSopenharmony_ci * @param { DragInfo } dragInfo - Information about the drag event. 52261847f8eSopenharmony_ci * @returns { DragAction } one drag action object 52361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 52461847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 52561847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 52661847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 52761847f8eSopenharmony_ci * @throws { BusinessError } 100001 - Internal handling failed. 52861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 52961847f8eSopenharmony_ci * @atomicservice 53061847f8eSopenharmony_ci * @since 12 53161847f8eSopenharmony_ci */ 53261847f8eSopenharmony_ci function createDragAction(customArray: Array<CustomBuilder | DragItemInfo>, dragInfo: DragInfo): DragAction; 53361847f8eSopenharmony_ci 53461847f8eSopenharmony_ci /** 53561847f8eSopenharmony_ci * Get drag preview object. 53661847f8eSopenharmony_ci * @returns { DragPreview } An drag preview object. 53761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 53861847f8eSopenharmony_ci * @since 11 53961847f8eSopenharmony_ci */ 54061847f8eSopenharmony_ci /** 54161847f8eSopenharmony_ci * Get drag preview object. 54261847f8eSopenharmony_ci * @returns { DragPreview } An drag preview object. 54361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 54461847f8eSopenharmony_ci * @atomicservice 54561847f8eSopenharmony_ci * @since 12 54661847f8eSopenharmony_ci */ 54761847f8eSopenharmony_ci function getDragPreview(): DragPreview; 54861847f8eSopenharmony_ci} 54961847f8eSopenharmony_ci 55061847f8eSopenharmony_ciexport default dragController; 551