From a4a5ba05ce726e34315eae6ae721cf7e358e4c0b Mon Sep 17 00:00:00 2001 From: aryawang Date: Wed, 27 Mar 2024 03:00:36 +0000 Subject: [PATCH] =?UTF-8?q?NDK=20C-Api=20=E6=89=8B=E5=8A=BF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aryawang Change-Id: I5b28f522fc654377582bea276078dd64779d08fa --- arkui/ace_engine/native/native_event.h | 182 --------- arkui/ace_engine/native/native_interface.h | 85 ++--- arkui/ace_engine/native/native_node.h | 246 +++++++----- arkui/ace_engine/native/ui_input_event.h | 419 +++++++++++++++++++++ 4 files changed, 597 insertions(+), 335 deletions(-) diff --git a/arkui/ace_engine/native/native_event.h b/arkui/ace_engine/native/native_event.h index a40143b86..ab2e301cb 100644 --- a/arkui/ace_engine/native/native_event.h +++ b/arkui/ace_engine/native/native_event.h @@ -37,194 +37,12 @@ #ifndef ARKUI_NATIVE_EVENT #define ARKUI_NATIVE_EVENT -#include #include #ifdef __cplusplus extern "C" { #endif -/** - * @brief Enumerates the tool types of the touch event. - * - * @since 12 - */ -typedef enum { - /** Unknown tool type. */ - NODE_TOOL_TYPE_UNKNOWN = -1, - - /** Finger. */ - NODE_TOOL_TYPE_FINGER = 0, - - /** Stylus. */ - NODE_TOOL_TYPE_STYLUS = 1, -} ArkUI_NodeToolType; - -/** - * @brief Enumerates the source types of the touch event. - * - * @since 12 - */ -typedef enum { - /** Unknown source type. */ - NODE_SOURCE_TYPE_UNKNOWN = -1, - /** Touchscreen. */ - NODE_SOURCE_TYPE_TOUCH_SCREEN = 0, - /** Stylus. */ - NODE_SOURCE_TYPE_STYLUS = 1, - /** Touchpad. */ - NODE_SOURCE_TYPE_TOUCHPAD = 2, -} ArkUI_NodeSourceType; - -/** - * @brief Defines the data structure of the touch point information of the - * touch event. - * - * @since 12 - */ -typedef struct { - /** ID of the touch event. */ - int32_t id; - - /** Timestamp when a finger is pressed, in μs. */ - int64_t pressedTime; - - /** X coordinate of the touch point on the screen. */ - int32_t screenX; - - /** Y coordinate of the touch point on the screen. */ - int32_t screenY; - - /** X coordinate of the touch point in the window. */ - int32_t windowX; - - /** Y coordinate of the touch point in the window. */ - int32_t windowY; - - /** X coordinate of the touch point in the component that triggers the event. */ - int32_t nodeX; - - /** Y coordinate of the touch point in the component that triggers the event. */ - int32_t nodeY; - - /** Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates - that the pressure is not supported. */ - double pressure; - - /** Width of the touch area. */ - int32_t contactAreaWidth; - - /** Height of the touch area. */ - int32_t contactAreaHeight; - - /** Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt. */ - double tiltX; - - /** Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt. */ - double tiltY; - - /** X coordinate of the center point of the tool area. */ - int32_t toolX; - - /** Y coordinate of the center point of the tool area. */ - int32_t toolY; - - /** Width of the tool area. */ - int32_t toolWidth; - - /** Height of the tool area. */ - int32_t toolHeight; - - /** X coordinate of the input device. */ - int32_t rawX; - - /** Y coordinate of the input device. */ - int32_t rawY; - - /** Tool type. */ - ArkUI_NodeToolType toolType; -} ArkUI_NodeTouchPoint; - -/** - * @brief Enumerates touch event types. - * - * @since 12 - */ -typedef enum { - /** Cancellation of touch. */ - NODE_ACTION_CANCEL = 0, - /** Pressing of a touch point. */ - NODE_ACTION_DOWN = 1, - /** Moving of a touch point. */ - NODE_ACTION_MOVE = 2, - /** Lifting of a touch point. */ - NODE_ACTION_UP = 3, -} ArkUI_NodeTouchEventAction; - -/** - * @brief Defines the data structure of the historical point information. - * - * @since 12 - */ -typedef struct { - /** Touch event type. */ - ArkUI_NodeTouchEventAction action; - /** Timestamp of the historical touch event, in μs. */ - int64_t timeStamp; - /** Source type of the historical touch event. */ - ArkUI_NodeTouchPoint actionTouch; - /** Source type of the historical touch event. */ - ArkUI_NodeSourceType sourceType; -} ArkUI_NodeHistoricalTouchPoint; - -/** - * @brief Defines the data structure of the touch event. - * - * @since 12 - */ -typedef struct { - /** Touch event type. */ - ArkUI_NodeTouchEventAction action; - - /** Timestamp of the touch event, in μs. */ - int64_t timeStamp; - - /** Touch point information of the touch event. */ - ArkUI_NodeTouchPoint actionTouch; - - /** - * @brief Returns information about all touch points when this event occurs. - * @param points Indicates the pointer to the object that receives data. - * @return Returns the number of elements in the touch point information array. - * @note - * When this function is called, ArkUI creates a heap memory object of the touch point information array and - * returns the pointer to the pointer. You need to call delete[] to manually free the memory when the - * object is not in use. - */ - int32_t (*getTouches)(ArkUI_NodeTouchPoint** points); - - /** - * @brief Returns the historical point information of this event, which covers actions that occur between - * this event and the previous event. - * @param historicalPoints Indicates the pointer to the object that receives data. - * @return Returns the number of elements in the historical touch point information array. - * @note - * When this function is called, ArkUI creates a heap memory object of the historical touch point information array - * and returns the pointer to the pointer. You need to call delete[] to manually free the memory - * when the object is not in use. - */ - int32_t (*getHistoricalPoints)(ArkUI_NodeHistoricalTouchPoint** historicalPoints); - - /** Source type of the touch event. */ - ArkUI_NodeSourceType sourceType; - - /** Whether to prevent propagation of the event to the parent node. */ - bool stopPropagation; - - /** Whether to prevent the default event processing behavior of the current node and allow propagation of the event. */ - bool preventDefault; -} ArkUI_NodeTouchEvent; - /** * @brief Enumerates the hit test modes. * diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h index 3e3ec33f1..ba288efaf 100644 --- a/arkui/ace_engine/native/native_interface.h +++ b/arkui/ace_engine/native/native_interface.h @@ -42,98 +42,67 @@ extern "C" { #endif -/** - * @brief Defines the native API type of any version. - * - * @since 12 - */ -typedef struct { - /** - * @brief Defines the version information of the native API set. - * - * Unlike the NDK version, the version field of the NativeNode API indicates the version of its own structure. - */ - int32_t version; -} ArkUI_AnyNativeAPI; - /** * @brief Defines the native API types. * * @since 12 */ typedef enum { - /** API related to UI components. */ + /** API related to UI components. For details, see the struct definition in . */ ARKUI_NATIVE_NODE, - /** API related to dialog boxes. */ + /** API related to dialog boxes. For details, see the struct definition in . */ ARKUI_NATIVE_DIALOG, - /** API related to gestures. */ + /** API related to gestures. For details, see the struct definition in . */ ARKUI_NATIVE_GESTURE, } ArkUI_NativeAPIVariantKind; /** - * @brief Defines the version information supported by the ARKUI_NATIVE_NODE type. + * @brief Obtains the native API set of a specified type. * - * @since 12 - */ -typedef enum { - /** The ARKUI_NATIVE_NODE type supports the structure {@link ArkUI_NativeNodeAPI_1} of version 1. */ - ARKUI_NATIVE_NODE_VERSION_1 = 1, -} ArkUI_NativeNodeAPIVersion; - -/** - * @brief Obtains the native API set of a specified version. - * - * @param type Indicates the type of the native API set provided by ArkUI, for example, - * ARKUI_NATIVE_NODE and ARKUI_NATIVE_GESTURE. - * @param version Indicates the version of the native API structure, which is obtained through the suffix - * defined in the structure. For the ARKUI_NATIVE_NODE structure, the version is 1, - * For the ARKUI_NATIVE_GESTURE structure, the version is 1 - * @return Returns the pointer to the native API abstract object that carries the version. + * @param type Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE + * and ARKUI_NATIVE_GESTURE. + * @param sturctName Indicates the name of a native struct defined in the corresponding header file, for example, + * ArkUI_NativeNodeAPI_1 in . + * @return Returns the pointer to the abstract native API, which can be used after being converted into a specific type. * @code {.cpp} * #include * #include + * #include * - * auto anyNativeAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1); - * if (anyNativeAPI->version == 1) { - * auto basicNodeApi = reinterpret_cast(anyNativeAPI); + * auto* anyNativeAPI = OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1"); + * if (anyNativeAPI) { + * auto nativeNodeApi = reinterpret_cast(anyNativeAPI); * } - * auto anyGestureAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_GESTURE, 1); - * if (anyNativeAPI->version == 1) { + * auto anyGestureAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1"); + * if (anyNativeAPI) { * auto basicGestureApi = reinterpret_cast(anyGestureAPI); * } * @endcode - * @deprecated This API is deprecated since API version 12. - * You are advised to use {@link OH_ArkUI_QueryModuleInterface} instead. + * * @since 12 */ -ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); +void* OH_ArkUI_QueryModuleInterfaceByName(ArkUI_NativeAPIVariantKind type, const char* structName); /** - * @brief Obtains the native module API set of a specified version. + * @brief Obtains the macro function corresponding to a struct pointer based on the struct type. * - * @param type Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE and - * ARKUI_NATIVE_GESTURE. - * @param version Indicates the version of the native API structure, which is obtained through the version enum - * supported by the structure, for example, For the ARKUI_NATIVE_NODE structure, the version is 1, - * For the ARKUI_NATIVE_GESTURE structure, the version is 1 - * @return Returns the pointer to the native API abstract object that carries the version. * @code {.cpp} * #include * #include * - * auto anyNativeAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_NODE, 1); - * if (anyNativeAPI->version == 1) { - * auto nativeNodeApi = reinterpret_cast(anyNativeAPI); - * } - * auto anyGestureAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_GESTURE, 1); - * if (anyNativeAPI->version == 1) { - * auto basicGestureApi = reinterpret_cast(anyGestureAPI); - * } + * ArkUI_NativeNodeAPI_1* nativeNodeApi = nullptr; + * OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nativeNodeApi); * @endcode * * @since 12 */ -ArkUI_AnyNativeAPI* OH_ArkUI_QueryModuleInterface(ArkUI_NativeAPIVariantKind type, int32_t version); +#define OH_ArkUI_GetModuleInterface(nativeAPIVariantKind, structType, structPtr) \ + do { \ + void* anyNativeAPI = OH_ArkUI_QueryModuleInterfaceByName(nativeAPIVariantKind, #structType); \ + if (anyNativeAPI) { \ + structPtr = (structType*)(anyNativeAPI); \ + } \ + } while (0) #ifdef __cplusplus }; diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 01469c964..7f25918a7 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -38,6 +38,7 @@ #include "native_event.h" #include "native_type.h" +#include "ui_input_event.h" #ifdef __cplusplus extern "C" { @@ -3676,7 +3677,7 @@ typedef enum { /** * @brief Defines the gesture event type. * - * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_TouchEvent}. + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_UIInputEvent}. */ NODE_TOUCH_EVENT = 0, @@ -4137,40 +4138,76 @@ typedef enum { * * @since 12 */ -typedef struct { - /** - * @brief Enumerates the event types. - * - * @see ArkUI_NodeEventType - */ - int32_t kind; +typedef struct ArkUI_NodeEvent ArkUI_NodeEvent; - /** - * @brief Defines the custom ID of the event. - * - * The event ID is passed as a parameter in {@link registerNodeEvent} and can be applied to the dispatch logic - * of the same event entry function {@link registerNodeEventReceiver}. - */ - int32_t eventId; +/** + * @brief Obtains the type of a component event. + * + * @param event Indicates the pointer to the component event. + * @return Returns the type of the component event. + * @since 12 + */ +ArkUI_NodeEventType OH_ArkUI_NodeEvent_GetEventType(ArkUI_NodeEvent* event); - /** Component object that triggers the event. */ - ArkUI_NodeHandle node; - union { - /** Callback parameter of the touch event type. */ - ArkUI_NodeTouchEvent touchEvent; - /** The universal component event uses callback parameters of the number type. */ - ArkUI_NodeComponentEvent componentEvent; - /** The universal component event uses callback parameters of the string type. */ - ArkUI_StringAsyncEvent stringEvent; - }; - /** - * @brief Defines the custom parameter of the event. - * - * This parameter is passed in {@link registerNodeEvent} and can be applied to the service logic when the event - * is triggered. - */ - void* extraParam; -} ArkUI_NodeEvent; +/** + * @brief Obtains the custom ID of a component event. + * + * The event ID is passed in as a parameter when the {@link registerNodeEvent} function is called and can be applied + * to the dispatch logic of the same event entry function {@link registerNodeEventReceiver}. + * + * @param event Indicates the pointer to the component event. + * @return Returns the custom ID of the component event. + * @since 12 + */ +int32_t OH_ArkUI_NodeEvent_GetTargetId(ArkUI_NodeEvent* event); + +/** + * @brief Obtains the component object that triggers a component event. + * + * @param event Indicates the pointer to the component event. + * @return Returns the component object that triggers the component event. + * @since 12 + */ +ArkUI_NodeHandle OH_ArkUI_NodeEvent_GetNodeHandle(ArkUI_NodeEvent* event); + +/** + * @brief Obtains input event (for example, touch event) data for a component event. + * + * @param event Indicates the pointer to the component event. + * @return Returns the pointer to the input event data. + * @since 12 + */ +ArkUI_UIInputEvent* OH_ArkUI_NodeEvent_GetInputEvent(ArkUI_NodeEvent* event); + +/** + * @brief Obtains the numerical data in a component event. + * + * @param event Indicates the pointer to the component event. + * @return Returns the pointer to the numerical data. + * @since 12 + */ +ArkUI_NodeComponentEvent* OH_ArkUI_NodeEvent_GetNodeComponentEvent(ArkUI_NodeEvent* event); + +/** + * @brief Obtains the string data in a component event. + * + * @param event Indicates the pointer to the component event. + * @return Returns the pointer to the string data. + * @since 12 + */ +ArkUI_StringAsyncEvent* OH_ArkUI_NodeEvent_GetStringAsyncEvent(ArkUI_NodeEvent* event); + +/** + * @brief Obtains the custom data in a component event. + * + * This parameter is passed in {@link registerNodeEvent} and can be applied to the service logic when the event + * is triggered. + * + * @param event Indicates the pointer to the component event. + * @return Returns the pointer to the custom data. + * @since 12 + */ +void* OH_ArkUI_NodeEvent_GetUserData(ArkUI_NodeEvent* event); /** * @brief Defines the dirty area flag passed in the ::markDirty API. @@ -4219,6 +4256,8 @@ typedef struct ArkUI_NodeCustomEvent ArkUI_NodeCustomEvent; /** * @brief Declares a collection of native node APIs provided by ArkUI. * + * The APIs related to the native node must be called in the main thread. + * * @version 1 * @since 12 */ @@ -4237,8 +4276,6 @@ typedef struct { /** * @brief Destroys the component to which the specified pointer points. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the pointer. */ void (*disposeNode)(ArkUI_NodeHandle node); @@ -4246,8 +4283,6 @@ typedef struct { /** * @brief Adds a component to a parent node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @return Returns 0 if success. @@ -4258,8 +4293,6 @@ typedef struct { /** * @brief Removes a component from its parent node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @return Returns 0 if success. @@ -4270,8 +4303,6 @@ typedef struct { /** * @brief Inserts a component to a parent node after the specified sibling node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param sibling Indicates the pointer to the sibling node after which the target node is to be inserted. @@ -4284,8 +4315,6 @@ typedef struct { /** * @brief Inserts a component to a parent node before the specified sibling node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param sibling Indicates the pointer to the sibling node before which the target node is to be inserted. @@ -4298,8 +4327,6 @@ typedef struct { /** * @brief Inserts a component to the specified position in a parent node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param position Indicates the position to which the target child node is to be inserted. If the value is a @@ -4312,8 +4339,6 @@ typedef struct { /** * @brief Sets the attribute of a node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the node whose attribute needs to be set. * @param attribute Indicates the type of attribute to set. * @param value Indicates the attribute value. @@ -4329,8 +4354,6 @@ typedef struct { * The pointer returned by this API is an internal buffer pointer of the ArkUI framework. As such, you do not need * to call delete to release the memory. However, the pointer must be used before this API is called next * time. Otherwise, the pointer may be overwritten by other values. - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the node whose attribute needs to be obtained. * @param attribute Indicates the type of attribute to obtain. * @return Returns the attribute value. If the operation fails, a null pointer is returned. @@ -4340,8 +4363,6 @@ typedef struct { /** * @brief Resets an attribute. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the node whose attribute needs to be reset. * @param attribute Indicates the type of attribute to reset. * @return Returns 0 if success. @@ -4357,13 +4378,15 @@ typedef struct { * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. - * @param eventId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} + * @param targetId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} * when the event is triggered. + * @param userData Indicates the custom event parameter, which is passed in the callback of {@link ArkUI_NodeEvent} * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. * Returns 106102 if the dynamic implementation library of the native API was not found. */ - int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, + int32_t targetId, void* userData); /** * @brief Unregisters an event for the specified node. @@ -4378,9 +4401,12 @@ typedef struct { /** * @brief Registers an event receiver. * - * The ArkUI framework collects component events generated during the process and calls back the events through the - * registered event receiver. \n - * A new call to this API will overwrite the previously registered event receiver. + * The ArkUI framework collects component events generated during the process and calls back the events through + * the registered event receiver. \n + * A new call to this API will overwrite the previously registered event receiver. \n + * Do not directly save the ArkUI_NodeEvent object pointer. The data will be destroyed after the + * callback is complete. \n + * To bind with a component instance, you can use the addNodeEventReceiver function. \n * * @param eventReceiver Indicates the event receiver to register. */ @@ -4397,8 +4423,6 @@ typedef struct { * * Regarding updates to system attributes, the ArkUI framework automatically marks the dirty area and performs * measuring, layout, or rendering again. In this case, you do not need to call this API. - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the node for which you want to mark as dirty area. * @param dirtyFlag Indicates type of dirty area. */ @@ -4407,8 +4431,6 @@ typedef struct { /** * @brief Obtains the number of subnodes. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. @@ -4418,8 +4440,6 @@ typedef struct { /** * @brief Obtains a subnode. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @param position Indicates the position of the subnode. * @return Returns the pointer to the subnode if the subnode exists; returns NULL otherwise. @@ -4429,8 +4449,6 @@ typedef struct { /** * @brief Obtains the first subnode. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @return Returns the pointer to the subnode if the subnode exists; returns NULL otherwise. */ @@ -4439,8 +4457,6 @@ typedef struct { /** * @brief Obtains the last subnode. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @return Returns the pointer to the subnode if the subnode exists; returns NULL otherwise. */ @@ -4449,35 +4465,29 @@ typedef struct { /** * @brief Obtains the previous sibling node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. - * @return Returns the pointer to the sibling node if the node exists; returns NULL otherwise. + * @return Returns the pointer to the subnode if the subnode exists; returns NULL otherwise. */ ArkUI_NodeHandle (*getPreviousSibling)(ArkUI_NodeHandle node); /** * @brief Obtains the next sibling node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. - * @return Returns the pointer to the sibling node if the node exists; returns NULL otherwise. + * @return Returns the pointer to the subnode if the subnode exists; returns NULL otherwise. */ ArkUI_NodeHandle (*getNextSibling)(ArkUI_NodeHandle node); /** * @brief Registers a custom event for a node. When the event is triggered, the value is returned through the entry - * function registered by registerNodeCustomEventReceiver. - * - * When the component is being displayed, this API must be called in the main thread. + * point function registered by registerNodeCustomEventReceiver. * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. - * @param targetId Indicates the custom event ID, which is passed in the callback of <@link ArkUI_NodeCustomEvent> - * when the event is triggered. + * @param targetId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeCustomEvent} + * when the event is triggered. * @param userData Indicates the custom event parameter, which is passed in the callback of - * <@link ArkUI_NodeCustomEvent> when the event is triggered. + * {@link ArkUI_NodeCustomEvent} when the event is triggered. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. * Returns 106102 if the dynamic implementation library of the native API was not found. @@ -4488,28 +4498,27 @@ typedef struct { /** * @brief Unregisters a custom event for a node. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @param eventType Indicates the type of event to unregister. */ void (*unregisterNodeCustomEvent)(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType eventType); /** - * @brief Registers a unified entry function for custom node event callbacks. + * @brief Registers a unified entry point function for custom node event callbacks. * * The ArkUI framework collects custom component events generated during the process and calls back the events * through the registered registerNodeCustomEventReceiver. \n * A new call to this API will overwrite the previously registered event receiver. + * Do not directly save the ArkUI_NodeCustomEvent object pointer. + * The data will be destroyed after the callback is complete. \n + * To bind with a component instance, you can use the addNodeCustomEventReceiver function. \n * * @param eventReceiver Indicates the event receiver to register. */ void (*registerNodeCustomEventReceiver)(void (*eventReceiver)(ArkUI_NodeCustomEvent* event)); /** - * @brief Unregisters the unified entry function for custom node event callbacks. - * - * When the component is being displayed, this API must be called in the main thread. + * @brief Unregisters the unified entry point function for custom node event callbacks. * */ void (*unregisterNodeCustomEventReceiver)(); @@ -4517,8 +4526,6 @@ typedef struct { /** * @brief Sets the width and height for a component after the measurement. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @param width Indicates the width. * @param height Indicates the height. @@ -4528,9 +4535,7 @@ typedef struct { int32_t (*setMeasuredSize)(ArkUI_NodeHandle node, int32_t width, int32_t height); /** - * @brief Sets the position for a component.. - * - * When the component is being displayed, this API must be called in the main thread. + * @brief Sets the position for a component. * * @param node Indicates the target node. * @param positionX Indicates the X coordinate. @@ -4543,8 +4548,6 @@ typedef struct { /** * @brief Obtains the width and height of a component after measurement. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @return Returns the width and height of the component. */ @@ -4553,8 +4556,6 @@ typedef struct { /** * @brief Obtains the position of a component after the layout is complete. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @return Returns the position of the component. */ @@ -4563,8 +4564,6 @@ typedef struct { /** * @brief Measures a node. You can use the getMeasuredSize API to obtain the size after the measurement. * - * When the component is being displayed, this API must be called in the main thread. - * * @param node Indicates the target node. * @param Constraint Indicates the size constraint. * @return Returns 0 if success. @@ -4584,6 +4583,63 @@ typedef struct { * Returns 401 if a parameter exception occurs. */ int32_t (*layoutNode)(ArkUI_NodeHandle node, int32_t positionX, int32_t positionY); + + /** + * @brief Adds a component event callback function to a component to receive component events generated + * by the component. + * + * Unlike the global registration function registerNodeEventReceiver, this API allows multiple event + * receivers to be added to the same component. \n + * The callback added by this API is triggered before the global callback registered by + * registerNodeEventReceiver. \n + * Do not directly save the ArkUI_NodeEvent object pointer. + * The data will be destroyed after the callback is complete. \n + * + * @param node Indicates the component for which you want to add the event callback function. + * @param eventReceiver Indicates the component event callback function to add. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*addNodeEventReceiver)(ArkUI_NodeHandle node, void (*eventReceiver)(ArkUI_NodeEvent* event)); + + /** + * @brief Removes the registered component event callback function from a component. + * + * @param node Indicates the component from which you want to remove the event callback function. + * @param eventReceiver Indicates the component event callback function to remove. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*removeNodeEventReceiver)(ArkUI_NodeHandle node, void (*eventReceiver)(ArkUI_NodeEvent* event)); + + /** + * @brief Adds a custom event callback function to a component to receive custom events + * (such as layout and drawing events) generated by the component. + * + * Unlike the global registration function registerNodeCustomEventReceiver, this API allows + * multiple event receivers to be added to the same component. \n + * The callback added by this API is triggered before the global callback registered by + * registerNodeCustomEventReceiver. \n + * Do not directly save the ArkUI_NodeCustomEvent object pointer. + * The data will be destroyed after the callback is complete. \n + * + * @param node Indicates the component for which you want to add the custom event callback function. + * @param eventReceiver Indicates the custom event callback function to add. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*addNodeCustomEventReceiver)(ArkUI_NodeHandle node, void (*eventReceiver)(ArkUI_NodeCustomEvent* event)); + + /** + * @brief Removes a registered custom event callback function from a component. + * + * @param node Indicates the component from which you want to remove the custom event callback function. + * @param eventReceiver Indicates the custom event callback function to remove. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*removeNodeCustomEventReceiver)(ArkUI_NodeHandle node, + void (*eventReceiver)(ArkUI_NodeCustomEvent* event)); } ArkUI_NativeNodeAPI_1; diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index 2546213db..0a0564823 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -59,6 +59,61 @@ typedef enum { ARKUI_UIINPUTEVENT_TYPE_AXIS = 2, } ArkUI_UIInputEvent_Type; +/** + * @brief Defines the action code of the input event. + * + * @since 12 + */ +enum { + /** Cancellation of touch. */ + UI_TOUCH_EVENT_ACTION_CANCEL = 0, + /** Pressing of a touch point. */ + UI_TOUCH_EVENT_ACTION_DOWN = 1, + /** Moving of a touch point. */ + UI_TOUCH_EVENT_ACTION_MOVE = 2, + /** Lifting of a touch point. */ + UI_TOUCH_EVENT_ACTION_UP = 3, +}; + +/** + * @brief Defines the tool type of the touch event. + * + * @since 12 + */ +enum { + /** Unknown tool type. */ + UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN = 0, + + /** Finger. */ + UI_INPUT_EVENT_TOOL_TYPE_FINGER = 1, + + /** Pen. */ + UI_INPUT_EVENT_TOOL_TYPE_PEN = 2, + + /** Mouse. */ + UI_INPUT_EVENT_TOOL_TYPE_MOUSE = 3, + + /** TouchPad. */ + UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 4, + + /** JoyStick. */ + UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK = 5, +}; + +/** + * @brief Defines the source type of the touch event. + * + * @since 12 + */ +enum { + /** Unknown source type. */ + UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0, + /** Mouse. */ + UI_INPUT_EVENT_SOURCE_TYPE_MOUSE = 1, + /** Touchscreen. */ + UI_INPUT_EVENT_SOURCE_TYPE_TOUCH_SCREEN = 2, +}; + /** * @brief Obtains the type of this UI input event. * @@ -68,6 +123,33 @@ typedef enum { */ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the action type of this UI input event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the action type of the current UI input event; returns 0 if any parameter error occurs. + * @since 12 + */ +int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the source type of this UI input event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the source type of the current UI input event. + * @since 12 + */ +int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the tool type of this UI input event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the tool type of the current UI input event. + * @since 12 + */ +int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event); + /** * @brief Obtains the time when this UI input event occurs. * @@ -77,6 +159,27 @@ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event); */ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the number of touch points from a directional input event (such as a touch event, mouse event, + * or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the number of touch points for the directional input event. + * @since 12 + */ +uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event, + * or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the ID of the corresponding touch point. + * @since 12 + */ +int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the X coordinate relative to the upper left corner of the current component from a directional * input event (such as a touch event, mouse event, or axis event). @@ -88,6 +191,18 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current component + * from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the X coordinate relative to the upper left corner of the current component; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the Y coordinate relative to the upper left corner of the current component from a directional * input event (such as a touch event, mouse event, or axis event). @@ -99,6 +214,18 @@ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current component + * from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the Y coordinate relative to the upper left corner of the current component; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the X coordinate relative to the upper left corner of the current application window from a * directional input event (such as a touch event, mouse event, or axis event). @@ -110,6 +237,18 @@ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current + * application window from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the X coordinate relative to the upper left corner of the current application window; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the Y coordinate relative to the upper left corner of the current application window from a * directional input event (such as a touch event, mouse event, or axis event). @@ -121,6 +260,18 @@ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current + * application window from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the Y coordinate relative to the upper left corner of the current application window; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the X coordinate relative to the upper left corner of the current screen from a directional input * event (such as a touch event, mouse event, or axis event). @@ -132,6 +283,18 @@ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current screen + * from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the X coordinate relative to the upper left corner of the current screen; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + /** * @brief Obtains the Y coordinate relative to the upper left corner of the current screen from a directional input * event (such as a touch event, mouse event, or axis event). @@ -143,6 +306,262 @@ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event); */ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current screen + * from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the Y coordinate relative to the upper left corner of the current screen; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the pressure applied to the touchscreen; returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the angle relative to the YZ plane from a directional input event (for example, a touch event). + * The value range is [-90, 90]. A positive value indicates a rightward tilt. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the angle relative to the YZ plane. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the angle relative to the XZ plane from a directional input event (for example, a touch event). + * The value range is [-90, 90]. A positive value indicates a downward tilt. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the angle relative to the XZ plane. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the width of the touch area from a directional input event (for example, a touch event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the width of the touch area. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the height of the touch area from a directional input event (for example, a touch event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the height of the touch area. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the number of historical events from a directional input event (such as a touch event, mouse event, + * or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the number of historical events. + * @since 12 + */ +uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the occurrence time of a historical event from a directional input event (such as a touch event, + * mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the time when the UI input event occurs; returns 0 if any parameter error occurs. + * @since 12 + */ +int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex); + +/** + * @brief Obtains the number of touch points in a specific historical event from a directional input event (such as + * a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the number of touch points in the specified historical event + * @since 12 + */ +uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex); + +/** + * @brief Obtains the ID of a touch point in a specific historical event from a directional input event (such as + * a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the ID of the corresponding touch point in the specified historical event. + * @since 12 + */ +int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current component from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the X coordinate relative to the upper left corner of the current component; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current component from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the Y coordinate relative to the upper left corner of the current component; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the X coordinate relative to the upper left corner of the current application window; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryWindowX( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current application window from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the Y coordinate relative to the upper left corner of the current application window; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryWindowY( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the X coordinate relative to the upper left corner of the current screen; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryDisplayX( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner + * of the current screen from a directional input event (such as a touch event, mouse event, or axis event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the Y coordinate relative to the upper left corner of the current screen; + * returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryDisplayY( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event + * (for example, a touch event).. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the pressure applied to the touchscreen; returns 0.0f if any parameter error occurs. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryPressure( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the angle relative to the YZ plane in a specific historical event from a directional input event + * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the angle relative to the YZ plane. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryTiltX( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the angle relative to the XZ plane in a specific historical event from a directional input event + * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the angle relative to the XZ plane. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryTiltY( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the width of the touch area in a specific historical event from a directional input event + * (for example, a touch event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the width of the touch area. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + +/** + * @brief Obtains the height of the touch area in a specific historical event from a directional input event + * (for example, a touch event). + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @param historyIndex Indicates the index of the target historical event. + * @return Returns the height of the touch area. + * @since 12 + */ +float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight( + const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex); + /** * @brief Obtains the value of the vertical scroll axis for this axis event. * -- Gitee