1 /* 2 * Copyright (c) 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 * @addtogroup ArkUI_NativeModule 18 * @{ 19 * 20 * @brief Provides drag and drop APIs of ArkUI on the native side. 21 * 22 * @since 12 23 */ 24 25 /** 26 * @file drag_and_drop.h 27 * 28 * @brief Defines the native drag and drop APIs. 29 * 30 * @library libace_ndk.z.so 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @since 12 33 */ 34 35 #ifndef ARKUI_NATIVE_DRAG_AND_DROP_H 36 #define ARKUI_NATIVE_DRAG_AND_DROP_H 37 38 #include <stdint.h> 39 #include <stdbool.h> 40 #include "native_type.h" 41 #include "ui_input_event.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Defines an enum for drag results, which are set by the data receiver and transferred by the system to the 49 * drag source so that the drag source is aware of the data processing result of the receiver. 50 * 51 * @since 12 52 */ 53 typedef enum { 54 /** The drag and drop operation succeeded. */ 55 ARKUI_DRAG_RESULT_SUCCESSFUL = 0, 56 /** The drag and drop operation failed. */ 57 ARKUI_DRAG_RESULT_FAILED, 58 /** The drag and drop operation was canceled. */ 59 ARKUI_DRAG_RESULT_CANCELED, 60 } ArkUI_DragResult; 61 62 /** 63 * @brief Defines an enum for data processing modes used when data is dropped, which affects the display of the badge. 64 * 65 * @since 12 66 */ 67 typedef enum { 68 /** Copy. */ 69 ARKUI_DROP_OPERATION_COPY = 0, 70 /** Cut. */ 71 ARKUI_DROP_OPERATION_MOVE, 72 } ArkUI_DropOperation; 73 74 /** 75 * @brief Defines an enum for interaction states prior to a drop and drop operation. 76 * 77 * @since 12 78 */ 79 typedef enum { 80 /** Unknown. */ 81 ARKUI_PRE_DRAG_STATUS_UNKNOWN = -1, 82 /** A drag gesture is being detected. */ 83 ARKUI_PRE_DRAG_STATUS_ACTION_DETECTING, 84 /** The component is ready to be dragged. */ 85 ARKUI_PRE_DRAG_STATUS_READY_TO_TRIGGER_DRAG, 86 /** A lift animation is started. */ 87 ARKUI_PRE_DRAG_STATUS_PREVIEW_LIFT_STARTED, 88 /** A lift animation is finished. */ 89 ARKUI_PRE_DRAG_STATUS_PREVIEW_LIFT_FINISHED, 90 /** A drop animation is started. */ 91 ARKUI_PRE_DRAG_STATUS_PREVIEW_LANDING_STARTED, 92 /** A drop animation is finished. */ 93 ARKUI_PRE_DRAG_STATUS_PREVIEW_LANDING_FINISHED, 94 /** A drop animation is terminated. */ 95 ARKUI_PRE_DRAG_STATUS_CANCELED_BEFORE_DRAG, 96 } ArkUI_PreDragStatus; 97 98 /** 99 * @brief Defines an enum for drag preview scale modes. 100 * 101 * @since 12 102 */ 103 typedef enum { 104 /** 105 * The system automatically changes the position of the dragged point based on the scenario and 106 * scales the drag preview based on set rules. 107 */ 108 ARKUI_DRAG_PREVIEW_SCALE_AUTO = 0, 109 /** The system does not scale the drag preview. */ 110 ARKUI_DRAG_PREVIEW_SCALE_DISABLED, 111 } ArkUI_DragPreviewScaleMode; 112 113 /** 114 * @brief Defines an enum for drag states. 115 * 116 * @since 12 117 */ 118 typedef enum { 119 /** Unknown. */ 120 ARKUI_DRAG_STATUS_UNKNOWN = -1, 121 /** Started. */ 122 ARKUI_DRAG_STATUS_STARTED, 123 /** Ended. */ 124 ARKUI_DRAG_STATUS_ENDED, 125 } ArkUI_DragStatus; 126 127 /** 128 * @brief Defines a struct for a component event. 129 * 130 * @since 12 131 */ 132 typedef struct ArkUI_NodeEvent ArkUI_NodeEvent; 133 134 /** 135 * @brief Defines a struct for a UI context object. 136 * 137 * @since 12 138 */ 139 typedef struct ArkUI_Context ArkUI_Context; 140 141 /** 142 * @brief Defines a struct for a UI context object pointer. 143 * 144 * @since 12 145 */ 146 typedef struct ArkUI_Context* ArkUI_ContextHandle; 147 148 /** 149 * @brief Defines a struct for a drag event. 150 * 151 * @since 12 152 */ 153 typedef struct ArkUI_DragEvent ArkUI_DragEvent; 154 155 /** 156 * @brief Defines a struct for custom drag preview options. 157 * 158 * @since 12 159 */ 160 typedef struct ArkUI_DragPreviewOption ArkUI_DragPreviewOption; 161 162 /** 163 * @brief Defines a struct for a drag action. 164 * 165 * @since 12 166 */ 167 typedef struct ArkUI_DragAction ArkUI_DragAction; 168 169 /** 170 * @brief Defines a struct for drag and drop information returned through a drag status listener. 171 * 172 * @since 12 173 */ 174 typedef struct ArkUI_DragAndDropInfo ArkUI_DragAndDropInfo; 175 176 /** 177 * @brief Defines a struct for UDMF unified data. 178 * 179 * @since 12 180 */ 181 typedef struct OH_UdmfData OH_UdmfData; 182 183 /** 184 * @brief Defines a struct for UDMF to get data with progress info. 185 * 186 * @since 15 187 */ 188 typedef struct OH_UdmfGetDataParams OH_UdmfGetDataParams; 189 190 /** 191 * @brief Defines a struct for UDMF to get data with progress info. 192 * 193 * @since 20 194 */ 195 typedef struct OH_UdmfDataLoadParams OH_UdmfDataLoadParams; 196 197 /** 198 * @brief Defines the <b>Pixelmap</b> struct, which is used to perform operations related to a pixel map. 199 * 200 * @since 12 201 */ 202 typedef struct OH_PixelmapNative OH_PixelmapNative; 203 204 /** 205 * @brief Obtains a <b>ArkUI_DragEvent</b> object from the specified <b>ArkUI_NodeEvent</b> object. 206 * 207 * @param node Indicates the pointer to an <b>ArkUI_NodeEvent</b> object. 208 * @return Returns the pointer to an <b>ArkUI_DragEvent</b> object. 209 * Returns <b>null</b> if the parameter passed in is invalid or is not a drag-related event. 210 * @since 12 211 */ 212 ArkUI_DragEvent* OH_ArkUI_NodeEvent_GetDragEvent(ArkUI_NodeEvent* nodeEvent); 213 214 /** 215 * @brief Obtains the interaction state prior to a drop and drop operation. 216 * 217 * @param node Indicates the pointer to an <b>ArkUI_NodeEvent</b> object. 218 * @return Returns the interaction state prior to the drop and drop operation. 219 * @since 12 220 */ 221 ArkUI_PreDragStatus OH_ArkUI_NodeEvent_GetPreDragStatus(ArkUI_NodeEvent* nodeEvent); 222 223 /** 224 * @brief Sets whether to disable the default drop animation. 225 * The default drop animation is enabled by default and can be disabled to apply a custom drop animation. 226 * 227 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 228 * @param disable Indicates whether to disable the default drop animation. 229 * The value <b>true</b> means to disable the default drop animation, and <b>false</b> means the opposite. 230 * @return Returns the result code. 231 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 232 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 233 * @since 12 234 */ 235 int32_t OH_ArkUI_DragEvent_DisableDefaultDropAnimation(ArkUI_DragEvent* event, bool disable); 236 237 /** 238 * @brief Obtains the drop operation from a drag event. 239 * 240 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 241 * @param operation Indicates the drop operation which the data receiver set. 242 * @return Returns the result code. 243 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 244 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 245 * Possible causes: 1. The given parameters are null or the given event is not a valid DragEvent. 246 * @since 12 247 */ 248 int32_t OH_ArkUI_DragEvent_SetSuggestedDropOperation(ArkUI_DragEvent* event, ArkUI_DropOperation dropOperation); 249 250 /** 251 * @brief Obtains the drop operation from a drag event. 252 * 253 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 254 * @param operation Indicates the drop operation which the data receiver set. 255 * @return Returns the result code. 256 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operations successful. 257 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 258 * @since 12 259 */ 260 int32_t OH_ArkUI_DragEvent_GetDropOperation(ArkUI_DragEvent* event, ArkUI_DropOperation* operation); 261 262 /** 263 * @brief Sets the result for a drag event. 264 * 265 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 266 * @param result Indicates the drag result. 267 * @return Returns the result code. 268 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 269 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 270 * @since 12 271 */ 272 int32_t OH_ArkUI_DragEvent_SetDragResult(ArkUI_DragEvent* event, ArkUI_DragResult result); 273 274 /** 275 * @brief Set drag data for a drag event. 276 * 277 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 278 * @param data Indicates the drag data. 279 * @return Returns the result code. 280 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 281 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 282 * @since 12 283 */ 284 int32_t OH_ArkUI_DragEvent_SetData(ArkUI_DragEvent* event, OH_UdmfData* data); 285 286 /** 287 * @brief Use this method to obtain the application bundle name of the drag-and-drop initiator, you need 288 * to pass a character array for receiving the string and explicitly specify the array length. It is 289 * recommended that the array length be no less than 128 characters. If the length cannot accommodate 290 * the actual bundle name length, the ERROR result will be returned. 291 * 292 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 293 * @param bundleName A string array used to receive the source application's bundle name. 294 * @param length Use this to explicitly specify the length of the incoming string array. 295 * It is recommended to be bigger than 128. 296 * @return Returns the result code. 297 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 298 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 299 * @since 20 300 */ 301 ArkUI_ErrorCode OH_ArkUI_DragEvent_GetDragSource(ArkUI_DragEvent* event, char* bundleName, int32_t length); 302 303 /** 304 * @brief Call this method to determine whether the current drag and drop operation is cross-device. 305 * 306 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 307 * @param isRemote Boolean pointer to receive the result. 308 * @return Returns the result code. 309 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 310 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 311 * @since 20 312 */ 313 ArkUI_ErrorCode OH_ArkUI_DragEvent_IsRemote(ArkUI_DragEvent* event, bool* isRemote); 314 315 /** 316 * @brief Obtains the default drag data from a drag event. 317 * 318 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 319 * @param data Indicates the pointer to an <b>OH_UdmfData</b> object. The application needs to create a pointer 320 * for receiving data by using the {@link OH_UdmfData_Create} method. 321 * @return Returns the result code. 322 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 323 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 324 * @since 12 325 */ 326 int32_t OH_ArkUI_DragEvent_GetUdmfData(ArkUI_DragEvent* event, OH_UdmfData *data); 327 328 /** 329 * @brief Obtains the number of drag data types from a drag event. 330 * 331 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 332 * @param count Indicates the number of drag data types returned. 333 * @return Returns the result code. 334 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 335 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 336 * @since 12 337 */ 338 int32_t OH_ArkUI_DragEvent_GetDataTypeCount(ArkUI_DragEvent* event, int32_t* count); 339 340 /** 341 * @brief Obtains the list of drag data types from a drag event. 342 * 343 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 344 * @param eventTypeArray Indicates the list of the drag data types. You need to create a string array first. 345 * @param length Indicates the total length of the list array. It must be greater than or equal to the number obtained 346 * by using {@link OH_ArkUI_DragEvent_GetDataTypeCount}. 347 * @param maxStrLen Indicates the max string length of drag data types. 348 * @return Returns the result code. 349 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 350 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 351 * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the giving buffer is not enough for string copy. 352 * @since 12 353 */ 354 int32_t OH_ArkUI_DragEvent_GetDataTypes( 355 ArkUI_DragEvent *event, char *eventTypeArray[], int32_t length, int32_t maxStrLen); 356 357 /** 358 * @brief Obtains the drag result from a drag event. 359 * 360 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 361 * @param result Indicates the drag result returned. 362 * @return Returns the result code. 363 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 364 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 365 * @since 12 366 */ 367 int32_t OH_ArkUI_DragEvent_GetDragResult(ArkUI_DragEvent* event, ArkUI_DragResult* result); 368 369 /** 370 * @brief Obtains the X coordinate of the touch point for a drag preview from a drag event. 371 * 372 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 373 * @return Returns the X coordinate of the touch point, in px. 374 * Returns the default value <b>0</b> if the input parameter is invalid. 375 * @since 12 376 */ 377 float OH_ArkUI_DragEvent_GetPreviewTouchPointX(ArkUI_DragEvent* event); 378 379 /** 380 * @brief Obtains the Y coordinate of the touch point for a drag preview from a drag event. 381 * 382 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 383 * @return Returns the Y coordinate of the touch point, in px. 384 * Returns the default value <b>0</b> if the input parameter is invalid. 385 * @since 12 386 */ 387 float OH_ArkUI_DragEvent_GetPreviewTouchPointY(ArkUI_DragEvent* event); 388 389 /** 390 * @brief Obtains the width of a drag preview from a drag event. 391 * 392 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 393 * @return Returns the width of the drag preview, in px. 394 * Returns the default value <b>0</b> if the input parameter is invalid. 395 * @since 12 396 */ 397 float OH_ArkUI_DragEvent_GetPreviewRectWidth(ArkUI_DragEvent* event); 398 399 /** 400 * @brief Obtains the height of a drag preview from a drag event. 401 * 402 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 403 * @return Returns the height of the drag preview, in px. 404 * Returns the default value <b>0</b> if the input parameter is invalid. 405 * @since 12 406 */ 407 float OH_ArkUI_DragEvent_GetPreviewRectHeight(ArkUI_DragEvent* event); 408 409 /** 410 * @brief Obtains the X coordinate of the touch point relative to the window from a drag event. 411 * 412 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 413 * @return Returns the X coordinate of the touch point relative to the window, in px. 414 * Returns the default value <b>0</b> if the input parameter is invalid. 415 * @since 12 416 */ 417 float OH_ArkUI_DragEvent_GetTouchPointXToWindow(ArkUI_DragEvent* event); 418 419 /** 420 * @brief Obtains the Y coordinate of the touch point relative to the window from a drag event. 421 * 422 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 423 * @return Returns the Y coordinate of the touch point relative to the window, in px. 424 * Returns the default value <b>0</b> if the input parameter is invalid. 425 * @since 12 426 */ 427 float OH_ArkUI_DragEvent_GetTouchPointYToWindow(ArkUI_DragEvent* event); 428 429 /** 430 * @brief Obtains the X coordinate of the touch point relative to the current display from a drag event. 431 * 432 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 433 * @return Returns the X coordinate of the touch point relative to the current display, in px. 434 * Returns the default value <b>0</b> if the input parameter is invalid. 435 * @since 12 436 */ 437 float OH_ArkUI_DragEvent_GetTouchPointXToDisplay(ArkUI_DragEvent* event); 438 439 /** 440 * @brief Obtains the Y coordinate of the touch point relative to the current display from a drag event. 441 * 442 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 443 * @return Returns the Y coordinate of the touch point relative to the current display, in px. 444 * Returns the default value <b>0</b> if the input parameter is invalid. 445 * @since 12 446 */ 447 float OH_ArkUI_DragEvent_GetTouchPointYToDisplay(ArkUI_DragEvent* event); 448 449 /** 450 * @brief Obtains the global display X coordinate of the touch point from an <b>ArkUI_DragEvent</b> object. 451 * 452 * @param event Pointer to an <b>ArkUI_DragEvent</b> object. 453 * @return float Global display X coordinate of the touch point, in px. 454 * If the input parameter is invalid, the default value <b>0</b> is returned. 455 * @since 20 456 */ 457 float OH_ArkUI_DragEvent_GetTouchPointXToGlobalDisplay(ArkUI_DragEvent* event); 458 459 /** 460 * @brief Obtains the global display Y coordinate of the touch point from an <b>ArkUI_DragEvent</b> object. 461 * 462 * @param event Pointer to an <b>ArkUI_DragEvent</b> object. 463 * @return float Global display Y coordinate of the touch point, in px. 464 * If the input parameter is invalid, the default value <b>0</b> is returned. 465 * @since 20 466 */ 467 float OH_ArkUI_DragEvent_GetTouchPointYToGlobalDisplay(ArkUI_DragEvent* event); 468 469 /** 470 * @brief Obtains the dragging velocity along the x-axis. 471 * 472 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 473 * @return Returns the dragging velocity along the x-axis, in px. 474 * Returns the default value <b>0</b> if the input parameter is invalid. 475 * @since 12 476 */ 477 float OH_ArkUI_DragEvent_GetVelocityX(ArkUI_DragEvent* event); 478 479 /** 480 * @brief Obtains the dragging velocity along the y-axis. 481 * 482 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 483 * @return Returns the dragging velocity along the y-axis, in px. 484 * Returns the default value <b>0</b> if the input parameter is invalid. 485 * @since 12 486 */ 487 float OH_ArkUI_DragEvent_GetVelocityY(ArkUI_DragEvent* event); 488 489 /** 490 * @brief Obtains the dragging velocity along the main axis. 491 * 492 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 493 * @return Returns the dragging velocity along the main axis, in px. 494 * Returns the default value <b>0</b> if the input parameter is invalid. 495 * @since 12 496 */ 497 float OH_ArkUI_DragEvent_GetVelocity(ArkUI_DragEvent* event); 498 499 /** 500 * @brief Obtains the pressed status of modifier keys from a drag event. 501 * 502 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 503 * @param keys Indicates the returned combination of modifier keys that are currently pressed. 504 * The application can determine the pressed modifier keys through bitwise operations. 505 * @return Returns the result code. 506 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 507 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 508 * @since 12 509 */ 510 int32_t OH_ArkUI_DragEvent_GetModifierKeyStates(ArkUI_DragEvent* event, uint64_t* keys); 511 512 /** 513 * @brief Obtains the display ID of the screen for the specified drag event. 514 * 515 * @param event Pointer to an <b>ArkUI_DragEvent</b> object. 516 * @param displayId Display ID of the event occurs in. 517 * @return Returns the result code. 518 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 519 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 520 * @since 20 521 */ 522 ArkUI_ErrorCode OH_ArkUI_DragEvent_GetDisplayId(ArkUI_DragEvent* event, int32_t* displayId); 523 524 /** 525 * 526 * @brief Request to start the data sync process with the sync option. 527 * 528 * @param event Indicates the pointer to an ArkUI_DragEvent object. 529 * @param options Indicates the pointer to an OH_UdmfGetDataParams object. 530 * @param key Represents return value after set data to database successfully, it should be not 531 * less than {@link UDMF_KEY_BUFFER_LEN}. 532 * @param keyLen Represents the length of key string. 533 * @return Returns the result code. 534 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 535 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 536 * Returns {@link ARKUI_ERROR_CODE_DRAG_DATA_SYNC_FAILED } if the data sync is not allowed or failed. 537 * @since 15 538 */ 539 int32_t OH_ArkUI_DragEvent_StartDataLoading( 540 ArkUI_DragEvent* event, OH_UdmfGetDataParams* options, char* key, unsigned int keyLen); 541 542 /** 543 * @brief Use this method to provide a data loading parameter to the system instead of providing 544 * a complete data object directly. When the user drags and drops to the target application, 545 * the system will use this parameter to request data from you. This can greatly improve the efficiency 546 * of the dragging operation for large amounts of data and the effectiveness of the drop data handling 547 * in the target application. 548 * 549 * This method should be always prioritized over using {@link OH_ArkUI_DragEvent_SetData}. 550 * See {@link OH_UdmfDataLoadParams_Create} in <b>udmf.h</b> for how to create and prepare the data loading parameter. 551 * 552 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 553 * @param dataLoadParams Indicates the data loading parameters which will be used when dropping. 554 * @return Returns the result code. 555 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 556 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 557 * @since 20 558 */ 559 560 ArkUI_ErrorCode OH_ArkUI_DragEvent_SetDataLoadParams(ArkUI_DragEvent* event, OH_UdmfDataLoadParams* dataLoadParams); 561 562 /** 563 * 564 * @brief Cancel the data sync process. 565 * 566 * @param uiContext Indicates the pointer to a UI instance. 567 * @param key Represents the data key returned by {@link OH_ArkUI_DragEvent_StartDataLoading}. 568 * @return Returns the result code. 569 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 570 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 571 * Returns {@link ARKUI_ERROR_CODE_OPERATION_FAILED} if no any data sync is in progress. 572 * @since 15 573 */ 574 int32_t OH_ArkUI_CancelDataLoading(ArkUI_ContextHandle uiContext, const char* key); 575 576 /** 577 * @brief Sets whether to disable data prefetch process before the onDrop callback executing. 578 * The system will retry to getting data until the max time limit (2.4s for now) reaches, 579 * this's useful for the cross device draging operation, as the system helps to eliminate 580 * the communication instability, but it's redundant for {@link OH_ArkUI_DragEvent_StartDataLoading} 581 * method, as it will take care the data fetching with asynchronous mechanism, so must set this 582 * field to true if using {@link OH_ArkUI_DragEvent_StartDataLoading} in onDrop to avoid the data is 583 * fetched before onDrop executing unexpectedly. 584 * 585 * @param node Indicates the pointer to a component node. 586 * @param disabled Indicates whether to disable the data pre-fetch process, true for disable, false for not. 587 * @return Returns the result code. 588 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 589 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 590 * @since 15 591 */ 592 int32_t OH_ArkUI_DisableDropDataPrefetchOnNode(ArkUI_NodeHandle node, bool disabled); 593 594 /** 595 * @brief Sets whether to enable strict reporting on drag events. 596 * This feature is disabled by default, and you are advised to enable it. 597 * If this feature is disabled, the parent component is not notified when an item in it is dragged over its child 598 * component. If this feature is enabled, the component is notified of the dragged item's leaving, and the chil 599 * component to which the dragged item is dropped is notified of the item's entering. This configuration is 600 * related to a specific UI instance. You can pass in a specific component node on the current UI instance 601 * for association. 602 * 603 * @param node Indicates the pointer to a component node. 604 * @param enabled Indicates whether to enable strict reporting on drag events. 605 * @return Returns the result code. 606 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 607 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 608 * @since 12 609 */ 610 int32_t OH_ArkUI_SetDragEventStrictReportWithNode(ArkUI_NodeHandle node, bool enabled); 611 612 /** 613 * @brief Sets whether to enable strict reporting on drag events. 614 * This feature is disabled by default, and you are advised to enable it. 615 * If this feature is disabled, the parent component is not notified when an item in it is dragged over its child 616 * component. If this feature is enabled, the component is notified of the dragged item's leaving, and the child 617 * component to which the dragged item is dropped is notified of the item's entering. This configuration is 618 * related to a specific UI instance. You can pass in a specific UI instance for association. 619 * 620 * @param uiContext Indicates the pointer to a UI instance. 621 * @param enabled Indicates whether to enable strict reporting on drag events. 622 * @return Returns the result code. 623 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 624 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 625 * @since 12 626 */ 627 int32_t OH_ArkUI_SetDragEventStrictReportWithContext(ArkUI_ContextHandle uiContext, bool enabled); 628 629 /** 630 * @brief Sets the types of data that can be dropped to the specified component. This API resets the settings configured 631 * through {@link OH_ArkUI_DisallowNodeAnyDropDataTypes} and {@link OH_ArkUI_AllowNodeAllDropDataTypes}. 632 * 633 * @param node Indicates the pointer to a component node. 634 * @param typesArray Indicates the array of types of data that can be dropped. 635 * @param count Indicates length of an array. 636 * @return Returns the result code. 637 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 638 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 639 * @since 12 640 */ 641 int32_t OH_ArkUI_SetNodeAllowedDropDataTypes(ArkUI_NodeHandle node, const char* typesArray[], int32_t count); 642 643 /** 644 * @brief Configures the specified component to disallow any data types. This API resets the settings configured through 645 * {@link OH_ArkUI_SetNodeAllowedDropDataTypes}. 646 * 647 * @param node Indicates the pointer to a component node. 648 * @return Returns the result code. 649 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 650 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 651 * @since 12 652 */ 653 int32_t OH_ArkUI_DisallowNodeAnyDropDataTypes(ArkUI_NodeHandle node); 654 655 /** 656 * @brief Configures the specified component to allow any data types. This API resets the settings configured through 657 * {@link OH_ArkUI_SetNodeAllowedDropDataTypes}. 658 * 659 * @param node Indicates the pointer to a component node. 660 * @return Returns the result code. 661 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 662 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 663 * @since 12 664 */ 665 int32_t OH_ArkUI_AllowNodeAllDropDataTypes(ArkUI_NodeHandle node); 666 667 /** 668 * @brief Sets whether the specified component is draggable. 669 * 670 * @param node Indicates the pointer to a component node. 671 * @param bool Indicates whether the component is draggable. 672 * @return Returns the result code. 673 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 674 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 675 * @since 12 676 */ 677 int32_t OH_ArkUI_SetNodeDraggable(ArkUI_NodeHandle node, bool enabled); 678 679 /** 680 * @brief Sets a custom drag preview for the specified component. 681 * 682 * @param node Indicates the pointer to a component node. 683 * @param preview Indicates the custom drag preview, which is a pixel map. 684 * @return Returns the result code. 685 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 686 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 687 * @since 12 688 */ 689 int32_t OH_ArkUI_SetNodeDragPreview(ArkUI_NodeHandle node, OH_PixelmapNative* preview); 690 691 /** 692 * @brief Creates an <b>ArkUI_DragPreviewOption</b> object. 693 * 694 * @return Returns the created <b>ArkUI_DragPreviewOption</b> object. 695 * @since 12 696 */ 697 ArkUI_DragPreviewOption* OH_ArkUI_CreateDragPreviewOption(void); 698 699 /** 700 * @brief Disposes of a <b>ArkUI_DragPreviewOption</b> object. 701 * 702 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 703 * @since 12 704 */ 705 void OH_ArkUI_DragPreviewOption_Dispose(ArkUI_DragPreviewOption* option); 706 707 /** 708 * @brief Sets the scale mode for an <b>ArkUI_DragPreviewOption</b> object. 709 * 710 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 711 * @param scaleMode Indicates the scale mode. 712 * @return Returns the result code. 713 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 714 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 715 * @since 12 716 */ 717 int32_t OH_ArkUI_DragPreviewOption_SetScaleMode(ArkUI_DragPreviewOption* option, ArkUI_DragPreviewScaleMode scaleMode); 718 719 /** 720 * @brief Sets whether to enable the shadow effect for an <b>ArkUI_DragPreviewOption</b> object. 721 * The shadow effect is enabled by default. 722 * 723 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 724 * @param enabled Indicates whether to enable the shadow effect. 725 * @return Returns the result code. 726 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 727 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 728 * @since 12 729 */ 730 int32_t OH_ArkUI_DragPreviewOption_SetDefaultShadowEnabled(ArkUI_DragPreviewOption* option, bool enabled); 731 732 /** 733 * @brief Sets whether to enable the rounded corner effect for an <b>ArkUI_DragPreviewOption</b> object. 734 * The rounded corner effect is enabled by default. 735 * 736 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 737 * @param enabled Indicates whether to enable the rounded corner effect. 738 * @return Returns the result code. 739 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 740 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 741 * @since 12 742 */ 743 int32_t OH_ArkUI_DragPreviewOption_SetDefaultRadiusEnabled(ArkUI_DragPreviewOption* option, bool enabled); 744 745 /** 746 * @brief Sets whether to enable the badge for an <b>ArkUI_DragPreviewOption</b> object. 747 * If this feature is enabled, a badge that contains the number of dragged items is displayed. 748 * 749 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 750 * @param enabled Indicates whether to enable badge. 751 * @return Returns the result code. 752 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 753 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 754 * @since 12 755 */ 756 int32_t OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(ArkUI_DragPreviewOption* option, bool enabled); 757 758 /** 759 * @brief Sets the count on the badge. 760 * The settings will overwrite the value in the <b>SetDragPreviewNumberBadgeEnabled</b> API. 761 * 762 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 763 * @param forcedNumber Indicates the count on the badge. 764 * @return Returns the result code. 765 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 766 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 767 * @since 12 768 */ 769 int32_t OH_ArkUI_DragPreviewOption_SetBadgeNumber(ArkUI_DragPreviewOption* option, uint32_t forcedNumber); 770 771 /** 772 * @brief Sets whether to enable the default animation on a click or touch, it's not used in drag action. 773 * 774 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 775 * @param enabled Indicates whether to enable the default animation on a click or touch. 776 * @return Returns the result code. 777 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 778 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 779 * @since 12 780 */ 781 int32_t OH_ArkUI_DragPreviewOption_SetDefaultAnimationBeforeLiftingEnabled( 782 ArkUI_DragPreviewOption* option, bool enabled); 783 /** 784 * @brief Sets an <b>ArkUI_DragPreviewOption</b> object for the specified component. 785 * 786 * @param node Indicates the pointer to a component node. 787 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 788 * @return Returns the result code. 789 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 790 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 791 * @since 12 792 */ 793 int32_t OH_ArkUI_SetNodeDragPreviewOption(ArkUI_NodeHandle node, ArkUI_DragPreviewOption* option); 794 795 /** 796 * @brief Creates a drag action object for a UI instance based on the specified component node of the current 797 * UI instance. 798 * 799 * @param node Indicates the pointer to a component node. 800 * @return Returns the pointer to the created drag action object; returns null if the operation fails. 801 * @since 12 802 */ 803 ArkUI_DragAction* OH_ArkUI_CreateDragActionWithNode(ArkUI_NodeHandle node); 804 805 /** 806 * @brief Creates a drag action object for the specified UI instance. 807 * 808 * @param uiContext Indicates the pointer to a UI instance. 809 * @return Returns the pointer to the created drag action object; returns null if the operation fails. 810 * @since 12 811 */ 812 ArkUI_DragAction* OH_ArkUI_CreateDragActionWithContext(ArkUI_ContextHandle uiContext); 813 814 /** 815 * @brief Disposes of a drag action object. 816 * 817 * @param dragAction Indicates the pointer to the target drag action object. 818 * @since 12 819 */ 820 void OH_ArkUI_DragAction_Dispose(ArkUI_DragAction* dragAction); 821 822 /** 823 * @brief Sets the pointer ID. If only one finger is operating on the screen, the pointer ID is 0. 824 * In general cases, you can set the pointer ID to 0. 825 * 826 * @param dragAction Indicates the pointer to the target drag action object. 827 * @param pointer Indicates the pointer ID. The value ranges from 0 to 9. 828 * @return Returns the result code. 829 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 830 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 831 * @since 12 832 */ 833 int32_t OH_ArkUI_DragAction_SetPointerId(ArkUI_DragAction* dragAction, int32_t pointer); 834 835 /** 836 * @brief Sets the drag previews for a drag action. 837 * 838 * @param dragAction Indicates the pointer to the target drag action object. 839 * @param pixelmapArray Indicates the array of the drag previews to set, which must be pixel maps. 840 * @param size Indicates the size of the drag preview array. 841 * @return Returns the result code. 842 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 843 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 844 * @since 12 845 */ 846 int32_t OH_ArkUI_DragAction_SetPixelMaps( 847 ArkUI_DragAction* dragAction, OH_PixelmapNative* pixelmapArray[], int32_t size); 848 849 /** 850 * @brief Sets the touch point relative to the upper left corner of the first drag preview (pixel map). 851 * 852 * @param dragAction Indicates the pointer to the target drag action object. 853 * @param x Indicates the X coordinate of the touch point. 854 * @return Returns the result code. 855 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 856 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 857 * @since 12 858 */ 859 int32_t OH_ArkUI_DragAction_SetTouchPointX(ArkUI_DragAction* dragAction, float x); 860 861 /** 862 * @brief Sets the touch point relative to the upper left corner of the first drag preview (pixel map). 863 * 864 * @param dragAction Indicates the pointer to the target drag action object. 865 * @param y Indicates the Y coordinate of the touch point. 866 * @return Returns the result code. 867 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 868 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 869 * @since 12 870 */ 871 int32_t OH_ArkUI_DragAction_SetTouchPointY(ArkUI_DragAction* dragAction, float y); 872 873 /** 874 * @brief Sets the drag data. 875 * 876 * @param dragAction Indicates the pointer to the target drag action object. 877 * @param data Indicates the drag data. 878 * @return Returns the result code. 879 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 880 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 881 * @since 12 882 */ 883 int32_t OH_ArkUI_DragAction_SetData(ArkUI_DragAction* dragAction, OH_UdmfData* data); 884 885 /** 886 * @brief Sets an <b>ArkUI_DragPreviewOption</b> object for the specified drag action object. 887 * 888 * @param dragAction Indicates the pointer to the target drag action object. 889 * @param option Indicates the pointer to an <b>ArkUI_DragPreviewOption</b> object. 890 * @return Returns the result code. 891 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 892 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 893 * @since 12 894 */ 895 int32_t OH_ArkUI_DragAction_SetDragPreviewOption(ArkUI_DragAction* dragAction, ArkUI_DragPreviewOption* option); 896 897 /** 898 * @brief Registers a drag status listener. 899 * This listener can be used to check whether the data is successfully received and processed. 900 * 901 * @param dragAction Indicates the pointer to the target drag action object. 902 * @param userData Indicates the custom user data. 903 * @param listener 904 * Indicates the listener to register. When the callback is invoked, the system returns a pointer to the drag status 905 * object. The pointer is destroyed after the callback is complete and the application should not hold it anymore. 906 * @return Returns the result code. 907 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 908 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 909 * @since 12 910 */ 911 int32_t OH_ArkUI_DragAction_RegisterStatusListener(ArkUI_DragAction* dragAction, void* userData, 912 void(*listener)(ArkUI_DragAndDropInfo* dragAndDropInfo, void* userData)); 913 914 /** 915 * @brief Unregisters a drag status listener. 916 * 917 * @param dragAction Indicates the pointer to the target drag action object. 918 * @since 12 919 */ 920 void OH_ArkUI_DragAction_UnregisterStatusListener(ArkUI_DragAction* dragAction); 921 922 /** 923 * @brief Use this method to provide a data loading parameter to the system instead of providing 924 * a complete data object directly. When the user drags and drops to the target application, 925 * the system will use this parameter to request data from you. This can greatly improve the efficiency 926 * of the dragging operation for large amounts of data and the effectiveness of the drop data handling 927 * in the target application. 928 * 929 * It's recommanded to use this method instead of using {@link OH_ArkUI_DragAction_SetData}. 930 * See {@link OH_UdmfDataLoadParams_Create} in <b>udmf.h</b> for how to create and prepare the data loading parameter. 931 * 932 * @param dragAction Indicates the pointer to the target drag action object. 933 * @param dataLoadParams Indicates the data loading parameters which will be used when dropping. 934 * @return Returns the result code. 935 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 936 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 937 * @since 20 938 */ 939 ArkUI_ErrorCode OH_ArkUI_DragAction_SetDataLoadParams( 940 ArkUI_DragAction* dragAction, OH_UdmfDataLoadParams* dataLoadParams); 941 942 /** 943 * @brief Obtains the drag status of a drag action. 944 * 945 * @param dragAndDropInfo Indicates the drag and drop information returned by the drag status listener. 946 * @return Returns an <b>ArkUI_DragStatus</b> object; returns <b>ArkUI_DRAG_STATUS_UNKNOWN</b> if an error occurs. 947 * @since 12 948 */ 949 ArkUI_DragStatus OH_ArkUI_DragAndDropInfo_GetDragStatus(ArkUI_DragAndDropInfo* dragAndDropInfo); 950 951 /** 952 * @brief Obtains a drag event based on the specified drag and drop information. 953 * The drag event can then be used to obtain the drag result and the drag behavior, please note 954 * other info is not included in such a drag event. 955 * 956 * @param dragAndDropInfo Indicates the drag and drop information returned by the drag status listener. 957 * @return Returns an <b>ArkUI_DragEvent</b> object; returns null if an error occurs. 958 * @since 12 959 */ 960 ArkUI_DragEvent* OH_ArkUI_DragAndDropInfo_GetDragEvent(ArkUI_DragAndDropInfo* dragAndDropInfo); 961 962 /** 963 * @brief Initiates a drag action through the specified drag action object. 964 * 965 * @param dragAction Indicates a drag action object. 966 * @return Returns the result code. 967 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 968 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 969 * @since 12 970 */ 971 int32_t OH_ArkUI_StartDrag(ArkUI_DragAction* dragAction); 972 973 /** 974 * @brief Request to delay the drop end handling for a while to wait until the process result 975 * is really conformed by application, the result need to be notified back to system through 976 * {@link OH_ArkUI_NotifyDragResult} interface. And when all the handling done, the 977 * {@link OH_ArkUI_NotifyDragEndPendingDone} should be called. 978 * Please be aware, the maximum pending time is 2 seconds; 979 * 980 * @param event Indicates the pointer to an <b>ArkUI_DragEvent</b> object. 981 * @param requestIdentify Indicates the Identify for the request initiated by this method, it's a number generated 982 by system automatically, and it's an out parameter too, so one valid address needed. 983 * @return Returns the result code. 984 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 985 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 986 * Returns {@link ARKUI_ERROR_CODE_DRAG_DROP_OPERATION_NOT_ALLOWED} if current is not during the drop handing. 987 * @since 19 988 */ 989 int32_t OH_ArkUI_DragEvent_RequestDragEndPending(ArkUI_DragEvent* event, int32_t* requestIdentify); 990 991 /** 992 * @brief Notify the system final drag result, the request identify will be checked, it should be the same 993 * as the one returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface, if it's not, 994 * the calling will be ignored. 995 * 996 * @param requestIdentify The identify returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface. 997 * @param event Indicates the drag result. 998 * @return Returns the result code. 999 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1000 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1001 * Returns {@link ARKUI_ERROR_CODE_DRAG_DROP_OPERATION_NOT_ALLOWED} if current is not during the drop handing. 1002 * @since 19 1003 */ 1004 int32_t OH_ArkUI_NotifyDragResult(int32_t requestIdentify, ArkUI_DragResult result); 1005 1006 /** 1007 * @brief Notify the system all handling done, the drag end pending can be finished. 1008 * 1009 * @param requestIdentify The identify returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface. 1010 * @return Returns the result code. 1011 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1012 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1013 * Returns {@link ARKUI_ERROR_CODE_DRAG_DROP_OPERATION_NOT_ALLOWED} if current is not during the drop handing. 1014 * @since 19 1015 */ 1016 int32_t OH_ArkUI_NotifyDragEndPendingDone(int32_t requestIdentify); 1017 1018 /** 1019 * @brief Sets whether to enable the display of a disallow status icon. 1020 * 1021 * Typically, when a component can receive or process data dragged by the user, or when it declares to the 1022 * system that data should be processed in COPY way by setting ARKUI_DROP_OPERATION_COPY through 1023 * {@link OH_ArkUI_DragEvent_SetSuggestedDropOperation}, the system will display 1024 * a plus sign together with the data number on the upper-left corner of the dragged object; if setting 1025 * ARKUI_DROP_OPERATION_MOVE to the system to declare that data should be processed in CUT way, the system will only 1026 * display the data number on the upper-left corner of the dragged object. 1027 * 1028 * In some cases, when the system determines or the component explicitly declares that it cannot handle the 1029 * data that the user is dragging, the system displays a badge icon in the same way as it does for DragBehavior.MOVE. 1030 * So if you want to show the more clearly status, you can call this method on the UI instance in advance to force 1031 * the system to display a clear prohibition icon on the upper left corner in such cases, and the user can clearly 1032 * know that data cannot be dropped here. 1033 * 1034 * @param uiContext Pointer to a UI instance. 1035 * @param enabled Whether to enable the display of the disallow badge icon. 1036 * @return Returns the result code. 1037 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1038 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1039 * @since 20 1040 */ 1041 int32_t OH_ArkUI_EnableDropDisallowedBadge(ArkUI_ContextHandle uiContext, bool enabled); 1042 1043 #ifdef __cplusplus 1044 }; 1045 #endif 1046 1047 #endif // ARKUI_NATIVE_DRAG_AND_DROP_H 1048 /** @} */