From 430feccf0f3ee14f6ec42d6f5112e634531c3fc3 Mon Sep 17 00:00:00 2001 From: pengzhiwen Date: Fri, 22 Nov 2024 14:34:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E8=A6=81capi=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E5=B8=83=E5=B1=80=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pengzhiwen --- .../native/native_interface_inspector.h | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 arkui/ace_engine/native/native_interface_inspector.h diff --git a/arkui/ace_engine/native/native_interface_inspector.h b/arkui/ace_engine/native/native_interface_inspector.h new file mode 100644 index 000000000..9353dee3e --- /dev/null +++ b/arkui/ace_engine/native/native_interface_inspector.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2024 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_Inspector + * @{ + * @brief Describes the native capabilities supported by ArkUI Inspector, such as register callback function on + * draw finish or layout finish. + * @since 16 + */ + +/** + * @file native_interface_inspector.h + * + * @brief Declares the APIs used to access the native Inspector. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @kit ArkUI + * @since 16 + */ +#ifndef _NATIVE_INTERFACE_INSPECTOR_H +#define _NATIVE_INTERFACE_INSPECTOR_H + +#include "native_type.h" +#ifdef __cplusplus +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the inspector error codes. + * @since 16 + */ +typedef enum { + /** + * @error Success. + */ + ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL = 0, + /** + * @error Invalid parameter. + */ + ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER = -1, +} ArkUI_InspectorErrorCode; + +/** + * @brief Registers a callback for node when layout is completed. + * + * @param node Indicates the target node. + * @param userData Indicates the custom data used in onLayoutCompleted callback function. + * @param onLayoutCompleted Indicates the function when layout completed is callback. + * @return Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 16 + */ +int32_t OH_ArkUI_RegisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node, + void* userData, void (*onLayoutCompleted)(void* userData)); + + +/** + * @brief Registers a callback for node when draw is completed. + * + * @param node Indicates the target node. + * @param userData Indicates the custom data used in onDrawCompleted callback function. + * @param onDrawCompleted Indicates the function when draw completed is callback. + * @return Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 16 + */ +int32_t OH_ArkUI_RegisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node, + void* userData, void (*onDrawCompleted)(void* userData)); + +/** + * @brief UnRegisters the layout completed callback for node. + * + * @param node Indicates the target node. + * @return Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 16 + */ +int32_t OH_ArkUI_UnRegisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node); + +/** + * @brief UnRegisters the draw completed callback for node. + * + * @param node Indicates the target node. + * @return Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 16 + */ +int32_t OH_ArkUI_UnRegisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node); +#ifdef __cplusplus +}; +#endif +#endif // _NATIVE_INTERFACE_INSPECTOR_H -- Gitee