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/calc_length.h" 28 #include "core/components_ng/property/border_property.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 Dimension VERTICAL_INTERVAL = 14.4_vp; 37 constexpr Dimension MENU_END_ICON_WIDTH = 24.0_vp; 38 constexpr Dimension MENU_END_ICON_HEIGHT = 24.0_vp; 39 constexpr Dimension DEFAULT_MENU_WIDTH = 0.0_vp; 40 constexpr Dimension MIN_MENU_WIDTH = 64.0_vp; 41 constexpr double TITLE_LEFT_PADDING = 16.0; 42 constexpr double TITLE_TOP_PADDING = 8.0; 43 constexpr double TITLE_RIGHT_PADDING = 8.0; 44 constexpr double TITLE_BOTTOM_PADDING = 16.0; 45 constexpr double SELECT_OPTION_INTERVAL = 6.0; 46 47 /** 48 * SelectTheme defines color and styles of SelectComponent. SelectTheme should be build 49 * using SelectTheme::Builder. 50 */ 51 class SelectTheme final : public virtual Theme { 52 DECLARE_ACE_TYPE(SelectTheme, Theme); 53 54 public: 55 class Builder final { 56 public: 57 Builder() = default; 58 ~Builder() = default; 59 Build(const RefPtr<ThemeConstants> & themeConstants)60 RefPtr<SelectTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const 61 { 62 RefPtr<SelectTheme> theme = AceType::Claim(new SelectTheme()); 63 if (!themeConstants) { 64 return theme; 65 } 66 ParseNewPattern(themeConstants, theme); 67 Parse(themeConstants, theme); 68 return theme; 69 } 70 Parse(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<SelectTheme> & theme)71 void Parse(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<SelectTheme>& theme) const 72 { 73 if (!theme) { 74 return; 75 } 76 RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_SELECT); 77 if (!pattern) { 78 LOGE("Pattern of select is null, please check!"); 79 return; 80 } 81 const double defaultTextColorAlpha = 0.9; 82 const double defaultDisabledColorAlpha = 0.4; 83 const double defaultSecondaryColorAlpha = 0.6; 84 const double defaultTertiaryColorAlpha = 0.6; 85 const double bgColorSelectedAlpha = 0.2; 86 87 theme->fontColor_ = 88 pattern->GetAttr<Color>("text_color", theme->fontColor_) 89 .BlendOpacity(pattern->GetAttr<double>("menu_text_primary_alpha", defaultTextColorAlpha)); 90 theme->disabledFontColorAlpha_ = 91 pattern->GetAttr<double>("color_disabled_alpha", defaultDisabledColorAlpha); 92 theme->secondaryFontColor_ = 93 pattern->GetAttr<Color>(PATTERN_TEXT_COLOR, theme->fontColor_) 94 .BlendOpacity(pattern->GetAttr<double>("menu_text_secondary_alpha", defaultSecondaryColorAlpha)); 95 theme->disabledMenuFontColor_ = theme->menuFontColor_.BlendOpacity( 96 pattern->GetAttr<double>("menu_text_tertiary_alpha", defaultTertiaryColorAlpha)); 97 theme->selectedColor_ = 98 pattern->GetAttr<Color>(PATTERN_BG_COLOR_SELECTED, theme->selectedColor_) 99 .BlendOpacity(pattern->GetAttr<double>("bg_color_selected_alpha", bgColorSelectedAlpha)); 100 theme->fontSize_ = pattern->GetAttr<Dimension>(PATTERN_TEXT_SIZE, theme->fontSize_); 101 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 102 theme->selectFontSizeMap_.insert( 103 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->fontSize_)); 104 theme->selectFontSizeMap_.insert(std::pair<ControlSize, Dimension>( 105 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_text_font_size", 0.0_vp))); 106 } 107 theme->menuFontSize_ = pattern->GetAttr<Dimension>("menu_text_font_size", theme->menuFontSize_); 108 theme->menuTitleFontSize_ = 109 pattern->GetAttr<Dimension>("menu_title_text_font_size", theme->menuTitleFontSize_); 110 theme->menuTitleFontColor_ = pattern->GetAttr<Color>(PATTERN_TEXT_COLOR, theme->menuTitleFontColor_); 111 theme->menuTitleHeight_ = pattern->GetAttr<Dimension>("menu_title_height", theme->menuTitleHeight_); 112 theme->spinnerSource_ = themeConstants->GetSymbolByName("sys.symbol.arrowtriangle_down_fill"); 113 ParsePartOne(theme, pattern); 114 ParsePartTwo(theme, pattern); 115 } 116 ParseNewPattern(const RefPtr<ThemeConstants> & themeConstants,const RefPtr<SelectTheme> & theme)117 void ParseNewPattern(const RefPtr<ThemeConstants>& themeConstants, const RefPtr<SelectTheme>& theme) const 118 { 119 if (!theme) { 120 return; 121 } 122 RefPtr<ThemeStyle> pattern = themeConstants->GetPatternByName(THEME_PATTERN_SELECT); 123 if (!pattern) { 124 LOGE("Pattern of select is null, please check!"); 125 return; 126 } 127 theme->disabledColor_ = pattern->GetAttr<Color>("select_color_text_primary", Color(0x5C000000)); 128 theme->clickedColor_ = pattern->GetAttr<Color>("select_clicked_color", Color(0x19000000)); 129 theme->selectedColor_ = pattern->GetAttr<Color>("select_selected_color", Color(0x19254FF7)); 130 theme->fontFamily_ = "sans-serif"; 131 theme->fontSize_ = pattern->GetAttr<Dimension>("text_font_size", 16.0_fp); 132 theme->fontColor_ = pattern->GetAttr<Color>("select_font_color", Color(0xe5000000)); 133 theme->fontWeight_ = FontWeight::NORMAL; 134 theme->textDecoration_ = TextDecoration::NONE; 135 auto optionSize = pattern->GetAttr<int>("select_option_show_count", INT32_MAX); 136 theme->optionSize_ = optionSize < 0 ? theme->optionSize_ : static_cast<size_t>(optionSize); 137 theme->rrectSize_ = pattern->GetAttr<Dimension>("select_itself_rrect_size", 8.0_vp); 138 theme->popupBorderWidth_ = pattern->GetAttr<Dimension>("select_popup_border_width", 2.0_vp); 139 theme->popupShadowWidth_ = pattern->GetAttr<Dimension>("select_popup_shadow_width", 60.0_vp); 140 theme->popupRRectSize_ = pattern->GetAttr<Dimension>("select_popup_rrect_size", 16.0_vp); 141 theme->popupMinWidth_ = pattern->GetAttr<Dimension>("select_popup_min_width", 136.0_vp); 142 theme->normalPadding_ = pattern->GetAttr<Dimension>("select_normal_padding", 16.0_vp); 143 theme->iconSize_ = pattern->GetAttr<Dimension>("select_itself_icon_size", 8.0_vp); 144 theme->isTV_ = pattern->GetAttr<int>("select_is_tv", 0); 145 theme->horizontalSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_horizontal", 24.0_vp); 146 theme->verticalSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_vertical", 27.0_vp); 147 theme->contentSpacing_ = pattern->GetAttr<Dimension>("select_popup_spacing_content", 0.0_vp); 148 theme->selectShowTime_ = 250; // unit is ms. 149 theme->selectHideTime_ = 250; // unit is ms. 150 theme->menuShowTime_ = 250; // unit is ms. 151 theme->menuHideTime_ = 250; // unit is ms. 152 theme->hoverAnimationDuration_ = 250; 153 theme->pressAnimationDuration_ = 100; 154 155 ParseAttribute(theme, pattern); 156 } 157 158 private: ParsePartOne(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)159 void ParsePartOne(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 160 { 161 theme->disabledFontColor_ = theme->fontColor_.BlendOpacity(theme->disabledFontColorAlpha_); 162 theme->menuFontColor_ = pattern->GetAttr<Color>("text_color", theme->menuFontColor_); 163 theme->clickedColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_CLICKED, theme->clickedColor_); 164 theme->selectedColorText_ = pattern->GetAttr<Color>(PATTERN_TEXT_COLOR_SELECTED, theme->selectedColorText_); 165 theme->hoverColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_HOVERED, theme->hoverColor_); 166 theme->backgroundColor_ = pattern->GetAttr<Color>("bg_color", theme->backgroundColor_); 167 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 168 theme->backgroundColorButton_ = 169 pattern->GetAttr<Color>("bg_color_select_button", theme->backgroundColorButton_); 170 } 171 theme->disabledBackgroundColor_ = 172 theme->disabledBackgroundColor_.BlendOpacity(theme->disabledFontColorAlpha_); 173 theme->lineColor_ = pattern->GetAttr<Color>("line_color", theme->lineColor_); 174 theme->spinnerColor_ = pattern->GetAttr<Color>("select_icon_color", theme->spinnerColor_); 175 theme->disabledSpinnerColor_ = theme->spinnerColor_.BlendOpacity(theme->disabledFontColorAlpha_); 176 theme->spinnerSymbolColor_ = pattern->GetAttr<Color>("select_symbol_color", theme->spinnerSymbolColor_); 177 theme->disabledSpinnerSymbolColor_ = 178 theme->spinnerSymbolColor_.BlendOpacity(theme->disabledFontColorAlpha_); 179 theme->selectBorderRadius_ = pattern->GetAttr<Dimension>("border_radius", theme->selectBorderRadius_); 180 theme->menuBorderRadius_ = pattern->GetAttr<Dimension>("menu_border_radius", theme->menuBorderRadius_); 181 theme->innerBorderRadius_ = pattern->GetAttr<Dimension>("inner_border_radius", theme->innerBorderRadius_); 182 theme->menuIconPadding_ = pattern->GetAttr<Dimension>("menu_icon_padding", theme->menuIconPadding_); 183 theme->iconContentPadding_ = 184 pattern->GetAttr<Dimension>("icon_content_padding", theme->iconContentPadding_); 185 theme->menuIconColor_ = pattern->GetAttr<Color>("menu_icon_color", theme->menuIconColor_); 186 theme->dividerPaddingVertical_ = 187 pattern->GetAttr<Dimension>("divider_padding_vertical", theme->dividerPaddingVertical_); 188 theme->optionMinHeight_ = pattern->GetAttr<Dimension>("option_min_height", theme->optionMinHeight_); 189 theme->selectMenuPadding_ = pattern->GetAttr<Dimension>("select_menu_padding", theme->selectMenuPadding_); 190 theme->outPadding_ = pattern->GetAttr<Dimension>("out_padding", theme->outPadding_); 191 theme->defaultPaddingStart_ = 192 pattern->GetAttr<Dimension>("default_padding_start", theme->defaultPaddingStart_); 193 theme->defaultPaddingEnd_ = pattern->GetAttr<Dimension>("default_padding_end", theme->defaultPaddingEnd_); 194 theme->defaultPaddingTop_ = pattern->GetAttr<Dimension>("default_padding_top", theme->defaultPaddingTop_); 195 theme->defaultPaddingBottomFixed_ = 196 pattern->GetAttr<Dimension>("default_padding_bottom_fixed", theme->defaultPaddingBottomFixed_); 197 theme->contentSpinnerPadding_ = 198 pattern->GetAttr<Dimension>("content_spinner_padding", theme->contentSpinnerPadding_); 199 theme->menuAnimationOffset_ = 200 pattern->GetAttr<Dimension>("menu_animation_offset", theme->menuAnimationOffset_); 201 theme->spinnerWidth_ = pattern->GetAttr<Dimension>("spinner_width", theme->spinnerWidth_); 202 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 203 theme->selectSpinnerWidthMap_.insert( 204 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->spinnerWidth_)); 205 theme->selectSpinnerWidthMap_.insert(std::pair<ControlSize, Dimension>( 206 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_spinner_width", 0.0_vp))); 207 } 208 } 209 ParsePartTwo(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)210 void ParsePartTwo(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 211 { 212 theme->spinnerHeight_ = pattern->GetAttr<Dimension>("spinner_height", theme->spinnerHeight_); 213 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 214 theme->selectSpinnerHeightMap_.insert( 215 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->spinnerHeight_)); 216 theme->selectSpinnerHeightMap_.insert(std::pair<ControlSize, Dimension>( 217 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_spinner_height", 0.0_vp))); 218 } 219 theme->defaultDividerWidth_ = 220 pattern->GetAttr<Dimension>("default_divider_width", theme->defaultDividerWidth_); 221 theme->selectMinWidth_ = pattern->GetAttr<Dimension>("select_min_width", theme->selectMinWidth_); 222 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 223 theme->selectMinWidthMap_.insert(std::pair<ControlSize, Dimension>( 224 ControlSize::NORMAL, pattern->GetAttr<Dimension>("normal_select_min_width", 0.0_vp))); 225 theme->selectMinWidthMap_.insert(std::pair<ControlSize, Dimension>( 226 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_min_width", 0.0_vp))); 227 } 228 theme->selectDefaultHeight_ = pattern->GetAttr<Dimension>("select_min_height", theme->selectDefaultHeight_); 229 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 230 theme->selectMinHeightMap_.insert( 231 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->selectDefaultHeight_)); 232 theme->selectMinHeightMap_.insert(std::pair<ControlSize, Dimension>( 233 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_min_height", 0.0_vp))); 234 } 235 theme->iconSideLength_ = pattern->GetAttr<Dimension>("icon_side_length", theme->iconSideLength_); 236 theme->endIconWidth_ = MENU_END_ICON_WIDTH; 237 theme->endIconHeight_ = MENU_END_ICON_HEIGHT; 238 theme->contentMargin_ = pattern->GetAttr<Dimension>("content_margin", theme->contentMargin_); 239 theme->selectDefaultBgColor_ = 240 pattern->GetAttr<Color>("select_default_bg_color", theme->selectDefaultBgColor_); 241 theme->selectDefaultBorderRadius_ = 242 pattern->GetAttr<Dimension>("select_default_border_radius", theme->selectDefaultBorderRadius_); 243 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 244 theme->selectBorderRadiusMap_.insert( 245 std::pair<ControlSize, Dimension>(ControlSize::NORMAL, theme->selectDefaultBorderRadius_)); 246 theme->selectBorderRadiusMap_.insert(std::pair<ControlSize, Dimension>( 247 ControlSize::SMALL, pattern->GetAttr<Dimension>("small_select_border_radius", 0.0_vp))); 248 } 249 if (Container::LessThanAPIVersion(PlatformVersion::VERSION_ELEVEN)) { 250 theme->expandDisplay_ = false; 251 } else { 252 std::string expandDisplay = pattern->GetAttr<std::string>("menu_expand_display", ""); 253 if (expandDisplay == "true") { 254 theme->expandDisplay_ = true; 255 } else { 256 theme->expandDisplay_ = false; 257 } 258 } 259 theme->maxPaddingStart_ = pattern->GetAttr<Dimension>("max_padding_start", theme->maxPaddingStart_); 260 theme->maxPaddingEnd_ = pattern->GetAttr<Dimension>("max_padding_end", theme->maxPaddingEnd_); 261 } 262 ParseAttribute(const RefPtr<SelectTheme> & theme,const RefPtr<ThemeStyle> & pattern)263 void ParseAttribute(const RefPtr<SelectTheme>& theme, const RefPtr<ThemeStyle>& pattern) const 264 { 265 theme->titleLeftPadding_ = Dimension(TITLE_LEFT_PADDING, DimensionUnit::VP); 266 theme->titleTopPadding_ = Dimension(TITLE_TOP_PADDING, DimensionUnit::VP); 267 theme->titleRightPadding_ = Dimension(TITLE_RIGHT_PADDING, DimensionUnit::VP); 268 theme->titleBottomPadding_ = Dimension(TITLE_BOTTOM_PADDING, DimensionUnit::VP); 269 theme->titleStyle_.SetFontSize(pattern->GetAttr<Dimension>("text_size_headline7", 24.0_vp)); 270 std::vector<std::string> families; 271 families.emplace_back("sans-serif"); 272 theme->titleStyle_.SetFontFamilies(families); 273 theme->titleStyle_.SetFontWeight(FontWeight::W500); 274 theme->titleStyle_.SetTextColor(pattern->GetAttr<Color>("select_font_color", Color(0xe5000000))); 275 theme->titleStyle_.SetTextDecoration(TextDecoration::NONE); 276 theme->optionPadding_ = Edge(SELECT_OPTION_LEFT_LENGTH, SELECT_OPTION_TOP_LENGTH, 277 SELECT_OPTION_RIGHT_LENGTH, SELECT_OPTION_BOTTOM_LENGTH, DimensionUnit::VP); 278 theme->optionInterval_ = theme->isTV_ ? Dimension(SELECT_OPTION_INTERVAL, DimensionUnit::VP) : 0.0_vp; 279 theme->tvFocusTextColor_ = Color(0xE6000000); 280 theme->tvNormalBackColor_ = Color(0x33FFFFFF); 281 theme->tvBackColor_ = (theme->isTV_ ? Color(0x99000000) : Color::TRANSPARENT); 282 // disabled color 283 theme->normalDisableColor_ = pattern->GetAttr<Color>("select_option_disable_color", Color(0x32FFFFFF)); 284 theme->focusedDisableColor_ = 285 pattern->GetAttr<Color>("select_option_focused_disable_color", Color(0x5DFFFFFF)); 286 theme->normalTextDisableColor_ = 287 pattern->GetAttr<Color>("select_option_focused_disable_color", Color(0x5DFFFFFF)); 288 theme->focusedTextDisableColor_ = 289 pattern->GetAttr<Color>("select_option_focused_disable_text_color", Color(0x66000000)); 290 theme->optionTextStyle_.SetFontSize(pattern->GetAttr<Dimension>("text_font_size", 16.0_fp)); 291 theme->optionTextStyle_.SetFontFamilies({ pattern->GetAttr<std::string>("text_font_family_regular", 292 "sans-serif") }); 293 theme->optionTextStyle_.SetFontWeight(FontWeight::NORMAL); 294 theme->optionTextStyle_.SetTextColor(pattern->GetAttr<Color>("select_font_color", Color(0xe5000000))); 295 theme->optionTextStyle_.SetTextDecoration(TextDecoration::NONE); 296 theme->menuLargeMargin_ = pattern->GetAttr<Dimension>("menu_large_margin", theme->menuLargeMargin_); 297 theme->menuMediumMargin_ = pattern->GetAttr<Dimension>("menu_medium_margin", theme->menuMediumMargin_); 298 theme->menuItemChildMinHeight_ = pattern->GetAttr<Dimension>("menu_item_child_min_height", 32.0_vp); 299 theme->menuItemVerticalPadding_ = pattern->GetAttr<Dimension>("menu_item_vertical_padding", 8.0_vp); 300 theme->menuItemGroupTitleTextFontSize_ = 301 pattern->GetAttr<Dimension>("menu_item_group_title_text_font_size", 18.0_vp); 302 theme->menuDefaultRadius_ = pattern->GetAttr<Dimension>("menu_border_radius_new", 20.0_vp); 303 theme->menuDefaultInnerRadius_ = pattern->GetAttr<Dimension>("inner_border_radius_new", 16.0_vp); 304 theme->menuTextColor_= pattern->GetAttr<Color>("menu_text_color", Color(0xe5000000)); 305 theme->menuDefaultWidth_ = pattern->GetAttr<Dimension>("menu_default_width", 160.0_vp); 306 theme->menuMinWidth_ = pattern->GetAttr<Dimension>("menu_min_width", 64.0_vp); 307 theme->menuMaxWidth_ = pattern->GetAttr<Dimension>("menu_max_width", 224.0_vp); 308 theme->menuMaxWidthRatio_ = pattern->GetAttr<double>("menu_max_width_ratio", 0.67f); 309 } 310 }; 311 312 ~SelectTheme() override = default; 313 clone()314 RefPtr<SelectTheme> clone() 315 { 316 RefPtr<SelectTheme> theme = AceType::Claim(new SelectTheme()); 317 ClonePartOne(theme); 318 ClonePartTwo(theme); 319 ClonePartThree(theme); 320 return theme; 321 } 322 ClonePartOne(RefPtr<SelectTheme> & theme)323 void ClonePartOne(RefPtr<SelectTheme>& theme) 324 { 325 theme->disabledColor_ = disabledColor_; 326 theme->clickedColor_ = clickedColor_; 327 theme->selectedColor_ = selectedColor_; 328 theme->fontSize_ = fontSize_; 329 theme->fontFamily_ = fontFamily_; 330 theme->fontColor_ = fontColor_; 331 theme->disabledFontColor_ = disabledFontColor_; 332 theme->disabledFontColorAlpha_ = disabledFontColorAlpha_; 333 theme->secondaryFontColor_ = secondaryFontColor_; 334 theme->fontWeight_ = fontWeight_; 335 theme->textDecoration_ = textDecoration_; 336 theme->rrectSize_ = rrectSize_; 337 theme->iconSize_ = iconSize_; 338 theme->normalPadding_ = normalPadding_; 339 theme->optionSize_ = optionSize_; 340 theme->popupRRectSize_ = popupRRectSize_; 341 theme->popupMinWidth_ = popupMinWidth_; 342 theme->popupShadowWidth_ = popupShadowWidth_; 343 theme->popupBorderWidth_ = popupBorderWidth_; 344 theme->titleLeftPadding_ = titleLeftPadding_; 345 theme->titleTopPadding_ = titleTopPadding_; 346 theme->titleRightPadding_ = titleRightPadding_; 347 theme->titleBottomPadding_ = titleBottomPadding_; 348 theme->titleStyle_ = titleStyle_; 349 theme->isTV_ = isTV_; 350 theme->horizontalSpacing_ = horizontalSpacing_; 351 theme->verticalSpacing_ = verticalSpacing_; 352 theme->contentSpacing_ = contentSpacing_; 353 theme->menuHideTime_ = menuHideTime_; 354 theme->menuShowTime_ = menuShowTime_; 355 theme->selectShowTime_ = selectShowTime_; 356 theme->selectHideTime_ = selectHideTime_; 357 theme->hoverAnimationDuration_ = hoverAnimationDuration_; 358 theme->pressAnimationDuration_ = pressAnimationDuration_; 359 theme->optionPadding_ = optionPadding_; 360 theme->optionInterval_ = optionInterval_; 361 theme->optionMinHeight_ = optionMinHeight_; 362 theme->tvFocusTextColor_ = tvFocusTextColor_; 363 theme->tvNormalBackColor_ = tvNormalBackColor_; 364 } 365 ClonePartTwo(RefPtr<SelectTheme> & theme)366 void ClonePartTwo(RefPtr<SelectTheme>& theme) 367 { 368 theme->tvBackColor_ = tvBackColor_; 369 theme->focusedDisableColor_ = focusedDisableColor_; 370 theme->normalDisableColor_ = normalDisableColor_; 371 theme->focusedTextDisableColor_ = focusedTextDisableColor_; 372 theme->normalTextDisableColor_ = normalTextDisableColor_; 373 theme->spinnerColor_ = spinnerColor_; 374 theme->disabledSpinnerColor_ = disabledSpinnerColor_; 375 theme->spinnerSymbolColor_ = spinnerSymbolColor_; 376 theme->disabledSpinnerSymbolColor_ = disabledSpinnerSymbolColor_; 377 theme->spinnerSource_ = spinnerSource_; 378 theme->backgroundColor_ = backgroundColor_; 379 theme->backgroundColorButton_ = backgroundColorButton_; 380 theme->disabledBackgroundColor_ = disabledBackgroundColor_; 381 theme->hoverColor_ = hoverColor_; 382 theme->selectedColorText_ = selectedColorText_; 383 theme->lineColor_ = lineColor_; 384 theme->optionTextStyle_ = optionTextStyle_; 385 theme->selectBorderRadius_ = selectBorderRadius_; 386 theme->menuBorderRadius_ = menuBorderRadius_; 387 theme->innerBorderRadius_ = innerBorderRadius_; 388 theme->menuFontSize_ = menuFontSize_; 389 theme->menuTitleFontSize_ = menuTitleFontSize_; 390 theme->menuTitleFontColor_ = menuTitleFontColor_; 391 theme->menuTitleHeight_ = menuTitleHeight_; 392 theme->menuFontColor_ = menuFontColor_; 393 theme->disabledMenuFontColor_ = disabledMenuFontColor_; 394 theme->menuIconPadding_ = menuIconPadding_; 395 theme->iconContentPadding_ = iconContentPadding_; 396 theme->dividerPaddingVertical_ = dividerPaddingVertical_; 397 theme->menuIconColor_ = menuIconColor_; 398 theme->optionMinHeight_ = optionMinHeight_; 399 theme->selectMenuPadding_ = selectMenuPadding_; 400 theme->outPadding_ = outPadding_; 401 theme->defaultPaddingStart_ = defaultPaddingStart_; 402 theme->defaultPaddingEnd_ = defaultPaddingEnd_; 403 theme->defaultPaddingTop_ = defaultPaddingTop_; 404 theme->defaultPaddingBottomFixed_ = defaultPaddingBottomFixed_; 405 theme->contentSpinnerPadding_ = contentSpinnerPadding_; 406 theme->menuAnimationOffset_ = menuAnimationOffset_; 407 theme->spinnerWidth_ = spinnerWidth_; 408 theme->spinnerHeight_ = spinnerHeight_; 409 } 410 ClonePartThree(RefPtr<SelectTheme> & theme)411 void ClonePartThree(RefPtr<SelectTheme>& theme) 412 { 413 theme->defaultDividerWidth_ = defaultDividerWidth_; 414 theme->selectMinWidth_ = selectMinWidth_; 415 theme->selectDefaultHeight_ = selectDefaultHeight_; 416 theme->iconSideLength_ = iconSideLength_; 417 theme->endIconWidth_ = endIconWidth_; 418 theme->endIconHeight_ = endIconHeight_; 419 theme->contentMargin_ = contentMargin_; 420 theme->expandDisplay_ = expandDisplay_; 421 theme->maxPaddingStart_ = maxPaddingStart_; 422 theme->maxPaddingEnd_ = maxPaddingEnd_; 423 theme->selectDefaultBgColor_ = selectDefaultBgColor_; 424 theme->selectDefaultBorderRadius_ = selectDefaultBorderRadius_; 425 theme->menuLargeMargin_ = menuLargeMargin_; 426 theme->menuMediumMargin_ = menuMediumMargin_; 427 theme->menuItemChildMinHeight_ = menuItemChildMinHeight_; 428 theme->menuItemVerticalPadding_ = menuItemVerticalPadding_; 429 theme->menuItemGroupTitleTextFontSize_ = menuItemGroupTitleTextFontSize_; 430 theme->menuDefaultRadius_ = menuDefaultRadius_; 431 theme->menuDefaultInnerRadius_ = menuDefaultInnerRadius_; 432 theme->menuTextColor_ = menuTextColor_; 433 theme->menuDefaultWidth_ = menuDefaultWidth_; 434 theme->menuMinWidth_ = menuMinWidth_; 435 theme->menuMaxWidth_ = menuMaxWidth_; 436 theme->menuMaxWidthRatio_ = menuMaxWidthRatio_; 437 } 438 GetSelectedColorText()439 const Color& GetSelectedColorText() const 440 { 441 return selectedColorText_; 442 } 443 GetHoverColor()444 const Color& GetHoverColor() const 445 { 446 return hoverColor_; 447 } 448 GetBackgroundColor()449 const Color& GetBackgroundColor() const 450 { 451 return backgroundColor_; 452 } 453 GetButtonBackgroundColor()454 const Color& GetButtonBackgroundColor() const 455 { 456 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 457 return backgroundColorButton_; 458 } 459 return backgroundColor_; 460 } 461 GetDisabledBackgroundColor()462 const Color& GetDisabledBackgroundColor() const 463 { 464 return disabledBackgroundColor_; 465 } 466 GetDisabledColor()467 const Color& GetDisabledColor() const 468 { 469 return disabledColor_; 470 } SetDisabledColor(const Color & value)471 void SetDisabledColor(const Color& value) 472 { 473 disabledColor_ = value; 474 } 475 GetClickedColor()476 const Color& GetClickedColor() const 477 { 478 return clickedColor_; 479 } SetClickedColor(const Color & value)480 void SetClickedColor(const Color& value) 481 { 482 clickedColor_ = value; 483 } 484 GetSelectedColor()485 const Color& GetSelectedColor() const 486 { 487 return selectedColor_; 488 } 489 SetSelectedColor(const Color & value)490 void SetSelectedColor(const Color& value) 491 { 492 selectedColor_ = value; 493 } 494 GetFontSize()495 const Dimension& GetFontSize() const 496 { 497 return fontSize_; 498 } 499 GetFontSize(ControlSize controlSize)500 const Dimension& GetFontSize(ControlSize controlSize) const 501 { 502 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 503 auto result = selectFontSizeMap_.find(controlSize); 504 if (result != selectFontSizeMap_.end()) { 505 return result->second; 506 } 507 } 508 return fontSize_; 509 } 510 SetFontSize(const Dimension & value)511 void SetFontSize(const Dimension& value) 512 { 513 fontSize_ = value; 514 } 515 GetFontColor()516 const Color& GetFontColor() const 517 { 518 return fontColor_; 519 } SetFontColor(const Color & value)520 void SetFontColor(const Color& value) 521 { 522 fontColor_ = value; 523 } 524 GetDisabledFontColor()525 const Color& GetDisabledFontColor() const 526 { 527 return disabledFontColor_; 528 } 529 GetDisabledFontColorAlpha()530 double GetDisabledFontColorAlpha() const 531 { 532 return disabledFontColorAlpha_; 533 } 534 GetSecondaryFontColor()535 const Color& GetSecondaryFontColor() const 536 { 537 return secondaryFontColor_; 538 } 539 GetFontFamily()540 const std::string& GetFontFamily() const 541 { 542 return fontFamily_; 543 } SetFontFamily(const std::string & value)544 void SetFontFamily(const std::string& value) 545 { 546 fontFamily_ = value; 547 } 548 GetFontWeight()549 FontWeight GetFontWeight() const 550 { 551 return fontWeight_; 552 } SetFontWeight(FontWeight value)553 void SetFontWeight(FontWeight value) 554 { 555 fontWeight_ = value; 556 } 557 GetTextDecoration()558 TextDecoration GetTextDecoration() const 559 { 560 return textDecoration_; 561 } SetTextDecoration(TextDecoration value)562 void SetTextDecoration(TextDecoration value) 563 { 564 textDecoration_ = value; 565 } 566 GetOptionSize()567 std::size_t GetOptionSize() const 568 { 569 return optionSize_; 570 } SetOptionSize(std::size_t value)571 void SetOptionSize(std::size_t value) 572 { 573 optionSize_ = value; 574 } 575 GetRRectSize()576 const Dimension& GetRRectSize() const 577 { 578 return rrectSize_; 579 } SetRRectSize(const Dimension & value)580 void SetRRectSize(const Dimension& value) 581 { 582 rrectSize_ = value; 583 } 584 GetPopupRRectSize()585 const Dimension& GetPopupRRectSize() const 586 { 587 return popupRRectSize_; 588 } SetPopupRRectSize(const Dimension & value)589 void SetPopupRRectSize(const Dimension& value) 590 { 591 popupRRectSize_ = value; 592 } 593 GetPopupBorderWidth()594 const Dimension& GetPopupBorderWidth() const 595 { 596 return popupBorderWidth_; 597 } SetPopupBorderWidth(const Dimension & value)598 void SetPopupBorderWidth(const Dimension& value) 599 { 600 popupBorderWidth_ = value; 601 } 602 GetPopupShadowWidth()603 const Dimension& GetPopupShadowWidth() const 604 { 605 return popupShadowWidth_; 606 } SetPopupShadowWidth(const Dimension & value)607 void SetPopupShadowWidth(const Dimension& value) 608 { 609 popupShadowWidth_ = value; 610 } 611 GetPopupMinWidth()612 const Dimension& GetPopupMinWidth() const 613 { 614 return popupMinWidth_; 615 } SetPopupMinWidth(const Dimension & value)616 void SetPopupMinWidth(const Dimension& value) 617 { 618 popupMinWidth_ = value; 619 } 620 GetNormalPadding()621 const Dimension& GetNormalPadding() const 622 { 623 return normalPadding_; 624 } SetNormalPadding(const Dimension & value)625 void SetNormalPadding(const Dimension& value) 626 { 627 normalPadding_ = value; 628 } 629 GetIconSize()630 const Dimension& GetIconSize() const 631 { 632 return iconSize_; 633 } SetIconSize(const Dimension & value)634 void SetIconSize(const Dimension& value) 635 { 636 iconSize_ = value; 637 } 638 GetTitleLeftPadding()639 const Dimension& GetTitleLeftPadding() const 640 { 641 return titleLeftPadding_; 642 } SetTitleLeftPadding(const Dimension & value)643 void SetTitleLeftPadding(const Dimension& value) 644 { 645 titleLeftPadding_ = value; 646 } 647 GetTitleTopPadding()648 const Dimension& GetTitleTopPadding() const 649 { 650 return titleTopPadding_; 651 } SetTitleTopPadding(const Dimension & value)652 void SetTitleTopPadding(const Dimension& value) 653 { 654 titleTopPadding_ = value; 655 } 656 GetTitleRightPadding()657 const Dimension& GetTitleRightPadding() const 658 { 659 return titleRightPadding_; 660 } SetTitleRightPadding(const Dimension & value)661 void SetTitleRightPadding(const Dimension& value) 662 { 663 titleRightPadding_ = value; 664 } 665 GetTitleBottomPadding()666 const Dimension& GetTitleBottomPadding() const 667 { 668 return titleBottomPadding_; 669 } SetTitleBottomPadding(const Dimension & value)670 void SetTitleBottomPadding(const Dimension& value) 671 { 672 titleBottomPadding_ = value; 673 } 674 GetTitleStyle()675 const TextStyle& GetTitleStyle() 676 { 677 return titleStyle_; 678 } SetTitleStyle(const TextStyle & value)679 void SetTitleStyle(const TextStyle& value) 680 { 681 titleStyle_ = value; 682 } 683 IsTV()684 bool IsTV() const 685 { 686 return isTV_; 687 } SetIsTV(bool isTV)688 void SetIsTV(bool isTV) 689 { 690 isTV_ = isTV; 691 } 692 GetHorizontalSpacing()693 const Dimension& GetHorizontalSpacing() const 694 { 695 return horizontalSpacing_; 696 } SetHorizontalSpacing(const Dimension & horizontalSpacing)697 void SetHorizontalSpacing(const Dimension& horizontalSpacing) 698 { 699 horizontalSpacing_ = horizontalSpacing; 700 } 701 GetVerticalSpacing()702 const Dimension& GetVerticalSpacing() const 703 { 704 return verticalSpacing_; 705 } SetVerticalSpacing(const Dimension & verticalSpacing)706 void SetVerticalSpacing(const Dimension& verticalSpacing) 707 { 708 verticalSpacing_ = verticalSpacing; 709 } 710 GetContentSpacing()711 const Dimension& GetContentSpacing() const 712 { 713 return contentSpacing_; 714 } SetContentSpacing(const Dimension & contentSpacing)715 void SetContentSpacing(const Dimension& contentSpacing) 716 { 717 contentSpacing_ = contentSpacing; 718 } 719 GetOptionPadding()720 const Edge& GetOptionPadding() const 721 { 722 return optionPadding_; 723 } SetOptionPadding(const Edge & value)724 void SetOptionPadding(const Edge& value) 725 { 726 optionPadding_ = value; 727 } 728 GetShowTime(bool isMenu)729 uint32_t GetShowTime(bool isMenu) const 730 { 731 if (isMenu) { 732 return menuShowTime_; 733 } else { 734 return selectShowTime_; 735 } 736 } 737 GetHideTime(bool isMenu)738 uint32_t GetHideTime(bool isMenu) const 739 { 740 if (isMenu) { 741 return menuHideTime_; 742 } else { 743 return selectHideTime_; 744 } 745 } 746 GetHoverAnimationDuration()747 int32_t GetHoverAnimationDuration() const 748 { 749 return hoverAnimationDuration_; 750 } 751 GetPressAnimationDuration()752 int32_t GetPressAnimationDuration() const 753 { 754 return pressAnimationDuration_; 755 } 756 757 SelectTheme() = default; 758 IsAllowScale()759 bool IsAllowScale() const 760 { 761 return allowScale_; 762 } 763 SetAllowScale(bool allowScale)764 void SetAllowScale(bool allowScale) 765 { 766 allowScale_ = allowScale; 767 } 768 GetOptionInterval()769 const Dimension& GetOptionInterval() const 770 { 771 return optionInterval_; 772 } 773 GetOptionMinHeight()774 const Dimension& GetOptionMinHeight() const 775 { 776 return optionMinHeight_; 777 } 778 GetTvFocusTextColor()779 const Color& GetTvFocusTextColor() const 780 { 781 return tvFocusTextColor_; 782 } 783 GetTvNormalBackColor()784 const Color& GetTvNormalBackColor() const 785 { 786 return tvNormalBackColor_; 787 } 788 GetTvBackColor()789 const Color& GetTvBackColor() const 790 { 791 return tvBackColor_; 792 } 793 GetFocusedDisableColor()794 const Color& GetFocusedDisableColor() const 795 { 796 return focusedDisableColor_; 797 } 798 GetNormalDisableColor()799 const Color& GetNormalDisableColor() const 800 { 801 return normalDisableColor_; 802 } 803 GetFocusedTextDisableColor()804 const Color& GetFocusedTextDisableColor() const 805 { 806 return focusedTextDisableColor_; 807 } 808 GetNormalTextDisableColor()809 const Color& GetNormalTextDisableColor() const 810 { 811 return normalTextDisableColor_; 812 } 813 GetSpinnerColor()814 const Color& GetSpinnerColor() const 815 { 816 return spinnerColor_; 817 } 818 GetDisabledSpinnerColor()819 const Color& GetDisabledSpinnerColor() const 820 { 821 return disabledSpinnerColor_; 822 } 823 GetSpinnerSymbolColor()824 const Color& GetSpinnerSymbolColor() const 825 { 826 return spinnerSymbolColor_; 827 } 828 GetDisabledSpinnerSymbolColor()829 const Color& GetDisabledSpinnerSymbolColor() const 830 { 831 return disabledSpinnerSymbolColor_; 832 } 833 GetSpinnerSource()834 const uint32_t& GetSpinnerSource() const 835 { 836 return spinnerSource_; 837 } 838 GetMenuIconColor()839 const Color& GetMenuIconColor() const 840 { 841 return menuIconColor_; 842 } 843 GetLineColor()844 const Color& GetLineColor() const 845 { 846 return lineColor_; 847 } 848 GetOptionTextStyle()849 const TextStyle& GetOptionTextStyle() const 850 { 851 return optionTextStyle_; 852 } 853 GetSelectBorderRadius()854 const Dimension& GetSelectBorderRadius() const 855 { 856 return selectBorderRadius_; 857 } 858 GetMenuBorderRadius()859 const Dimension& GetMenuBorderRadius() const 860 { 861 return menuBorderRadius_; 862 } 863 GetInnerBorderRadius()864 const Dimension& GetInnerBorderRadius() const 865 { 866 return innerBorderRadius_; 867 } 868 GetMenuFontSize()869 const Dimension& GetMenuFontSize() const 870 { 871 return menuFontSize_; 872 } 873 GetMenuTitleFontSize()874 const Dimension& GetMenuTitleFontSize() const 875 { 876 return menuTitleFontSize_; 877 } 878 GetMenuTitleFontColor()879 const Color& GetMenuTitleFontColor() const 880 { 881 return menuTitleFontColor_; 882 } 883 GetMenuTitleHeight()884 const Dimension& GetMenuTitleHeight() const 885 { 886 return menuTitleHeight_; 887 } 888 GetMenuFontColor()889 const Color& GetMenuFontColor() const 890 { 891 return menuFontColor_; 892 } 893 GetDisabledMenuFontColor()894 const Color& GetDisabledMenuFontColor() const 895 { 896 return disabledMenuFontColor_; 897 } SetDisabledMenuFontColor(const Color & value)898 void SetDisabledMenuFontColor(const Color& value) 899 { 900 disabledMenuFontColor_ = value; 901 } 902 GetMenuIconPadding()903 const Dimension& GetMenuIconPadding() const 904 { 905 return menuIconPadding_; 906 } 907 GetIconContentPadding()908 const Dimension& GetIconContentPadding() const 909 { 910 return iconContentPadding_; 911 } 912 GetDividerPaddingVertical()913 const Dimension& GetDividerPaddingVertical() const 914 { 915 return dividerPaddingVertical_; 916 } 917 GetSelectMenuPadding()918 const Dimension& GetSelectMenuPadding() const 919 { 920 return selectMenuPadding_; 921 } 922 GetOutPadding()923 const Dimension& GetOutPadding() const 924 { 925 return outPadding_; 926 } 927 GetDefaultPaddingStart()928 const Dimension& GetDefaultPaddingStart() const 929 { 930 return defaultPaddingStart_; 931 } 932 GetDefaultPaddingEnd()933 const Dimension& GetDefaultPaddingEnd() const 934 { 935 return defaultPaddingEnd_; 936 } 937 GetDefaultPaddingTop()938 const Dimension& GetDefaultPaddingTop() const 939 { 940 return defaultPaddingTop_; 941 } 942 GetDefaultPaddingBottomFixed()943 const Dimension& GetDefaultPaddingBottomFixed() const 944 { 945 return defaultPaddingBottomFixed_; 946 } 947 GetContentSpinnerPadding()948 const Dimension& GetContentSpinnerPadding() const 949 { 950 return contentSpinnerPadding_; 951 } 952 GetMenuAnimationOffset()953 const Dimension& GetMenuAnimationOffset() const 954 { 955 return menuAnimationOffset_; 956 } 957 GetSpinnerWidth()958 const Dimension& GetSpinnerWidth() const 959 { 960 return spinnerWidth_; 961 } 962 GetSpinnerWidth(ControlSize controlSize)963 const Dimension& GetSpinnerWidth(ControlSize controlSize) const 964 { 965 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 966 auto result = selectSpinnerWidthMap_.find(controlSize); 967 if (result != selectSpinnerWidthMap_.end()) { 968 return result->second; 969 } 970 } 971 return spinnerWidth_; 972 } 973 GetSpinnerHeight()974 const Dimension& GetSpinnerHeight() const 975 { 976 return spinnerHeight_; 977 } 978 GetSpinnerHeight(ControlSize controlSize)979 const Dimension& GetSpinnerHeight(ControlSize controlSize) const 980 { 981 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 982 auto result = selectSpinnerHeightMap_.find(controlSize); 983 if (result != selectSpinnerHeightMap_.end()) { 984 return result->second; 985 } 986 } 987 return spinnerHeight_; 988 } 989 GetDefaultDividerWidth()990 const Dimension& GetDefaultDividerWidth() const 991 { 992 return defaultDividerWidth_; 993 } 994 GetSelectMinWidth()995 const Dimension& GetSelectMinWidth() const 996 { 997 return selectMinWidth_; 998 } 999 GetSelectMinWidth(ControlSize controlSize)1000 const Dimension& GetSelectMinWidth(ControlSize controlSize) const 1001 { 1002 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1003 auto result = selectMinWidthMap_.find(controlSize); 1004 if (result != selectMinWidthMap_.end()) { 1005 return result->second; 1006 } 1007 } 1008 return selectMinWidth_; 1009 } 1010 GetSelectDefaultHeight()1011 const Dimension& GetSelectDefaultHeight() const 1012 { 1013 return selectDefaultHeight_; 1014 } 1015 GetSelectDefaultHeight(ControlSize controlSize)1016 const Dimension& GetSelectDefaultHeight(ControlSize controlSize) const 1017 { 1018 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1019 auto result = selectMinHeightMap_.find(controlSize); 1020 if (result != selectMinHeightMap_.end()) { 1021 return result->second; 1022 } 1023 } 1024 return selectDefaultHeight_; 1025 } 1026 GetIconSideLength()1027 const Dimension& GetIconSideLength() const 1028 { 1029 return iconSideLength_; 1030 } 1031 GetEndIconWidth()1032 const Dimension& GetEndIconWidth() const 1033 { 1034 return endIconWidth_; 1035 } 1036 GetEndIconHeight()1037 const Dimension& GetEndIconHeight() const 1038 { 1039 return endIconHeight_; 1040 } 1041 GetContentMargin()1042 const Dimension& GetContentMargin() const 1043 { 1044 return contentMargin_; 1045 } 1046 GetSelectDefaultBgColor()1047 const Color& GetSelectDefaultBgColor() const 1048 { 1049 return selectDefaultBgColor_; 1050 } 1051 GetSelectDefaultBorderRadius()1052 const Dimension& GetSelectDefaultBorderRadius() const 1053 { 1054 return selectDefaultBorderRadius_; 1055 } 1056 GetSelectDefaultBorderRadius(ControlSize controlSize)1057 const Dimension& GetSelectDefaultBorderRadius(ControlSize controlSize) const 1058 { 1059 if (Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWELVE)) { 1060 auto result = selectBorderRadiusMap_.find(controlSize); 1061 if (result != selectBorderRadiusMap_.end()) { 1062 return result->second; 1063 } 1064 } 1065 return selectDefaultBorderRadius_; 1066 } 1067 GetExpandDisplay()1068 bool GetExpandDisplay() const 1069 { 1070 return expandDisplay_; 1071 } 1072 GetMaxPaddingStart()1073 const Dimension& GetMaxPaddingStart() const 1074 { 1075 return maxPaddingStart_; 1076 } 1077 GetMaxPaddingEnd()1078 const Dimension& GetMaxPaddingEnd() const 1079 { 1080 return maxPaddingEnd_; 1081 } GetMenuLargeMargin()1082 const Dimension& GetMenuLargeMargin() const 1083 { 1084 return menuLargeMargin_; 1085 } GetMenuMediumMargin()1086 const Dimension& GetMenuMediumMargin() const 1087 { 1088 return menuMediumMargin_; 1089 } 1090 GetMenuChildMinHeight()1091 const Dimension& GetMenuChildMinHeight() const 1092 { 1093 return menuItemChildMinHeight_; 1094 } 1095 GetMenuItemVerticalPadding()1096 const Dimension& GetMenuItemVerticalPadding() const 1097 { 1098 return menuItemVerticalPadding_; 1099 } 1100 GetMenuItemGroupTitleTextFontSize()1101 const Dimension& GetMenuItemGroupTitleTextFontSize() const 1102 { 1103 return menuItemGroupTitleTextFontSize_; 1104 } 1105 GetMenuDefaultRadius()1106 const Dimension& GetMenuDefaultRadius() const 1107 { 1108 return menuDefaultRadius_; 1109 } 1110 GetMenuDefaultInnerRadius()1111 const Dimension& GetMenuDefaultInnerRadius() const 1112 { 1113 return menuDefaultInnerRadius_; 1114 } 1115 GetMenuDefaultWidth()1116 const Dimension& GetMenuDefaultWidth() const 1117 { 1118 return menuDefaultWidth_; 1119 } 1120 GetMenuMinWidth()1121 const Dimension& GetMenuMinWidth() const 1122 { 1123 return menuMinWidth_; 1124 } 1125 GetMenuMaxWidth()1126 const Dimension& GetMenuMaxWidth() const 1127 { 1128 return menuMaxWidth_; 1129 } 1130 GetMenuMaxWidthRatio()1131 double GetMenuMaxWidthRatio() const 1132 { 1133 return menuMaxWidthRatio_; 1134 } 1135 GetMenuTextColor()1136 const Color& GetMenuTextColor() const 1137 { 1138 return menuTextColor_; 1139 } 1140 GetMenuItemContentAlign()1141 const uint32_t& GetMenuItemContentAlign() const 1142 { 1143 return menuItemContentAlign_; 1144 } 1145 1146 private: 1147 Color disabledColor_; 1148 Color clickedColor_; 1149 Color selectedColor_; 1150 1151 Color backgroundColor_ = Color::WHITE; 1152 Color backgroundColorButton_ = Color::WHITE; 1153 Color disabledBackgroundColor_; 1154 Color hoverColor_ = Color(0x0c000000); 1155 Color selectedColorText_ = Color(0xff0a59f7); 1156 Color lineColor_ = Color(0x33000000); 1157 Color spinnerColor_ = Color(0xE5182431); 1158 Color disabledSpinnerColor_; 1159 Color spinnerSymbolColor_ = Color(0xff182431); 1160 Color disabledSpinnerSymbolColor_; 1161 uint32_t spinnerSource_ = 983615; 1162 Color menuIconColor_ = Color(0x99182431); 1163 Color menuFontColor_; 1164 Color disabledMenuFontColor_; 1165 Color menuTitleFontColor_; 1166 1167 bool allowScale_ = true; 1168 Dimension fontSize_; 1169 Color fontColor_; 1170 Color disabledFontColor_; 1171 double disabledFontColorAlpha_ = 0.0; 1172 Color secondaryFontColor_; 1173 std::string fontFamily_; 1174 FontWeight fontWeight_ { FontWeight::NORMAL }; 1175 TextDecoration textDecoration_ { TextDecoration::NONE }; 1176 1177 std::size_t optionSize_ { 0 }; 1178 Dimension rrectSize_; 1179 Dimension iconSize_; 1180 Dimension normalPadding_; 1181 1182 Dimension popupRRectSize_; 1183 Dimension popupBorderWidth_; 1184 Dimension popupShadowWidth_; 1185 Dimension popupMinWidth_; 1186 1187 Dimension titleLeftPadding_; 1188 Dimension titleTopPadding_; 1189 Dimension titleRightPadding_; 1190 Dimension titleBottomPadding_; 1191 Dimension horizontalSpacing_; 1192 Dimension verticalSpacing_; 1193 Dimension contentSpacing_; 1194 Dimension optionInterval_; 1195 Dimension optionMinHeight_; 1196 1197 Dimension selectBorderRadius_; 1198 Dimension menuBorderRadius_; 1199 Dimension innerBorderRadius_; 1200 Dimension menuFontSize_; 1201 Dimension menuTitleFontSize_; 1202 Dimension menuTitleHeight_; 1203 Dimension menuIconPadding_; 1204 Dimension iconContentPadding_; 1205 Dimension dividerPaddingVertical_; 1206 1207 Dimension selectMenuPadding_; 1208 Dimension outPadding_; 1209 Dimension defaultPaddingStart_; 1210 Dimension defaultPaddingEnd_; 1211 Dimension defaultPaddingTop_; 1212 Dimension defaultPaddingBottomFixed_; 1213 Dimension contentSpinnerPadding_; 1214 Dimension menuAnimationOffset_; 1215 Dimension spinnerWidth_; 1216 Dimension spinnerHeight_; 1217 Dimension defaultDividerWidth_; 1218 1219 Dimension selectMinWidth_; 1220 Dimension selectDefaultHeight_; 1221 Dimension iconSideLength_; 1222 Dimension endIconWidth_; 1223 Dimension endIconHeight_; 1224 Dimension contentMargin_; 1225 1226 Color tvFocusTextColor_; 1227 Color tvNormalBackColor_; 1228 Color tvBackColor_; 1229 1230 Color focusedDisableColor_; 1231 Color normalDisableColor_; 1232 Color focusedTextDisableColor_; 1233 Color normalTextDisableColor_; 1234 1235 TextStyle titleStyle_; 1236 TextStyle optionTextStyle_; 1237 bool isTV_ = false; 1238 uint32_t menuShowTime_ = 0; 1239 uint32_t selectShowTime_ = 0; 1240 uint32_t menuHideTime_ = 0; 1241 uint32_t selectHideTime_ = 0; 1242 int32_t hoverAnimationDuration_ = 0; 1243 int32_t pressAnimationDuration_ = 0; 1244 1245 Edge optionPadding_; 1246 1247 bool expandDisplay_ = false; 1248 Dimension maxPaddingStart_; 1249 Dimension maxPaddingEnd_; 1250 1251 Color selectDefaultBgColor_; 1252 Dimension selectDefaultBorderRadius_; 1253 std::unordered_map<ControlSize, Dimension> selectMinWidthMap_; 1254 std::unordered_map<ControlSize, Dimension> selectMinHeightMap_; 1255 std::unordered_map<ControlSize, Dimension> selectBorderRadiusMap_; 1256 std::unordered_map<ControlSize, Dimension> selectSpinnerWidthMap_; 1257 std::unordered_map<ControlSize, Dimension> selectSpinnerHeightMap_; 1258 std::unordered_map<ControlSize, Dimension> selectFontSizeMap_; 1259 Dimension menuLargeMargin_; 1260 Dimension menuMediumMargin_; 1261 uint32_t menuItemContentAlign_ = 4; 1262 Dimension menuItemChildMinHeight_; 1263 Dimension menuItemVerticalPadding_; 1264 Dimension menuItemGroupTitleTextFontSize_; 1265 Dimension menuDefaultRadius_; 1266 Dimension menuDefaultInnerRadius_; 1267 Dimension menuDefaultWidth_; 1268 Dimension menuMinWidth_; 1269 Dimension menuMaxWidth_; 1270 double menuMaxWidthRatio_; 1271 Color menuTextColor_; 1272 }; 1273 1274 } // namespace OHOS::Ace 1275 1276 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SELECT_SELECT_THEME_H 1277