diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 8576e71fb785e10da5b1e7d988ad8f533629fcb6..72bfa9a81901cec9b3c456215e1ff13f3b126c0f 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -678,5 +678,29 @@ { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_SetInterceptHitTestMode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeContent_AddNode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeContent_InsertNode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeContent_RemoveNode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeContent_RegisterCallback" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeContentEvent_GetEventType" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_GetNodeContentFromNapiValue" } ] \ 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 d856e862e37c60c8597a89f57df745c19790a058..040a618c9a7d2cdf222463a57c32ffecfa719b6c 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -5135,6 +5135,84 @@ ArkUI_NodeHandle OH_ArkUI_NodeCustomEvent_GetNodeHandle(ArkUI_NodeCustomEvent* e */ ArkUI_NodeCustomEventType OH_ArkUI_NodeCustomEvent_GetEventType(ArkUI_NodeCustomEvent* event); +/** + * @brief Defines the node content event type. + * + * @since 12 + */ +typedef enum { + /** Defines the attach event. */ + NOTE_CONTENT_EVENT_ON_ATTACH_TO_WINDOW = 0, + /** Defines the detach event. */ + NOTE_CONTENT_EVENT_ON_DETACH_FROM_WINDOW = 1, +} ArkUI_NodeContentEventType; + +/** + * @brief Defines the general structure of a node content event. + * @since 12 + */ +typedef struct ArkUI_NodeContentEvent ArkUI_NodeContentEvent; + +/** + * @brief Defines the callback function of a node content event. + * @since 12 + */ +typedef void(*ArkUI_NodeContentCallback)(ArkUI_NodeContentEvent* event); + +/** + * @brief register a callback functoin to a node content. + * + * @param content Indicates the pointer to the node content instance. + * @param callback Indicates the callback function. + * @return Returns 0 if success, + * Returns 401 if parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeContent_RegisterCallback(ArkUI_NodeContentHandle content, ArkUI_NodeContentCallback callback); + +/** + * @brief Obtains the type of a node content event. + * + * @param event Indicates the pointer to the node content event. + * @return Returns the type of the node content event. + * @since 12 + */ +ArkUI_NodeContentEventType OH_ArkUI_NodeContentEvent_GetEventType(ArkUI_NodeContentEvent* event); + +/** + * @brief Add a node to a node content. + * + * @param content Indicates the pointer to the node content instance. + * @param node Indicates the pointer to the node + * @return Returns 0 if success, + * Returns 401 if parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeContent_AddNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node); + +/** + * @brief remove a node from a node content. + * + * @param content Indicates the pointer to the node content instance. + * @param node Indicates the pointer to the node + * @return Returns 0 if success, + * Returns 401 if parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeContent_RemoveNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node); + +/** + * @brief insert a node into a node content at a given position. + * + * @param content Indicates the pointer to the node content instance. + * @param node Indicates the pointer to the node + * @param position Indicates the position for inserting the node + * @return Returns 0 if success, + * Returns 401 if parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeContent_InsertNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node, int32_t position); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_node_napi.h b/arkui/ace_engine/native/native_node_napi.h index bba0121e8356c5bd8fd12876e07ea4a33f07d944..29e8d0dd31c57f380967259d2200dffbf837887f 100644 --- a/arkui/ace_engine/native/native_node_napi.h +++ b/arkui/ace_engine/native/native_node_napi.h @@ -57,17 +57,32 @@ extern "C" { int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value frameNode, ArkUI_NodeHandle* handle); /** - * @brief Obtains a UIContext object on the ArkTS side and maps it to an ArkUI_ContextHandle object on the - * native side. + * @brief Obtains a UIContext object on the ArkTS side and maps it to an ArkUI_ContextHandle object on the + * native side. + * + * @param env ndicates the NAPI environment pointer. + * @param value Indicates the UIContext object created on the ArkTS side. + * @param context Indicates the pointer to the ArkUI_ContextHandle object. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_GetContextFromNapiValue(napi_env env, napi_value value, ArkUI_ContextHandle* context); + + +/** + * @brief Obtains a NodeContent object on the ArkTS side and maps it to an ArkUI_NodeContentHandle + * object on the native side. * * @param env ndicates the NAPI environment pointer. - * @param value Indicates the UIContext object created on the ArkTS side. - * @param context Indicates the pointer to the ArkUI_ContextHandle object. + * @param value Indicates the NodeContent object created on the ArkTS side. + * @param content Indicates the pointer to the ArkUI_NodeContentHandle object. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. * @since 12 */ -int32_t OH_ArkUI_GetContextFromNapiValue(napi_env env, napi_value value, ArkUI_ContextHandle* context); +int32_t OH_ArkUI_GetNodeContentFromNapiValue(napi_env env, napi_value value, ArkUI_NodeContentHandle* content); + #ifdef __cplusplus }; diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index b206f3c19ba13a2b520b65cdfcbdb7837a06d287..c44cfcf1be748ffbf38adeba358f655371d2b44e 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -49,6 +49,13 @@ extern "C" { */ struct ArkUI_Node; +/** + * @brief Defines the pointer type of the ArkUI node content + * + * @since 12 + */ +typedef struct ArkUI_NodeContent* ArkUI_NodeContentHandle; + /** * @brief Defines the custom dialog box controller of ArkUI on the native side. *