From b872a5a872d413362c0ffd76b5c0f5c0932a6ce6 Mon Sep 17 00:00:00 2001 From: zoulinken Date: Tue, 4 Mar 2025 20:31:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4NDK=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=8F=8D=E8=89=B2=E7=AE=97=E6=B3=95=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zoulinken --- arkui/ace_engine/native/BUILD.gn | 1 + arkui/ace_engine/native/native_node.h | 5 ++ arkui/ace_engine/native/native_theme.h | 72 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 arkui/ace_engine/native/native_theme.h diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index b48b73ada..31cb72ebc 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -37,6 +37,7 @@ if (!is_arkui_x) { "native_key_event.h", "native_node.h", "native_node_napi.h", + "native_theme.h", "native_type.h", "styled_string.h", "ui_input_event.h", diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index c246d755f..eb293cf0d 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -133,6 +133,11 @@ typedef enum { ARKUI_NODE_GRID_ITEM, /** Custom span. */ ARKUI_NODE_CUSTOM_SPAN, + /** + * all node type means no specific node type is specified. + * @since 20 + */ + ARKUI_NODE_ALL = INT32_MAX, } ArkUI_NodeType; /** diff --git a/arkui/ace_engine/native/native_theme.h b/arkui/ace_engine/native/native_theme.h new file mode 100644 index 000000000..9d6c7fe61 --- /dev/null +++ b/arkui/ace_engine/native/native_theme.h @@ -0,0 +1,72 @@ +/* + * 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_theme.h + * + * @brief Defines the theme types for the native module. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @kit ArkUI + * @since 20 + */ + +#ifndef ARKUI_NATIVE_THEME_H +#define ARKUI_NATIVE_THEME_H + +#include "native_node.h" +#include "native_type.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Set the component's ability to switch between light and dark colors. + * + * @param forceDark Forcedark color reversal ability. + * @param nodeType Control type. refer to {@link ArkUI_NodeType}. + * @param colorConvertFunc Custom color reversal algorithm function pointer. + * @param uiContext 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 + */ +uint32_t OH_ArkUI_SetForceDarkConfig(bool forceDark, ArkUI_NodeType nodeType, + uint32_t (*colorConvertFunc)(uint32_t color, void* userData), + ArkUI_ContextHandle uiContext, void* userData); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_THEME_H +/** @} */ -- Gitee