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