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