!1033 C-API 系统配置变更回调需求

Merge pull request !1033 from 邹林肯/config
This commit is contained in:
openharmony_ci 2024-08-05 04:17:13 +00:00 committed by Gitee
commit 80a2ae2969
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 110 additions and 0 deletions

View File

@ -2046,5 +2046,29 @@
{
"first_introduced": "12",
"name": "OH_ArkUI_CustomSpanDrawInfo_GetBaseline"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_RegisterSystemColorModeChangeEvent"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_UnregisterSystemColorModeChangeEvent"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_RegisterSystemFontStyleChangeEvent"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_UnregisterSystemFontStyleChangeEvent"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_SystemFontStyleEvent_GetFontSize"
},
{
"first_introduced": "12",
"name": "OH_ArkUI_SystemFontStyleEvent_GetFontWeight"
}
]

View File

@ -7676,6 +7676,73 @@ int32_t OH_ArkUI_List_CloseAllSwipeActions(ArkUI_NodeHandle node, void* userData
*/
ArkUI_ContextHandle OH_ArkUI_GetContextByNode(ArkUI_NodeHandle node);
/**
* @brief The event called when the system color mode changes.
* Only one system color change callback can be registered for the same component.
*
* @param node Indicates the target node.
* @param userData Indicates the custom data to be saved.
* @param onColorModeChange Callback Events.
* @return Error code.
* {@link ARKUI_ERROR_CODE_NO_ERROR} Success.
* {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception.
* {@link ARKUI_ERROR_CODE_ATTRIBUTE_OR_EVENT_NOT_SUPPORTED} The component does not support this event.
* @since 12
*/
int32_t OH_ArkUI_RegisterSystemColorModeChangeEvent(ArkUI_NodeHandle node,
void* userData, void (*onColorModeChange)(ArkUI_SystemColorMode colorMode, void* userData));
/**
* @brief Unregister the event callback when the system color mode changes.
*
* @param node Indicates the target node.
* @since 12
*/
void OH_ArkUI_UnregisterSystemColorModeChangeEvent(ArkUI_NodeHandle node);
/**
* @brief The event called when the system font style changes.
* Only one system font change callback can be registered for the same component.
*
* @param node Indicates the target node.
* @param userData Indicates the custom data to be saved.
* @param onFontStyleChange Callback Events.
* @return Error code.
* {@link ARKUI_ERROR_CODE_NO_ERROR} Success.
* {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception.
* {@link ARKUI_ERROR_CODE_ATTRIBUTE_OR_EVENT_NOT_SUPPORTED} The component does not support this event.
* @since 12
*/
int32_t OH_ArkUI_RegisterSystemFontStyleChangeEvent(ArkUI_NodeHandle node,
void* userData, void (*onFontStyleChange)(ArkUI_SystemFontStyleEvent* event, void* userData));
/**
* @brief Unregister the event callback when the system font style changes.
*
* @param node Indicates the target node.
* @since 12
*/
void OH_ArkUI_UnregisterSystemFontStyleChangeEvent(ArkUI_NodeHandle node);
/**
* @brief Retrieve the font size value for system font change events.
*
* @param event Indicates a pointer to the current system font change event.
* @return Updated system font size. -1 indicates a retrieval error.
* @since 12
*/
int32_t OH_ArkUI_SystemFontStyleEvent_GetFontSize(const ArkUI_SystemFontStyleEvent* event);
/**
* @brief Retrieve the font thickness values for system font change events.
*
* @param event Indicates a pointer to the current system font change event.
* @return Updated system font thickness, return value type {@link ArkUI_fontWeight},
* default value:ARKUI_FONT_WEIGHT_W100
* @since 12
*/
int32_t OH_ArkUI_SystemFontStyleEvent_GetFontWeight(const ArkUI_SystemFontStyleEvent* event);
#ifdef __cplusplus
};
#endif

View File

@ -983,6 +983,18 @@ typedef enum {
ARKUI_COLOR_MODE_DARK,
} ArkUI_ColorMode;
/**
* @brief Enumerates the system color modes.
*
* @since 12
*/
typedef enum {
/** Light color mode. */
ARKUI_SYSTEM_COLOR_MODE_LIGHT = 0,
/** Dark color mode. */
ARKUI_SYSTEM_COLOR_MODE_DARK,
} ArkUI_SystemColorMode;
/**
* @brief Enumerates the blur styles.
*
@ -2158,6 +2170,13 @@ typedef enum {
ARKUI_SAFE_AREA_EDGE_END = 1 << 3,
} ArkUI_SafeAreaEdge;
/**
* @brief Defines parameter used by the system font style callback event.
*
* @since 12
*/
typedef struct ArkUI_SystemFontStyleEvent ArkUI_SystemFontStyleEvent;
/**
* @brief Creates a size constraint.
*