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