• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import { Callback } from './@ohos.base';
22
23/**
24 * Declares the APIs for dragging management.
25 *
26 * @namespace dragInteraction
27 * @syscap SystemCapability.Msdp.DeviceStatus.Drag
28 * @systemapi Hide this for inner system use.
29 * @since 10
30 */
31declare namespace dragInteraction {
32  /**
33   * Enumerates the dragging states.
34   *
35   * @enum { number }
36   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
37   * @systemapi Hide this for inner system use.
38   * @since 10
39   */
40  enum DragState {
41    /**
42     * Dragging starts.
43     *
44     * @syscap SystemCapability.Msdp.DeviceStatus.Drag
45     * @systemapi Hide this for inner system use.
46     * @since 10
47     */
48    MSG_DRAG_STATE_START = 1,
49
50    /**
51     * Dragging ends.
52     *
53     * @syscap SystemCapability.Msdp.DeviceStatus.Drag
54     * @systemapi Hide this for inner system use.
55     * @since 10
56     */
57    MSG_DRAG_STATE_STOP = 2,
58
59    /**
60     * Dragging is canceled.
61     *
62     * @syscap SystemCapability.Msdp.DeviceStatus.Drag
63     * @systemapi Hide this for inner system use.
64     * @since 10
65     */
66    MSG_DRAG_STATE_CANCEL = 3,
67  }
68
69  /**
70   * Abstract of the dragged data.
71   *
72   * @interface Summary
73   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
74   * @systemapi Hide this for inner system use.
75   * @since 11
76   */
77  interface Summary {
78    /**
79     * Type of the dragged object.
80     *
81     * @type { string }
82     * @syscap SystemCapability.Msdp.DeviceStatus.Drag
83     * @systemapi Hide this for inner system use.
84     * @since 11
85     */
86    dataType: string;
87
88    /**
89     * Data length of the dragged object.
90     *
91     * @type { number }
92     * @syscap SystemCapability.Msdp.DeviceStatus.Drag
93     * @systemapi Hide this for inner system use.
94     * @since 11
95     */
96    dataSize: number;
97  }
98
99  /**
100   * Listens for dragging state change events.
101   *
102   * @param { 'drag' } type Indicates the event type.
103   * @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state.
104   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
105   * <br>2.Incorrect parameter types.3.Parameter verification failed.
106   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
107   * @systemapi Hide this for inner system use.
108   * @since 10
109   */
110  /**
111   * Listens for dragging state change events.
112   *
113   * @param { 'drag' } type Indicates the event type.
114   * @param { Callback<DragState> } callback Indicates the callback to receive the changed dragging state.
115   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
116   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
117   * <br>2.Incorrect parameter types.3.Parameter verification failed.
118   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
119   * @systemapi Hide this for inner system use.
120   * @since 12
121   */
122  function on(type: 'drag', callback: Callback<DragState>): void;
123
124  /**
125   * Disables listening for dragging state change events.
126   *
127   * @param { 'drag' } type Indicates the event type.
128   * @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter
129   * is not specified, listening will be disabled for all registered callbacks.
130   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
131   * <br>2.Incorrect parameter types.3.Parameter verification failed.
132   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
133   * @systemapi Hide this for inner system use.
134   * @since 10
135   */
136  /**
137   * Disables listening for dragging state change events.
138   *
139   * @param { 'drag' } type Indicates the event type.
140   * @param { Callback<DragState> }callback Indicates the callback for which listening is disabled. If this parameter
141   * is not specified, listening will be disabled for all registered callbacks.
142   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
143   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
144   * <br>2.Incorrect parameter types.3.Parameter verification failed.
145   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
146   * @systemapi Hide this for inner system use.
147   * @since 12
148   */
149  function off(type: 'drag', callback?: Callback<DragState>): void;
150
151  /**
152   * Obtains the abstract of a dragged object.
153   *
154   * @returns { Array<Summary> } Data abstract of the dragged object.
155   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
156   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
157   * @systemapi Hide this for inner system use.
158   * @since 11
159   */
160  function getDataSummary(): Array<Summary>;
161
162  /**
163   * Sets the master switch for enhancing the drag capability.
164   *
165   * @param { boolean } enabled Switch state.
166   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
167   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
168   * @systemapi Hide this for inner system use.
169   * @since 18
170   */
171  function setDragSwitchState(enabled: boolean): void;
172
173  /**
174   * Sets the app switch for enhancing the drag capability.
175   *
176   * @param { boolean } enabled Switch state.
177   * @param { string } bundleName App bundle name.
178   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
179   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
180   * <br>2.Incorrect parameter types.3.Parameter verification failed.
181   * @syscap SystemCapability.Msdp.DeviceStatus.Drag
182   * @systemapi Hide this for inner system use.
183   * @since 18
184   */
185  function setAppDragSwitchState(enabled: boolean, bundleName: string): void;
186}
187
188export default dragInteraction;