From 4e8850adc5205589742690c33ab31b0ea8e7c519 Mon Sep 17 00:00:00 2001 From: fangzhiyuan Date: Thu, 7 Aug 2025 22:17:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=BB=84=E4=BB=B6=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E8=AE=BE=E7=BD=AE=E8=83=BD=E5=8A=9B=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangzhiyuan --- arkui/ace_engine/native/libace.ndk.json | 8 +++++ arkui/ace_engine/native/native_node.h | 40 +++++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 5 ++++ 3 files changed, 53 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3c739a283..a67b8e83d 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -4062,5 +4062,13 @@ { "first_introduced": "20", "name": "OH_ArkUI_PostUITaskAndWait" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NativeModule_RegisterCommonEvent" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NativeModule_UnregisterCommonEvent" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 53cfc3bf4..a479a2d1a 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -7204,6 +7204,16 @@ typedef enum { */ NODE_ON_HOVER_MOVE = 29, + /** + * @brief Defines the size change event. + * + * The event will be triggered when the component size changes. + * When the event callback occurs, the {@link ArkUI_NodeEvent} object can be obtained from the + * {@link ArkUI_UIInputEvent} object. \n + * @since 20 + */ + NODE_ON_SIZE_CHANGE = 30, + /** * @brief Triggers onDetectResultUpdate callback * when the text is set to TextDataDetectorConfig and recognized successfully. @@ -10027,6 +10037,36 @@ int32_t OH_ArkUI_PostUITask(ArkUI_ContextHandle context, void* taskData, void (* * @since 20 */ int32_t OH_ArkUI_PostUITaskAndWait(ArkUI_ContextHandle context, void* taskData, void (*task)(void* taskData)); + +/** + * @brief Register common event callback of target node. + * + * @param node The ArkUI-NodeHandle pointer. + * @param eventType Indicates the type of event to set. + * @param userData Indicates the pointer to the custom data. + * @param callback Indicates the event callback function. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function params is invalid. + * Returns {@link ARKUI_ERROR_CODE_NODE_UNSUPPORT_EVENT_TYPE} Function parameter eventType is not supported. + * @since 20 + */ +int32_t OH_ArkUI_NativeModule_RegisterCommonEvent(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, + void* userData, void (*callback)(ArkUI_NodeEvent* event, void* userData)); + +/** + * @brief Unregister common event callback of target node. + * + * @param node The ArkUI-NodeHandle pointer. + * @param eventType Indicates the type of event to set. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function params is invalid. + * Returns {@link ARKUI_ERROR_CODE_NODE_UNSUPPORT_EVENT_TYPE} Function parameter eventType is not supported. + * @since 20 + */ +int32_t OH_ArkUI_NativeModule_UnregisterCommonEvent(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 3bfa0c36d..01e6650f4 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2255,6 +2255,11 @@ typedef enum { ARKUI_ERROR_CODE_NODE_EVENT_PARAM_INVALID = 106108, /** The component event does not support return values. */ ARKUI_ERROR_CODE_NODE_EVENT_NO_RETURN = 106109, + /** + * @error The node is not support event type. + * @since 20 + */ + ARKUI_ERROR_CODE_NODE_UNSUPPORT_EVENT_TYPE = 106110, /** The index value is invalid. */ ARKUI_ERROR_CODE_NODE_INDEX_INVALID = 106200, /** Failed to query route navigation information. */ -- Gitee