From 169dfd7eb961df45ac8acb9ab5d6ffe7d3423e34 Mon Sep 17 00:00:00 2001 From: Lby Date: Wed, 14 May 2025 10:00:37 +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 | 28 +++++++++++++ arkui/ace_engine/native/native_type.h | 53 +++++++++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 810026693..3b7a8c0af 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3318,5 +3318,21 @@ { "first_introduced": "19", "name": "OH_ArkUI_PanGesture_GetDistanceByToolType" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentOption_Create" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentOption_Dispose" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentOption_SetOnError" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_EmbeddedComponentOption_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 c6d24128e..63b4e41b3 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,29 @@ typedef enum { * @since 19 */ NODE_CALENDAR_PICKER_MARK_TODAY = 16007, + + /** + * @brief Defines the want used to start EmbeddedAbility. + * This attribute can be set as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: The want of EmbeddedComponent, with parameter type {@AbilityBase_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. + * This attribute can be set as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: The option for EmbeddedComponent, with parameter type {@ArkUI_EmbeddedComponentOption}.\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 8595c4076..2aff46ade 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 Declares the Ability base want. + * + * @since 20 + */ +typedef struct AbilityBase_Want AbilityBase_Want; + +/** + * @brief Define the EmbeddedComponentOption for the EmbeddedComponent. + * + * @since 20 + */ +typedef struct ArkUI_EmbeddedComponentOption ArkUI_EmbeddedComponentOption; + /** * @brief Defines the event callback type. * @@ -5128,6 +5142,45 @@ void OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex( *@since 19 */ void OH_ArkUI_TextCascadePickerRangeContentArray_Destroy(ArkUI_TextCascadePickerRangeContentArray* handle); + +/** + * @brief Create an object for the EmbeddedComponent option. + * + * @return A pointer to the object of the EmbeddedComponent option. + * @since 20 + */ +ArkUI_EmbeddedComponentOption* OH_ArkUI_EmbeddedComponentOption_Create(); + +/** + * @brief Destroy the object by EmbeddedComponent option. + * + * @param option Pointer to the object by the EmbeddeComponent to be destroyed. + * @since 20 + */ +void OH_ArkUI_EmbeddedComponentOption_Dispose(ArkUI_EmbeddedComponentOption* option); + +/** + * @brief Set the onError of EmbeddedComponent. + * + * @param option Pointer to the object option by the EmbeddedComponent. + * @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_EmbeddedComponentOption_SetOnError( + ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, const char* name, const char* message)); + +/** + * @brief Set the onTerminated of EmbeddedComponent. + * + * @param option Pointer to the object option by the EmbeddedComponent. + * @param code Result code returned when the EmbeddedUIExtensionAbility exits. + * @param want Data returned when the EmbeddedUIExtensionAbility exits. + * @since 20 + */ +void OH_ArkUI_EmbeddedComponentOption_SetOnTerminated( + ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, AbilityBase_Want* want)); #ifdef __cplusplus }; #endif -- Gitee