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