1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SELECT_SELECT_THEME_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SELECT_SELECT_THEME_H 18 19 #include "base/geometry/dimension.h" 20 #include "core/common/container.h" 21 #include "core/components/common/layout/constants.h" 22 #include "core/components/common/properties/color.h" 23 #include "core/components/common/properties/text_style.h" 24 #include "core/components/theme/theme.h" 25 #include "core/components/theme/theme_constants.h" 26 #include "core/components/theme/theme_constants_defines.h" 27 #include "core/components_ng/property/border_property.h" 28 #include "core/components_ng/property/calc_length.h" 29 30 namespace OHOS::Ace { 31 32 constexpr double SELECT_OPTION_LEFT_LENGTH = 16.0; 33 constexpr double SELECT_OPTION_TOP_LENGTH = 15.0; 34 constexpr double SELECT_OPTION_RIGHT_LENGTH = 16.0; 35 constexpr double SELECT_OPTION_BOTTOM_LENGTH = 15.0; 36 constexpr uint32_t CONTENT_ALIGN_LEFT = 4; 37 constexpr double SELECT_FOCUS_SCALE = 1.0; 38 constexpr double NONE_SHADOW_VALUE = 6.0; 39 constexpr Dimension VERTICAL_INTERVAL = 14.4_vp; 40 constexpr Dimension MENU_END_ICON_WIDTH = 24.0_vp; 41 constexpr Dimension MENU_END_ICON_HEIGHT = 24.0_vp; 42 constexpr Dimension DEFAULT_MENU_WIDTH = 0.0_vp; 43 constexpr Dimension MIN_MENU_WIDTH = 64.0_vp; 44 constexpr double TITLE_LEFT_PADDING = 16.0; 45 constexpr double TITLE_TOP_PADDING = 8.0; 46 constexpr double TITLE_RIGHT_PADDING = 8.0; 47 constexpr double TITLE_BOTTOM_PADDING = 16.0; 48 constexpr double SELECT_OPTION_INTERVAL = 6.0; 49 50 /** 51 * SelectTheme defines color and styles of SelectComponent. SelectTheme should be build 52 * using SelectTheme::Builder. 53 */ 54 class SelectTheme : public virtual Theme { 55 DECLARE_ACE_TYPE(SelectTheme, Theme); 56 57 public: 58 class Builder { 59 public: 60 Builder() = default; 61 ~Builder() = default; 62 Build(const RefPtr<ThemeConstants> & themeConstants)63 RefPtr<SelectTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const 64 { 65 RefPtr<SelectTheme> theme = AceType::Claim(new SelectTheme()); 66 if (!themeConstants) { 67 return theme; 68 } 69 ParseNewPattern(themeConstants, theme); 70 Parse(themeConstants, theme); 71 return theme; 72 } 73 Parse(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<SelectTheme> & theme)74 void Parse(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<SelectTheme>& theme) const 75 { 76 if (!theme) { 77 return; 78 } 79 RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_SELECT); 80 if (!pattern) { 81 LOGE("Pattern of select is null, please check!"); 82 return; 83 } 84 const double defaultTextColorAlpha = 0.9; 85 const double defaultDisabledColorAlpha = 0.4; 86 const double defaultSecondaryColorAlpha = 0.6; 87 const double defaultTertiaryColorAlpha = 0.6; 88 const double bgColorSelectedAlpha = 0.2; 89 90 theme->fontColor_ = 91 pattern->GetAttr<Color>("text_color", theme->fontColor_) 92 .BlendOpacity(pattern->GetAttr<double>("menu_text_primary_alpha", defaultTextColorAlpha)); 93 theme->disabledFontColorAlpha_ = 94 pattern->GetAttr<double>("color_disabled_alpha", defaultDisabledColorAlpha); 95 theme->secondaryFontColor_ = 96 pattern->GetAttr<Color>(PATTERN_TEXT_COLOR, theme->fontColor_) 97 .BlendOpacity(pattern->GetAttr<double>("menu_text_secondary_alpha", defaultSecondaryColorAlpha)); 98 theme->menuFontColor_ = pattern->GetAttr<Color>("text_color", theme->menuFontColor_); 99 theme->disabledMenuFontColor_ = theme->menuFontColor_.BlendOpacity( 100 pattern->GetAttr<double>("menu_text_tertiary_alpha", defaultTertiaryColorAlpha)); 101 theme->selectedColor_ = 102 pattern->GetAttr<Color>(PATTERN_BG_COLOR_SELECTED, theme->selectedColor_) 103 .BlendOpacity(pattern->GetAttr<double>("bg_color_selected_alpha", bgColorSelectedAlpha)); 104 theme->fontSize_ = pattern->GetAttr<Dimension>(PATTERN_TEXT_SIZE, theme->fontSize_); 105 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 106 theme->selectFontSizeMap_.insert( 107 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->fontSize_)); 108 theme->selectFontSizeMap_.insert(std::pair<ControlSize, Dimension>( 109 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_text_font_size", 0.0_vp))); 110 } 111 theme->menuFontSize_ = pattern->GetAttr<Dimension>("menu_text_font_size", theme->menuFontSize_); 112 theme->menuTitleFontSize_ = 113 pattern->GetAttr<Dimension>("menu_title_text_font_size", theme->menuTitleFontSize_); 114 theme->menuTitleFontColor_ = pattern->GetAttr<Color>(PATTERN_TEXT_COLOR, theme->menuTitleFontColor_); 115 theme->menuTitleHeight_ = pattern->GetAttr<Dimension>("menu_title_height", theme->menuTitleHeight_); 116 theme->spinnerSource_ = themeConstants->GetSymbolByName("sys.symbol.arrowtriangle_down_fill"); 117 ParsePartOne(theme, pattern); 118 ParsePartTwo(theme, pattern); 119 ParsePartThree(theme, pattern); 120 ParsePartFourth(theme, pattern); 121 } 122 ParseNewPattern(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<SelectTheme> & theme)123 void ParseNewPattern(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<SelectTheme>& theme) const 124 { 125 if (!theme) { 126 return; 127 } 128 RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_SELECT); 129 if (!pattern) { 130 LOGE("Pattern of select is null, please check!"); 131 return; 132 } 133 theme->disabledColor_ = pattern->GetAttr<Color>("select_color_text_primary", Color(0x5C000000)); 134 theme->clickedColor_ = pattern->GetAttr<Color>("select_clicked_color", Color(0x19000000)); 135 theme->selectedColor_ = pattern->GetAttr<Color>("select_selected_color", Color(0x19254FF7)); 136 theme->fontFamily_ = "sans-serif"; 137 theme->fontSize_ = pattern->GetAttr<Dimension>("text_font_size", 16.0_fp); 138 theme->fontColor_ = pattern->GetAttr<Color>("select_font_color", Color(0xe5000000)); 139 theme->fontWeight_ = FontWeight::NORMAL; 140 theme->textDecoration_ = TextDecoration::NONE; 141 auto optionSize = pattern->GetAttr<int>("select_option_show_count", INT32_MAX); 142 theme->optionSize_ = optionSize < 0 ? theme->optionSize_ : static_cast<size_t>(optionSize); 143 theme->rrectSize_ = pattern->GetAttr<Dimension>("select_itself_rrect_size", 8.0_vp); 144 theme->popupBorderWidth_ = pattern->GetAttr<Dimension>("select_popup_border_width", 2.0_vp); 145 theme->popupShadowWidth_ = pattern->GetAttr<Dimension>("select_popup_shadow_width", 60.0_vp); 146 theme->popupRRectSize_ = pattern->GetAttr<Dimension>("select_popup_rrect_size", 16.0_vp); 147 theme->popupMinWidth_ = pattern->GetAttr<Dimension>("select_popup_min_width", 136.0_vp); 148 theme->normalPadding_ = pattern->GetAttr<Dimension>("select_normal_padding", 16.0_vp); 149 theme->iconSize_ = pattern->GetAttr<Dimension>("select_itself_icon_size", 8.0_vp); 150 theme->isTV_ = pattern->GetAttr<int>("select_is_tv", 0); 151 theme->horizontalSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_horizontal", 24.0_vp); 152 theme->verticalSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_vertical", 27.0_vp); 153 theme->contentSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_content", 0.0_vp); 154 theme->selectShowTime_ = 250; // unit is ms. 155 theme->selectHideTime_ = 250; // unit is ms. 156 theme->menuShowTime_ = 250; // unit is ms. 157 theme->menuHideTime_ = 250; // unit is ms. 158 theme->hoverAnimationDuration_ = 250; 159 theme->pressAnimationDuration_ = 100; 160 161 ParseAttribute(theme, pattern); 162 } 163 164 private: ParsePartOne(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)165 void ParsePartOne(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 166 { 167 theme->disabledFontColor_ = theme->fontColor_.BlendOpacity(theme->disabledFontColorAlpha_); 168 theme->clickedColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_CLICKED, theme->clickedColor_); 169 theme->selectedColorText_ = pattern->GetAttr<Color>(PATTERN_TEXT_COLOR_SELECTED, theme->selectedColorText_); 170 theme->hoverColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_HOVERED, theme->hoverColor_); 171 theme->backgroundColor_ = pattern->GetAttr<Color>("bg_color", theme->backgroundColor_); 172 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 173 theme->backgroundColorButton_ = 174 pattern->GetAttr<Color>("bg_color_select_button", theme->backgroundColorButton_); 175 } 176 theme->disabledBackgroundColor_ = 177 theme->disabledBackgroundColor_.BlendOpacity(theme->disabledFontColorAlpha_); 178 theme->lineColor_ = pattern->GetAttr<Color>("line_color", theme->lineColor_); 179 theme->spinnerColor_ = pattern->GetAttr<Color>("select_icon_color", theme->spinnerColor_); 180 theme->disabledSpinnerColor_ = theme->spinnerColor_.BlendOpacity(theme->disabledFontColorAlpha_); 181 theme->spinnerSymbolColor_ = pattern->GetAttr<Color>("select_symbol_color", theme->spinnerSymbolColor_); 182 theme->disabledSpinnerSymbolColor_ = 183 theme->spinnerSymbolColor_.BlendOpacity(theme->disabledFontColorAlpha_); 184 theme->selectBorderRadius_ = pattern->GetAttr<Dimension>("border_radius", theme->selectBorderRadius_); 185 theme->menuBorderRadius_ = pattern->GetAttr<Dimension>("menu_border_radius", theme->menuBorderRadius_); 186 theme->innerBorderRadius_ = pattern->GetAttr<Dimension>("inner_border_radius", theme->innerBorderRadius_); 187 theme->menuIconPadding_ = pattern->GetAttr<Dimension>("menu_icon_padding", theme->menuIconPadding_); 188 theme->iconContentPadding_ = 189 pattern->GetAttr<Dimension>("icon_content_padding", theme->iconContentPadding_); 190 theme->menuIconColor_ = pattern->GetAttr<Color>("menu_icon_color", theme->menuIconColor_); 191 theme->dividerPaddingVertical_ = 192 pattern->GetAttr<Dimension>("divider_padding_vertical", theme->dividerPaddingVertical_); 193 theme->optionMinHeight_ = pattern->GetAttr<Dimension>("option_min_height", theme->optionMinHeight_); 194 theme->selectMenuPadding_ = pattern->GetAttr<Dimension>("select_menu_padding", theme->selectMenuPadding_); 195 theme->outPadding_ = pattern->GetAttr<Dimension>("out_padding", theme->outPadding_); 196 theme->defaultPaddingStart_ = 197 pattern->GetAttr<Dimension>("default_padding_start", theme->defaultPaddingStart_); 198 theme->defaultPaddingEnd_ = pattern->GetAttr<Dimension>("default_padding_end", theme->defaultPaddingEnd_); 199 theme->defaultPaddingTop_ = pattern->GetAttr<Dimension>("default_padding_top", theme->defaultPaddingTop_); 200 theme->defaultPaddingBottomFixed_ = 201 pattern->GetAttr<Dimension>("default_padding_bottom_fixed", theme->defaultPaddingBottomFixed_); 202 theme->contentSpinnerPadding_ = 203 pattern->GetAttr<Dimension>("content_spinner_padding", theme->contentSpinnerPadding_); 204 theme->menuAnimationOffset_ = 205 pattern->GetAttr<Dimension>("menu_animation_offset", theme->menuAnimationOffset_); 206 theme->spinnerWidth_ = pattern->GetAttr<Dimension>("spinner_width", theme->spinnerWidth_); 207 theme->menuNeedFocus_ = static_cast<bool>(pattern->GetAttr<int>("menu_need_focus", 0)); 208 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 209 theme->selectSpinnerWidthMap_.insert( 210 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->spinnerWidth_)); 211 theme->selectSpinnerWidthMap_.insert(std::pair<ControlSize, Dimension>( 212 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_spinner_width", 0.0_vp))); 213 } 214 } 215 ParsePartTwo(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)216 void ParsePartTwo(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 217 { 218 theme->spinnerHeight_ = pattern->GetAttr<Dimension>("spinner_height", theme->spinnerHeight_); 219 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 220 theme->selectSpinnerHeightMap_.insert( 221 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->spinnerHeight_)); 222 theme->selectSpinnerHeightMap_.insert(std::pair<ControlSize, Dimension>( 223 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_spinner_height", 0.0_vp))); 224 } 225 theme->defaultDividerWidth_ = 226 pattern->GetAttr<Dimension>("default_divider_width", theme->defaultDividerWidth_); 227 theme->selectMinWidth_ = pattern->GetAttr<Dimension>("select_min_width", theme->selectMinWidth_); 228 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 229 theme->selectMinWidthMap_.insert(std::pair<ControlSize, Dimension>( 230 ControlSize::NORMAL, pattern->GetAttr<Dimension>("normal_select_min_width", 0.0_vp))); 231 theme->selectMinWidthMap_.insert(std::pair<ControlSize, Dimension>( 232 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_min_width", 0.0_vp))); 233 } 234 theme->selectDefaultHeight_ = pattern->GetAttr<Dimension>("select_min_height", theme->selectDefaultHeight_); 235 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 236 theme->selectMinHeightMap_.insert( 237 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->selectDefaultHeight_)); 238 theme->selectMinHeightMap_.insert(std::pair<ControlSize, Dimension>( 239 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_min_height", 0.0_vp))); 240 } 241 theme->iconSideLength_ = pattern->GetAttr<Dimension>("icon_side_length", theme->iconSideLength_); 242 theme->endIconWidth_ = MENU_END_ICON_WIDTH; 243 theme->endIconHeight_ = MENU_END_ICON_HEIGHT; 244 theme->contentMargin_ = pattern->GetAttr<Dimension>("content_margin", theme->contentMargin_); 245 theme->selectDefaultBgColor_ = 246 pattern->GetAttr<Color>("select_default_bg_color", theme->selectDefaultBgColor_); 247 theme->selectDefaultBorderRadius_ = 248 pattern->GetAttr<Dimension>("select_default_border_radius", theme->selectDefaultBorderRadius_); 249 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 250 theme->selectBorderRadiusMap_.insert( 251 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->selectDefaultBorderRadius_)); 252 theme->selectBorderRadiusMap_.insert(std::pair<ControlSize, Dimension>( 253 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_border_radius", 0.0_vp))); 254 } 255 if (Container::LessThanAPIVersion(PlatformVersion::VERSION_ELEVEN)) { 256 theme->expandDisplay_ = false; 257 } else { 258 std::string expandDisplay = pattern->GetAttr<std::string>("menu_expand_display", ""); 259 theme->expandDisplay_ = (expandDisplay == "true"); 260 } 261 theme->maxPaddingStart_ = pattern->GetAttr<Dimension>("max_padding_start", theme->maxPaddingStart_); 262 theme->maxPaddingEnd_ = pattern->GetAttr<Dimension>("max_padding_end", theme->maxPaddingEnd_); 263 } 264 ParsePartThree(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)265 void ParsePartThree(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 266 { 267 theme->selectNormalBorderWidth_ = pattern->GetAttr<Dimension>("select_normal_border_width", 0.0_vp); 268 theme->selectNormalBorderColor_ = pattern->GetAttr<Color>("select_normal_border_color", Color::TRANSPARENT); 269 theme->selectNormalShadow_ = static_cast<ShadowStyle>( 270 static_cast<uint32_t>(pattern->GetAttr<double>("select_normal_shadow", NONE_SHADOW_VALUE))); 271 theme->selectFocusedShadow_ = static_cast<ShadowStyle>( 272 static_cast<uint32_t>(pattern->GetAttr<double>("select_focused_shadow", NONE_SHADOW_VALUE))); 273 theme->selectHoverOrFocusedScale_ = pattern->GetAttr<double>("select_focused_scale", SELECT_FOCUS_SCALE); 274 theme->selectFocusedTextColor_ = pattern->GetAttr<Color>("select_focused_text_color", Color(0xff182431)); 275 theme->selectFocusedBackgroundColor_ = 276 pattern->GetAttr<Color>("select_focused_back_ground_color", Color::TRANSPARENT); 277 theme->menuNormalBorderWidth_ = pattern->GetAttr<Dimension>("menu_normal_border_width", 0.0_vp); 278 theme->menuNormalBorderColor_ = pattern->GetAttr<Color>("menu_normal_border_color", Color::TRANSPARENT); 279 theme->menuNormalBackgroundBlurStyle_ = 280 static_cast<int>(pattern->GetAttr<double>("menu_normal_back_ground_blur_type", 0)); 281 theme->optionNormalTopBottomMargin_ = 282 pattern->GetAttr<Dimension>("option_normal_top_bottom_margin", 0.0_vp); 283 theme->optionContentNormalLeftRightPadding_ = 284 pattern->GetAttr<Dimension>("option_content_normal_left_right_padding", 0.0_vp); 285 theme->optionContentNormalAlign_ = 286 static_cast<uint32_t>(pattern->GetAttr<double>("option_content_normal_align", CONTENT_ALIGN_LEFT)); 287 theme->optionFocusedLeftRightMargin_ = 288 pattern->GetAttr<Dimension>("option_focused_left_right_margin", 0.0_vp); 289 theme->optionFocusedBackgroundColor_ = 290 pattern->GetAttr<Color>("option_focused_back_ground_color", Color::TRANSPARENT); 291 theme->optionFocusedShadow_ = 292 static_cast<uint32_t>(pattern->GetAttr<double>("option_focus_shadow", NONE_SHADOW_VALUE)); 293 theme->optionFocusedFontColor_ = pattern->GetAttr<Color>("option_focused_font_color", Color(0xff182431)); 294 theme->shadowNormal_ = 295 static_cast<uint32_t>(pattern->GetAttr<double>("option_default_shadow", NONE_SHADOW_VALUE)); 296 theme->optionSelectedBorderColor_ = 297 pattern->GetAttr<Color>("option_selected_border_color", Color::TRANSPARENT); 298 theme->optionSelectedBorderWidth_ = pattern->GetAttr<Dimension>("option_selected_border_width", 0.0_vp); 299 theme->optionNormalWidth_ = pattern->GetAttr<Dimension>("option_normal_width", 156.0_vp); 300 theme->selectedFontSizeText = pattern->GetAttr<Dimension>("select_font_size_text", 16.0_fp); 301 theme->selectNormalLeftRightMargin_ = 302 pattern->GetAttr<Dimension>("select_normal_left_right_margin", 8.0_vp); 303 theme->menuBlendBgColor_ = pattern->GetAttr<int>("menu_is_blend_bg_color", 0); 304 theme->optionFocusedBoxPadding_ = 305 pattern->GetAttr<Dimension>("option_focused_box_padding", 0.0_vp); 306 theme->spinnerFocusedSymbolColor_ = 307 pattern->GetAttr<Color>("select_focused_symbol_color", theme->spinnerFocusedSymbolColor_); 308 theme->spinnerFocusedColor_ = 309 pattern->GetAttr<Color>("select_focused_icon_color", theme->spinnerFocusedColor_); 310 theme->optionApplyFocusedStyle_ = pattern->GetAttr<int>("option_is_apply_focus_style", 0); 311 theme->isSlideMoreOffset_ = pattern->GetAttr<int>("select_slide_more_offset", 0); 312 } 313 ParsePartFourth(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)314 void ParsePartFourth(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 315 { 316 theme->defaultDividerStartMargin_ = pattern->GetAttr<Dimension>("menu_divider_start_margin", 0.0_vp); 317 theme->defaultDividerEndMargin_ = pattern->GetAttr<Dimension>("menu_divider_end_margin", 0.0_vp); 318 theme->defaultShowDivider_ = static_cast<bool>(pattern->GetAttr<int>("menu_default_show_divider", 0)); 319 theme->menuItemTopBottomMargin_ = pattern->GetAttr<Dimension>("menu_item_top_bottom_margin", 0.0_vp); 320 theme->menuItemLeftRightMargin_ = pattern->GetAttr<Dimension>("menu_item_left_right_margin", 0.0_vp); 321 theme->menuTargetSecuritySpace_ = pattern->GetAttr<Dimension>("menu_target_security_space", 8.0_vp); 322 theme->menuItemFocusedBgColor_ = pattern->GetAttr<Color>("menu_item_focused_bg_color", Color::TRANSPARENT); 323 theme->menuItemFocusedTextColor_ = 324 pattern->GetAttr<Color>("menu_item_focused_text_color", Color(0xff182431)); 325 theme->menuItemFocusedShadowStyle_ = 326 static_cast<uint32_t>(pattern->GetAttr<double>("menu_item_focused_shadow_style", NONE_SHADOW_VALUE)); 327 theme->menuItemContentAlign_ = 328 static_cast<uint32_t>(pattern->GetAttr<double>("menu_item_content_align", CONTENT_ALIGN_LEFT)); 329 theme->selectFocusStyleType_ = pattern->GetAttr<double>("select_focus_style_type", 0.0); 330 theme->optionFocusStyleType_ = pattern->GetAttr<double>("option_focus_style_type", 0.0); 331 theme->menuItemHorIntervalPadding_ = 332 pattern->GetAttr<Dimension>("menu_item_hor_interval", theme->menuItemHorIntervalPadding_); 333 theme->menuPadding_ = pattern->GetAttr<Dimension>("menu_padding_interval", theme->menuPadding_); 334 } 335 ParseAttribute(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)336 void ParseAttribute(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 337 { 338 theme->titleLeftPadding_ = Dimension(TITLE_LEFT_PADDING, DimensionUnit::VP); 339 theme->titleTopPadding_ = Dimension(TITLE_TOP_PADDING, DimensionUnit::VP); 340 theme->titleRightPadding_ = Dimension(TITLE_RIGHT_PADDING, DimensionUnit::VP); 341 theme->titleBottomPadding_ = Dimension(TITLE_BOTTOM_PADDING, DimensionUnit::VP); 342 theme->titleStyle_.SetFontSize(pattern->GetAttr<Dimension>("text_size_headline7", 24.0_vp)); 343 std::vector<std::string> families; 344 families.emplace_back("sans-serif"); 345 theme->titleStyle_.SetFontFamilies(families); 346 theme->titleStyle_.SetFontWeight(FontWeight::W500); 347 theme->titleStyle_.SetTextColor(pattern->GetAttr<Color>("select_font_color", Color(0xe5000000))); 348 theme->titleStyle_.SetTextDecoration(TextDecoration::NONE); 349 theme->optionPadding_ = Edge(SELECT_OPTION_LEFT_LENGTH, SELECT_OPTION_TOP_LENGTH, 350 SELECT_OPTION_RIGHT_LENGTH, SELECT_OPTION_BOTTOM_LENGTH, DimensionUnit::VP); 351 theme->optionInterval_ = theme->isTV_ ? Dimension(SELECT_OPTION_INTERVAL, DimensionUnit::VP) : 0.0_vp; 352 theme->tvFocusTextColor_ = Color(0xE6000000); 353 theme->tvNormalBackColor_ = Color(0x33FFFFFF); 354 theme->tvBackColor_ = (theme->isTV_ ? Color(0x99000000) : Color::TRANSPARENT); 355 // disabled color 356 theme->normalDisableColor_ = pattern->GetAttr<Color>("select_option_disable_color", Color(0x32FFFFFF)); 357 theme->focusedDisableColor_ = 358 pattern->GetAttr<Color>("select_option_focused_disable_color", Color(0x5DFFFFFF)); 359 theme->normalTextDisableColor_ = 360 pattern->GetAttr<Color>("select_option_focused_disable_color", Color(0x5DFFFFFF)); 361 theme->focusedTextDisableColor_ = 362 pattern->GetAttr<Color>("select_option_focused_disable_text_color", Color(0x66000000)); 363 theme->optionTextStyle_.SetFontSize(pattern->GetAttr<Dimension>("text_font_size", 16.0_fp)); 364 theme->optionTextStyle_.SetFontFamilies({ pattern->GetAttr<std::string>("text_font_family_regular", 365 "sans-serif") }); 366 theme->optionTextStyle_.SetFontWeight(FontWeight::NORMAL); 367 theme->optionTextStyle_.SetTextColor(pattern->GetAttr<Color>("select_font_color", Color(0xe5000000))); 368 theme->optionTextStyle_.SetTextDecoration(TextDecoration::NONE); 369 theme->menuLargeMargin_ = pattern->GetAttr<Dimension>("menu_large_margin", theme->menuLargeMargin_); 370 theme->menuMediumMargin_ = pattern->GetAttr<Dimension>("menu_medium_margin", theme->menuMediumMargin_); 371 theme->menuItemChildMinHeight_ = pattern->GetAttr<Dimension>("menu_item_child_min_height", 32.0_vp); 372 theme->menuItemVerticalPadding_ = pattern->GetAttr<Dimension>("menu_item_vertical_padding", 8.0_vp); 373 theme->menuItemGroupTitleTextFontSize_ = 374 pattern->GetAttr<Dimension>("menu_item_group_title_text_font_size", 18.0_vp); 375 theme->menuDefaultRadius_ = pattern->GetAttr<Dimension>("menu_border_radius_new", 20.0_vp); 376 theme->menuDefaultInnerRadius_ = pattern->GetAttr<Dimension>("inner_border_radius_new", 16.0_vp); 377 theme->menuTextColor_= pattern->GetAttr<Color>("menu_text_color", Color(0xe5000000)); 378 theme->menuDefaultWidth_ = pattern->GetAttr<Dimension>("menu_default_width", 160.0_vp); 379 theme->menuMinWidth_ = pattern->GetAttr<Dimension>("menu_min_width", 64.0_vp); 380 theme->menuMaxWidth_ = pattern->GetAttr<Dimension>("menu_max_width", 224.0_vp); 381 theme->menuMaxWidthRatio_ = pattern->GetAttr<double>("menu_max_width_ratio", 0.67f); 382 theme->menuBackgroundBlurStyle_ = 383 pattern->GetAttr<int>("menu_background_blur_style", static_cast<int>(BlurStyle::COMPONENT_ULTRA_THICK)); 384 } 385 }; 386 387 ~SelectTheme() override = default; 388 clone()389 RefPtr<SelectTheme> clone() 390 { 391 RefPtr<SelectTheme> theme = AceType::Claim(new SelectTheme()); 392 ClonePartOne(theme); 393 ClonePartTwo(theme); 394 ClonePartThree(theme); 395 CloneWideScreenAttrs(theme); 396 return theme; 397 } 398 ClonePartOne(RefPtr<SelectTheme> & theme)399 void ClonePartOne(RefPtr<SelectTheme>& theme) 400 { 401 theme->disabledColor_ = disabledColor_; 402 theme->clickedColor_ = clickedColor_; 403 theme->selectedColor_ = selectedColor_; 404 theme->fontSize_ = fontSize_; 405 theme->fontFamily_ = fontFamily_; 406 theme->fontColor_ = fontColor_; 407 theme->disabledFontColor_ = disabledFontColor_; 408 theme->disabledFontColorAlpha_ = disabledFontColorAlpha_; 409 theme->secondaryFontColor_ = secondaryFontColor_; 410 theme->fontWeight_ = fontWeight_; 411 theme->textDecoration_ = textDecoration_; 412 theme->rrectSize_ = rrectSize_; 413 theme->iconSize_ = iconSize_; 414 theme->normalPadding_ = normalPadding_; 415 theme->optionSize_ = optionSize_; 416 theme->popupRRectSize_ = popupRRectSize_; 417 theme->popupMinWidth_ = popupMinWidth_; 418 theme->popupShadowWidth_ = popupShadowWidth_; 419 theme->popupBorderWidth_ = popupBorderWidth_; 420 theme->titleLeftPadding_ = titleLeftPadding_; 421 theme->titleTopPadding_ = titleTopPadding_; 422 theme->titleRightPadding_ = titleRightPadding_; 423 theme->titleBottomPadding_ = titleBottomPadding_; 424 theme->titleStyle_ = titleStyle_; 425 theme->isTV_ = isTV_; 426 theme->horizontalSpacing_ = horizontalSpacing_; 427 theme->verticalSpacing_ = verticalSpacing_; 428 theme->contentSpacing_ = contentSpacing_; 429 theme->menuHideTime_ = menuHideTime_; 430 theme->menuShowTime_ = menuShowTime_; 431 theme->selectShowTime_ = selectShowTime_; 432 theme->selectHideTime_ = selectHideTime_; 433 theme->hoverAnimationDuration_ = hoverAnimationDuration_; 434 theme->pressAnimationDuration_ = pressAnimationDuration_; 435 theme->optionPadding_ = optionPadding_; 436 theme->optionInterval_ = optionInterval_; 437 theme->optionMinHeight_ = optionMinHeight_; 438 theme->tvFocusTextColor_ = tvFocusTextColor_; 439 theme->tvNormalBackColor_ = tvNormalBackColor_; 440 } 441 ClonePartTwo(RefPtr<SelectTheme> & theme)442 void ClonePartTwo(RefPtr<SelectTheme>& theme) 443 { 444 theme->tvBackColor_ = tvBackColor_; 445 theme->focusedDisableColor_ = focusedDisableColor_; 446 theme->normalDisableColor_ = normalDisableColor_; 447 theme->focusedTextDisableColor_ = focusedTextDisableColor_; 448 theme->normalTextDisableColor_ = normalTextDisableColor_; 449 theme->spinnerColor_ = spinnerColor_; 450 theme->disabledSpinnerColor_ = disabledSpinnerColor_; 451 theme->spinnerSymbolColor_ = spinnerSymbolColor_; 452 theme->disabledSpinnerSymbolColor_ = disabledSpinnerSymbolColor_; 453 theme->spinnerSource_ = spinnerSource_; 454 theme->backgroundColor_ = backgroundColor_; 455 theme->backgroundColorButton_ = backgroundColorButton_; 456 theme->disabledBackgroundColor_ = disabledBackgroundColor_; 457 theme->hoverColor_ = hoverColor_; 458 theme->selectedColorText_ = selectedColorText_; 459 theme->lineColor_ = lineColor_; 460 theme->optionTextStyle_ = optionTextStyle_; 461 theme->selectBorderRadius_ = selectBorderRadius_; 462 theme->menuBorderRadius_ = menuBorderRadius_; 463 theme->innerBorderRadius_ = innerBorderRadius_; 464 theme->menuFontSize_ = menuFontSize_; 465 theme->menuTitleFontSize_ = menuTitleFontSize_; 466 theme->menuTitleFontColor_ = menuTitleFontColor_; 467 theme->menuTitleHeight_ = menuTitleHeight_; 468 theme->menuFontColor_ = menuFontColor_; 469 theme->disabledMenuFontColor_ = disabledMenuFontColor_; 470 theme->menuIconPadding_ = menuIconPadding_; 471 theme->iconContentPadding_ = iconContentPadding_; 472 theme->dividerPaddingVertical_ = dividerPaddingVertical_; 473 theme->menuIconColor_ = menuIconColor_; 474 theme->optionMinHeight_ = optionMinHeight_; 475 theme->selectMenuPadding_ = selectMenuPadding_; 476 theme->outPadding_ = outPadding_; 477 theme->defaultPaddingStart_ = defaultPaddingStart_; 478 theme->defaultPaddingEnd_ = defaultPaddingEnd_; 479 theme->defaultPaddingTop_ = defaultPaddingTop_; 480 theme->defaultPaddingBottomFixed_ = defaultPaddingBottomFixed_; 481 theme->contentSpinnerPadding_ = contentSpinnerPadding_; 482 theme->menuAnimationOffset_ = menuAnimationOffset_; 483 theme->spinnerWidth_ = spinnerWidth_; 484 theme->spinnerHeight_ = spinnerHeight_; 485 } 486 ClonePartThree(RefPtr<SelectTheme> & theme)487 void ClonePartThree(RefPtr<SelectTheme>& theme) 488 { 489 theme->defaultDividerWidth_ = defaultDividerWidth_; 490 theme->selectMinWidth_ = selectMinWidth_; 491 theme->selectDefaultHeight_ = selectDefaultHeight_; 492 theme->iconSideLength_ = iconSideLength_; 493 theme->endIconWidth_ = endIconWidth_; 494 theme->endIconHeight_ = endIconHeight_; 495 theme->contentMargin_ = contentMargin_; 496 theme->selectDefaultBgColor_ = selectDefaultBgColor_; 497 theme->selectDefaultBorderRadius_ = selectDefaultBorderRadius_; 498 theme->expandDisplay_ = expandDisplay_; 499 theme->maxPaddingStart_ = maxPaddingStart_; 500 theme->maxPaddingEnd_ = maxPaddingEnd_; 501 theme->menuLargeMargin_ = menuLargeMargin_; 502 theme->menuMediumMargin_ = menuMediumMargin_; 503 theme->menuItemChildMinHeight_ = menuItemChildMinHeight_; 504 theme->menuItemVerticalPadding_ = menuItemVerticalPadding_; 505 theme->menuItemGroupTitleTextFontSize_ = menuItemGroupTitleTextFontSize_; 506 theme->menuDefaultRadius_ = menuDefaultRadius_; 507 theme->menuDefaultInnerRadius_ = menuDefaultInnerRadius_; 508 theme->menuTextColor_ = menuTextColor_; 509 theme->menuDefaultWidth_ = menuDefaultWidth_; 510 theme->menuMinWidth_ = menuMinWidth_; 511 theme->menuMaxWidth_ = menuMaxWidth_; 512 theme->menuMaxWidthRatio_ = menuMaxWidthRatio_; 513 theme->menuBackgroundBlurStyle_ = menuBackgroundBlurStyle_; 514 theme->menuItemHorIntervalPadding_ = menuItemHorIntervalPadding_; 515 theme->menuPadding_ = menuPadding_; 516 } 517 CloneWideScreenAttrs(RefPtr<SelectTheme> & theme)518 void CloneWideScreenAttrs(RefPtr<SelectTheme>& theme) 519 { 520 theme->selectNormalBorderWidth_ = selectNormalBorderWidth_; 521 theme->selectNormalBorderColor_ = selectNormalBorderColor_; 522 theme->selectNormalShadow_ = selectNormalShadow_; 523 theme->selectFocusedShadow_ = selectFocusedShadow_; 524 theme->selectHoverOrFocusedScale_ = selectHoverOrFocusedScale_; 525 theme->selectFocusedTextColor_ = selectFocusedTextColor_; 526 theme->selectFocusedBackgroundColor_ = selectFocusedBackgroundColor_; 527 theme->menuNormalBorderWidth_ = menuNormalBorderWidth_; 528 theme->menuNormalBorderColor_ = menuNormalBorderColor_; 529 theme->menuNormalBackgroundBlurStyle_ = menuNormalBackgroundBlurStyle_; 530 theme->optionNormalTopBottomMargin_ = optionNormalTopBottomMargin_; 531 theme->optionContentNormalLeftRightPadding_ = optionContentNormalLeftRightPadding_; 532 theme->optionContentNormalAlign_ = optionContentNormalAlign_; 533 theme->optionFocusedLeftRightMargin_ = optionFocusedLeftRightMargin_; 534 theme->optionFocusedBackgroundColor_ = optionFocusedBackgroundColor_; 535 theme->optionFocusedShadow_ = optionFocusedShadow_; 536 theme->optionFocusedFontColor_ = optionFocusedFontColor_; 537 theme->shadowNormal_ = shadowNormal_; 538 theme->optionSelectedBorderColor_ = optionSelectedBorderColor_; 539 theme->optionSelectedBorderWidth_ = optionSelectedBorderWidth_; 540 theme->optionNormalWidth_ = optionNormalWidth_; 541 theme->selectedFontSizeText = selectedFontSizeText; 542 theme->selectNormalLeftRightMargin_ = selectNormalLeftRightMargin_; 543 theme->menuBlendBgColor_ = menuBlendBgColor_; 544 theme->optionFocusedBoxPadding_ = optionFocusedBoxPadding_; 545 theme->spinnerFocusedSymbolColor_ = spinnerFocusedSymbolColor_; 546 theme->spinnerFocusedColor_ = spinnerFocusedColor_; 547 theme->optionApplyFocusedStyle_ = optionApplyFocusedStyle_; 548 theme->isSlideMoreOffset_ = isSlideMoreOffset_; 549 theme->menuItemTopBottomMargin_ = menuItemTopBottomMargin_; 550 theme->menuItemLeftRightMargin_ = menuItemLeftRightMargin_; 551 theme->menuTargetSecuritySpace_ = menuTargetSecuritySpace_; 552 theme->menuItemFocusedBgColor_ = menuItemFocusedBgColor_; 553 theme->menuItemFocusedTextColor_ = menuItemFocusedTextColor_; 554 theme->menuItemFocusedShadowStyle_ = menuItemFocusedShadowStyle_; 555 theme->menuItemContentAlign_ = menuItemContentAlign_; 556 theme->selectFocusStyleType_ = selectFocusStyleType_; 557 theme->optionFocusStyleType_ = optionFocusStyleType_; 558 } 559 GetSelectedColorText()560 const Color& GetSelectedColorText() const 561 { 562 return selectedColorText_; 563 } 564 GetHoverColor()565 const Color& GetHoverColor() const 566 { 567 return hoverColor_; 568 } 569 GetBackgroundColor()570 const Color& GetBackgroundColor() const 571 { 572 return backgroundColor_; 573 } 574 GetButtonBackgroundColor()575 const Color& GetButtonBackgroundColor() const 576 { 577 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 578 return backgroundColorButton_; 579 } 580 return backgroundColor_; 581 } SetButtonBackgroundColor(const Color & value)582 void SetButtonBackgroundColor(const Color& value) 583 { 584 backgroundColorButton_ = value; 585 } 586 GetDisabledBackgroundColor()587 const Color& GetDisabledBackgroundColor() const 588 { 589 return disabledBackgroundColor_; 590 } 591 GetDisabledColor()592 const Color& GetDisabledColor() const 593 { 594 return disabledColor_; 595 } SetDisabledColor(const Color & value)596 void SetDisabledColor(const Color& value) 597 { 598 disabledColor_ = value; 599 } 600 GetClickedColor()601 const Color& GetClickedColor() const 602 { 603 return clickedColor_; 604 } SetClickedColor(const Color & value)605 void SetClickedColor(const Color& value) 606 { 607 clickedColor_ = value; 608 } 609 GetSelectedColor()610 const Color& GetSelectedColor() const 611 { 612 return selectedColor_; 613 } 614 SetSelectedColor(const Color & value)615 void SetSelectedColor(const Color& value) 616 { 617 selectedColor_ = value; 618 } 619 GetFontSize()620 const Dimension& GetFontSize() const 621 { 622 return fontSize_; 623 } 624 GetFontSize(ControlSize controlSize)625 const Dimension& GetFontSize(ControlSize controlSize) const 626 { 627 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 628 auto result = selectFontSizeMap_.find(controlSize); 629 if (result != selectFontSizeMap_.end()) { 630 return result->second; 631 } 632 } 633 return fontSize_; 634 } 635 SetFontSize(const Dimension & value)636 void SetFontSize(const Dimension& value) 637 { 638 fontSize_ = value; 639 } 640 GetFontColor()641 const Color& GetFontColor() const 642 { 643 return fontColor_; 644 } SetFontColor(const Color & value)645 void SetFontColor(const Color& value) 646 { 647 fontColor_ = value; 648 } 649 GetDisabledFontColor()650 const Color& GetDisabledFontColor() const 651 { 652 return disabledFontColor_; 653 } 654 GetDisabledFontColorAlpha()655 double GetDisabledFontColorAlpha() const 656 { 657 return disabledFontColorAlpha_; 658 } 659 GetSecondaryFontColor()660 const Color& GetSecondaryFontColor() const 661 { 662 return secondaryFontColor_; 663 } 664 GetFontFamily()665 const std::string& GetFontFamily() const 666 { 667 return fontFamily_; 668 } SetFontFamily(const std::string & value)669 void SetFontFamily(const std::string& value) 670 { 671 fontFamily_ = value; 672 } 673 GetFontWeight()674 FontWeight GetFontWeight() const 675 { 676 return fontWeight_; 677 } SetFontWeight(FontWeight value)678 void SetFontWeight(FontWeight value) 679 { 680 fontWeight_ = value; 681 } 682 GetTextDecoration()683 TextDecoration GetTextDecoration() const 684 { 685 return textDecoration_; 686 } SetTextDecoration(TextDecoration value)687 void SetTextDecoration(TextDecoration value) 688 { 689 textDecoration_ = value; 690 } 691 GetOptionSize()692 std::size_t GetOptionSize() const 693 { 694 return optionSize_; 695 } SetOptionSize(std::size_t value)696 void SetOptionSize(std::size_t value) 697 { 698 optionSize_ = value; 699 } 700 GetRRectSize()701 const Dimension& GetRRectSize() const 702 { 703 return rrectSize_; 704 } SetRRectSize(const Dimension & value)705 void SetRRectSize(const Dimension& value) 706 { 707 rrectSize_ = value; 708 } 709 GetPopupRRectSize()710 const Dimension& GetPopupRRectSize() const 711 { 712 return popupRRectSize_; 713 } SetPopupRRectSize(const Dimension & value)714 void SetPopupRRectSize(const Dimension& value) 715 { 716 popupRRectSize_ = value; 717 } 718 GetPopupBorderWidth()719 const Dimension& GetPopupBorderWidth() const 720 { 721 return popupBorderWidth_; 722 } SetPopupBorderWidth(const Dimension & value)723 void SetPopupBorderWidth(const Dimension& value) 724 { 725 popupBorderWidth_ = value; 726 } 727 GetPopupShadowWidth()728 const Dimension& GetPopupShadowWidth() const 729 { 730 return popupShadowWidth_; 731 } SetPopupShadowWidth(const Dimension & value)732 void SetPopupShadowWidth(const Dimension& value) 733 { 734 popupShadowWidth_ = value; 735 } 736 GetPopupMinWidth()737 const Dimension& GetPopupMinWidth() const 738 { 739 return popupMinWidth_; 740 } SetPopupMinWidth(const Dimension & value)741 void SetPopupMinWidth(const Dimension& value) 742 { 743 popupMinWidth_ = value; 744 } 745 GetNormalPadding()746 const Dimension& GetNormalPadding() const 747 { 748 return normalPadding_; 749 } SetNormalPadding(const Dimension & value)750 void SetNormalPadding(const Dimension& value) 751 { 752 normalPadding_ = value; 753 } 754 GetIconSize()755 const Dimension& GetIconSize() const 756 { 757 return iconSize_; 758 } SetIconSize(const Dimension & value)759 void SetIconSize(const Dimension& value) 760 { 761 iconSize_ = value; 762 } 763 GetTitleLeftPadding()764 const Dimension& GetTitleLeftPadding() const 765 { 766 return titleLeftPadding_; 767 } SetTitleLeftPadding(const Dimension & value)768 void SetTitleLeftPadding(const Dimension& value) 769 { 770 titleLeftPadding_ = value; 771 } 772 GetTitleTopPadding()773 const Dimension& GetTitleTopPadding() const 774 { 775 return titleTopPadding_; 776 } SetTitleTopPadding(const Dimension & value)777 void SetTitleTopPadding(const Dimension& value) 778 { 779 titleTopPadding_ = value; 780 } 781 GetTitleRightPadding()782 const Dimension& GetTitleRightPadding() const 783 { 784 return titleRightPadding_; 785 } SetTitleRightPadding(const Dimension & value)786 void SetTitleRightPadding(const Dimension& value) 787 { 788 titleRightPadding_ = value; 789 } 790 GetTitleBottomPadding()791 const Dimension& GetTitleBottomPadding() const 792 { 793 return titleBottomPadding_; 794 } SetTitleBottomPadding(const Dimension & value)795 void SetTitleBottomPadding(const Dimension& value) 796 { 797 titleBottomPadding_ = value; 798 } 799 GetTitleStyle()800 const TextStyle& GetTitleStyle() 801 { 802 return titleStyle_; 803 } SetTitleStyle(const TextStyle & value)804 void SetTitleStyle(const TextStyle& value) 805 { 806 titleStyle_ = value; 807 } 808 IsTV()809 bool IsTV() const 810 { 811 return isTV_; 812 } SetIsTV(bool isTV)813 void SetIsTV(bool isTV) 814 { 815 isTV_ = isTV; 816 } 817 GetHorizontalSpacing()818 const Dimension& GetHorizontalSpacing() const 819 { 820 return horizontalSpacing_; 821 } SetHorizontalSpacing(const Dimension & horizontalSpacing)822 void SetHorizontalSpacing(const Dimension& horizontalSpacing) 823 { 824 horizontalSpacing_ = horizontalSpacing; 825 } 826 GetVerticalSpacing()827 const Dimension& GetVerticalSpacing() const 828 { 829 return verticalSpacing_; 830 } SetVerticalSpacing(const Dimension & verticalSpacing)831 void SetVerticalSpacing(const Dimension& verticalSpacing) 832 { 833 verticalSpacing_ = verticalSpacing; 834 } 835 GetContentSpacing()836 const Dimension& GetContentSpacing() const 837 { 838 return contentSpacing_; 839 } SetContentSpacing(const Dimension & contentSpacing)840 void SetContentSpacing(const Dimension& contentSpacing) 841 { 842 contentSpacing_ = contentSpacing; 843 } 844 GetOptionPadding()845 const Edge& GetOptionPadding() const 846 { 847 return optionPadding_; 848 } SetOptionPadding(const Edge & value)849 void SetOptionPadding(const Edge& value) 850 { 851 optionPadding_ = value; 852 } 853 GetShowTime(bool isMenu)854 uint32_t GetShowTime(bool isMenu) const 855 { 856 if (isMenu) { 857 return menuShowTime_; 858 } else { 859 return selectShowTime_; 860 } 861 } 862 GetHideTime(bool isMenu)863 uint32_t GetHideTime(bool isMenu) const 864 { 865 if (isMenu) { 866 return menuHideTime_; 867 } else { 868 return selectHideTime_; 869 } 870 } 871 GetHoverAnimationDuration()872 int32_t GetHoverAnimationDuration() const 873 { 874 return hoverAnimationDuration_; 875 } 876 GetPressAnimationDuration()877 int32_t GetPressAnimationDuration() const 878 { 879 return pressAnimationDuration_; 880 } 881 882 SelectTheme() = default; 883 IsAllowScale()884 bool IsAllowScale() const 885 { 886 return allowScale_; 887 } 888 SetAllowScale(bool allowScale)889 void SetAllowScale(bool allowScale) 890 { 891 allowScale_ = allowScale; 892 } 893 GetOptionInterval()894 const Dimension& GetOptionInterval() const 895 { 896 return optionInterval_; 897 } 898 GetOptionMinHeight()899 const Dimension& GetOptionMinHeight() const 900 { 901 return optionMinHeight_; 902 } 903 GetTvFocusTextColor()904 const Color& GetTvFocusTextColor() const 905 { 906 return tvFocusTextColor_; 907 } 908 GetTvNormalBackColor()909 const Color& GetTvNormalBackColor() const 910 { 911 return tvNormalBackColor_; 912 } 913 GetTvBackColor()914 const Color& GetTvBackColor() const 915 { 916 return tvBackColor_; 917 } 918 GetFocusedDisableColor()919 const Color& GetFocusedDisableColor() const 920 { 921 return focusedDisableColor_; 922 } 923 GetNormalDisableColor()924 const Color& GetNormalDisableColor() const 925 { 926 return normalDisableColor_; 927 } 928 GetFocusedTextDisableColor()929 const Color& GetFocusedTextDisableColor() const 930 { 931 return focusedTextDisableColor_; 932 } 933 GetNormalTextDisableColor()934 const Color& GetNormalTextDisableColor() const 935 { 936 return normalTextDisableColor_; 937 } 938 GetSpinnerColor()939 const Color& GetSpinnerColor() const 940 { 941 return spinnerColor_; 942 } 943 GetDisabledSpinnerColor()944 const Color& GetDisabledSpinnerColor() const 945 { 946 return disabledSpinnerColor_; 947 } 948 GetSpinnerSymbolColor()949 const Color& GetSpinnerSymbolColor() const 950 { 951 return spinnerSymbolColor_; 952 } 953 GetDisabledSpinnerSymbolColor()954 const Color& GetDisabledSpinnerSymbolColor() const 955 { 956 return disabledSpinnerSymbolColor_; 957 } 958 GetSpinnerSource()959 const uint32_t& GetSpinnerSource() const 960 { 961 return spinnerSource_; 962 } 963 GetMenuIconColor()964 const Color& GetMenuIconColor() const 965 { 966 return menuIconColor_; 967 } 968 GetLineColor()969 const Color& GetLineColor() const 970 { 971 return lineColor_; 972 } 973 GetOptionTextStyle()974 const TextStyle& GetOptionTextStyle() const 975 { 976 return optionTextStyle_; 977 } 978 GetSelectBorderRadius()979 const Dimension& GetSelectBorderRadius() const 980 { 981 return selectBorderRadius_; 982 } 983 GetMenuBorderRadius()984 const Dimension& GetMenuBorderRadius() const 985 { 986 return menuBorderRadius_; 987 } 988 GetInnerBorderRadius()989 const Dimension& GetInnerBorderRadius() const 990 { 991 return innerBorderRadius_; 992 } 993 GetMenuFontSize()994 const Dimension& GetMenuFontSize() const 995 { 996 return menuFontSize_; 997 } 998 GetMenuTitleFontSize()999 const Dimension& GetMenuTitleFontSize() const 1000 { 1001 return menuTitleFontSize_; 1002 } 1003 GetMenuTitleFontColor()1004 const Color& GetMenuTitleFontColor() const 1005 { 1006 return menuTitleFontColor_; 1007 } 1008 GetMenuTitleHeight()1009 const Dimension& GetMenuTitleHeight() const 1010 { 1011 return menuTitleHeight_; 1012 } 1013 GetMenuFontColor()1014 const Color& GetMenuFontColor() const 1015 { 1016 return menuFontColor_; 1017 } 1018 GetDisabledMenuFontColor()1019 const Color& GetDisabledMenuFontColor() const 1020 { 1021 return disabledMenuFontColor_; 1022 } SetDisabledMenuFontColor(const Color & value)1023 void SetDisabledMenuFontColor(const Color& value) 1024 { 1025 disabledMenuFontColor_ = value; 1026 } 1027 GetMenuIconPadding()1028 const Dimension& GetMenuIconPadding() const 1029 { 1030 return menuIconPadding_; 1031 } 1032 GetMenuItemHorIntervalPadding()1033 const Dimension& GetMenuItemHorIntervalPadding() const 1034 { 1035 return menuItemHorIntervalPadding_; 1036 } 1037 GetMenuPadding()1038 const Dimension& GetMenuPadding() const 1039 { 1040 return menuPadding_; 1041 } 1042 GetIconContentPadding()1043 const Dimension& GetIconContentPadding() const 1044 { 1045 return iconContentPadding_; 1046 } 1047 GetDividerPaddingVertical()1048 const Dimension& GetDividerPaddingVertical() const 1049 { 1050 return dividerPaddingVertical_; 1051 } 1052 GetSelectMenuPadding()1053 const Dimension& GetSelectMenuPadding() const 1054 { 1055 return selectMenuPadding_; 1056 } 1057 GetOutPadding()1058 const Dimension& GetOutPadding() const 1059 { 1060 return outPadding_; 1061 } 1062 GetDefaultPaddingStart()1063 const Dimension& GetDefaultPaddingStart() const 1064 { 1065 return defaultPaddingStart_; 1066 } 1067 GetDefaultPaddingEnd()1068 const Dimension& GetDefaultPaddingEnd() const 1069 { 1070 return defaultPaddingEnd_; 1071 } 1072 GetDefaultPaddingTop()1073 const Dimension& GetDefaultPaddingTop() const 1074 { 1075 return defaultPaddingTop_; 1076 } 1077 GetDefaultPaddingBottomFixed()1078 const Dimension& GetDefaultPaddingBottomFixed() const 1079 { 1080 return defaultPaddingBottomFixed_; 1081 } 1082 GetContentSpinnerPadding()1083 const Dimension& GetContentSpinnerPadding() const 1084 { 1085 return contentSpinnerPadding_; 1086 } 1087 GetMenuAnimationOffset()1088 const Dimension& GetMenuAnimationOffset() const 1089 { 1090 return menuAnimationOffset_; 1091 } 1092 GetSpinnerWidth()1093 const Dimension& GetSpinnerWidth() const 1094 { 1095 return spinnerWidth_; 1096 } 1097 GetMenuNeedFocus()1098 bool GetMenuNeedFocus() const 1099 { 1100 return menuNeedFocus_; 1101 } 1102 GetSpinnerWidth(ControlSize controlSize)1103 const Dimension& GetSpinnerWidth(ControlSize controlSize) const 1104 { 1105 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1106 auto result = selectSpinnerWidthMap_.find(controlSize); 1107 if (result != selectSpinnerWidthMap_.end()) { 1108 return result->second; 1109 } 1110 } 1111 return spinnerWidth_; 1112 } 1113 GetSpinnerHeight()1114 const Dimension& GetSpinnerHeight() const 1115 { 1116 return spinnerHeight_; 1117 } 1118 GetSpinnerHeight(ControlSize controlSize)1119 const Dimension& GetSpinnerHeight(ControlSize controlSize) const 1120 { 1121 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1122 auto result = selectSpinnerHeightMap_.find(controlSize); 1123 if (result != selectSpinnerHeightMap_.end()) { 1124 return result->second; 1125 } 1126 } 1127 return spinnerHeight_; 1128 } 1129 GetDefaultDividerWidth()1130 const Dimension& GetDefaultDividerWidth() const 1131 { 1132 return defaultDividerWidth_; 1133 } 1134 GetSelectMinWidth()1135 const Dimension& GetSelectMinWidth() const 1136 { 1137 return selectMinWidth_; 1138 } 1139 GetSelectMinWidth(ControlSize controlSize)1140 const Dimension& GetSelectMinWidth(ControlSize controlSize) const 1141 { 1142 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1143 auto result = selectMinWidthMap_.find(controlSize); 1144 if (result != selectMinWidthMap_.end()) { 1145 return result->second; 1146 } 1147 } 1148 return selectMinWidth_; 1149 } 1150 GetSelectDefaultHeight()1151 const Dimension& GetSelectDefaultHeight() const 1152 { 1153 return selectDefaultHeight_; 1154 } 1155 GetSelectDefaultHeight(ControlSize controlSize)1156 const Dimension& GetSelectDefaultHeight(ControlSize controlSize) const 1157 { 1158 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1159 auto result = selectMinHeightMap_.find(controlSize); 1160 if (result != selectMinHeightMap_.end()) { 1161 return result->second; 1162 } 1163 } 1164 return selectDefaultHeight_; 1165 } 1166 GetIconSideLength()1167 const Dimension& GetIconSideLength() const 1168 { 1169 return iconSideLength_; 1170 } 1171 GetEndIconWidth()1172 const Dimension& GetEndIconWidth() const 1173 { 1174 return endIconWidth_; 1175 } 1176 GetEndIconHeight()1177 const Dimension& GetEndIconHeight() const 1178 { 1179 return endIconHeight_; 1180 } 1181 GetContentMargin()1182 const Dimension& GetContentMargin() const 1183 { 1184 return contentMargin_; 1185 } 1186 GetSelectDefaultBgColor()1187 const Color& GetSelectDefaultBgColor() const 1188 { 1189 return selectDefaultBgColor_; 1190 } 1191 GetSelectDefaultBorderRadius()1192 const Dimension& GetSelectDefaultBorderRadius() const 1193 { 1194 return selectDefaultBorderRadius_; 1195 } 1196 GetSelectDefaultBorderRadius(ControlSize controlSize)1197 const Dimension& GetSelectDefaultBorderRadius(ControlSize controlSize) const 1198 { 1199 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1200 auto result = selectBorderRadiusMap_.find(controlSize); 1201 if (result != selectBorderRadiusMap_.end()) { 1202 return result->second; 1203 } 1204 } 1205 return selectDefaultBorderRadius_; 1206 } 1207 GetExpandDisplay()1208 bool GetExpandDisplay() const 1209 { 1210 return expandDisplay_; 1211 } 1212 GetMaxPaddingStart()1213 const Dimension& GetMaxPaddingStart() const 1214 { 1215 return maxPaddingStart_; 1216 } 1217 GetMaxPaddingEnd()1218 const Dimension& GetMaxPaddingEnd() const 1219 { 1220 return maxPaddingEnd_; 1221 } GetMenuLargeMargin()1222 const Dimension& GetMenuLargeMargin() const 1223 { 1224 return menuLargeMargin_; 1225 } GetMenuMediumMargin()1226 const Dimension& GetMenuMediumMargin() const 1227 { 1228 return menuMediumMargin_; 1229 } 1230 GetMenuChildMinHeight()1231 const Dimension& GetMenuChildMinHeight() const 1232 { 1233 return menuItemChildMinHeight_; 1234 } 1235 GetMenuItemVerticalPadding()1236 const Dimension& GetMenuItemVerticalPadding() const 1237 { 1238 return menuItemVerticalPadding_; 1239 } 1240 GetMenuItemGroupTitleTextFontSize()1241 const Dimension& GetMenuItemGroupTitleTextFontSize() const 1242 { 1243 return menuItemGroupTitleTextFontSize_; 1244 } 1245 GetMenuDefaultRadius()1246 const Dimension& GetMenuDefaultRadius() const 1247 { 1248 return menuDefaultRadius_; 1249 } 1250 GetMenuDefaultInnerRadius()1251 const Dimension& GetMenuDefaultInnerRadius() const 1252 { 1253 return menuDefaultInnerRadius_; 1254 } 1255 GetMenuDefaultWidth()1256 const Dimension& GetMenuDefaultWidth() const 1257 { 1258 return menuDefaultWidth_; 1259 } 1260 GetMenuMinWidth()1261 const Dimension& GetMenuMinWidth() const 1262 { 1263 return menuMinWidth_; 1264 } 1265 GetMenuMaxWidth()1266 const Dimension& GetMenuMaxWidth() const 1267 { 1268 return menuMaxWidth_; 1269 } 1270 GetMenuMaxWidthRatio()1271 double GetMenuMaxWidthRatio() const 1272 { 1273 return menuMaxWidthRatio_; 1274 } 1275 GetMenuTextColor()1276 const Color& GetMenuTextColor() const 1277 { 1278 return menuTextColor_; 1279 } 1280 GetMenuItemContentAlign()1281 const uint32_t& GetMenuItemContentAlign() const 1282 { 1283 return menuItemContentAlign_; 1284 } 1285 GetSelectNormalBorderWidth()1286 Dimension GetSelectNormalBorderWidth() const 1287 { 1288 return selectNormalBorderWidth_; 1289 } 1290 GetSelectNormalBorderColor()1291 Color GetSelectNormalBorderColor() const 1292 { 1293 return selectNormalBorderColor_; 1294 } 1295 GetSelectNormalShadow()1296 ShadowStyle GetSelectNormalShadow() const 1297 { 1298 return selectNormalShadow_; 1299 } 1300 GetSelectFocusedShadow()1301 ShadowStyle GetSelectFocusedShadow() const 1302 { 1303 return selectFocusedShadow_; 1304 } 1305 GetSelectHoverOrFocusedScale()1306 double GetSelectHoverOrFocusedScale() const 1307 { 1308 return selectHoverOrFocusedScale_; 1309 } 1310 GetSelectFocusedBackground()1311 Color GetSelectFocusedBackground() const 1312 { 1313 return selectFocusedBackgroundColor_; 1314 } 1315 GetSelectFocusTextColor()1316 Color GetSelectFocusTextColor() const 1317 { 1318 return selectFocusedTextColor_; 1319 } 1320 GetMenuNormalBorderWidth()1321 Dimension GetMenuNormalBorderWidth() const 1322 { 1323 return menuNormalBorderWidth_; 1324 } 1325 GetMenuNormalBackgroundBlurStyle()1326 int GetMenuNormalBackgroundBlurStyle() const 1327 { 1328 return menuNormalBackgroundBlurStyle_; 1329 } 1330 GetMenuNormalBorderColor()1331 Color GetMenuNormalBorderColor() const 1332 { 1333 return menuNormalBorderColor_; 1334 } 1335 GetOptionNormalTopBottomMargin()1336 Dimension GetOptionNormalTopBottomMargin() const 1337 { 1338 return optionNormalTopBottomMargin_; 1339 } 1340 GetOptionFocusedLeftRightMargin()1341 Dimension GetOptionFocusedLeftRightMargin() const 1342 { 1343 return optionFocusedLeftRightMargin_; 1344 } 1345 GetOptionFocusedBackgroundColor()1346 Color GetOptionFocusedBackgroundColor() const 1347 { 1348 return optionFocusedBackgroundColor_; 1349 } 1350 GetOptionFocusedShadow()1351 uint32_t GetOptionFocusedShadow() const 1352 { 1353 return optionFocusedShadow_; 1354 } 1355 GetOptionFocusedFontColor()1356 Color GetOptionFocusedFontColor() const 1357 { 1358 return optionFocusedFontColor_; 1359 } 1360 GetOptionContentNormalLeftRightPadding()1361 Dimension GetOptionContentNormalLeftRightPadding() const 1362 { 1363 return optionContentNormalLeftRightPadding_; 1364 } 1365 GetOptionContentNormalAlign()1366 uint32_t GetOptionContentNormalAlign() const 1367 { 1368 return optionContentNormalAlign_; 1369 } 1370 GetShadowNormal()1371 uint32_t GetShadowNormal() const 1372 { 1373 return shadowNormal_; 1374 } 1375 GetOptionSelectedBorderColor()1376 Color GetOptionSelectedBorderColor() const 1377 { 1378 return optionSelectedBorderColor_; 1379 } 1380 GetOptionSelectedBorderWidth()1381 Dimension GetOptionSelectedBorderWidth() const 1382 { 1383 return optionSelectedBorderWidth_; 1384 } 1385 GetMenuNormalWidth()1386 Dimension GetMenuNormalWidth() const 1387 { 1388 return optionNormalWidth_; 1389 } 1390 GetSelectFontSizeText()1391 Dimension GetSelectFontSizeText() const 1392 { 1393 return selectedFontSizeText; 1394 } 1395 GetSelectNormalLeftRightMargin()1396 Dimension GetSelectNormalLeftRightMargin() const 1397 { 1398 return selectNormalLeftRightMargin_; 1399 } 1400 GetMenuBlendBgColor()1401 bool GetMenuBlendBgColor() const 1402 { 1403 return menuBlendBgColor_; 1404 } 1405 GetOptionFocusedBoxPadding()1406 Dimension GetOptionFocusedBoxPadding() const 1407 { 1408 return optionFocusedBoxPadding_; 1409 } 1410 GetSpinnerFocusedSymbolColor()1411 Color GetSpinnerFocusedSymbolColor() const 1412 { 1413 return spinnerFocusedSymbolColor_; 1414 } 1415 GetSpinnerFocusedColor()1416 Color GetSpinnerFocusedColor() const 1417 { 1418 return spinnerFocusedColor_; 1419 } 1420 GetoptionApplyFocusedStyle()1421 bool GetoptionApplyFocusedStyle() const 1422 { 1423 return optionApplyFocusedStyle_; 1424 } 1425 GetScrollSlideMoreOffset()1426 bool GetScrollSlideMoreOffset() const 1427 { 1428 return isSlideMoreOffset_; 1429 } 1430 GetDefaultDividerStartMargin()1431 Dimension GetDefaultDividerStartMargin() const 1432 { 1433 return defaultDividerStartMargin_; 1434 } 1435 GetDefaultDividerEndMargin()1436 Dimension GetDefaultDividerEndMargin() const 1437 { 1438 return defaultDividerEndMargin_; 1439 } 1440 GetDefaultShowDivider()1441 bool GetDefaultShowDivider() const 1442 { 1443 return defaultShowDivider_; 1444 } 1445 GetMenuItemTopBottomMargin()1446 Dimension GetMenuItemTopBottomMargin() const 1447 { 1448 return menuItemTopBottomMargin_; 1449 } 1450 GetMenuItemLeftRightMargin()1451 Dimension GetMenuItemLeftRightMargin() const 1452 { 1453 return menuItemLeftRightMargin_; 1454 } 1455 GetMenuTargetSecuritySpace()1456 Dimension GetMenuTargetSecuritySpace() const 1457 { 1458 return menuTargetSecuritySpace_; 1459 } 1460 GetMenuItemFocusedBgColor()1461 Color GetMenuItemFocusedBgColor() const 1462 { 1463 return menuItemFocusedBgColor_; 1464 } 1465 GetMenuItemFocusedTextColor()1466 Color GetMenuItemFocusedTextColor() const 1467 { 1468 return menuItemFocusedTextColor_; 1469 } 1470 GetMenuItemFocusedShadowStyle()1471 uint32_t GetMenuItemFocusedShadowStyle() const 1472 { 1473 return menuItemFocusedShadowStyle_; 1474 } 1475 GetSelectFocusStyleType_()1476 double GetSelectFocusStyleType_() const 1477 { 1478 return selectFocusStyleType_; 1479 } 1480 GetOptionFocusStyleType_()1481 double GetOptionFocusStyleType_() const 1482 { 1483 return optionFocusStyleType_; 1484 } 1485 GetMenuBackgroundBlurStyle()1486 int GetMenuBackgroundBlurStyle() const 1487 { 1488 return menuBackgroundBlurStyle_; 1489 } 1490 1491 private: 1492 Color disabledColor_; 1493 Color clickedColor_; 1494 Color selectedColor_; 1495 1496 Color backgroundColor_ = Color::WHITE; 1497 Color backgroundColorButton_ = Color::WHITE; 1498 Color disabledBackgroundColor_; 1499 Color hoverColor_ = Color(0x0c000000); 1500 Color selectedColorText_ = Color(0xff0a59f7); 1501 Color lineColor_ = Color(0x33000000); 1502 Color spinnerColor_ = Color(0xE5182431); 1503 Color disabledSpinnerColor_; 1504 Color spinnerSymbolColor_ = Color(0xff182431); 1505 Color disabledSpinnerSymbolColor_; 1506 uint32_t spinnerSource_ = 983615; 1507 Color menuIconColor_ = Color(0x99182431); 1508 Color menuFontColor_; 1509 Color disabledMenuFontColor_; 1510 Color menuTitleFontColor_; 1511 1512 bool allowScale_ = true; 1513 Dimension fontSize_; 1514 Color fontColor_; 1515 Color disabledFontColor_; 1516 double disabledFontColorAlpha_ = 0.0; 1517 Color secondaryFontColor_; 1518 std::string fontFamily_; 1519 FontWeight fontWeight_ { FontWeight::NORMAL }; 1520 TextDecoration textDecoration_ { TextDecoration::NONE }; 1521 1522 std::size_t optionSize_ { 0 }; 1523 Dimension rrectSize_; 1524 Dimension iconSize_; 1525 Dimension normalPadding_; 1526 1527 Dimension popupRRectSize_; 1528 Dimension popupBorderWidth_; 1529 Dimension popupShadowWidth_; 1530 Dimension popupMinWidth_; 1531 1532 Dimension titleLeftPadding_; 1533 Dimension titleTopPadding_; 1534 Dimension titleRightPadding_; 1535 Dimension titleBottomPadding_; 1536 Dimension horizontalSpacing_; 1537 Dimension verticalSpacing_; 1538 Dimension contentSpacing_; 1539 Dimension optionInterval_; 1540 Dimension optionMinHeight_; 1541 1542 Dimension selectBorderRadius_; 1543 Dimension menuBorderRadius_; 1544 Dimension innerBorderRadius_; 1545 Dimension menuFontSize_; 1546 Dimension menuTitleFontSize_; 1547 Dimension menuTitleHeight_; 1548 Dimension menuIconPadding_; 1549 Dimension menuItemHorIntervalPadding_; 1550 Dimension menuPadding_; 1551 Dimension iconContentPadding_; 1552 Dimension dividerPaddingVertical_; 1553 1554 Dimension selectMenuPadding_; 1555 Dimension outPadding_; 1556 Dimension defaultPaddingStart_; 1557 Dimension defaultPaddingEnd_; 1558 Dimension defaultPaddingTop_; 1559 Dimension defaultPaddingBottomFixed_; 1560 Dimension contentSpinnerPadding_; 1561 Dimension menuAnimationOffset_; 1562 Dimension spinnerWidth_; 1563 Dimension spinnerHeight_; 1564 Dimension defaultDividerWidth_; 1565 1566 Dimension selectMinWidth_; 1567 Dimension selectDefaultHeight_; 1568 Dimension iconSideLength_; 1569 Dimension endIconWidth_; 1570 Dimension endIconHeight_; 1571 Dimension contentMargin_; 1572 1573 Color tvFocusTextColor_; 1574 Color tvNormalBackColor_; 1575 Color tvBackColor_; 1576 1577 Color focusedDisableColor_; 1578 Color normalDisableColor_; 1579 Color focusedTextDisableColor_; 1580 Color normalTextDisableColor_; 1581 1582 TextStyle titleStyle_; 1583 TextStyle optionTextStyle_; 1584 bool isTV_ = false; 1585 uint32_t menuShowTime_ = 0; 1586 uint32_t selectShowTime_ = 0; 1587 uint32_t menuHideTime_ = 0; 1588 uint32_t selectHideTime_ = 0; 1589 int32_t hoverAnimationDuration_ = 0; 1590 int32_t pressAnimationDuration_ = 0; 1591 1592 Edge optionPadding_; 1593 1594 Color selectDefaultBgColor_; 1595 Dimension selectDefaultBorderRadius_; 1596 bool expandDisplay_ = false; 1597 Dimension maxPaddingStart_; 1598 Dimension maxPaddingEnd_; 1599 std::unordered_map<ControlSize, Dimension> selectMinWidthMap_; 1600 std::unordered_map<ControlSize, Dimension> selectMinHeightMap_; 1601 std::unordered_map<ControlSize, Dimension> selectBorderRadiusMap_; 1602 std::unordered_map<ControlSize, Dimension> selectSpinnerWidthMap_; 1603 std::unordered_map<ControlSize, Dimension> selectSpinnerHeightMap_; 1604 std::unordered_map<ControlSize, Dimension> selectFontSizeMap_; 1605 Dimension menuLargeMargin_; 1606 Dimension menuMediumMargin_; 1607 Dimension menuItemChildMinHeight_; 1608 Dimension menuItemVerticalPadding_; 1609 Dimension menuItemGroupTitleTextFontSize_; 1610 Dimension menuDefaultRadius_; 1611 Dimension menuDefaultInnerRadius_; 1612 Dimension menuDefaultWidth_; 1613 Dimension menuMinWidth_; 1614 Dimension menuMaxWidth_; 1615 double menuMaxWidthRatio_; 1616 Color menuTextColor_; 1617 uint32_t menuItemContentAlign_ = CONTENT_ALIGN_LEFT; 1618 Dimension selectNormalBorderWidth_; 1619 Color selectNormalBorderColor_; 1620 Color selectFocusedTextColor_; 1621 Color selectFocusedBackgroundColor_; 1622 ShadowStyle selectNormalShadow_; 1623 ShadowStyle selectFocusedShadow_; 1624 double selectHoverOrFocusedScale_; 1625 Dimension menuNormalBorderWidth_; 1626 Color menuNormalBorderColor_; 1627 int menuNormalBackgroundBlurStyle_; 1628 Dimension optionNormalTopBottomMargin_; 1629 Dimension optionContentNormalLeftRightPadding_; 1630 uint32_t optionContentNormalAlign_; 1631 Dimension optionFocusedLeftRightMargin_; 1632 Color optionFocusedBackgroundColor_; 1633 uint32_t optionFocusedShadow_; 1634 Color optionFocusedFontColor_; 1635 uint32_t shadowNormal_; // no shadow 1636 Color optionSelectedBorderColor_; 1637 Dimension optionSelectedBorderWidth_; 1638 Dimension optionNormalWidth_; 1639 Dimension selectedFontSizeText; 1640 Dimension selectNormalLeftRightMargin_ = 8.0_vp; 1641 bool menuBlendBgColor_ = false; 1642 Dimension optionFocusedBoxPadding_ = 0.0_vp; 1643 Color spinnerFocusedSymbolColor_ = Color(0xff182431); 1644 Color spinnerFocusedColor_ = Color(0xE5182431); 1645 bool optionApplyFocusedStyle_ = false; 1646 bool isSlideMoreOffset_ = false; 1647 bool defaultShowDivider_ = false; 1648 uint32_t menuItemFocusedShadowStyle_; 1649 Dimension defaultDividerStartMargin_; 1650 Dimension defaultDividerEndMargin_; 1651 Dimension menuItemTopBottomMargin_; 1652 Dimension menuItemLeftRightMargin_; 1653 Dimension menuTargetSecuritySpace_; 1654 Color menuItemFocusedBgColor_; 1655 Color menuItemFocusedTextColor_; 1656 double selectFocusStyleType_ = 0.0; 1657 double optionFocusStyleType_ = 0.0; 1658 bool menuNeedFocus_ = false; 1659 int menuBackgroundBlurStyle_ = static_cast<int>(BlurStyle::COMPONENT_ULTRA_THICK); 1660 }; 1661 1662 } // namespace OHOS::Ace 1663 1664 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SELECT_SELECT_THEME_H 1665