123b3eb3cSopenharmony_ci/*
223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License.
523b3eb3cSopenharmony_ci * You may obtain a copy of the License at
623b3eb3cSopenharmony_ci *
723b3eb3cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
823b3eb3cSopenharmony_ci *
923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and
1323b3eb3cSopenharmony_ci * limitations under the License.
1423b3eb3cSopenharmony_ci */
1523b3eb3cSopenharmony_ci
1623b3eb3cSopenharmony_ci/**
1723b3eb3cSopenharmony_ci * @addtogroup ArkUI_NativeModule
1823b3eb3cSopenharmony_ci * @{
1923b3eb3cSopenharmony_ci *
2023b3eb3cSopenharmony_ci * @brief Provides drag and drop APIs of ArkUI on the native side.
2123b3eb3cSopenharmony_ci *
2223b3eb3cSopenharmony_ci * @since 12
2323b3eb3cSopenharmony_ci */
2423b3eb3cSopenharmony_ci
2523b3eb3cSopenharmony_ci/**
2623b3eb3cSopenharmony_ci * @file drag_and_drop.h
2723b3eb3cSopenharmony_ci *
2823b3eb3cSopenharmony_ci * @brief Defines the native drag and drop APIs.
2923b3eb3cSopenharmony_ci *
3023b3eb3cSopenharmony_ci * @library libace_ndk.z.so
3123b3eb3cSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
3223b3eb3cSopenharmony_ci * @since 12
3323b3eb3cSopenharmony_ci */
3423b3eb3cSopenharmony_ci
3523b3eb3cSopenharmony_ci#ifndef ARKUI_NATIVE_DRAG_AND_DROP_H
3623b3eb3cSopenharmony_ci#define ARKUI_NATIVE_DRAG_AND_DROP_H
3723b3eb3cSopenharmony_ci
3823b3eb3cSopenharmony_ci#include <stdint.h>
3923b3eb3cSopenharmony_ci
4023b3eb3cSopenharmony_ci#include "native_type.h"
4123b3eb3cSopenharmony_ci#include "ui_input_event.h"
4223b3eb3cSopenharmony_ci
4323b3eb3cSopenharmony_ci#ifdef __cplusplus
4423b3eb3cSopenharmony_ciextern "C" {
4523b3eb3cSopenharmony_ci#endif
4623b3eb3cSopenharmony_ci
4723b3eb3cSopenharmony_ci/**
4823b3eb3cSopenharmony_ci * @brief Defines an enum for drag results, which are set by the data receiver and transferred by the system to the
4923b3eb3cSopenharmony_ci *        drag source so that the drag source is aware of the data processing result of the receiver.
5023b3eb3cSopenharmony_ci *
5123b3eb3cSopenharmony_ci * @since 12
5223b3eb3cSopenharmony_ci */
5323b3eb3cSopenharmony_citypedef enum {
5423b3eb3cSopenharmony_ci    /** The drag and drop operation succeeded. */
5523b3eb3cSopenharmony_ci    ARKUI_DRAG_RESULT_SUCCESSFUL = 0,
5623b3eb3cSopenharmony_ci    /** The drag and drop operation failed. */
5723b3eb3cSopenharmony_ci    ARKUI_DRAG_RESULT_FAILED,
5823b3eb3cSopenharmony_ci    /** The drag and drop operation was canceled. */
5923b3eb3cSopenharmony_ci    ARKUI_DRAG_RESULT_CANCELED,
6023b3eb3cSopenharmony_ci} ArkUI_DragResult;
6123b3eb3cSopenharmony_ci
6223b3eb3cSopenharmony_ci/**
6323b3eb3cSopenharmony_ci * @brief Defines an enum for data processing modes used when data is dropped, which affects the display of the badge.
6423b3eb3cSopenharmony_ci *
6523b3eb3cSopenharmony_ci * @since 12
6623b3eb3cSopenharmony_ci */
6723b3eb3cSopenharmony_citypedef enum {
6823b3eb3cSopenharmony_ci    /** Copy. */
6923b3eb3cSopenharmony_ci    ARKUI_DROP_OPERATION_COPY = 0,
7023b3eb3cSopenharmony_ci    /** Cut. */
7123b3eb3cSopenharmony_ci    ARKUI_DROP_OPERATION_MOVE,
7223b3eb3cSopenharmony_ci} ArkUI_DropOperation;
7323b3eb3cSopenharmony_ci
7423b3eb3cSopenharmony_ci/**
7523b3eb3cSopenharmony_ci * @brief Defines an enum for interaction states prior to a drop and drop operation.
7623b3eb3cSopenharmony_ci *
7723b3eb3cSopenharmony_ci * @since 12
7823b3eb3cSopenharmony_ci */
7923b3eb3cSopenharmony_citypedef enum {
8023b3eb3cSopenharmony_ci    /** Unknown. */
8123b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_UNKNOWN = -1,
8223b3eb3cSopenharmony_ci    /** A drag gesture is being detected. */
8323b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_ACTION_DETECTING,
8423b3eb3cSopenharmony_ci    /** The component is ready to be dragged. */
8523b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_READY_TO_TRIGGER_DRAG,
8623b3eb3cSopenharmony_ci    /** A lift animation is started. */
8723b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_PREVIEW_LIFT_STARTED,
8823b3eb3cSopenharmony_ci    /** A lift animation is finished. */
8923b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_PREVIEW_LIFT_FINISHED,
9023b3eb3cSopenharmony_ci    /** A drop animation is started. */
9123b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_PREVIEW_LANDING_STARTED,
9223b3eb3cSopenharmony_ci    /** A drop animation is finished. */
9323b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_PREVIEW_LANDING_FINISHED,
9423b3eb3cSopenharmony_ci    /** A drop animation is terminated. */
9523b3eb3cSopenharmony_ci    ARKUI_PRE_DRAG_STATUS_CANCELED_BEFORE_DRAG,
9623b3eb3cSopenharmony_ci} ArkUI_PreDragStatus;
9723b3eb3cSopenharmony_ci
9823b3eb3cSopenharmony_ci/**
9923b3eb3cSopenharmony_ci * @brief Defines an enum for drag preview scale modes.
10023b3eb3cSopenharmony_ci *
10123b3eb3cSopenharmony_ci * @since 12
10223b3eb3cSopenharmony_ci */
10323b3eb3cSopenharmony_citypedef enum {
10423b3eb3cSopenharmony_ci    /**
10523b3eb3cSopenharmony_ci     * The system automatically changes the position of the dragged point based on the scenario and
10623b3eb3cSopenharmony_ci     * scales the drag preview based on set rules.
10723b3eb3cSopenharmony_ci     */
10823b3eb3cSopenharmony_ci    ARKUI_DRAG_PREVIEW_SCALE_AUTO = 0,
10923b3eb3cSopenharmony_ci    /** The system does not scale the drag preview. */
11023b3eb3cSopenharmony_ci    ARKUI_DRAG_PREVIEW_SCALE_DISABLED,
11123b3eb3cSopenharmony_ci} ArkUI_DragPreviewScaleMode;
11223b3eb3cSopenharmony_ci
11323b3eb3cSopenharmony_ci/**
11423b3eb3cSopenharmony_ci * @brief Defines an enum for drag states.
11523b3eb3cSopenharmony_ci *
11623b3eb3cSopenharmony_ci * @since 12
11723b3eb3cSopenharmony_ci */
11823b3eb3cSopenharmony_citypedef enum {
11923b3eb3cSopenharmony_ci    /** Unknown. */
12023b3eb3cSopenharmony_ci    ARKUI_DRAG_STATUS_UNKNOWN = -1,
12123b3eb3cSopenharmony_ci    /** Started. */
12223b3eb3cSopenharmony_ci    ARKUI_DRAG_STATUS_STARTED,
12323b3eb3cSopenharmony_ci    /** Ended. */
12423b3eb3cSopenharmony_ci    ARKUI_DRAG_STATUS_ENDED,
12523b3eb3cSopenharmony_ci} ArkUI_DragStatus;
12623b3eb3cSopenharmony_ci
12723b3eb3cSopenharmony_ci/**
12823b3eb3cSopenharmony_ci * @brief Defines a struct for a component event.
12923b3eb3cSopenharmony_ci *
13023b3eb3cSopenharmony_ci * @since 12
13123b3eb3cSopenharmony_ci */
13223b3eb3cSopenharmony_citypedef struct ArkUI_NodeEvent ArkUI_NodeEvent;
13323b3eb3cSopenharmony_ci
13423b3eb3cSopenharmony_ci/**
13523b3eb3cSopenharmony_ci * @brief Defines a struct for a UI context object.
13623b3eb3cSopenharmony_ci *
13723b3eb3cSopenharmony_ci * @since 12
13823b3eb3cSopenharmony_ci */
13923b3eb3cSopenharmony_citypedef struct ArkUI_Context ArkUI_Context;
14023b3eb3cSopenharmony_ci
14123b3eb3cSopenharmony_ci/**
14223b3eb3cSopenharmony_ci * @brief Defines a struct for a UI context object pointer.
14323b3eb3cSopenharmony_ci *
14423b3eb3cSopenharmony_ci * @since 12
14523b3eb3cSopenharmony_ci */
14623b3eb3cSopenharmony_citypedef struct ArkUI_Context* ArkUI_ContextHandle;
14723b3eb3cSopenharmony_ci
14823b3eb3cSopenharmony_ci/**
14923b3eb3cSopenharmony_ci * @brief Defines a struct for a drag event.
15023b3eb3cSopenharmony_ci *
15123b3eb3cSopenharmony_ci * @since 12
15223b3eb3cSopenharmony_ci */
15323b3eb3cSopenharmony_citypedef struct ArkUI_DragEvent ArkUI_DragEvent;
15423b3eb3cSopenharmony_ci
15523b3eb3cSopenharmony_ci/**
15623b3eb3cSopenharmony_ci * @brief Defines a struct for custom drag preview options.
15723b3eb3cSopenharmony_ci *
15823b3eb3cSopenharmony_ci * @since 12
15923b3eb3cSopenharmony_ci */
16023b3eb3cSopenharmony_citypedef struct ArkUI_DragPreviewOption ArkUI_DragPreviewOption;
16123b3eb3cSopenharmony_ci
16223b3eb3cSopenharmony_ci/**
16323b3eb3cSopenharmony_ci * @brief Defines a struct for a drag action.
16423b3eb3cSopenharmony_ci *
16523b3eb3cSopenharmony_ci * @since 12
16623b3eb3cSopenharmony_ci */
16723b3eb3cSopenharmony_citypedef struct ArkUI_DragAction ArkUI_DragAction;
16823b3eb3cSopenharmony_ci
16923b3eb3cSopenharmony_ci/**
17023b3eb3cSopenharmony_ci * @brief Defines a struct for drag and drop information returned through a drag status listener.
17123b3eb3cSopenharmony_ci *
17223b3eb3cSopenharmony_ci * @since 12
17323b3eb3cSopenharmony_ci */
17423b3eb3cSopenharmony_citypedef struct ArkUI_DragAndDropInfo ArkUI_DragAndDropInfo;
17523b3eb3cSopenharmony_ci
17623b3eb3cSopenharmony_ci/**
17723b3eb3cSopenharmony_ci * @brief Defines a struct for UDMF unified data.
17823b3eb3cSopenharmony_ci *
17923b3eb3cSopenharmony_ci * @since 12
18023b3eb3cSopenharmony_ci */
18123b3eb3cSopenharmony_citypedef struct OH_UdmfData OH_UdmfData;
18223b3eb3cSopenharmony_ci
18323b3eb3cSopenharmony_ci/**
18423b3eb3cSopenharmony_ci * @brief Defines the <b>Pixelmap</b> struct, which is used to perform operations related to a pixel map.
18523b3eb3cSopenharmony_ci *
18623b3eb3cSopenharmony_ci * @since 12
18723b3eb3cSopenharmony_ci */
18823b3eb3cSopenharmony_citypedef struct OH_PixelmapNative OH_PixelmapNative;
18923b3eb3cSopenharmony_ci
19023b3eb3cSopenharmony_ci/**
19123b3eb3cSopenharmony_ci * @brief Obtains a <b>ArkUI_DragEvent</b> object from the specified <b>ArkUI_NodeEvent</b> object.
19223b3eb3cSopenharmony_ci *
19323b3eb3cSopenharmony_ci * @param node Indicates the pointer to an <b>ArkUI_NodeEvent</b> object.
19423b3eb3cSopenharmony_ci * @return Returns the pointer to an <b>ArkUI_DragEvent</b> object.
19523b3eb3cSopenharmony_ci *         Returns <b>null</b> if the parameter passed in is invalid or is not a drag-related event.
19623b3eb3cSopenharmony_ci * @since 12
19723b3eb3cSopenharmony_ci */
19823b3eb3cSopenharmony_ciArkUI_DragEvent* OH_ArkUI_NodeEvent_GetDragEvent(ArkUI_NodeEvent* nodeEvent);
19923b3eb3cSopenharmony_ci
20023b3eb3cSopenharmony_ci/**
20123b3eb3cSopenharmony_ci * @brief Obtains the interaction state prior to a drop and drop operation.
20223b3eb3cSopenharmony_ci *
20323b3eb3cSopenharmony_ci * @param node Indicates the pointer to an <b>ArkUI_NodeEvent</b> object.
20423b3eb3cSopenharmony_ci * @return Returns the interaction state prior to the drop and drop operation.
20523b3eb3cSopenharmony_ci * @since 12
20623b3eb3cSopenharmony_ci */
20723b3eb3cSopenharmony_ciArkUI_PreDragStatus OH_ArkUI_NodeEvent_GetPreDragStatus(ArkUI_NodeEvent* nodeEvent);
20823b3eb3cSopenharmony_ci
20923b3eb3cSopenharmony_ci/**
21023b3eb3cSopenharmony_ci * @brief Sets whether to disable the default drop animation.
21123b3eb3cSopenharmony_ci * The default drop animation is enabled by default and can be disabled to apply a custom drop animation.
21223b3eb3cSopenharmony_ci *
21323b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
21423b3eb3cSopenharmony_ci * @param disable Indicates whether to disable the default drop animation.
21523b3eb3cSopenharmony_ci * The value <b>true</b> means to disable the default drop animation, and <b>false</b> means the opposite.
21623b3eb3cSopenharmony_ci * @return Returns the result code.
21723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
21823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
21923b3eb3cSopenharmony_ci * @since 12
22023b3eb3cSopenharmony_ci */
22123b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_DisableDefaultDropAnimation(ArkUI_DragEvent* event, bool disable);
22223b3eb3cSopenharmony_ci
22323b3eb3cSopenharmony_ci/**
22423b3eb3cSopenharmony_ci * @brief Obtains the drop operation from a drag event.
22523b3eb3cSopenharmony_ci *
22623b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
22723b3eb3cSopenharmony_ci * @param operation Indicates the drop operation which the data receiver set.
22823b3eb3cSopenharmony_ci * @return Returns the result code.
22923b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
23023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
23123b3eb3cSopenharmony_ci *                 Possible causes: 1. The given parameters are null or the given event is not a valid DragEvent.
23223b3eb3cSopenharmony_ci * @since 12
23323b3eb3cSopenharmony_ci */
23423b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_SetSuggestedDropOperation(ArkUI_DragEvent* event, ArkUI_DropOperation dropOperation);
23523b3eb3cSopenharmony_ci
23623b3eb3cSopenharmony_ci/**
23723b3eb3cSopenharmony_ci * @brief Obtains the drop operation from a drag event.
23823b3eb3cSopenharmony_ci *
23923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
24023b3eb3cSopenharmony_ci * @param operation Indicates the drop operation which the data receiver set.
24123b3eb3cSopenharmony_ci * @return Returns the result code.
24223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operations successful.
24323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
24423b3eb3cSopenharmony_ci * @since 12
24523b3eb3cSopenharmony_ci */
24623b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetDropOperation(ArkUI_DragEvent* event, ArkUI_DropOperation* operation);
24723b3eb3cSopenharmony_ci
24823b3eb3cSopenharmony_ci/**
24923b3eb3cSopenharmony_ci * @brief Sets the result for a drag event.
25023b3eb3cSopenharmony_ci *
25123b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
25223b3eb3cSopenharmony_ci * @param result Indicates the drag result.
25323b3eb3cSopenharmony_ci * @return Returns the result code.
25423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
25523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
25623b3eb3cSopenharmony_ci * @since 12
25723b3eb3cSopenharmony_ci */
25823b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_SetDragResult(ArkUI_DragEvent* event, ArkUI_DragResult result);
25923b3eb3cSopenharmony_ci
26023b3eb3cSopenharmony_ci/**
26123b3eb3cSopenharmony_ci * @brief Set drag data for a drag event.
26223b3eb3cSopenharmony_ci *
26323b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
26423b3eb3cSopenharmony_ci * @param data Indicates the drag data.
26523b3eb3cSopenharmony_ci * @return Returns the result code.
26623b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
26723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
26823b3eb3cSopenharmony_ci * @since 12
26923b3eb3cSopenharmony_ci */
27023b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_SetData(ArkUI_DragEvent* event, OH_UdmfData* data);
27123b3eb3cSopenharmony_ci
27223b3eb3cSopenharmony_ci/**
27323b3eb3cSopenharmony_ci * @brief Obtains the default drag data from a drag event.
27423b3eb3cSopenharmony_ci *
27523b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
27623b3eb3cSopenharmony_ci * @param data Indicates the pointer to an <b>OH_UdmfData</b> object. The application needs to create a pointer
27723b3eb3cSopenharmony_ci *             for receiving data by using the {@link OH_UdmfData_Create} method.
27823b3eb3cSopenharmony_ci * @return Returns the result code.
27923b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
28023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
28123b3eb3cSopenharmony_ci * @since 12
28223b3eb3cSopenharmony_ci */
28323b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetUdmfData(ArkUI_DragEvent* event, OH_UdmfData *data);
28423b3eb3cSopenharmony_ci
28523b3eb3cSopenharmony_ci/**
28623b3eb3cSopenharmony_ci * @brief Obtains the number of drag data types from a drag event.
28723b3eb3cSopenharmony_ci *
28823b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
28923b3eb3cSopenharmony_ci * @param count Indicates the number of drag data types returned.
29023b3eb3cSopenharmony_ci * @return Returns the result code.
29123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
29223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
29323b3eb3cSopenharmony_ci * @since 12
29423b3eb3cSopenharmony_ci */
29523b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetDataTypeCount(ArkUI_DragEvent* event, int32_t* count);
29623b3eb3cSopenharmony_ci
29723b3eb3cSopenharmony_ci/**
29823b3eb3cSopenharmony_ci * @brief Obtains the list of drag data types from a drag event.
29923b3eb3cSopenharmony_ci *
30023b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
30123b3eb3cSopenharmony_ci * @param eventTypeArray Indicates the list of the drag data types. You need to create a string array first.
30223b3eb3cSopenharmony_ci * @param length Indicates the total length of the list array. It must be greater than or equal to the number obtained
30323b3eb3cSopenharmony_ci *        by using {@link OH_ArkUI_DragEvent_GetDataTypeCount}.
30423b3eb3cSopenharmony_ci * @param maxStrLen Indicates the max string length of drag data types.
30523b3eb3cSopenharmony_ci * @return Returns the result code.
30623b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
30723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
30823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the giving buffer is not enough for string copy.
30923b3eb3cSopenharmony_ci * @since 12
31023b3eb3cSopenharmony_ci */
31123b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetDataTypes(
31223b3eb3cSopenharmony_ci    ArkUI_DragEvent *event, char *eventTypeArray[], int32_t length, int32_t maxStrLen);
31323b3eb3cSopenharmony_ci
31423b3eb3cSopenharmony_ci/**
31523b3eb3cSopenharmony_ci * @brief Obtains the drag result from a drag event.
31623b3eb3cSopenharmony_ci *
31723b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
31823b3eb3cSopenharmony_ci * @param result Indicates the drag result returned.
31923b3eb3cSopenharmony_ci * @return Returns the result code.
32023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
32123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
32223b3eb3cSopenharmony_ci * @since 12
32323b3eb3cSopenharmony_ci */
32423b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetDragResult(ArkUI_DragEvent* event, ArkUI_DragResult* result);
32523b3eb3cSopenharmony_ci
32623b3eb3cSopenharmony_ci/**
32723b3eb3cSopenharmony_ci * @brief Obtains the X coordinate of the touch point for a drag preview from a drag event.
32823b3eb3cSopenharmony_ci *
32923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
33023b3eb3cSopenharmony_ci * @return Returns the X coordinate of the touch point, in px.
33123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
33223b3eb3cSopenharmony_ci * @since 12
33323b3eb3cSopenharmony_ci */
33423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetPreviewTouchPointX(ArkUI_DragEvent* event);
33523b3eb3cSopenharmony_ci
33623b3eb3cSopenharmony_ci/**
33723b3eb3cSopenharmony_ci * @brief Obtains the Y coordinate of the touch point for a drag preview from a drag event.
33823b3eb3cSopenharmony_ci *
33923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
34023b3eb3cSopenharmony_ci * @return Returns the Y coordinate of the touch point, in px.
34123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
34223b3eb3cSopenharmony_ci * @since 12
34323b3eb3cSopenharmony_ci */
34423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetPreviewTouchPointY(ArkUI_DragEvent* event);
34523b3eb3cSopenharmony_ci
34623b3eb3cSopenharmony_ci/**
34723b3eb3cSopenharmony_ci * @brief Obtains the width of a drag preview from a drag event.
34823b3eb3cSopenharmony_ci *
34923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
35023b3eb3cSopenharmony_ci * @return Returns the width of the drag preview, in px.
35123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
35223b3eb3cSopenharmony_ci * @since 12
35323b3eb3cSopenharmony_ci */
35423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetPreviewRectWidth(ArkUI_DragEvent* event);
35523b3eb3cSopenharmony_ci
35623b3eb3cSopenharmony_ci/**
35723b3eb3cSopenharmony_ci * @brief Obtains the height of a drag preview from a drag event.
35823b3eb3cSopenharmony_ci *
35923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
36023b3eb3cSopenharmony_ci * @return Returns the height of the drag preview, in px.
36123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
36223b3eb3cSopenharmony_ci * @since 12
36323b3eb3cSopenharmony_ci */
36423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetPreviewRectHeight(ArkUI_DragEvent* event);
36523b3eb3cSopenharmony_ci
36623b3eb3cSopenharmony_ci/**
36723b3eb3cSopenharmony_ci * @brief Obtains the X coordinate of the touch point relative to the window from a drag event.
36823b3eb3cSopenharmony_ci *
36923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
37023b3eb3cSopenharmony_ci * @return Returns the X coordinate of the touch point relative to the window, in px.
37123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
37223b3eb3cSopenharmony_ci * @since 12
37323b3eb3cSopenharmony_ci */
37423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetTouchPointXToWindow(ArkUI_DragEvent* event);
37523b3eb3cSopenharmony_ci
37623b3eb3cSopenharmony_ci/**
37723b3eb3cSopenharmony_ci * @brief Obtains the Y coordinate of the touch point relative to the window from a drag event.
37823b3eb3cSopenharmony_ci *
37923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
38023b3eb3cSopenharmony_ci * @return Returns the Y coordinate of the touch point relative to the window, in px.
38123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
38223b3eb3cSopenharmony_ci * @since 12
38323b3eb3cSopenharmony_ci */
38423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetTouchPointYToWindow(ArkUI_DragEvent* event);
38523b3eb3cSopenharmony_ci
38623b3eb3cSopenharmony_ci/**
38723b3eb3cSopenharmony_ci * @brief Obtains the X coordinate of the touch point relative to the current display from a drag event.
38823b3eb3cSopenharmony_ci *
38923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
39023b3eb3cSopenharmony_ci * @return Returns the X coordinate of the touch point relative to the current display, in px.
39123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
39223b3eb3cSopenharmony_ci * @since 12
39323b3eb3cSopenharmony_ci */
39423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetTouchPointXToDisplay(ArkUI_DragEvent* event);
39523b3eb3cSopenharmony_ci
39623b3eb3cSopenharmony_ci/**
39723b3eb3cSopenharmony_ci * @brief Obtains the Y coordinate of the touch point relative to the current display from a drag event.
39823b3eb3cSopenharmony_ci *
39923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
40023b3eb3cSopenharmony_ci * @return Returns the Y coordinate of the touch point relative to the current display, in px.
40123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
40223b3eb3cSopenharmony_ci * @since 12
40323b3eb3cSopenharmony_ci */
40423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetTouchPointYToDisplay(ArkUI_DragEvent* event);
40523b3eb3cSopenharmony_ci
40623b3eb3cSopenharmony_ci/**
40723b3eb3cSopenharmony_ci * @brief Obtains the dragging velocity along the x-axis.
40823b3eb3cSopenharmony_ci *
40923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
41023b3eb3cSopenharmony_ci * @return Returns the dragging velocity along the x-axis, in px.
41123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
41223b3eb3cSopenharmony_ci * @since 12
41323b3eb3cSopenharmony_ci */
41423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetVelocityX(ArkUI_DragEvent* event);
41523b3eb3cSopenharmony_ci
41623b3eb3cSopenharmony_ci/**
41723b3eb3cSopenharmony_ci * @brief Obtains the dragging velocity along the y-axis.
41823b3eb3cSopenharmony_ci *
41923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
42023b3eb3cSopenharmony_ci * @return Returns the dragging velocity along the y-axis, in px.
42123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
42223b3eb3cSopenharmony_ci * @since 12
42323b3eb3cSopenharmony_ci */
42423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetVelocityY(ArkUI_DragEvent* event);
42523b3eb3cSopenharmony_ci
42623b3eb3cSopenharmony_ci/**
42723b3eb3cSopenharmony_ci * @brief Obtains the dragging velocity along the main axis.
42823b3eb3cSopenharmony_ci *
42923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
43023b3eb3cSopenharmony_ci * @return Returns the dragging velocity along the main axis, in px.
43123b3eb3cSopenharmony_ci *         Returns the default value <b>0</b> if the input parameter is invalid.
43223b3eb3cSopenharmony_ci * @since 12
43323b3eb3cSopenharmony_ci */
43423b3eb3cSopenharmony_cifloat OH_ArkUI_DragEvent_GetVelocity(ArkUI_DragEvent* event);
43523b3eb3cSopenharmony_ci
43623b3eb3cSopenharmony_ci/**
43723b3eb3cSopenharmony_ci * @brief Obtains the pressed status of modifier keys from a drag event.
43823b3eb3cSopenharmony_ci *
43923b3eb3cSopenharmony_ci * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object.
44023b3eb3cSopenharmony_ci * @param keys Indicates the returned combination of modifier keys that are currently pressed.
44123b3eb3cSopenharmony_ci *             The application can determine the pressed modifier keys through bitwise operations.
44223b3eb3cSopenharmony_ci * @return Returns the result code.
44323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
44423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
44523b3eb3cSopenharmony_ci * @since 12
44623b3eb3cSopenharmony_ci */
44723b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragEvent_GetModifierKeyStates(ArkUI_DragEvent* event, uint64_t* keys);
44823b3eb3cSopenharmony_ci
44923b3eb3cSopenharmony_ci/**
45023b3eb3cSopenharmony_ci * @brief Sets whether to enable strict reporting on drag events.
45123b3eb3cSopenharmony_ci *        This feature is disabled by default, and you are advised to enable it.
45223b3eb3cSopenharmony_ci *        If this feature is disabled, the parent component is not notified when an item in it is dragged over its child
45323b3eb3cSopenharmony_ci *        component. If this feature is enabled, the component is notified of the dragged item's leaving, and the chil
45423b3eb3cSopenharmony_ci *        component to which the dragged item is dropped is notified of the item's entering. This configuration is
45523b3eb3cSopenharmony_ci *        related to a specific UI instance. You can pass in a specific component node on the current UI instance
45623b3eb3cSopenharmony_ci *        for association.
45723b3eb3cSopenharmony_ci *
45823b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
45923b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable strict reporting on drag events.
46023b3eb3cSopenharmony_ci * @return Returns the result code.
46123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
46223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
46323b3eb3cSopenharmony_ci * @since 12
46423b3eb3cSopenharmony_ci */
46523b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetDragEventStrictReportWithNode(ArkUI_NodeHandle node, bool enabled);
46623b3eb3cSopenharmony_ci
46723b3eb3cSopenharmony_ci/**
46823b3eb3cSopenharmony_ci * @brief Sets whether to enable strict reporting on drag events.
46923b3eb3cSopenharmony_ci *        This feature is disabled by default, and you are advised to enable it.
47023b3eb3cSopenharmony_ci *        If this feature is disabled, the parent component is not notified when an item in it is dragged over its child
47123b3eb3cSopenharmony_ci *        component. If this feature is enabled, the component is notified of the dragged item's leaving, and the child
47223b3eb3cSopenharmony_ci *        component to which the dragged item is dropped is notified of the item's entering. This configuration is
47323b3eb3cSopenharmony_ci *        related to a specific UI instance. You can pass in a specific UI instance for association.
47423b3eb3cSopenharmony_ci *
47523b3eb3cSopenharmony_ci * @param uiContext Indicates the pointer to a UI instance.
47623b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable strict reporting on drag events.
47723b3eb3cSopenharmony_ci * @return Returns the result code.
47823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
47923b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
48023b3eb3cSopenharmony_ci * @since 12
48123b3eb3cSopenharmony_ci */
48223b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetDragEventStrictReportWithContext(ArkUI_ContextHandle uiContext, bool enabled);
48323b3eb3cSopenharmony_ci
48423b3eb3cSopenharmony_ci/**
48523b3eb3cSopenharmony_ci * @brief Sets the types of data that can be dropped to the specified component. This API resets the settings configured
48623b3eb3cSopenharmony_ci *        through {@link OH_ArkUI_DisallowNodeAnyDropDataTypes} and {@link OH_ArkUI_AllowNodeAllDropDataTypes}.
48723b3eb3cSopenharmony_ci *
48823b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
48923b3eb3cSopenharmony_ci * @param typesArray Indicates the array of types of data that can be dropped.
49023b3eb3cSopenharmony_ci * @param count Indicates length of an array.
49123b3eb3cSopenharmony_ci * @return Returns the result code.
49223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
49323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
49423b3eb3cSopenharmony_ci * @since 12
49523b3eb3cSopenharmony_ci */
49623b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetNodeAllowedDropDataTypes(ArkUI_NodeHandle node, const char* typesArray[], int32_t count);
49723b3eb3cSopenharmony_ci
49823b3eb3cSopenharmony_ci/**
49923b3eb3cSopenharmony_ci * @brief Configures the specified component to disallow any data types. This API resets the settings configured through
50023b3eb3cSopenharmony_ci *        {@link OH_ArkUI_SetNodeAllowedDropDataTypes}.
50123b3eb3cSopenharmony_ci *
50223b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
50323b3eb3cSopenharmony_ci * @return Returns the result code.
50423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
50523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
50623b3eb3cSopenharmony_ci * @since 12
50723b3eb3cSopenharmony_ci */
50823b3eb3cSopenharmony_ciint32_t OH_ArkUI_DisallowNodeAnyDropDataTypes(ArkUI_NodeHandle node);
50923b3eb3cSopenharmony_ci
51023b3eb3cSopenharmony_ci/**
51123b3eb3cSopenharmony_ci * @brief Configures the specified component to allow any data types. This API resets the settings configured through
51223b3eb3cSopenharmony_ci *        {@link OH_ArkUI_SetNodeAllowedDropDataTypes}.
51323b3eb3cSopenharmony_ci *
51423b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
51523b3eb3cSopenharmony_ci * @return Returns the result code.
51623b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
51723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
51823b3eb3cSopenharmony_ci * @since 12
51923b3eb3cSopenharmony_ci */
52023b3eb3cSopenharmony_ciint32_t OH_ArkUI_AllowNodeAllDropDataTypes(ArkUI_NodeHandle node);
52123b3eb3cSopenharmony_ci
52223b3eb3cSopenharmony_ci/**
52323b3eb3cSopenharmony_ci * @brief Sets whether the specified component is draggable.
52423b3eb3cSopenharmony_ci *
52523b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
52623b3eb3cSopenharmony_ci * @param bool Indicates whether the component is draggable.
52723b3eb3cSopenharmony_ci * @return Returns the result code.
52823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
52923b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
53023b3eb3cSopenharmony_ci * @since 12
53123b3eb3cSopenharmony_ci */
53223b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetNodeDraggable(ArkUI_NodeHandle node, bool enabled);
53323b3eb3cSopenharmony_ci
53423b3eb3cSopenharmony_ci/**
53523b3eb3cSopenharmony_ci * @brief Sets a custom drag preview for the specified component.
53623b3eb3cSopenharmony_ci *
53723b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
53823b3eb3cSopenharmony_ci * @param preview Indicates the custom drag preview, which is a pixel map.
53923b3eb3cSopenharmony_ci * @return Returns the result code.
54023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
54123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
54223b3eb3cSopenharmony_ci * @since 12
54323b3eb3cSopenharmony_ci */
54423b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetNodeDragPreview(ArkUI_NodeHandle node, OH_PixelmapNative* preview);
54523b3eb3cSopenharmony_ci
54623b3eb3cSopenharmony_ci/**
54723b3eb3cSopenharmony_ci * @brief Creates an <b>ArkUI_DragPreviewOption</b> object.
54823b3eb3cSopenharmony_ci *
54923b3eb3cSopenharmony_ci * @return Returns the created <b>ArkUI_DragPreviewOption</b> object.
55023b3eb3cSopenharmony_ci * @since 12
55123b3eb3cSopenharmony_ci */
55223b3eb3cSopenharmony_ciArkUI_DragPreviewOption* OH_ArkUI_CreateDragPreviewOption(void);
55323b3eb3cSopenharmony_ci
55423b3eb3cSopenharmony_ci/**
55523b3eb3cSopenharmony_ci * @brief Disposes of a <b>ArkUI_DragPreviewOption</b> object.
55623b3eb3cSopenharmony_ci *
55723b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
55823b3eb3cSopenharmony_ci * @since 12
55923b3eb3cSopenharmony_ci */
56023b3eb3cSopenharmony_civoid OH_ArkUI_DragPreviewOption_Dispose(ArkUI_DragPreviewOption* option);
56123b3eb3cSopenharmony_ci
56223b3eb3cSopenharmony_ci/**
56323b3eb3cSopenharmony_ci * @brief Sets the scale mode for an <b>ArkUI_DragPreviewOption</b> object.
56423b3eb3cSopenharmony_ci *
56523b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
56623b3eb3cSopenharmony_ci * @param scaleMode Indicates the scale mode.
56723b3eb3cSopenharmony_ci * @return Returns the result code.
56823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
56923b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
57023b3eb3cSopenharmony_ci * @since 12
57123b3eb3cSopenharmony_ci */
57223b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetScaleMode(ArkUI_DragPreviewOption* option, ArkUI_DragPreviewScaleMode scaleMode);
57323b3eb3cSopenharmony_ci
57423b3eb3cSopenharmony_ci/**
57523b3eb3cSopenharmony_ci * @brief Sets whether to enable the shadow effect for an <b>ArkUI_DragPreviewOption</b> object.
57623b3eb3cSopenharmony_ci *        The shadow effect is enabled by default.
57723b3eb3cSopenharmony_ci *
57823b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
57923b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable the shadow effect.
58023b3eb3cSopenharmony_ci * @return Returns the result code.
58123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
58223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
58323b3eb3cSopenharmony_ci * @since 12
58423b3eb3cSopenharmony_ci */
58523b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetDefaultShadowEnabled(ArkUI_DragPreviewOption* option, bool enabled);
58623b3eb3cSopenharmony_ci
58723b3eb3cSopenharmony_ci/**
58823b3eb3cSopenharmony_ci * @brief Sets whether to enable the rounded corner effect for an <b>ArkUI_DragPreviewOption</b> object.
58923b3eb3cSopenharmony_ci *        The rounded corner effect is enabled by default.
59023b3eb3cSopenharmony_ci *
59123b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
59223b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable the rounded corner effect.
59323b3eb3cSopenharmony_ci * @return Returns the result code.
59423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
59523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
59623b3eb3cSopenharmony_ci * @since 12
59723b3eb3cSopenharmony_ci */
59823b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetDefaultRadiusEnabled(ArkUI_DragPreviewOption* option, bool enabled);
59923b3eb3cSopenharmony_ci
60023b3eb3cSopenharmony_ci/**
60123b3eb3cSopenharmony_ci * @brief Sets whether to enable the badge for an <b>ArkUI_DragPreviewOption</b> object.
60223b3eb3cSopenharmony_ci *        If this feature is enabled, a badge that contains the number of dragged items is displayed.
60323b3eb3cSopenharmony_ci *
60423b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
60523b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable badge.
60623b3eb3cSopenharmony_ci * @return Returns the result code.
60723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
60823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
60923b3eb3cSopenharmony_ci * @since 12
61023b3eb3cSopenharmony_ci */
61123b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(ArkUI_DragPreviewOption* option, bool enabled);
61223b3eb3cSopenharmony_ci
61323b3eb3cSopenharmony_ci/**
61423b3eb3cSopenharmony_ci * @brief Sets the count on the badge.
61523b3eb3cSopenharmony_ci *        The settings will overwrite the value in the <b>SetDragPreviewNumberBadgeEnabled</b> API.
61623b3eb3cSopenharmony_ci *
61723b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
61823b3eb3cSopenharmony_ci * @param forcedNumber Indicates the count on the badge.
61923b3eb3cSopenharmony_ci * @return Returns the result code.
62023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
62123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
62223b3eb3cSopenharmony_ci * @since 12
62323b3eb3cSopenharmony_ci */
62423b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetBadgeNumber(ArkUI_DragPreviewOption* option, uint32_t forcedNumber);
62523b3eb3cSopenharmony_ci
62623b3eb3cSopenharmony_ci/**
62723b3eb3cSopenharmony_ci * @brief Sets whether to enable the default animation on a click or touch, it's not used in drag action.
62823b3eb3cSopenharmony_ci *
62923b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
63023b3eb3cSopenharmony_ci * @param enabled Indicates whether to enable the default animation on a click or touch.
63123b3eb3cSopenharmony_ci * @return Returns the result code.
63223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
63323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
63423b3eb3cSopenharmony_ci * @since 12
63523b3eb3cSopenharmony_ci */
63623b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragPreviewOption_SetDefaultAnimationBeforeLiftingEnabled(
63723b3eb3cSopenharmony_ci    ArkUI_DragPreviewOption* option, bool enabled);
63823b3eb3cSopenharmony_ci/**
63923b3eb3cSopenharmony_ci * @brief Sets an <b>ArkUI_DragPreviewOption</b> object for the specified component.
64023b3eb3cSopenharmony_ci *
64123b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
64223b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
64323b3eb3cSopenharmony_ci * @return Returns the result code.
64423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
64523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
64623b3eb3cSopenharmony_ci * @since 12
64723b3eb3cSopenharmony_ci */
64823b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetNodeDragPreviewOption(ArkUI_NodeHandle node, ArkUI_DragPreviewOption* option);
64923b3eb3cSopenharmony_ci
65023b3eb3cSopenharmony_ci/**
65123b3eb3cSopenharmony_ci * @brief Creates a drag action object for a UI instance based on the specified component node of the current
65223b3eb3cSopenharmony_ci *        UI instance.
65323b3eb3cSopenharmony_ci *
65423b3eb3cSopenharmony_ci * @param node Indicates the pointer to a component node.
65523b3eb3cSopenharmony_ci * @return Returns the pointer to the created drag action object; returns null if the operation fails.
65623b3eb3cSopenharmony_ci * @since 12
65723b3eb3cSopenharmony_ci */
65823b3eb3cSopenharmony_ciArkUI_DragAction* OH_ArkUI_CreateDragActionWithNode(ArkUI_NodeHandle node);
65923b3eb3cSopenharmony_ci
66023b3eb3cSopenharmony_ci/**
66123b3eb3cSopenharmony_ci * @brief Creates a drag action object for the specified UI instance.
66223b3eb3cSopenharmony_ci *
66323b3eb3cSopenharmony_ci * @param uiContext Indicates the pointer to a UI instance.
66423b3eb3cSopenharmony_ci * @return Returns the pointer to the created drag action object; returns null if the operation fails.
66523b3eb3cSopenharmony_ci * @since 12
66623b3eb3cSopenharmony_ci */
66723b3eb3cSopenharmony_ciArkUI_DragAction* OH_ArkUI_CreateDragActionWithContext(ArkUI_ContextHandle uiContext);
66823b3eb3cSopenharmony_ci
66923b3eb3cSopenharmony_ci/**
67023b3eb3cSopenharmony_ci * @brief Disposes of a drag action object.
67123b3eb3cSopenharmony_ci *
67223b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
67323b3eb3cSopenharmony_ci * @since 12
67423b3eb3cSopenharmony_ci */
67523b3eb3cSopenharmony_civoid OH_ArkUI_DragAction_Dispose(ArkUI_DragAction* dragAction);
67623b3eb3cSopenharmony_ci
67723b3eb3cSopenharmony_ci/**
67823b3eb3cSopenharmony_ci * @brief Sets the pointer ID. If only one finger is operating on the screen, the pointer ID is 0.
67923b3eb3cSopenharmony_ci *        In general cases, you can set the pointer ID to 0.
68023b3eb3cSopenharmony_ci *
68123b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
68223b3eb3cSopenharmony_ci * @param pointer Indicates the pointer ID. The value ranges from 0 to 9.
68323b3eb3cSopenharmony_ci * @return Returns the result code.
68423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
68523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
68623b3eb3cSopenharmony_ci * @since 12
68723b3eb3cSopenharmony_ci */
68823b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetPointerId(ArkUI_DragAction* dragAction, int32_t pointer);
68923b3eb3cSopenharmony_ci
69023b3eb3cSopenharmony_ci/**
69123b3eb3cSopenharmony_ci * @brief Sets the drag previews for a drag action.
69223b3eb3cSopenharmony_ci *
69323b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
69423b3eb3cSopenharmony_ci * @param pixelmapArray Indicates the array of the drag previews to set, which must be pixel maps.
69523b3eb3cSopenharmony_ci * @param size Indicates the size of the drag preview array.
69623b3eb3cSopenharmony_ci * @return Returns the result code.
69723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
69823b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
69923b3eb3cSopenharmony_ci * @since 12
70023b3eb3cSopenharmony_ci */
70123b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetPixelMaps(
70223b3eb3cSopenharmony_ci    ArkUI_DragAction* dragAction, OH_PixelmapNative* pixelmapArray[], int32_t size);
70323b3eb3cSopenharmony_ci
70423b3eb3cSopenharmony_ci/**
70523b3eb3cSopenharmony_ci * @brief Sets the touch point relative to the upper left corner of the first drag preview (pixel map).
70623b3eb3cSopenharmony_ci *
70723b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
70823b3eb3cSopenharmony_ci * @param x Indicates the X coordinate of the touch point.
70923b3eb3cSopenharmony_ci * @return Returns the result code.
71023b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
71123b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
71223b3eb3cSopenharmony_ci * @since 12
71323b3eb3cSopenharmony_ci */
71423b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetTouchPointX(ArkUI_DragAction* dragAction, float x);
71523b3eb3cSopenharmony_ci
71623b3eb3cSopenharmony_ci/**
71723b3eb3cSopenharmony_ci * @brief Sets the touch point relative to the upper left corner of the first drag preview (pixel map).
71823b3eb3cSopenharmony_ci *
71923b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
72023b3eb3cSopenharmony_ci * @param y Indicates the Y coordinate of the touch point.
72123b3eb3cSopenharmony_ci * @return Returns the result code.
72223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
72323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
72423b3eb3cSopenharmony_ci * @since 12
72523b3eb3cSopenharmony_ci */
72623b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetTouchPointY(ArkUI_DragAction* dragAction, float y);
72723b3eb3cSopenharmony_ci
72823b3eb3cSopenharmony_ci/**
72923b3eb3cSopenharmony_ci * @brief Sets the drag data.
73023b3eb3cSopenharmony_ci *
73123b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
73223b3eb3cSopenharmony_ci * @param data Indicates the drag data.
73323b3eb3cSopenharmony_ci * @return Returns the result code.
73423b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
73523b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
73623b3eb3cSopenharmony_ci * @since 12
73723b3eb3cSopenharmony_ci */
73823b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetData(ArkUI_DragAction* dragAction, OH_UdmfData* data);
73923b3eb3cSopenharmony_ci
74023b3eb3cSopenharmony_ci/**
74123b3eb3cSopenharmony_ci * @brief Sets an <b>ArkUI_DragPreviewOption</b> object for the specified drag action object.
74223b3eb3cSopenharmony_ci *
74323b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
74423b3eb3cSopenharmony_ci * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object.
74523b3eb3cSopenharmony_ci * @return Returns the result code.
74623b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
74723b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
74823b3eb3cSopenharmony_ci * @since 12
74923b3eb3cSopenharmony_ci */
75023b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_SetDragPreviewOption(ArkUI_DragAction* dragAction, ArkUI_DragPreviewOption* option);
75123b3eb3cSopenharmony_ci
75223b3eb3cSopenharmony_ci/**
75323b3eb3cSopenharmony_ci * @brief Registers a drag status listener.
75423b3eb3cSopenharmony_ci *        This listener can be used to check whether the data is successfully  received and processed.
75523b3eb3cSopenharmony_ci *
75623b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
75723b3eb3cSopenharmony_ci * @param userData Indicates the custom user data.
75823b3eb3cSopenharmony_ci * @param listener
75923b3eb3cSopenharmony_ci * Indicates the listener to register. When the callback is invoked, the system returns a pointer to the drag status
76023b3eb3cSopenharmony_ci * object. The pointer is destroyed after the callback is complete and the application should not hold it anymore.
76123b3eb3cSopenharmony_ci * @return Returns the result code.
76223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
76323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
76423b3eb3cSopenharmony_ci * @since 12
76523b3eb3cSopenharmony_ci */
76623b3eb3cSopenharmony_ciint32_t OH_ArkUI_DragAction_RegisterStatusListener(ArkUI_DragAction* dragAction, void* userData,
76723b3eb3cSopenharmony_ci    void(*listener)(ArkUI_DragAndDropInfo* dragAndDropInfo, void* userData));
76823b3eb3cSopenharmony_ci
76923b3eb3cSopenharmony_ci/**
77023b3eb3cSopenharmony_ci * @brief Unregisters a drag status listener.
77123b3eb3cSopenharmony_ci *
77223b3eb3cSopenharmony_ci * @param dragAction Indicates the pointer to the target drag action object.
77323b3eb3cSopenharmony_ci * @since 12
77423b3eb3cSopenharmony_ci */
77523b3eb3cSopenharmony_civoid OH_ArkUI_DragAction_UnregisterStatusListener(ArkUI_DragAction* dragAction);
77623b3eb3cSopenharmony_ci
77723b3eb3cSopenharmony_ci/**
77823b3eb3cSopenharmony_ci * @brief Obtains the drag status of a drag action.
77923b3eb3cSopenharmony_ci *
78023b3eb3cSopenharmony_ci * @param dragAndDropInfo Indicates the drag and drop information returned by the drag status listener.
78123b3eb3cSopenharmony_ci * @return Returns an <b>ArkUI_DragStatus</b> object; returns <b>ArkUI_DRAG_STATUS_UNKNOWN</b> if an error occurs.
78223b3eb3cSopenharmony_ci * @since 12
78323b3eb3cSopenharmony_ci */
78423b3eb3cSopenharmony_ciArkUI_DragStatus OH_ArkUI_DragAndDropInfo_GetDragStatus(ArkUI_DragAndDropInfo* dragAndDropInfo);
78523b3eb3cSopenharmony_ci
78623b3eb3cSopenharmony_ci/**
78723b3eb3cSopenharmony_ci * @brief Obtains a drag event based on the specified drag and drop information.
78823b3eb3cSopenharmony_ci *        The drag event can then be used to obtain the drag result and the drag behavior, please note
78923b3eb3cSopenharmony_ci *        other info is not included in such a drag event.
79023b3eb3cSopenharmony_ci *
79123b3eb3cSopenharmony_ci * @param dragAndDropInfo Indicates the drag and drop information returned by the drag status listener.
79223b3eb3cSopenharmony_ci * @return Returns an <b>ArkUI_DragEvent</b> object; returns null if an error occurs.
79323b3eb3cSopenharmony_ci * @since 12
79423b3eb3cSopenharmony_ci */
79523b3eb3cSopenharmony_ciArkUI_DragEvent* OH_ArkUI_DragAndDropInfo_GetDragEvent(ArkUI_DragAndDropInfo* dragAndDropInfo);
79623b3eb3cSopenharmony_ci
79723b3eb3cSopenharmony_ci/**
79823b3eb3cSopenharmony_ci * @brief Initiates a drag action through the specified drag action object.
79923b3eb3cSopenharmony_ci *
80023b3eb3cSopenharmony_ci * @param dragAction Indicates a drag action object.
80123b3eb3cSopenharmony_ci * @return Returns the result code.
80223b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
80323b3eb3cSopenharmony_ci *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
80423b3eb3cSopenharmony_ci * @since 12
80523b3eb3cSopenharmony_ci */
80623b3eb3cSopenharmony_ciint32_t OH_ArkUI_StartDrag(ArkUI_DragAction* dragAction);
80723b3eb3cSopenharmony_ci
80823b3eb3cSopenharmony_ci#ifdef __cplusplus
80923b3eb3cSopenharmony_ci};
81023b3eb3cSopenharmony_ci#endif
81123b3eb3cSopenharmony_ci
81223b3eb3cSopenharmony_ci#endif // ARKUI_NATIVE_DRAG_AND_DROP_H
81323b3eb3cSopenharmony_ci/** @} */