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_EventModule 18 * @{ 19 * 20 * @brief Declares the UI input event capabilities provided by ArkUI on the native side. 21 * 22 * @since 12 23 */ 24 25 /** 26 * @file ui_input_event.h 27 * 28 * @brief Provides ArkUI event definitions on the native side. 29 * 30 * @library libace_ndk.z.so 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @kit ArkUI 33 * @since 12 34 */ 35 36 #ifndef _ARKUI_UI_INPUT_EVENT_H_ 37 #define _ARKUI_UI_INPUT_EVENT_H_ 38 39 #include <stdint.h> 40 41 #include "native_type.h" 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** 47 * @brief Defines the UI input event. 48 * 49 * @since 12 50 */ 51 typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent; 52 53 /** 54 * @brief Enumerates the UI input event types. 55 * 56 * @since 12 57 */ 58 typedef enum { 59 ARKUI_UIINPUTEVENT_TYPE_UNKNOWN = 0, 60 ARKUI_UIINPUTEVENT_TYPE_TOUCH = 1, 61 ARKUI_UIINPUTEVENT_TYPE_AXIS = 2, 62 /** Mouse event. */ 63 ARKUI_UIINPUTEVENT_TYPE_MOUSE = 3, 64 } ArkUI_UIInputEvent_Type; 65 66 /** 67 * @brief Defines the action code of the input event. 68 * 69 * @since 12 70 */ 71 enum { 72 /** Cancellation of touch. */ 73 UI_TOUCH_EVENT_ACTION_CANCEL = 0, 74 /** Pressing of a touch point. */ 75 UI_TOUCH_EVENT_ACTION_DOWN = 1, 76 /** Moving of a touch point. */ 77 UI_TOUCH_EVENT_ACTION_MOVE = 2, 78 /** Lifting of a touch point. */ 79 UI_TOUCH_EVENT_ACTION_UP = 3, 80 }; 81 82 /** 83 * @brief Defines the tool type of the touch event. 84 * 85 * @since 12 86 */ 87 enum { 88 /** Unknown tool type. */ 89 UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN = 0, 90 91 /** Finger. */ 92 UI_INPUT_EVENT_TOOL_TYPE_FINGER = 1, 93 94 /** Pen. */ 95 UI_INPUT_EVENT_TOOL_TYPE_PEN = 2, 96 97 /** Mouse. */ 98 UI_INPUT_EVENT_TOOL_TYPE_MOUSE = 3, 99 100 /** TouchPad. */ 101 UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 4, 102 103 /** JoyStick. */ 104 UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK = 5, 105 }; 106 107 /** 108 * @brief Defines the source type of the touch event. 109 * 110 * @since 12 111 */ 112 enum { 113 /** Unknown source type. */ 114 UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0, 115 /** Mouse. */ 116 UI_INPUT_EVENT_SOURCE_TYPE_MOUSE = 1, 117 /** Touchscreen. */ 118 UI_INPUT_EVENT_SOURCE_TYPE_TOUCH_SCREEN = 2, 119 }; 120 121 /** 122 * @brief Enumerates the hit test modes. 123 * 124 * @since 12 125 */ 126 typedef enum { 127 /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from 128 * the hit test. 129 */ 130 HTM_DEFAULT = 0, 131 132 /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit 133 * test. 134 */ 135 HTM_BLOCK, 136 137 /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also 138 * considered during the hit test. 139 */ 140 HTM_TRANSPARENT, 141 142 /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered 143 * during the hit test. 144 */ 145 HTM_NONE, 146 } HitTestMode; 147 148 /** 149 * @brief Define the Action Code for mouse events. 150 * 151 * @since 12 152 */ 153 enum { 154 /** Invalid. */ 155 UI_MOUSE_EVENT_ACTION_UNKNOWN = 0, 156 /** Press. */ 157 UI_MOUSE_EVENT_ACTION_PRESS = 1, 158 /** Release. */ 159 UI_MOUSE_EVENT_ACTION_RELEASE = 2, 160 /** Move. */ 161 UI_MOUSE_EVENT_ACTION_MOVE = 3, 162 /** Cancel. 163 * @since 18 164 */ 165 UI_MOUSE_EVENT_ACTION_CANCEL = 13, 166 }; 167 168 /** 169 * @brief Define the button type for mouse events. 170 * 171 * @since 12 172 */ 173 enum { 174 /** None. */ 175 UI_MOUSE_EVENT_BUTTON_NONE = 0, 176 /** Left. */ 177 UI_MOUSE_EVENT_BUTTON_LEFT = 1, 178 /** Right. */ 179 UI_MOUSE_EVENT_BUTTON_RIGHT = 2, 180 /** Middle. */ 181 UI_MOUSE_EVENT_BUTTON_MIDDLE = 3, 182 /** Back. */ 183 UI_MOUSE_EVENT_BUTTON_BACK = 4, 184 /** Forward. */ 185 UI_MOUSE_EVENT_BUTTON_FORWARD = 5, 186 }; 187 188 /** 189 * @brief Defines an enum for modifier keys. 190 * 191 * @since 12 192 */ 193 typedef enum { 194 /** Ctrl. */ 195 ARKUI_MODIFIER_KEY_CTRL = 1 << 0, 196 /** Shift. */ 197 ARKUI_MODIFIER_KEY_SHIFT = 1 << 1, 198 /** Alt. */ 199 ARKUI_MODIFIER_KEY_ALT = 1 << 2, 200 /** Fn. */ 201 ARKUI_MODIFIER_KEY_FN = 1 << 3, 202 } ArkUI_ModifierKeyName; 203 204 /** 205 * @brief Defines an enum for the axis types for focus axis events. 206 * 207 * @since 15 208 */ 209 enum { 210 /** ABS_X. */ 211 UI_FOCUS_AXIS_EVENT_ABS_X = 0, 212 /** ABS_Y. */ 213 UI_FOCUS_AXIS_EVENT_ABS_Y = 1, 214 /** ABS_Z. */ 215 UI_FOCUS_AXIS_EVENT_ABS_Z = 2, 216 /** ABS_RZ. */ 217 UI_FOCUS_AXIS_EVENT_ABS_RZ = 3, 218 /** ABS_GAS. */ 219 UI_FOCUS_AXIS_EVENT_ABS_GAS = 4, 220 /** ABS_BRAKE. */ 221 UI_FOCUS_AXIS_EVENT_ABS_BRAKE = 5, 222 /** ABS_HAT0X. */ 223 UI_FOCUS_AXIS_EVENT_ABS_HAT0X = 6, 224 /** ABS_HAT0Y. */ 225 UI_FOCUS_AXIS_EVENT_ABS_HAT0Y = 7, 226 }; 227 228 /** 229 * @brief Defines whether the touch event is from the left or right hand. 230 * 231 * @since 15 232 */ 233 typedef enum { 234 /** Unknown. */ 235 ARKUI_EVENT_HAND_NONE = 0, 236 /** Left hand. */ 237 ARKUI_EVENT_HAND_LEFT = 1, 238 /** Right hand. */ 239 ARKUI_EVENT_HAND_RIGHT = 2, 240 } ArkUI_InteractionHand; 241 242 /** 243 * @brief Enumerates the action types for axis events. 244 * 245 * @since 15 246 */ 247 enum { 248 /** The axis event is abnormal. */ 249 UI_AXIS_EVENT_ACTION_NONE = 0, 250 /** The axis event begins. */ 251 UI_AXIS_EVENT_ACTION_BEGIN = 1, 252 /** The axis event is updated. */ 253 UI_AXIS_EVENT_ACTION_UPDATE = 2, 254 /** The axis event ends. */ 255 UI_AXIS_EVENT_ACTION_END = 3, 256 /** The axis event is canceled. */ 257 UI_AXIS_EVENT_ACTION_CANCEL = 4, 258 }; 259 260 /** 261 * @brief Obtains the type of this UI input event. 262 * 263 * @param event Indicates the pointer to the current UI input event. 264 * @return Returns the type of the current UI input event; returns <b>0</b> if any parameter error occurs. 265 * @since 12 266 */ 267 int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event); 268 269 /** 270 * @brief Obtains the action type of this UI input event. 271 * 272 * @param event Indicates the pointer to the current UI input event. 273 * @return Returns the action type of the current UI input event; returns <b>0</b> if any parameter error occurs. 274 * @since 12 275 */ 276 int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event); 277 278 /** 279 * @brief Obtains the source type of this UI input event. 280 * 281 * @param event Indicates the pointer to the current UI input event. 282 * @return Returns the source type of the current UI input event. 283 * @since 12 284 */ 285 int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event); 286 287 /** 288 * @brief Obtains the tool type of this UI input event. 289 * 290 * @param event Indicates the pointer to the current UI input event. 291 * @return Returns the tool type of the current UI input event. 292 * @since 12 293 */ 294 int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event); 295 296 /** 297 * @brief Obtains the time when this UI input event occurs. 298 * 299 * @param event Indicates the pointer to the current UI input event. 300 * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs. 301 * @since 12 302 */ 303 int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event); 304 305 /** 306 * @brief Obtains the number of touch points from a directional input event (such as a touch event, mouse event, 307 * or axis event). 308 * 309 * @param event Indicates the pointer to the current UI input event. 310 * @return Returns the number of touch points for the directional input event. 311 * @since 12 312 */ 313 uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event); 314 315 /** 316 * @brief Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event, 317 * or axis event). 318 * 319 * @param event Indicates the pointer to the current UI input event. 320 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 321 * @return Returns the ID of the corresponding touch point. 322 * @since 12 323 */ 324 int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 325 326 /** 327 * @brief Obtains the ID of the touch pointer that triggers the current touch event. 328 * 329 * @param event Indicates the pointer to the current UI input event. 330 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 331 * @return Returns the result code. 332 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 333 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 334 * @since 15 335 */ 336 int32_t OH_ArkUI_PointerEvent_GetChangedPointerId(const ArkUI_UIInputEvent* event, uint32_t* pointerIndex); 337 338 /** 339 * @brief Obtains the X coordinate relative to the upper left corner of the current component from a directional 340 * input event (such as a touch event, mouse event, or axis event). 341 * 342 * @param event Indicates the pointer to the directional input event. 343 * @return Returns the X coordinate relative to the upper left corner of the current component; 344 * returns <b>0</b> if any parameter error occurs. 345 * @since 12 346 */ 347 float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event); 348 349 /** 350 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current component 351 * from a directional input event (such as a touch event, mouse event, or axis event). 352 * 353 * @param event Indicates the pointer to the current UI input event. 354 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 355 * @return Returns the X coordinate relative to the upper left corner of the current component; 356 * returns <b>0.0f</b> if any parameter error occurs. 357 * @since 12 358 */ 359 float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 360 361 /** 362 * @brief Obtains the Y coordinate relative to the upper left corner of the current component from a directional 363 * input event (such as a touch event, mouse event, or axis event). 364 * 365 * @param event Indicates the pointer to the UI input event. 366 * @return Returns the Y coordinate relative to the upper left corner of the current component; 367 * returns <b>0</b> if any parameter error occurs. 368 * @since 12 369 */ 370 float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event); 371 372 /** 373 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current component 374 * from a directional input event (such as a touch event, mouse event, or axis event). 375 * 376 * @param event Indicates the pointer to the current UI input event. 377 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 378 * @return Returns the Y coordinate relative to the upper left corner of the current component; 379 * returns <b>0.0f</b> if any parameter error occurs. 380 * @since 12 381 */ 382 float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 383 384 /** 385 * @brief Obtains the X coordinate relative to the upper left corner of the current application window from a 386 * directional input event (such as a touch event, mouse event, or axis event). 387 * 388 * @param event Indicates the pointer to the UI input event. 389 * @return Returns the X coordinate relative to the upper left corner of the current application window; 390 * returns <b>0</b> if any parameter error occurs. 391 * @since 12 392 */ 393 float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event); 394 395 /** 396 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current 397 * application window from a directional input event (such as a touch event, mouse event, or axis event). 398 * 399 * @param event Indicates the pointer to the current UI input event. 400 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 401 * @return Returns the X coordinate relative to the upper left corner of the current application window; 402 * returns <b>0.0f</b> if any parameter error occurs. 403 * @since 12 404 */ 405 float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 406 407 /** 408 * @brief Obtains the Y coordinate relative to the upper left corner of the current application window from a 409 * directional input event (such as a touch event, mouse event, or axis event). 410 * 411 * @param event Indicates the pointer to the UI input event. 412 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 413 * returns <b>0</b> if any parameter error occurs. 414 * @since 12 415 */ 416 float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event); 417 418 /** 419 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current 420 * application window from a directional input event (such as a touch event, mouse event, or axis event). 421 * 422 * @param event Indicates the pointer to the current UI input event. 423 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 424 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 425 * returns <b>0.0f</b> if any parameter error occurs. 426 * @since 12 427 */ 428 float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 429 430 /** 431 * @brief Obtains the X coordinate relative to the upper left corner of the current screen from a directional input 432 * event (such as a touch event, mouse event, or axis event). 433 * 434 * @param event Indicates the pointer to the UI input event. 435 * @return Returns the X coordinate relative to the upper left corner of the current screen; 436 * returns <b>0</b> if any parameter error occurs. 437 * @since 12 438 */ 439 float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event); 440 441 /** 442 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current screen 443 * from a directional input event (such as a touch event, mouse event, or axis event). 444 * 445 * @param event Indicates the pointer to the current UI input event. 446 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 447 * @return Returns the X coordinate relative to the upper left corner of the current screen; 448 * returns <b>0.0f</b> if any parameter error occurs. 449 * @since 12 450 */ 451 float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 452 453 /** 454 * @brief Obtains the Y coordinate relative to the upper left corner of the current screen from a directional input 455 * event (such as a touch event, mouse event, or axis event). 456 * 457 * @param event Indicates the pointer to the UI input event. 458 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 459 * returns <b>0</b> if any parameter error occurs. 460 * @since 12 461 */ 462 float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event); 463 464 /** 465 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current screen 466 * from a directional input event (such as a touch event, mouse event, or axis event). 467 * 468 * @param event Indicates the pointer to the current UI input event. 469 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 470 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 471 * returns <b>0.0f</b> if any parameter error occurs. 472 * @since 12 473 */ 474 float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 475 476 /** 477 * @brief Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event). 478 * 479 * @param event Indicates the pointer to the current UI input event. 480 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 481 * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs. 482 * @since 12 483 */ 484 float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 485 486 /** 487 * @brief Obtains the angle relative to the YZ plane from a directional input event (for example, a touch event). 488 * The value range is [-90, 90]. A positive value indicates a rightward tilt. 489 * 490 * @param event Indicates the pointer to the current UI input event. 491 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 492 * @return Returns the angle relative to the YZ plane. 493 * @since 12 494 */ 495 float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 496 497 /** 498 * @brief Obtains the angle relative to the XZ plane from a directional input event (for example, a touch event). 499 * The value range is [-90, 90]. A positive value indicates a downward tilt. 500 * 501 * @param event Indicates the pointer to the current UI input event. 502 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 503 * @return Returns the angle relative to the XZ plane. 504 * @since 12 505 */ 506 float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 507 508 /** 509 * @brief Obtains the rotation angle of the stylus around the z-axis from a UI input event. 510 * 511 * @param event Pointer to the UI input event. 512 * @param rollAngle Rotation angle of the stylus around the z-axis. 513 * @return Returns the result code. 514 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 515 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 516 * @since 17 517 */ 518 int32_t OH_ArkUI_PointerEvent_GetRollAngle(const ArkUI_UIInputEvent* event, double* rollAngle); 519 520 /** 521 * @brief Obtains the width of the touch area from a directional input event (for example, a touch event). 522 * 523 * @param event Indicates the pointer to the current UI input event. 524 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 525 * @return Returns the width of the touch area. 526 * @since 12 527 */ 528 float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 529 530 /** 531 * @brief Obtains the height of the touch area from a directional input event (for example, a touch event). 532 * 533 * @param event Indicates the pointer to the current UI input event. 534 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 535 * @return Returns the height of the touch area. 536 * @since 12 537 */ 538 float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 539 540 /** 541 * @brief Obtains whether the current touch event is from the left or right hand. 542 * 543 * @param event Pointer to the current UI input event. 544 * @param hand Whether the touch point is from the left or right hand. 545 * @return Returns the result code. 546 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 547 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 548 * @since 15 549 */ 550 int32_t OH_ArkUI_PointerEvent_GetInteractionHand(const ArkUI_UIInputEvent *event, ArkUI_InteractionHand *hand); 551 552 /** 553 * @brief Obtains whether the current touch event is from the left or right hand. 554 * 555 * @param event Pointer to the current UI input event. 556 * @param pointerIndex Index of the target touch point in the multi-touch data list. 557 * @param hand Whether the touch point is from the left or right hand. 558 * @return Returns the result code. 559 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 560 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 561 * @since 15 562 */ 563 int32_t OH_ArkUI_PointerEvent_GetInteractionHandByIndex( 564 const ArkUI_UIInputEvent *event, int32_t pointerIndex, ArkUI_InteractionHand *hand); 565 566 /** 567 * @brief Obtains the number of historical events from a directional input event (such as a touch event, mouse event, 568 * or axis event). 569 * 570 * @param event Indicates the pointer to the current UI input event. 571 * @return Returns the number of historical events. 572 * @since 12 573 */ 574 uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event); 575 576 /** 577 * @brief Obtains the occurrence time of a historical event from a directional input event (such as a touch event, 578 * mouse event, or axis event). 579 * 580 * @param event Indicates the pointer to the current UI input event. 581 * @param historyIndex Indicates the index of the target historical event. 582 * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs. 583 * @since 12 584 */ 585 int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex); 586 587 /** 588 * @brief Obtains the number of touch points in a specific historical event from a directional input event (such as 589 * a touch event, mouse event, or axis event). 590 * 591 * @param event Indicates the pointer to the current UI input event. 592 * @param historyIndex Indicates the index of the target historical event. 593 * @return Returns the number of touch points in the specified historical event 594 * @since 12 595 */ 596 uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex); 597 598 /** 599 * @brief Obtains the ID of a touch point in a specific historical event from a directional input event (such as 600 * a touch event, mouse event, or axis event). 601 * 602 * @param event Indicates the pointer to the current UI input event. 603 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 604 * @param historyIndex Indicates the index of the target historical event. 605 * @return Returns the ID of the corresponding touch point in the specified historical event. 606 * @since 12 607 */ 608 int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId( 609 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 610 611 /** 612 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 613 * of the current component from a directional input event (such as a touch event, mouse event, or axis event). 614 * 615 * @param event Indicates the pointer to the current UI input event. 616 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 617 * @param historyIndex Indicates the index of the target historical event. 618 * @return Returns the X coordinate relative to the upper left corner of the current component; 619 * returns <b>0.0f</b> if any parameter error occurs. 620 * @since 12 621 */ 622 float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 623 624 /** 625 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 626 * of the current component from a directional input event (such as a touch event, mouse event, or axis event). 627 * 628 * @param event Indicates the pointer to the current UI input event. 629 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 630 * @param historyIndex Indicates the index of the target historical event. 631 * @return Returns the Y coordinate relative to the upper left corner of the current component; 632 * returns <b>0.0f</b> if any parameter error occurs. 633 * @since 12 634 */ 635 float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 636 637 /** 638 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 639 * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). 640 * 641 * @param event Indicates the pointer to the current UI input event. 642 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 643 * @param historyIndex Indicates the index of the target historical event. 644 * @return Returns the X coordinate relative to the upper left corner of the current application window; 645 * returns <b>0.0f</b> if any parameter error occurs. 646 * @since 12 647 */ 648 float OH_ArkUI_PointerEvent_GetHistoryWindowX( 649 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 650 651 /** 652 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 653 * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). 654 * 655 * @param event Indicates the pointer to the current UI input event. 656 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 657 * @param historyIndex Indicates the index of the target historical event. 658 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 659 * returns <b>0.0f</b> if any parameter error occurs. 660 * @since 12 661 */ 662 float OH_ArkUI_PointerEvent_GetHistoryWindowY( 663 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 664 665 /** 666 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 667 * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). 668 * 669 * @param event Indicates the pointer to the current UI input event. 670 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 671 * @param historyIndex Indicates the index of the target historical event. 672 * @return Returns the X coordinate relative to the upper left corner of the current screen; 673 * returns <b>0.0f</b> if any parameter error occurs. 674 * @since 12 675 */ 676 float OH_ArkUI_PointerEvent_GetHistoryDisplayX( 677 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 678 679 /** 680 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 681 * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). 682 * 683 * @param event Indicates the pointer to the current UI input event. 684 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 685 * @param historyIndex Indicates the index of the target historical event. 686 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 687 * returns <b>0.0f</b> if any parameter error occurs. 688 * @since 12 689 */ 690 float OH_ArkUI_PointerEvent_GetHistoryDisplayY( 691 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 692 693 /** 694 * @brief Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event 695 * (for example, a touch event).. 696 * 697 * @param event Indicates the pointer to the current UI input event. 698 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 699 * @param historyIndex Indicates the index of the target historical event. 700 * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs. 701 * @since 12 702 */ 703 float OH_ArkUI_PointerEvent_GetHistoryPressure( 704 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 705 706 /** 707 * @brief Obtains the angle relative to the YZ plane in a specific historical event from a directional input event 708 * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt. 709 * 710 * @param event Indicates the pointer to the current UI input event. 711 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 712 * @param historyIndex Indicates the index of the target historical event. 713 * @return Returns the angle relative to the YZ plane. 714 * @since 12 715 */ 716 float OH_ArkUI_PointerEvent_GetHistoryTiltX( 717 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 718 719 /** 720 * @brief Obtains the angle relative to the XZ plane in a specific historical event from a directional input event 721 * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt. 722 * 723 * @param event Indicates the pointer to the current UI input event. 724 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 725 * @param historyIndex Indicates the index of the target historical event. 726 * @return Returns the angle relative to the XZ plane. 727 * @since 12 728 */ 729 float OH_ArkUI_PointerEvent_GetHistoryTiltY( 730 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 731 732 /** 733 * @brief Obtains the width of the touch area in a specific historical event from a directional input event 734 * (for example, a touch event). 735 * 736 * @param event Indicates the pointer to the current UI input event. 737 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 738 * @param historyIndex Indicates the index of the target historical event. 739 * @return Returns the width of the touch area. 740 * @since 12 741 */ 742 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth( 743 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 744 745 /** 746 * @brief Obtains the height of the touch area in a specific historical event from a directional input event 747 * (for example, a touch event). 748 * 749 * @param event Indicates the pointer to the current UI input event. 750 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 751 * @param historyIndex Indicates the index of the target historical event. 752 * @return Returns the height of the touch area. 753 * @since 12 754 */ 755 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight( 756 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 757 758 /** 759 * @brief Obtains the value of the vertical scroll axis for this axis event. 760 * 761 * @param event Indicates the pointer to the UI input event. 762 * @return Returns the value of the vertical scroll axis of the current axis event; 763 * returns <b>0</b> if any parameter error occurs. 764 * @since 12 765 */ 766 double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event); 767 768 /** 769 * @brief Obtains the value of the horizontal scroll axis for this axis event. 770 * 771 * @param event Indicates the pointer to the UI input event. 772 * @return Returns the value of the horizontal scroll axis of the current axis event; 773 * returns <b>0</b> if any parameter error occurs. 774 * @since 12 775 */ 776 double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event); 777 778 /** 779 * @brief Obtains the scale value of the pinch axis for this axis event. 780 * 781 * @param event Indicates the pointer to the UI input event. 782 * @return Returns the scale value of the pinch axis of the current axis event; 783 * returns <b>0</b> if any parameter error occurs. 784 * @since 12 785 */ 786 double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event); 787 788 /** 789 * @brief Obtains the action type of the current axis event. 790 * 791 * @param event Indicates the pointer to the current UI input event. 792 * @return Returns the action type of the current axis event. 793 * @since 15 794 */ 795 int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event); 796 797 /** 798 * @brief Sets how the component behaves during hit testing. 799 * 800 * @param event Indicates the pointer to the current UI input event. 801 * @param mode Indicates how the component behaves during hit testing. The parameter type is {@link HitTestMode}. 802 * @return Returns the status code of the execution. 803 * @since 12 804 */ 805 int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode); 806 807 /** 808 * @brief Get the value of the button type for mouse events. 809 * 810 * @param event Represents a pointer to the current UI input event. 811 * @return Return to the mouse button type, where <b>1</b> is the left button, <b>2</b> is the right button, 812 * <b>3</b> is the middle button, <b>4</b> is the back button, and <b>5</b> is the forward button. 813 * @since 12 814 */ 815 int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event); 816 817 /** 818 * @brief Get the value of the mouse action type for mouse events. 819 * 820 * @param event Represents a pointer to the current UI input event. 821 * @return Returns the type of mouse action, where <b>1</b> represents button pressed, 822 * <b>2</b> represents button released, and <b>3</b> represents mouse movement. 823 * @since 12 824 */ 825 int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event); 826 827 /** 828 * @brief Sets whether to prevent event bubbling. 829 * 830 * @param event Indicates the pointer to the current UI input event. 831 * @param stopPropagation Indicates whether the event is prevented from bubbling. 832 * @return Returns the status code of the execution. If 0 is returned, the setting is successful. 833 * If 401 is returned, the execution fails. 834 * The possible cause of the failure is that the event parameter is abnormal, such as a null pointer. 835 * @since 12 836 */ 837 int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); 838 839 /** 840 * @brief Obtains the ID of device that triggers UI input event. 841 * 842 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 843 * @return Returns the device ID. 844 * @since 14 845 */ 846 int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event); 847 848 /** 849 * @brief Obtains all keys that are pressed from UI input event. Only supports key events currently. 850 * 851 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 852 * @param pressedKeyCodes Array of all keys that are pressed. You need to allocate the memory space. 853 * @param length Length of the passed pressedKeyCodes array (when used as an input parameter); 854 * number of the keys pressed (when used as an output parameter). 855 * @return Returns the result code. 856 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 857 * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the giving buffer is not enough. 858 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 859 * @since 14 860 */ 861 int32_t OH_ArkUI_UIInputEvent_GetPressedKeys( 862 const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length); 863 864 /** 865 * @brief Obtains the axis value of a focus axis event. 866 * 867 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 868 * @param axis Axis type of the focus axis event. 869 * @return Returns the axis value of the focus axis event; returns <b>0.0</b> if any parameter error occurs. 870 * @since 15 871 */ 872 double OH_ArkUI_FocusAxisEvent_GetAxisValue(const ArkUI_UIInputEvent* event, int32_t axis); 873 874 /** 875 * @brief Sets whether to prevent a focus axis event from bubbling up. 876 * 877 * @param event Indicates the pointer to the current UI input event. 878 * @param stopPropagation Indicates whether to stop event propagation. 879 * @return Returns the result code. 880 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 881 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 882 * @since 15 883 */ 884 int32_t OH_ArkUI_FocusAxisEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); 885 886 /** 887 * @brief Obtains the width of the component hit by an event. 888 * 889 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 890 * @return Returns the width of the component hit by the event; returns <b>0.0f</b> if any parameter error occurs. 891 * @since 17 892 */ 893 float OH_ArkUI_UIInputEvent_GetEventTargetWidth(const ArkUI_UIInputEvent* event); 894 895 /** 896 * @brief Obtains the height of the component hit by an event. 897 * 898 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 899 * @return Returns the height of the component hit by the event; returns <b>0.0f</b> if any parameter error occurs. 900 * @since 17 901 */ 902 float OH_ArkUI_UIInputEvent_GetEventTargetHeight(const ArkUI_UIInputEvent* event); 903 904 /** 905 * @brief Obtains the X coordinate of the component hit by an event. 906 * 907 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 908 * @return Returns the X coordinate of the component hit by the event; returns <b>0.0f</b> if any parameter error occurs. 909 * @since 17 910 */ 911 float OH_ArkUI_UIInputEvent_GetEventTargetPositionX(const ArkUI_UIInputEvent* event); 912 913 /** 914 * @brief Obtains the Y coordinate of the component hit by an event. 915 * 916 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 917 * @return Returns the Y coordinate of the component hit by the event; 918 * returns <b>0.0f</b> if any parameter error occurs. 919 * @since 17 920 */ 921 float OH_ArkUI_UIInputEvent_GetEventTargetPositionY(const ArkUI_UIInputEvent* event); 922 923 /** 924 * @brief Obtains the global X coordinate of the component hit by an event. 925 * 926 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 927 * @return Returns the global X coordinate of the component hit by the event; 928 * returns <b>0.0f</b> if any parameter error occurs. 929 * @since 17 930 */ 931 float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX(const ArkUI_UIInputEvent* event); 932 933 /** 934 * @brief Obtains the global Y coordinate of the component hit by an event. 935 * 936 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 937 * @return Returns the global Y coordinate of the component hit by the event; 938 * returns <b>0.0f</b> if any parameter error occurs. 939 * @since 17 940 */ 941 float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY(const ArkUI_UIInputEvent* event); 942 943 /** 944 * @brief Checks whether the cursor is hovering over this component. 945 * 946 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 947 * @return Returns <b>true</b> if the cursor is hovering over the current component. 948 * Returns <b>false</b> if the cursor is not hovering over the current component. 949 * @since 17 950 */ 951 bool OH_ArkUI_HoverEvent_IsHovered(const ArkUI_UIInputEvent* event); 952 953 /** 954 * @brief Obtains the state of the modifier keys in a UI input event. 955 * 956 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 957 * @param keys Pointer to a variable where the current combination of pressed modifier keys will be returned. 958 * The application can use bitwise operations to determine the state of each modifier key. 959 * @return Returns the result code. 960 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 961 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 962 * @since 17 963 */ 964 int32_t OH_ArkUI_UIInputEvent_GetModifierKeyStates(const ArkUI_UIInputEvent* event, uint64_t* keys); 965 966 /** 967 * @brief Obtains the press time of a specific touch point. 968 * 969 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 970 * @param pointerIndex Index of the target touch point in the multi-touch data list. 971 * @return Returns the press time of the specific touch point; returns <b>0</b> if any parameter error occurs. 972 * @since 15 973 */ 974 int64_t OH_ArkUI_PointerEvent_GetPressedTimeByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 975 976 /** 977 * @brief Obtains the x-axis offset of the mouse pointer position relative to the position in the previously reported 978 * mouse event. This value may be less than the difference between the two reported X coordinates when the mouse pointer 979 * is near the screen edge. 980 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 981 * @return Returns the x-axis offset of the mouse pointer position relative to the position in the previously reported 982 * mouse event; returns <b>0.0f</b> if any parameter error occurs. 983 * @since 15 984 */ 985 float OH_ArkUI_MouseEvent_GetRawDeltaX(const ArkUI_UIInputEvent* event); 986 987 /** 988 * @brief Obtains the y-axis offset of the mouse pointer position relative to the position in the previously reported 989 * mouse event. This value may be less than the difference between the two reported Y coordinates when the mouse pointer 990 * is near the screen edge. 991 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 992 * @return Returns the y-axis offset of the mouse pointer position relative to the position in the previously reported 993 * mouse event; returns <b>0.0f</b> if any parameter error occurs. 994 * @since 15 995 */ 996 float OH_ArkUI_MouseEvent_GetRawDeltaY(const ArkUI_UIInputEvent* event); 997 998 /** 999 * @brief Obtains the pressed buttons from a mouse event. 1000 * 1001 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1002 * @param pressedButtons Array of the pressed buttons. An int array must be created beforehand to store the pressed 1003 * buttons. 1004 * @param length Length of the passed pressedButtons array (when used as an input parameter); 1005 * number of the buttons pressed (when used as an output parameter). 1006 * @return Returns the result code. 1007 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1008 * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the given buffer size is insufficient. 1009 * @since 15 1010 */ 1011 int32_t OH_ArkUI_MouseEvent_GetPressedButtons( 1012 const ArkUI_UIInputEvent* event, int32_t* pressedButtons, int32_t* length); 1013 1014 /** 1015 * @brief Obtains the ID of the screen where the UI input event occurs. 1016 * 1017 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1018 * @return Returns the screen ID; returns <b>0</b> if any parameter error occurs. 1019 * @since 15 1020 */ 1021 int32_t OH_ArkUI_UIInputEvent_GetTargetDisplayId(const ArkUI_UIInputEvent* event); 1022 1023 /** 1024 * @brief Sets whether to enable axis event propagation. 1025 * 1026 * @param event Pointer to the UI input event. 1027 * @param propagation Whether to enable event propagation. 1028 * @return Returns the result code. 1029 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1030 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1031 * @since 17 1032 */ 1033 int32_t OH_ArkUI_AxisEvent_SetPropagation(const ArkUI_UIInputEvent* event, bool propagation); 1034 1035 /** 1036 * @brief Obtains the scroll step configuration of the mouse wheel axis event. 1037 * 1038 * @param event Pointer to the UI input event. 1039 * @return Returns the scroll step configuration of the mouse wheel axis event. 1040 * @since 17 1041 */ 1042 int32_t OH_ArkUI_AxisEvent_GetScrollStep(const ArkUI_UIInputEvent* event); 1043 1044 /** 1045 * @brief Creates a cloned event pointer based on an event pointer. 1046 * 1047 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1048 * @param clonedEvent Pointer to the cloned <b>ArkUI_UIInputEvent</b> object. 1049 * @return Returns the result code. 1050 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1051 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1052 * @since 15 1053 */ 1054 int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent); 1055 1056 /** 1057 * @brief Destroys a cloned event pointer. 1058 * 1059 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1060 * @return Returns the result code. 1061 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1062 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1063 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1064 * cloned event pointer. 1065 * @since 15 1066 */ 1067 int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event); 1068 1069 /** 1070 * @brief Sets the X and Y coordinates of a cloned event relative to the upper left corner of the current component. 1071 * 1072 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1073 * @param x X coordinate of the event relative to the upper left corner of the current component. 1074 * @param y Y coordinate of the event relative to the upper left corner of the current component. 1075 * @return Returns the result code. 1076 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1077 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1078 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1079 * cloned event pointer. 1080 * @since 15 1081 */ 1082 int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y); 1083 1084 /** 1085 * @brief Sets the X and Y coordinates of a specific contact point of a cloned event relative to the upper left corner 1086 * of the current component. 1087 * 1088 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1089 * @param x X coordinate of the event relative to the upper left corner of the current component. 1090 * @param y Y coordinate of the event relative to the upper left corner of the current component. 1091 * @param pointerIndex Index of the target touch point in the multi-touch data list. 1092 * @return Returns the result code. 1093 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1094 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1095 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1096 * cloned event pointer. 1097 * @since 15 1098 */ 1099 int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex( 1100 const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex); 1101 1102 /** 1103 * @brief Sets the action type of a cloned event. 1104 * 1105 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1106 * @param actionType Action type of the cloned event. 1107 * @return Returns the result code. 1108 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1109 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1110 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1111 * cloned event pointer. 1112 * @since 15 1113 */ 1114 int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType); 1115 1116 /** 1117 * @brief Sets the touch point ID of a cloned pointer event. 1118 * 1119 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1120 * @param fingerId ID of the touch point that triggers the event. 1121 * @return Returns the result code. 1122 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1123 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1124 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1125 * cloned event pointer. 1126 * @since 15 1127 */ 1128 int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId); 1129 1130 /** 1131 * @brief Sets the touch point ID of a specific contact point of a cloned event. 1132 * 1133 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1134 * @param fingerId Touch point ID of the specific contact point. 1135 * @param pointerIndex Index of the target touch point in the multi-touch data list. 1136 * @return Returns the result code. 1137 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1138 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1139 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1140 * cloned event pointer. 1141 * @since 15 1142 */ 1143 int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex( 1144 const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex); 1145 1146 /** 1147 * @brief Posts a cloned event to a specific node. 1148 * 1149 * @param node Target node. 1150 * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object. 1151 * @return Returns the result code. 1152 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1153 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1154 * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a 1155 * cloned event pointer. 1156 * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL} 1157 * if the component status abnormal. 1158 * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT} 1159 * if no component hit to response to the event. 1160 * @since 15 1161 */ 1162 int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event); 1163 1164 #ifdef __cplusplus 1165 }; 1166 #endif 1167 1168 #endif // _ARKUI_UI_INPUT_EVENT_H_ 1169 /** @} */ 1170