diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3c739a283d083bc3ec54e71cbce89094a70bce10..d75a5bc6bfed48956cc1aefd439b8bbd99e93420 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": "21", + "name": "OH_ArkUI_NativeModule_RegisterCommonEvent" + }, + { + "first_introduced": "21", + "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 afeb5f72620454e0044f0ef7762861a97dd61793..788f80454702a862b8e02b42a73ade278b7afe3e 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -7316,6 +7316,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 21 + */ + NODE_ON_SIZE_CHANGE = 30, + /** * @brief Triggers onDetectResultUpdate callback * when the text is set to TextDataDetectorConfig and recognized successfully. @@ -10138,6 +10148,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_UNSUPPORTED_EVENT_TYPE} Function parameter eventType is not supported. + * @since 21 + */ +int32_t OH_ArkUI_NativeModule_RegisterCommonEvent(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, + void* userData, void (*callback)(ArkUI_NodeEvent* event)); + +/** + * @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_UNSUPPORTED_EVENT_TYPE} Function parameter eventType is not supported. + * @since 21 + */ +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 03b814fd3b4d68b698228c8dfbe8db1c2d329a8b..f7b72cc37d01d1e2fdf67c70598a42194058fb72 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2301,6 +2301,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 event type is not supported by the node. + * @since 21 + */ + ARKUI_ERROR_CODE_NODE_UNSUPPORTED_EVENT_TYPE = 106110, /** The index value is invalid. */ ARKUI_ERROR_CODE_NODE_INDEX_INVALID = 106200, /** Failed to query route navigation information. */