123b3eb3cSopenharmony_ci/*
223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License.
523b3eb3cSopenharmony_ci * You may obtain a copy of the License at
623b3eb3cSopenharmony_ci *
723b3eb3cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
823b3eb3cSopenharmony_ci *
923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and
1323b3eb3cSopenharmony_ci * limitations under the License.
1423b3eb3cSopenharmony_ci */
1523b3eb3cSopenharmony_ci
1623b3eb3cSopenharmony_ci/**
1723b3eb3cSopenharmony_ci * @addtogroup ArkUI_NativeModule
1823b3eb3cSopenharmony_ci * @{
1923b3eb3cSopenharmony_ci *
2023b3eb3cSopenharmony_ci * @brief 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。
2123b3eb3cSopenharmony_ci *
2223b3eb3cSopenharmony_ci * @since 12
2323b3eb3cSopenharmony_ci */
2423b3eb3cSopenharmony_ci
2523b3eb3cSopenharmony_ci/**
2623b3eb3cSopenharmony_ci * @file styled_string.h
2723b3eb3cSopenharmony_ci *
2823b3eb3cSopenharmony_ci * @brief 提供ArkUI在Native侧的属性字符串能力。
2923b3eb3cSopenharmony_ci *
3023b3eb3cSopenharmony_ci * @library libace_ndk.z.so
3123b3eb3cSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
3223b3eb3cSopenharmony_ci * @since 12
3323b3eb3cSopenharmony_ci */
3423b3eb3cSopenharmony_ci
3523b3eb3cSopenharmony_ci#ifndef ARKUI_NATIVE_STYLED_STRING_H
3623b3eb3cSopenharmony_ci#define ARKUI_NATIVE_STYLED_STRING_H
3723b3eb3cSopenharmony_ci
3823b3eb3cSopenharmony_ci// should be careful this path is not same in SDK.
3923b3eb3cSopenharmony_ci#include "drawing_text_typography.h"
4023b3eb3cSopenharmony_ci
4123b3eb3cSopenharmony_ci#ifdef __cplusplus
4223b3eb3cSopenharmony_ciextern "C" {
4323b3eb3cSopenharmony_ci#endif
4423b3eb3cSopenharmony_ci
4523b3eb3cSopenharmony_ci/**
4623b3eb3cSopenharmony_ci * @brief 定义文本组件支持的格式化字符串数据对象。
4723b3eb3cSopenharmony_ci *
4823b3eb3cSopenharmony_ci * @since 12
4923b3eb3cSopenharmony_ci */
5023b3eb3cSopenharmony_citypedef struct ArkUI_StyledString ArkUI_StyledString;
5123b3eb3cSopenharmony_ci
5223b3eb3cSopenharmony_ci/**
5323b3eb3cSopenharmony_ci * @brief 创建指向ArkUI_StyledString对象的指针。
5423b3eb3cSopenharmony_ci *
5523b3eb3cSopenharmony_ci * @param style 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。
5623b3eb3cSopenharmony_ci * @param collection 指向OH_Drawing_FontCollection的指针,由{@link OH_Drawing_CreateFontCollection}获取。
5723b3eb3cSopenharmony_ci * @return 创建指向ArkUI_StyledString对象的指针,异常返回空指针。
5823b3eb3cSopenharmony_ci * @since 12
5923b3eb3cSopenharmony_ci */
6023b3eb3cSopenharmony_ciArkUI_StyledString* OH_ArkUI_StyledString_Create(
6123b3eb3cSopenharmony_ci    OH_Drawing_TypographyStyle* style, OH_Drawing_FontCollection* collection);
6223b3eb3cSopenharmony_ci
6323b3eb3cSopenharmony_ci/**
6423b3eb3cSopenharmony_ci * @brief 释放被ArkUI_StyledString对象占据的内存。
6523b3eb3cSopenharmony_ci *
6623b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
6723b3eb3cSopenharmony_ci * @since 12
6823b3eb3cSopenharmony_ci */
6923b3eb3cSopenharmony_civoid OH_ArkUI_StyledString_Destroy(ArkUI_StyledString* handle);
7023b3eb3cSopenharmony_ci
7123b3eb3cSopenharmony_ci/**
7223b3eb3cSopenharmony_ci * @brief 将新的排版风格设置到当前格式化字符串样式栈顶。
7323b3eb3cSopenharmony_ci *
7423b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
7523b3eb3cSopenharmony_ci * @param style 指向OH_Drawing_TextStyle对象的指针。
7623b3eb3cSopenharmony_ci * @since 12
7723b3eb3cSopenharmony_ci */
7823b3eb3cSopenharmony_civoid OH_ArkUI_StyledString_PushTextStyle(ArkUI_StyledString* handle, OH_Drawing_TextStyle* style);
7923b3eb3cSopenharmony_ci
8023b3eb3cSopenharmony_ci/**
8123b3eb3cSopenharmony_ci * @brief 基于当前格式化字符串样式设置对应的文本内容。
8223b3eb3cSopenharmony_ci *
8323b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
8423b3eb3cSopenharmony_ci * @param content 指向文本内容的指针。
8523b3eb3cSopenharmony_ci * @since 12
8623b3eb3cSopenharmony_ci */
8723b3eb3cSopenharmony_civoid OH_ArkUI_StyledString_AddText(ArkUI_StyledString* handle, const char* content);
8823b3eb3cSopenharmony_ci
8923b3eb3cSopenharmony_ci/**
9023b3eb3cSopenharmony_ci * @brief 将当前格式化字符串对象中栈顶样式出栈。
9123b3eb3cSopenharmony_ci *
9223b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
9323b3eb3cSopenharmony_ci * @since 12
9423b3eb3cSopenharmony_ci */
9523b3eb3cSopenharmony_civoid OH_ArkUI_StyledString_PopTextStyle(ArkUI_StyledString* handle);
9623b3eb3cSopenharmony_ci
9723b3eb3cSopenharmony_ci/**
9823b3eb3cSopenharmony_ci * @brief 基于格式字符串对象创建指向OH_Drawing_Typography对象的指针,用于提前进行文本测算排版。
9923b3eb3cSopenharmony_ci *
10023b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
10123b3eb3cSopenharmony_ci * @return 指向OH_Drawing_Typography对象的指针。
10223b3eb3cSopenharmony_ci * @since 12
10323b3eb3cSopenharmony_ci */
10423b3eb3cSopenharmony_ciOH_Drawing_Typography* OH_ArkUI_StyledString_CreateTypography(ArkUI_StyledString* handle);
10523b3eb3cSopenharmony_ci
10623b3eb3cSopenharmony_ci/**
10723b3eb3cSopenharmony_ci * @brief 设置占位符。
10823b3eb3cSopenharmony_ci *
10923b3eb3cSopenharmony_ci * @param handle 指向ArkUI_StyledString对象的指针。
11023b3eb3cSopenharmony_ci * @param placeholder 指向OH_Drawing_PlaceholderSpan对象的指针。
11123b3eb3cSopenharmony_ci * @since 12
11223b3eb3cSopenharmony_ci */
11323b3eb3cSopenharmony_civoid OH_ArkUI_StyledString_AddPlaceholder(ArkUI_StyledString* handle, OH_Drawing_PlaceholderSpan* placeholder);
11423b3eb3cSopenharmony_ci
11523b3eb3cSopenharmony_ci#ifdef __cplusplus
11623b3eb3cSopenharmony_ci};
11723b3eb3cSopenharmony_ci#endif
11823b3eb3cSopenharmony_ci
11923b3eb3cSopenharmony_ci#endif // ARKUI_NATIVE_STYLED_STRING_H