diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn
index d29b8ce34606a43936f4c274b40eedebf2168b5e..df21fe5b3a27ca1ab64d27aa2778170b664f3246 100644
--- a/arkui/ace_engine/native/BUILD.gn
+++ b/arkui/ace_engine/native/BUILD.gn
@@ -30,6 +30,7 @@ if (!is_arkui_x) {
"native_interface.h",
"native_node.h",
"native_type.h",
+ "ui_input_event.h",
]
}
diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json
index 90e2f0ae30ea59d97b6a190fb9a052e0dc2f89df..af9796452b8e492be2988f84f81ecebfa0aab2dc 100644
--- a/arkui/ace_engine/native/libace.ndk.json
+++ b/arkui/ace_engine/native/libace.ndk.json
@@ -102,5 +102,53 @@
{
"first_introduced": "12",
"name": "OH_ArkUI_GetNativeAPI"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_NativeXComponent_RegisterUIInputEventCallback"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_UIInputEvent_GetType"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_UIInputEvent_GetEventTime"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetX"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetY"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetWindowX"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetWindowY"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetDisplayX"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_PointerEvent_GetDisplayY"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_AxisEvent_GetVerticalAxisValue"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_AxisEvent_GetHorizontalAxisValue"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_ArkUI_AxisEvent_GetPinchAxisScaleValue"
}
]
\ No newline at end of file
diff --git a/arkui/ace_engine/native/native_interface_xcomponent.h b/arkui/ace_engine/native/native_interface_xcomponent.h
index e7a6ece21ac19bbc60dda6330852d851738a3c27..1a2c19b81436f0baa7801c27114be21594794e7c 100644
--- a/arkui/ace_engine/native/native_interface_xcomponent.h
+++ b/arkui/ace_engine/native/native_interface_xcomponent.h
@@ -43,6 +43,7 @@
#endif
#include "arkui/native_type.h"
+#include "arkui/ui_input_event.h"
#include "native_xcomponent_key_event.h"
@@ -650,6 +651,23 @@ int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component,
*/
int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root);
+/**
+ * @brief Registers a UI input event callback for this OH_NativeXComponent instance and enables the callback to
+ * be invoked when a UI input event is received.
+ *
+ * @param component Indicates the pointer to the OH_NativeXComponent instance.
+ * @param callback Indicates the pointer to the UI input event callback.
+ * @param type Indicates the type of the current UI input event.
+ * @return Returns 0 if success.
+ * Returns 401 if a parameter exception occurs.
+ * @since 12
+ */
+int32_t OH_NativeXComponent_RegisterUIInputEventCallback(
+ OH_NativeXComponent* component,
+ void (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event,
+ ArkUI_UIInputEvent_Type type),
+ ArkUI_UIInputEvent_Type type);
+
#ifdef __cplusplus
};
#endif
diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h
new file mode 100644
index 0000000000000000000000000000000000000000..2546213dbdfd11d1def6bdb84c9652cb18c25c4f
--- /dev/null
+++ b/arkui/ace_engine/native/ui_input_event.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @addtogroup ArkUI_EventModule
+ * @{
+ *
+ * @brief Declares the UI input event capabilities provided by ArkUI on the native side.
+ *
+ * @since 12
+ */
+
+/**
+ * @file ui_input_event.h
+ *
+ * @brief Provides ArkUI event definitions on the native side.
+ *
+ * @library libace_ndk.z.so
+ * @syscap SystemCapability.ArkUI.ArkUI.Full
+ * @since 12
+ */
+
+#ifndef _ARKUI_UI_INPUT_EVENT_H_
+#define _ARKUI_UI_INPUT_EVENT_H_
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Defines the UI input event.
+ *
+ * @since 12
+ */
+typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent;
+
+/**
+ * @brief Enumerates the UI input event types.
+ *
+ * @since 12
+ */
+typedef enum {
+ ARKUI_UIINPUTEVENT_TYPE_UNKNOWN = 0,
+ ARKUI_UIINPUTEVENT_TYPE_TOUCH = 1,
+ ARKUI_UIINPUTEVENT_TYPE_AXIS = 2,
+} ArkUI_UIInputEvent_Type;
+
+/**
+ * @brief Obtains the type of this UI input event.
+ *
+ * @param event Indicates the pointer to the current UI input event.
+ * @return Returns the type of the current UI input event; returns 0 if any parameter error occurs.
+ * @since 12
+ */
+int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event);
+
+/**
+ * @brief Obtains the time when this UI input event occurs.
+ *
+ * @param event Indicates the pointer to the current UI input event.
+ * @return Returns the time when the UI input event occurs; returns 0 if any parameter error occurs.
+ * @since 12
+ */
+int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the directional input event.
+ * @return Returns the X coordinate relative to the upper left corner of the current component;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the Y coordinate relative to the upper left corner of the current component;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the X coordinate relative to the upper left corner of the current application window;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the Y coordinate relative to the upper left corner of the current application window;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the X coordinate relative to the upper left corner of the current screen;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event);
+
+/**
+ * @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).
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the Y coordinate relative to the upper left corner of the current screen;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event);
+
+/**
+ * @brief Obtains the value of the vertical scroll axis for this axis event.
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the value of the vertical scroll axis of the current axis event;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event);
+
+/**
+ * @brief Obtains the value of the horizontal scroll axis for this axis event.
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the value of the horizontal scroll axis of the current axis event;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event);
+
+/**
+ * @brief Obtains the scale value of the pinch axis for this axis event.
+ *
+ * @param event Indicates the pointer to the UI input event.
+ * @return Returns the scale value of the pinch axis of the current axis event;
+ * returns 0 if any parameter error occurs.
+ * @since 12
+ */
+double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _ARKUI_UI_INPUT_EVENT_H_
+/** @} */