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 <cstdint> 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /** 45 * @brief Defines the UI input event. 46 * 47 * @since 12 48 */ 49 typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent; 50 51 /** 52 * @brief Enumerates the UI input event types. 53 * 54 * @since 12 55 */ 56 typedef enum { 57 ARKUI_UIINPUTEVENT_TYPE_UNKNOWN = 0, 58 ARKUI_UIINPUTEVENT_TYPE_TOUCH = 1, 59 ARKUI_UIINPUTEVENT_TYPE_AXIS = 2, 60 ARKUI_UIINPUTEVENT_TYPE_MOUSE = 3, 61 } ArkUI_UIInputEvent_Type; 62 63 /** 64 * @brief Defines the action code of the input event. 65 * 66 * @since 12 67 */ 68 enum { 69 /** Cancellation of touch. */ 70 UI_TOUCH_EVENT_ACTION_CANCEL = 0, 71 /** Pressing of a touch point. */ 72 UI_TOUCH_EVENT_ACTION_DOWN = 1, 73 /** Moving of a touch point. */ 74 UI_TOUCH_EVENT_ACTION_MOVE = 2, 75 /** Lifting of a touch point. */ 76 UI_TOUCH_EVENT_ACTION_UP = 3, 77 }; 78 79 /** 80 * @brief Defines the tool type of the touch event. 81 * 82 * @since 12 83 */ 84 enum { 85 /** Unknown tool type. */ 86 UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN = 0, 87 88 /** Finger. */ 89 UI_INPUT_EVENT_TOOL_TYPE_FINGER = 1, 90 91 /** Pen. */ 92 UI_INPUT_EVENT_TOOL_TYPE_PEN = 2, 93 94 /** Mouse. */ 95 UI_INPUT_EVENT_TOOL_TYPE_MOUSE = 3, 96 97 /** TouchPad. */ 98 UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 4, 99 100 /** JoyStick. */ 101 UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK = 5, 102 }; 103 104 /** 105 * @brief Defines the source type of the touch event. 106 * 107 * @since 12 108 */ 109 enum { 110 /** Unknown source type. */ 111 UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0, 112 /** Mouse. */ 113 UI_INPUT_EVENTT_SOURCE_TYPE_MOUSE = 1, 114 /** Touchscreen. */ 115 UI_INPUT_EVENTT_SOURCE_TYPE_TOUCH_SCREEN = 2, 116 }; 117 118 /** 119 * @brief Enumerates the hit test modes. 120 * 121 * @since 12 122 */ 123 typedef enum { 124 /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from 125 * the hit test. 126 */ 127 HTM_DEFAULT = 0, 128 129 /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit 130 * test. 131 */ 132 HTM_BLOCK, 133 134 /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also 135 * considered during the hit test. 136 */ 137 HTM_TRANSPARENT, 138 139 /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered 140 * during the hit test. 141 */ 142 HTM_NONE, 143 } HitTestMode; 144 145 /** 146 * @brief 定义鼠标事件的Action Code。 147 * 148 * @since 12 149 */ 150 enum { 151 /** 无效行为 */ 152 UI_MOUSE_EVENT_ACTION_UNKNOWN = 0, 153 /** 鼠标按键按下。 */ 154 UI_MOUSE_EVENT_ACTION_PRESS = 1, 155 /** 鼠标按键松开。 */ 156 UI_MOUSE_EVENT_ACTION_RELEASE = 2, 157 /** 鼠标移动。 */ 158 UI_MOUSE_EVENT_ACTION_MOVE = 3, 159 }; 160 161 /** 162 * @brief 定义鼠标事件的按键类型。 163 * 164 * @since 12 165 */ 166 enum { 167 /** 无按键。 */ 168 UI_MOUSE_EVENT_BUTTON_NONE = 0, 169 /** 鼠标左键。 */ 170 UI_MOUSE_EVENT_BUTTON_LEFT = 1, 171 /** 鼠标右键。 */ 172 UI_MOUSE_EVENT_BUTTON_RIGHT = 2, 173 /** 鼠标中键。 */ 174 UI_MOUSE_EVENT_BUTTON_MIDDLE = 3, 175 /** 鼠标左侧后退键。 */ 176 UI_MOUSE_EVENT_BUTTON_BACK = 4, 177 /** 鼠标左侧前进键。 */ 178 UI_MOUSE_EVENT_BUTTON_FORWARD = 5, 179 }; 180 181 /** 182 * @brief Defines an enum for modifier keys. 183 * 184 * @since 12 185 */ 186 typedef enum { 187 /** Ctrl. */ 188 ARKUI_MODIFIER_KEY_CTRL = 1 << 0, 189 /** Shift. */ 190 ARKUI_MODIFIER_KEY_SHIFT = 1 << 1, 191 /** Alt. */ 192 ARKUI_MODIFIER_KEY_ALT = 1 << 2, 193 /** Fn. */ 194 ARKUI_MODIFIER_KEY_FN = 1 << 3, 195 } ArkUI_ModifierKeyName; 196 197 /** 198 * @brief Obtains the type of this UI input event. 199 * 200 * @param event Indicates the pointer to the current UI input event. 201 * @return Returns the type of the current UI input event; returns <b>0</b> if any parameter error occurs. 202 * @since 12 203 */ 204 int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event); 205 206 /** 207 * @brief Obtains the action type of this UI input event. 208 * 209 * @param event Indicates the pointer to the current UI input event. 210 * @return Returns the action type of the current UI input event; returns <b>0</b> if any parameter error occurs. 211 * @since 12 212 */ 213 int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event); 214 215 /** 216 * @brief Obtains the source type of this UI input event. 217 * 218 * @param event Indicates the pointer to the current UI input event. 219 * @return Returns the source type of the current UI input event. 220 * @since 12 221 */ 222 int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event); 223 224 /** 225 * @brief Obtains the tool type of this UI input event. 226 * 227 * @param event Indicates the pointer to the current UI input event. 228 * @return Returns the tool type of the current UI input event. 229 * @since 12 230 */ 231 int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event); 232 233 /** 234 * @brief Obtains the time when this UI input event occurs. 235 * 236 * @param event Indicates the pointer to the current UI input event. 237 * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs. 238 * @since 12 239 */ 240 int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event); 241 242 /** 243 * @brief Obtains the number of touch points from a directional input event (such as a touch event, mouse event, 244 * or axis event). 245 * 246 * @param event Indicates the pointer to the current UI input event. 247 * @return Returns the number of touch points for the directional input event. 248 * @since 12 249 */ 250 uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event); 251 252 /** 253 * @brief Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event, 254 * or axis event). 255 * 256 * @param event Indicates the pointer to the current UI input event. 257 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 258 * @return Returns the ID of the corresponding touch point. 259 * @since 12 260 */ 261 int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 262 263 /** 264 * @brief Obtains the X coordinate relative to the upper left corner of the current component from a directional 265 * input event (such as a touch event, mouse event, or axis event). 266 * 267 * @param event Indicates the pointer to the directional input event. 268 * @return Returns the X coordinate relative to the upper left corner of the current component; 269 * returns <b>0</b> if any parameter error occurs. 270 * @since 12 271 */ 272 float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event); 273 274 /** 275 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current component 276 * from a directional input event (such as a touch event, mouse event, or axis event). 277 * 278 * @param event Indicates the pointer to the current UI input event. 279 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 280 * @return Returns the X coordinate relative to the upper left corner of the current component; 281 * returns <b>0.0f</b> if any parameter error occurs. 282 * @since 12 283 */ 284 float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 285 286 /** 287 * @brief Obtains the Y coordinate relative to the upper left corner of the current component from a directional 288 * input event (such as a touch event, mouse event, or axis event). 289 * 290 * @param event Indicates the pointer to the UI input event. 291 * @return Returns the Y coordinate relative to the upper left corner of the current component; 292 * returns <b>0</b> if any parameter error occurs. 293 * @since 12 294 */ 295 float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event); 296 297 /** 298 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current component 299 * from a directional input event (such as a touch event, mouse event, or axis event). 300 * 301 * @param event Indicates the pointer to the current UI input event. 302 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 303 * @return Returns the Y coordinate relative to the upper left corner of the current component; 304 * returns <b>0.0f</b> if any parameter error occurs. 305 * @since 12 306 */ 307 float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 308 309 /** 310 * @brief Obtains the X coordinate relative to the upper left corner of the current application window from a 311 * directional input event (such as a touch event, mouse event, or axis event). 312 * 313 * @param event Indicates the pointer to the UI input event. 314 * @return Returns the X coordinate relative to the upper left corner of the current application window; 315 * returns <b>0</b> if any parameter error occurs. 316 * @since 12 317 */ 318 float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event); 319 320 /** 321 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current 322 * application window from a directional input event (such as a touch event, mouse event, or axis event). 323 * 324 * @param event Indicates the pointer to the current UI input event. 325 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 326 * @return Returns the X coordinate relative to the upper left corner of the current application window; 327 * returns <b>0.0f</b> if any parameter error occurs. 328 * @since 12 329 */ 330 float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 331 332 /** 333 * @brief Obtains the Y coordinate relative to the upper left corner of the current application window from a 334 * directional input event (such as a touch event, mouse event, or axis event). 335 * 336 * @param event Indicates the pointer to the UI input event. 337 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 338 * returns <b>0</b> if any parameter error occurs. 339 * @since 12 340 */ 341 float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event); 342 343 /** 344 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current 345 * application window from a directional input event (such as a touch event, mouse event, or axis event). 346 * 347 * @param event Indicates the pointer to the current UI input event. 348 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 349 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 350 * returns <b>0.0f</b> if any parameter error occurs. 351 * @since 12 352 */ 353 float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 354 355 /** 356 * @brief Obtains the X coordinate relative to the upper left corner of the current screen from a directional input 357 * event (such as a touch event, mouse event, or axis event). 358 * 359 * @param event Indicates the pointer to the UI input event. 360 * @return Returns the X coordinate relative to the upper left corner of the current screen; 361 * returns <b>0</b> if any parameter error occurs. 362 * @since 12 363 */ 364 float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event); 365 366 /** 367 * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current screen 368 * from a directional input event (such as a touch event, mouse event, or axis event). 369 * 370 * @param event Indicates the pointer to the current UI input event. 371 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 372 * @return Returns the X coordinate relative to the upper left corner of the current screen; 373 * returns <b>0.0f</b> if any parameter error occurs. 374 * @since 12 375 */ 376 float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 377 378 /** 379 * @brief Obtains the Y coordinate relative to the upper left corner of the current screen from a directional input 380 * event (such as a touch event, mouse event, or axis event). 381 * 382 * @param event Indicates the pointer to the UI input event. 383 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 384 * returns <b>0</b> if any parameter error occurs. 385 * @since 12 386 */ 387 float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event); 388 389 /** 390 * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current screen 391 * from a directional input event (such as a touch event, mouse event, or axis event). 392 * 393 * @param event Indicates the pointer to the current UI input event. 394 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 395 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 396 * returns <b>0.0f</b> if any parameter error occurs. 397 * @since 12 398 */ 399 float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 400 401 /** 402 * @brief Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event). 403 * 404 * @param event Indicates the pointer to the current UI input event. 405 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 406 * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs. 407 * @since 12 408 */ 409 float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 410 411 /** 412 * @brief Obtains the angle relative to the YZ plane from a directional input event (for example, a touch event). 413 * The value range is [-90, 90]. A positive value indicates a rightward tilt. 414 * 415 * @param event Indicates the pointer to the current UI input event. 416 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 417 * @return Returns the angle relative to the YZ plane. 418 * @since 12 419 */ 420 float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 421 422 /** 423 * @brief Obtains the angle relative to the XZ plane from a directional input event (for example, a touch event). 424 * The value range is [-90, 90]. A positive value indicates a downward tilt. 425 * 426 * @param event Indicates the pointer to the current UI input event. 427 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 428 * @return Returns the angle relative to the XZ plane. 429 * @since 12 430 */ 431 float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 432 433 /** 434 * @brief Obtains the width of the touch area from a directional input event (for example, a touch event). 435 * 436 * @param event Indicates the pointer to the current UI input event. 437 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 438 * @return Returns the width of the touch area. 439 * @since 12 440 */ 441 float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 442 443 /** 444 * @brief Obtains the height of the touch area from a directional input event (for example, a touch event). 445 * 446 * @param event Indicates the pointer to the current UI input event. 447 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 448 * @return Returns the height of the touch area. 449 * @since 12 450 */ 451 float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); 452 453 /** 454 * @brief Obtains the number of historical events from a directional input event (such as a touch event, mouse event, 455 * or axis event). 456 * 457 * @param event Indicates the pointer to the current UI input event. 458 * @return Returns the number of historical events. 459 * @since 12 460 */ 461 uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event); 462 463 /** 464 * @brief Obtains the occurrence time of a historical event from a directional input event (such as a touch event, 465 * mouse event, or axis event). 466 * 467 * @param event Indicates the pointer to the current UI input event. 468 * @param historyIndex Indicates the index of the target historical event. 469 * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs. 470 * @since 12 471 */ 472 int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex); 473 474 /** 475 * @brief Obtains the number of touch points in a specific historical event from a directional input event (such as 476 * a touch event, mouse event, or axis event). 477 * 478 * @param event Indicates the pointer to the current UI input event. 479 * @param historyIndex Indicates the index of the target historical event. 480 * @return Returns the number of touch points in the specified historical event 481 * @since 12 482 */ 483 uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex); 484 485 /** 486 * @brief Obtains the ID of a touch point in a specific historical event from a directional input event (such as 487 * a touch event, mouse event, or axis event). 488 * 489 * @param event Indicates the pointer to the current UI input event. 490 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 491 * @param historyIndex Indicates the index of the target historical event. 492 * @return Returns the ID of the corresponding touch point in the specified historical event. 493 * @since 12 494 */ 495 int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId( 496 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 497 498 /** 499 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 500 * of the current component from a directional input event (such as a touch event, mouse event, or axis event). 501 * 502 * @param event Indicates the pointer to the current UI input event. 503 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 504 * @param historyIndex Indicates the index of the target historical event. 505 * @return Returns the X coordinate relative to the upper left corner of the current component; 506 * returns <b>0.0f</b> if any parameter error occurs. 507 * @since 12 508 */ 509 float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 510 511 /** 512 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 513 * of the current component from a directional input event (such as a touch event, mouse event, or axis event). 514 * 515 * @param event Indicates the pointer to the current UI input event. 516 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 517 * @param historyIndex Indicates the index of the target historical event. 518 * @return Returns the Y coordinate relative to the upper left corner of the current component; 519 * returns <b>0.0f</b> if any parameter error occurs. 520 * @since 12 521 */ 522 float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 523 524 /** 525 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 526 * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). 527 * 528 * @param event Indicates the pointer to the current UI input event. 529 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 530 * @param historyIndex Indicates the index of the target historical event. 531 * @return Returns the X coordinate relative to the upper left corner of the current application window; 532 * returns <b>0.0f</b> if any parameter error occurs. 533 * @since 12 534 */ 535 float OH_ArkUI_PointerEvent_GetHistoryWindowX( 536 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 537 538 /** 539 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 540 * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). 541 * 542 * @param event Indicates the pointer to the current UI input event. 543 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 544 * @param historyIndex Indicates the index of the target historical event. 545 * @return Returns the Y coordinate relative to the upper left corner of the current application window; 546 * returns <b>0.0f</b> if any parameter error occurs. 547 * @since 12 548 */ 549 float OH_ArkUI_PointerEvent_GetHistoryWindowY( 550 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 551 552 /** 553 * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner 554 * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). 555 * 556 * @param event Indicates the pointer to the current UI input event. 557 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 558 * @param historyIndex Indicates the index of the target historical event. 559 * @return Returns the X coordinate relative to the upper left corner of the current screen; 560 * returns <b>0.0f</b> if any parameter error occurs. 561 * @since 12 562 */ 563 float OH_ArkUI_PointerEvent_GetHistoryDisplayX( 564 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 565 566 /** 567 * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner 568 * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). 569 * 570 * @param event Indicates the pointer to the current UI input event. 571 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 572 * @param historyIndex Indicates the index of the target historical event. 573 * @return Returns the Y coordinate relative to the upper left corner of the current screen; 574 * returns <b>0.0f</b> if any parameter error occurs. 575 * @since 12 576 */ 577 float OH_ArkUI_PointerEvent_GetHistoryDisplayY( 578 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 579 580 /** 581 * @brief Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event 582 * (for example, a touch event).. 583 * 584 * @param event Indicates the pointer to the current UI input event. 585 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 586 * @param historyIndex Indicates the index of the target historical event. 587 * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs. 588 * @since 12 589 */ 590 float OH_ArkUI_PointerEvent_GetHistoryPressure( 591 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 592 593 /** 594 * @brief Obtains the angle relative to the YZ plane in a specific historical event from a directional input event 595 * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt. 596 * 597 * @param event Indicates the pointer to the current UI input event. 598 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 599 * @param historyIndex Indicates the index of the target historical event. 600 * @return Returns the angle relative to the YZ plane. 601 * @since 12 602 */ 603 float OH_ArkUI_PointerEvent_GetHistoryTiltX( 604 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 605 606 /** 607 * @brief Obtains the angle relative to the XZ plane in a specific historical event from a directional input event 608 * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt. 609 * 610 * @param event Indicates the pointer to the current UI input event. 611 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 612 * @param historyIndex Indicates the index of the target historical event. 613 * @return Returns the angle relative to the XZ plane. 614 * @since 12 615 */ 616 float OH_ArkUI_PointerEvent_GetHistoryTiltY( 617 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 618 619 /** 620 * @brief Obtains the width of the touch area in a specific historical event from a directional input event 621 * (for example, a touch event). 622 * 623 * @param event Indicates the pointer to the current UI input event. 624 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 625 * @param historyIndex Indicates the index of the target historical event. 626 * @return Returns the width of the touch area. 627 * @since 12 628 */ 629 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth( 630 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 631 632 /** 633 * @brief Obtains the height of the touch area in a specific historical event from a directional input event 634 * (for example, a touch event). 635 * 636 * @param event Indicates the pointer to the current UI input event. 637 * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. 638 * @param historyIndex Indicates the index of the target historical event. 639 * @return Returns the height of the touch area. 640 * @since 12 641 */ 642 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight( 643 const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); 644 645 /** 646 * @brief Obtains the value of the vertical scroll axis for this axis event. 647 * 648 * @param event Indicates the pointer to the UI input event. 649 * @return Returns the value of the vertical scroll axis of the current axis event; 650 * returns <b>0</b> if any parameter error occurs. 651 * @since 12 652 */ 653 double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event); 654 655 /** 656 * @brief Obtains the value of the horizontal scroll axis for this axis event. 657 * 658 * @param event Indicates the pointer to the UI input event. 659 * @return Returns the value of the horizontal scroll axis of the current axis event; 660 * returns <b>0</b> if any parameter error occurs. 661 * @since 12 662 */ 663 double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event); 664 665 /** 666 * @brief Obtains the scale value of the pinch axis for this axis event. 667 * 668 * @param event Indicates the pointer to the UI input event. 669 * @return Returns the scale value of the pinch axis of the current axis event; 670 * returns <b>0</b> if any parameter error occurs. 671 * @since 12 672 */ 673 double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event); 674 675 /** 676 * @brief Sets how the component behaves during hit testing. 677 * 678 * @param event Indicates the pointer to the current UI input event. 679 * @param mode Indicates how the component behaves during hit testing. The parameter type is {@link HitTestMode}. 680 * @return Returns the status code of the execution. 681 * @since 12 682 */ 683 int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode); 684 685 /** 686 * @brief 获取鼠标事件的按键类型的值。 687 * 688 * @param event 表示指向当前UI输入事件的指针。 689 * @return 返回鼠标按键类型,1为左键,2为右键,3为中键,4为后退键,5为前进键。 690 * @since 12 691 */ 692 int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event); 693 694 /** 695 * @brief 获取鼠标事件的鼠标动作类型的值。 696 * 697 * @param event 表示指向当前UI输入事件的指针。 698 * @return 返回鼠标动作类型,1表示按键按下,2表示按键松开,3表示鼠标移动。 699 * @since 12 700 */ 701 int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event); 702 703 /** 704 * @brief Sets whether to prevent event bubbling. 705 * 706 * @param event Indicates the pointer to the current UI input event. 707 * @param stopPropagation Indicates whether the event is prevented from bubbling. 708 * @return Returns the status code of the execution. If 0 is returned, the setting is successful. 709 * If 401 is returned, the execution fails. 710 * The possible cause of the failure is that the event parameter is abnormal, such as a null pointer. 711 * @since 12 712 */ 713 int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); 714 715 #ifdef __cplusplus 716 }; 717 #endif 718 719 #endif // _ARKUI_UI_INPUT_EVENT_H_ 720 /** @} */ 721