From 9618915a9d90050d7dc09e6d1daf83ca90d8a3cc Mon Sep 17 00:00:00 2001 From: r00447448 Date: Wed, 8 Nov 2023 14:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=E5=BD=92=E4=B8=80=5Fbutton=E7=BB=84=E4=BB=B6=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8sys=5Fresource=20S?= =?UTF-8?q?igned-off-by:=20ranzhiqiang=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/components/button/button_theme.h | 72 ++++++++----------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/frameworks/core/components/button/button_theme.h b/frameworks/core/components/button/button_theme.h index 601bb624d08..7e4b0b37d20 100644 --- a/frameworks/core/components/button/button_theme.h +++ b/frameworks/core/components/button/button_theme.h @@ -43,48 +43,6 @@ public: if (!themeConstants) { return theme; } - theme->radius_ = themeConstants->GetDimension(THEME_BUTTON_RADIUS); - theme->bgColor_ = themeConstants->GetColor(THEME_BUTTON_BACKGROUND_COLOR); - theme->bgFocusColor_ = themeConstants->GetColor(THEME_BUTTON_FOCUS_COLOR); - theme->clickedColor_ = themeConstants->GetColor(THEME_BUTTON_CLICKED_COLOR); - theme->disabledColor_ = themeConstants->GetColor(THEME_BUTTON_DISABLED_COLOR); - theme->bgDisabledAlpha_ = themeConstants->GetDouble(THEME_BUTTON_DISABLED_ALPHA); - theme->hoverColor_ = themeConstants->GetColor(THEME_BUTTON_HOVER_COLOR); - theme->borderColor_ = themeConstants->GetColor(THEME_BUTTON_BORDER_COLOR); - theme->borderWidth_ = themeConstants->GetDimension(THEME_BUTTON_BORDER_WIDTH); - theme->textFocusColor_ = themeConstants->GetColor(THEME_BUTTON_TEXT_FOCUS_COLOR); - theme->textDisabledColor_ = themeConstants->GetColor(THEME_BUTTON_TEXT_DISABLED_COLOR); - theme->textWaitingColor_ = themeConstants->GetColor(THEME_BUTTON_TEXT_WAITING_COLOR); - theme->textStyle_.SetTextColor(themeConstants->GetColor(THEME_BUTTON_TEXT_COLOR)); - theme->textStyle_.SetFontSize(themeConstants->GetDimension(THEME_BUTTON_TEXT_FONTSIZE)); - theme->textStyle_.SetFontWeight(FontWeight(themeConstants->GetInt(THEME_BUTTON_TEXT_FONTWEIGHT))); - theme->minWidth_ = themeConstants->GetDimension(THEME_BUTTON_MIN_WIDTH); - theme->height_ = themeConstants->GetDimension(THEME_BUTTON_HEIGHT); - theme->downloadHeight_ = themeConstants->GetDimension(THEME_BUTTON_DOWNLOAD_HEIGHT); - theme->padding_ = Edge(themeConstants->GetDimension(THEME_BUTTON_PADDING_HORIZONTAL).Value(), - themeConstants->GetDimension(THEME_BUTTON_PADDING_VERTICAL).Value(), - themeConstants->GetDimension(THEME_BUTTON_PADDING_HORIZONTAL).Value(), - themeConstants->GetDimension(THEME_BUTTON_PADDING_VERTICAL).Value(), - themeConstants->GetDimension(THEME_BUTTON_PADDING_VERTICAL).Unit()); - theme->minFontSize_ = themeConstants->GetDimension(THEME_BUTTON_TEXT_FONTSIZE_MIN); - int32_t maxlines = themeConstants->GetInt(THEME_BUTTON_TEXT_MAX_LINES); - theme->textMaxLines_ = maxlines < 0 ? theme->textMaxLines_ : static_cast(maxlines); - theme->minCircleButtonDiameter_ = themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MIN_DIAMETER); - theme->minCircleButtonIcon_ = themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MIN_ICON_SIZE); - theme->minCircleButtonPadding_ = Edge(themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MIN_PADDING)); - theme->maxCircleButtonDiameter_ = themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MAX_DIAMETER); - theme->maxCircleButtonIcon_ = themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MAX_ICON_SIZE); - theme->maxCircleButtonPadding_ = Edge(themeConstants->GetDimension(THEME_BUTTON_CIRCLE_MAX_PADDING)); - theme->progressFocusColor_ = themeConstants->GetColor(THEME_BUTTON_PROGRESS_FOCUS_COLOR); - theme->downloadBorderColor_ = themeConstants->GetColor(THEME_BUTTON_DOWNLOAD_BORDER_COLOR); - theme->normalTextColor_ = themeConstants->GetColor(THEME_BUTTON_NORMAL_TEXT_COLOR); - theme->downloadBackgroundColor_ = themeConstants->GetColor(THEME_BUTTON_DOWNLOAD_BG_COLOR); - theme->downloadTextColor_ = themeConstants->GetColor(THEME_BUTTON_DOWNLOAD_TEXT_COLOR); - theme->downloadFontSize_ = themeConstants->GetDimension(THEME_BUTTON_DOWNLOAD_TEXT_FONTSIZE); - theme->progressColor_ = themeConstants->GetColor(THEME_BUTTON_PROGRESS_COLOR); - theme->progressDiameter_ = themeConstants->GetDimension(THEME_BUTTON_PROGRESS_DIAMETER); - theme->downloadProgressColor_ = themeConstants->GetColor(THEME_BUTTON_DOWNLOAD_PROGRESS_COLOR); - theme->innerPadding_ = themeConstants->GetDimension(THEME_BUTTON_INNER_PADDING); ParsePattern(themeConstants->GetThemeStyle(), theme); return theme; } @@ -120,6 +78,36 @@ public: .BlendOpacity(buttonPattern->GetAttr("download_button_process_color_alpha", 0.0)); theme->downloadTextColor_ = buttonPattern->GetAttr("download_button_text_color", Color()); theme->progressColor_ = buttonPattern->GetAttr("process_button_text_color", Color()); + theme->radius_ = buttonPattern->GetAttr("button_radius", 0.0_vp); + theme->bgFocusColor_ = buttonPattern->GetAttr("button_bg_focus_color", Color()); + theme->bgDisabledAlpha_ = buttonPattern->GetAttr(PATTERN_BG_COLOR_DISABLED_ALPHA, 0.0); + theme->textFocusColor_ = buttonPattern->GetAttr("button_text_focus_color", Color()); + theme->textStyle_.SetFontSize(buttonPattern->GetAttr("button_font_size", 0.0_fp)); + theme->textStyle_.SetFontWeight( + FontWeight(static_cast(buttonPattern->GetAttr("button_font_weight", 0.0)))); + theme->minWidth_ = buttonPattern->GetAttr("button_min_width", 0.0_vp); + theme->height_ = buttonPattern->GetAttr("button_height", 0.0_vp); + theme->downloadHeight_ = buttonPattern->GetAttr("button_download_height", 0.0_vp); + theme->padding_ = Edge(buttonPattern->GetAttr("button_horizontal_padding", 0.0_vp).Value(), + buttonPattern->GetAttr("button_vertical_padding", 0.0_vp).Value(), + buttonPattern->GetAttr("button_horizontal_padding", 0.0_vp).Value(), + buttonPattern->GetAttr("button_vertical_padding", 0.0_vp).Value(), + buttonPattern->GetAttr("button_vertical_padding", 0.0_vp).Unit()); + theme->minFontSize_ = buttonPattern->GetAttr("button_min_font_size", 0.0_fp); + int32_t maxlines = static_cast(buttonPattern->GetAttr("button_text_max_lines", 0.0)); + theme->textMaxLines_ = maxlines < 0 ? theme->textMaxLines_ : static_cast(maxlines); + theme->minCircleButtonDiameter_ = buttonPattern->GetAttr("min_circle_button_diameter", 0.0_vp); + theme->minCircleButtonIcon_ = buttonPattern->GetAttr("min_circle_button_icon_size", 0.0_vp); + theme->minCircleButtonPadding_ = + Edge(buttonPattern->GetAttr("min_circle_button_padding", 0.0_vp)); + theme->maxCircleButtonDiameter_ = buttonPattern->GetAttr("max_circle_button_diameter", 0.0_vp); + theme->maxCircleButtonIcon_ = buttonPattern->GetAttr("max_circle_button_icon_size", 0.0_vp); + theme->maxCircleButtonPadding_ = + Edge(buttonPattern->GetAttr("button_max_circle_button_padding", 0.0_vp)); + theme->progressFocusColor_ = buttonPattern->GetAttr("button_progress_focus_color", Color()); + theme->downloadFontSize_ = buttonPattern->GetAttr("button_download_font_size", 0.0_fp); + theme->progressDiameter_ = buttonPattern->GetAttr("button_progress_diameter", 0.0_vp); + theme->innerPadding_ = buttonPattern->GetAttr("button_inner_padding", 0.0_vp); } }; -- Gitee