diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index 13d3f7c209ea4824e23d72364388116bce486d46..14963778572b2e5b497cd50297e8684e8f5ade89 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -36,6 +36,7 @@ if (!is_arkui_x) { "native_interface_focus.h", "native_key_event.h", "native_node.h", + "native_node_ani.h", "native_node_napi.h", "native_type.h", "styled_string.h", diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 4881b6a04da71bc685d977ac71429d0a58b11113..e36fe8b1aa918e3d3d57c3d4ece518808f4c472f 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3502,5 +3502,13 @@ { "first_introduced": "20", "name": "OH_ArkUI_SetForceDarkConfig" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NativeModule_GetNodeHandleFromAniValue" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_NativeModule_GetContextFromAniValue" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node_ani.h b/arkui/ace_engine/native/native_node_ani.h new file mode 100644 index 0000000000000000000000000000000000000000..7068bfa2cce522dc822e222fad0d2bcdfd7c4059 --- /dev/null +++ b/arkui/ace_engine/native/native_node_ani.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node_ani.h + * + * @brief Declares APIs for converting FrameNode objects on the ArkTS side to ArkUI_NodeHandle objects on + * the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @kit ArkUI + * @since 20 + */ + +#ifndef ARKUI_NATIVE_NODE_ANI_H +#define ARKUI_NATIVE_NODE_ANI_H + +#include "ani/ani.h" + +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Obtains a FrameNode object on the ArkTS side and maps it to an ArkUI_NodeHandle object on the + * native side. + * + * @param env Indicates the ANI environment pointer. + * @param frameNode Indicates the FrameNode object created on the ArkTS side. + * @param handle Indicates the pointer to the ArkUI_NodeHandle object. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 20 + */ +int32_t OH_ArkUI_NativeModule_GetNodeHandleFromAniValue(ani_env* env, ani_object 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. + * + * @param env ndicates the ANI environment pointer. + * @param context Indicates the UIContext object created on the ArkTS side. + * @param handle Indicates the pointer to the ArkUI_ContextHandle object. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 20 + */ +int32_t OH_ArkUI_NativeModule_GetContextFromAniValue(ani_env* env, ani_object context, ArkUI_ContextHandle* handle); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_ANI_H +/** @} */ \ No newline at end of file