From 102c4f760424ff15cfb567668ff9eaf8f10f5b1b Mon Sep 17 00:00:00 2001 From: Lby Date: Thu, 24 Apr 2025 15:59:19 +0800 Subject: [PATCH] =?UTF-8?q?EmbeddedComponent=E6=8E=A5=E5=85=A5NDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lby --- arkui/ace_engine/native/libace.ndk.json | 16 ++++++++ arkui/ace_engine/native/native_node.h | 27 +++++++++++++ arkui/ace_engine/native/native_type.h | 53 +++++++++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3a129e851..d76e8f0be 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3318,5 +3318,21 @@ { "first_introduced": "18", "name": "OH_ArkUI_PanGesture_GetDistanceByToolType" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentItem_Create" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentItem_Dispose" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentItem_SetOnError" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentItem_SetOnTerminated" } ] \ 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 c1458a02f..78fff9e25 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -138,6 +138,11 @@ typedef enum { ARKUI_NODE_GRID_ITEM, /** Custom span. */ ARKUI_NODE_CUSTOM_SPAN, + /** + * EmbeddedComponent. + * @since 20 + */ + ARKUI_NODE_EMBEDDED_COMPONENT, } ArkUI_NodeType; /** @@ -6301,6 +6306,28 @@ typedef enum { * @since 18 */ NODE_CALENDAR_PICKER_MARK_TODAY = 16007, + + /** + * @brief Defines the want used to start EmbeddedAbility. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * value[0].i32: want. The default value is nullptr.\n + * + * @since 20 + */ + NODE_EMBEDDED_COMPONENT_WANT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_EMBEDDED_COMPONENT, + + /** + * @brief Set onError and onTerminated callbacks for EMBEDDED_COMPONENT. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: OH_ArkUI_EmbeddedComponentItem_SetOnError set onError callback. \n + * OH_ArkUI_EmbeddedComponentItem_SetOnTerminated set onTerminated callback.\n + * + * @since 20 + */ + NODE_EMBEDDED_COMPONENT_OPTION, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 5d4d17691..285ede68d 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -242,6 +242,20 @@ typedef struct ArkUI_ProgressLinearStyleOption ArkUI_ProgressLinearStyleOption; */ typedef struct ArkUI_CrossLanguageOption ArkUI_CrossLanguageOption; +/** + * @brief Defines the Ability base want. + * + * @since 20 + */ +typedef struct AbilityBase_Want AbilityBase_Want; + +/** + * @brief Define the EmbeddedComponentItem for the EmbeddedComponent. + * + * @since 20 + */ +typedef struct ArkUI_EmbeddedComponentItem ArkUI_EmbeddedComponentItem; + /** * @brief Defines the event callback type. * @@ -5128,6 +5142,45 @@ void OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex( *@since 18 */ void OH_ArkUI_TextCascadePickerRangeContentArray_Destroy(ArkUI_TextCascadePickerRangeContentArray* handle); + +/** + * @brief Create a configuration item for the EmbeddedComponentItem interface settings. + * + * @return EmbeddedComponent Item configuration item instance. + * @since 20 + */ +ArkUI_EmbeddedComponentItem *OH_ArkUI_EmbeddedComponentItem_Create(); + +/** + * @brief Destroy the EmbeddedComponentItem instance. + * + * @param item EmbeddedComponent Item instance to be destroyed. + * @since 20 + */ +void OH_ArkUI_EmbeddedComponentItem_Dispose(ArkUI_EmbeddedComponentItem *item); + +/** + * @brief Set the onError of EmbeddedComponentItem. + * + * @param item EmbeddedComponentItem instance. + * @param code Common error information about the API invoking failure. + * @param name Common error name information about the API invoking failure. + * @param message Common error message information about the API invoking failure. + * @since 20 + */ +void OH_ArkUI_EmbeddedComponentItem_SetOnError( + ArkUI_EmbeddedComponentItem *item, void (*callback)(int32_t code, const char *name, const char *message)); + +/** + * @brief Set the onTerminated of EmbeddedComponentItem. + * + * @param item EmbeddedComponentItem instance. + * @param code Result code returned when the EmbeddedUIExtensionAbility exits. + * @param want Data returned when the EmbeddedUIExtensionAbility exits. + * @since 20 + */ +void OH_ArkUI_EmbeddedComponentItem_SetOnTerminated( + ArkUI_EmbeddedComponentItem *item, void (*callback)(int32_t code, AbilityBase_Want *want)); #ifdef __cplusplus }; #endif -- Gitee