mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-10-07 00:13:44 +00:00
挑单5.0Release
Signed-off-by: wanjining <wanjining@huawei.com>
This commit is contained in:
parent
9884dd1436
commit
80dd0fcc3e
@ -1106,4 +1106,11 @@ void TextModelNG::SetHalfLeading(FrameNode* frameNode, bool halfLeading)
|
||||
{
|
||||
ACE_UPDATE_NODE_LAYOUT_PROPERTY(TextLayoutProperty, HalfLeading, halfLeading, frameNode);
|
||||
}
|
||||
|
||||
bool TextModelNG::GetHalfLeading(FrameNode* frameNode)
|
||||
{
|
||||
bool value = false;
|
||||
ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE(TextLayoutProperty, HalfLeading, value, frameNode, value);
|
||||
return value;
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
@ -173,6 +173,7 @@ public:
|
||||
static void SetSelectionMenuOptions(FrameNode* frameNode, const NG::OnCreateMenuCallback&& onCreateMenuCallback,
|
||||
const NG::OnMenuItemClickCallback&& onMenuItemClick);
|
||||
static void SetHalfLeading(FrameNode* frameNode, bool halfLeading);
|
||||
static bool GetHalfLeading(FrameNode* frameNode);
|
||||
};
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
||||
|
@ -2055,6 +2055,7 @@ struct ArkUITextModifier {
|
||||
void (*resetTextMaxFontScale)(ArkUINodeHandle node);
|
||||
void (*setTextHalfLeading)(ArkUINodeHandle node, ArkUI_Bool value);
|
||||
void (*resetTextHalfLeading)(ArkUINodeHandle node);
|
||||
ArkUI_Int32 (*getTextHalfLeading)(ArkUINodeHandle node);
|
||||
void (*setTextOnClick)(ArkUINodeHandle node, void* callback);
|
||||
void (*resetTextOnClick)(ArkUINodeHandle node);
|
||||
void (*setTextResponseRegion)(
|
||||
|
@ -1159,6 +1159,13 @@ void ResetTextHalfLeading(ArkUINodeHandle node)
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
TextModelNG::SetHalfLeading(frameNode, false);
|
||||
}
|
||||
|
||||
ArkUI_Int32 GetTextHalfLeading(ArkUINodeHandle node)
|
||||
{
|
||||
auto* frameNode = reinterpret_cast<FrameNode*>(node);
|
||||
CHECK_NULL_RETURN(frameNode, false);
|
||||
return static_cast<ArkUI_Int32>(TextModelNG::GetHalfLeading(frameNode));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace NodeModifier {
|
||||
@ -1188,6 +1195,7 @@ const ArkUITextModifier* GetTextModifier()
|
||||
ResetTextDataDetectorConfigWithEvent, SetTextOnCopy, ResetTextOnCopy, SetTextOnTextSelectionChange,
|
||||
ResetTextOnTextSelectionChange, SetTextSelectionMenuOptions, ResetTextSelectionMenuOptions, SetTextMinFontScale,
|
||||
ResetTextMinFontScale, SetTextMaxFontScale, ResetTextMaxFontScale, SetTextHalfLeading, ResetTextHalfLeading,
|
||||
GetTextHalfLeading,
|
||||
SetOnClick, ResetOnClick, SetResponseRegion, ResetResponseRegion };
|
||||
|
||||
return &modifier;
|
||||
|
@ -2024,6 +2024,18 @@ typedef enum {
|
||||
*/
|
||||
NODE_TEXT_CONTENT_WITH_STYLED_STRING,
|
||||
|
||||
/**
|
||||
* @brief 设置文本居中显示。
|
||||
*
|
||||
* 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n
|
||||
* .value[0].i32:文本是否居中,默认值false。\n
|
||||
* \n
|
||||
* 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n
|
||||
* .value[0].i32:文本是否居中。\n
|
||||
*
|
||||
*/
|
||||
NODE_TEXT_HALF_LEADING = 1029,
|
||||
|
||||
/**
|
||||
* @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs.
|
||||
*
|
||||
|
@ -9433,6 +9433,33 @@ void ResetTextContentWithStyledString(ArkUI_NodeHandle node)
|
||||
fullImpl->getNodeModifiers()->getTextModifier()->resetTextContentWithStyledString(node->uiNodeHandle);
|
||||
}
|
||||
|
||||
int32_t SetHalfLeading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
|
||||
{
|
||||
auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
|
||||
if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
|
||||
return ERROR_CODE_PARAM_INVALID;
|
||||
}
|
||||
// already check in entry point.
|
||||
auto* fullImpl = GetFullImpl();
|
||||
fullImpl->getNodeModifiers()->getTextModifier()->setTextHalfLeading(
|
||||
node->uiNodeHandle, item->value[NUM_0].i32);
|
||||
return ERROR_CODE_NO_ERROR;
|
||||
}
|
||||
|
||||
const ArkUI_AttributeItem* GetHalfLeading(ArkUI_NodeHandle node)
|
||||
{
|
||||
auto fullImpl = GetFullImpl();
|
||||
g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextHalfLeading(node->uiNodeHandle);
|
||||
g_attributeItem.size = REQUIRED_ONE_PARAM;
|
||||
return &g_attributeItem;
|
||||
}
|
||||
|
||||
void ResetHalfLeading(ArkUI_NodeHandle node)
|
||||
{
|
||||
auto* fullImpl = GetFullImpl();
|
||||
fullImpl->getNodeModifiers()->getTextModifier()->resetTextHalfLeading(node->uiNodeHandle);
|
||||
}
|
||||
|
||||
const ArkUI_AttributeItem* GetTextEllipsisMode(ArkUI_NodeHandle node)
|
||||
{
|
||||
auto fullImpl = GetFullImpl();
|
||||
@ -12847,7 +12874,7 @@ int32_t SetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_A
|
||||
SetTextCopyOption, SetBaseLineOffset, SetTextShadow, SetTextMinFontSize, SetTextMaxFontSize, SetTextFont,
|
||||
SetTextHeightAdaptivePolicy, SetTextIndent, SetTextWordBreak, SetTextEllipsisMode, SetLineSpacing,
|
||||
SetFontFeature, SetTextEnableDateDetector, SetTextDataDetectorConfig, SetTextSelectedBackgroundColor,
|
||||
SetTextContentWithStyledString };
|
||||
SetTextContentWithStyledString, SetHalfLeading };
|
||||
if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
|
||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||
return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
|
||||
@ -12861,8 +12888,9 @@ const ArkUI_AttributeItem* GetTextAttribute(ArkUI_NodeHandle node, int32_t subTy
|
||||
GetDecoration, GetTextCase, GetLetterSpacing, GetMaxLines, GetTextAlign, GetTextOverflow, GetTextFontFamily,
|
||||
GetTextCopyOption, GetBaseLineOffset, GetTextShadow, GetTextMinFontSize, GetTextMaxFontSize, GetTextFont,
|
||||
GetTextHeightAdaptivePolicy, GetTextIndent, GetTextWordBreak, GetTextEllipsisMode, GetLineSpacing,
|
||||
GetFontFeature, GetTextEnableDateDetector, GetTextDataDetectorConfig, GetTextSelectedBackgroundColor };
|
||||
if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
|
||||
GetFontFeature, GetTextEnableDateDetector, GetTextDataDetectorConfig, GetTextSelectedBackgroundColor,
|
||||
nullptr, GetHalfLeading };
|
||||
if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*) || !getters[subTypeId]) {
|
||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||
return nullptr;
|
||||
}
|
||||
@ -12877,7 +12905,7 @@ void ResetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
|
||||
ResetTextOverflow, ResetTextFontFamily, ResetTextCopyOption, ResetBaselineOffset, ResetTextShadow,
|
||||
ResetTextMinFontSize, ResetTextMaxFontSize, ResetTextFont, ResetTextHeightAdaptivePolicy, ResetTextIndent,
|
||||
ResetTextWordBreak, ResetTextEllipsisMode, ResetLineSpacing, ResetFontFeature, ResetTextEnableDateDetector,
|
||||
ResetTextDataDetectorConfig, ResetTextSelectedBackgroundColor, ResetTextContentWithStyledString };
|
||||
ResetTextDataDetectorConfig, ResetTextSelectedBackgroundColor, ResetTextContentWithStyledString, ResetHalfLeading };
|
||||
if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
|
||||
TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user