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_PICKER_PICKER_THEME_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PICKER_PICKER_THEME_H 18 19 #include "base/geometry/dimension.h" 20 #include "base/utils/system_properties.h" 21 #include "core/components/common/layout/constants.h" 22 #include "core/components/common/properties/border.h" 23 #include "core/components/common/properties/color.h" 24 #include "core/components/common/properties/decoration.h" 25 #include "core/components/common/properties/edge.h" 26 #include "core/components/common/properties/text_style.h" 27 #include "core/components/picker/picker_data.h" 28 #include "core/components/theme/theme.h" 29 #include "core/components/theme/theme_constants.h" 30 #include "core/components/theme/theme_constants_defines.h" 31 32 namespace OHOS::Ace { 33 namespace { 34 constexpr Dimension DIVIDER_THICKNESS = 1.0_px; 35 } // namespace 36 37 class PickerTheme final : public virtual Theme { 38 DECLARE_ACE_TYPE(PickerTheme, Theme); 39 40 public: 41 class Builder final { 42 public: 43 Builder() = default; 44 ~Builder() = default; 45 Build(const RefPtr<ThemeConstants> & themeConstants)46 RefPtr<PickerTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const 47 { 48 RefPtr<PickerTheme> theme = AceType::Claim(new PickerTheme()); 49 if (!themeConstants) { 50 return theme; 51 } 52 InitializeTextStyles(theme, themeConstants); 53 theme->popupDecoration_ = AceType::MakeRefPtr<Decoration>(); 54 theme->popupDecoration_->SetBackgroundColor(themeConstants->GetColor(THEME_PICKER_BACK_COLOR)); 55 theme->popupDecoration_->SetBorderRadius(Radius(themeConstants->GetDimension(THEME_PICKER_POPUP_RADIUS))); 56 theme->popupEdge_.SetLeft(themeConstants->GetDimension(THEME_PICKER_POPUP_PADDING)); 57 theme->popupEdge_.SetTop(themeConstants->GetDimension(THEME_PICKER_POPUP_PADDING)); 58 theme->popupEdge_.SetRight(themeConstants->GetDimension(THEME_PICKER_POPUP_PADDING)); 59 theme->popupEdge_.SetBottom(themeConstants->GetDimension(THEME_PICKER_POPUP_PADDING_BOTTOM)); 60 auto showOptionCount = themeConstants->GetInt(THEME_PICKER_SHOW_OPTION_COUNT); 61 theme->showOptionCount_ = 62 showOptionCount < 0 ? theme->showOptionCount_ : static_cast<uint32_t>(showOptionCount); 63 theme->showButtons_ = static_cast<bool>(themeConstants->GetInt(THEME_PICKER_SHOW_BUTTONS)); 64 theme->focusColor_ = themeConstants->GetColor(THEME_PICKER_FOCUS_COLOR); 65 theme->focusRadius_ = Radius(themeConstants->GetDimension(THEME_PICKER_FOCUS_RADIUS)); 66 theme->selectedOptionSize_ = Size(themeConstants->GetDouble(THEME_PICKER_OPTION_WIDTH), 67 themeConstants->GetDouble(THEME_PICKER_SELECT_OPTION_HEIGHT)); 68 theme->normalOptionSize_ = Size(themeConstants->GetDouble(THEME_PICKER_OPTION_WIDTH), 69 themeConstants->GetDouble(THEME_PICKER_NORMAL_OPTION_HEIGHT)); 70 theme->optionPadding_ = themeConstants->GetDouble(THEME_PICKER_OPTION_PADDING); 71 theme->optionSizeUnit_ = DimensionUnit::VP; 72 theme->jumpInterval_ = themeConstants->GetDimension(THEME_PICKER_JUMP_INTERVAL); 73 theme->columnIntervalMargin_ = themeConstants->GetDimension(THEME_PICKER_COLUMN_MARGIN); 74 theme->selectedOptionDecoration_ = AceType::MakeRefPtr<Decoration>(); 75 theme->selectedOptionDecoration_->SetBackgroundColor( 76 themeConstants->GetColor(THEME_PICKER_SELECT_OPTION_BACK_COLOR)); 77 theme->selectedOptionDecoration_->SetBorderRadius( 78 Radius(themeConstants->GetDimension(THEME_PICKER_SELECT_OPTION_RADIUS))); 79 theme->focusOptionDecoration_ = AceType::MakeRefPtr<Decoration>(); 80 theme->focusOptionDecoration_->SetBackgroundColor( 81 themeConstants->GetColor(THEME_PICKER_FOCUS_OPTION_BACK_COLOR)); 82 theme->focusOptionDecoration_->SetBorderRadius( 83 Radius(themeConstants->GetDimension(THEME_PICKER_FOCUS_OPTION_RADIUS))); 84 theme->lunarWidth_ = Dimension(36.0, DimensionUnit::VP); // this width do not need setting by outer. 85 theme->lunarHeight_ = Dimension(18.0, DimensionUnit::VP); // this height do not need setting by outer. 86 theme->buttonWidth_ = themeConstants->GetDimension(THEME_PICKER_BUTTON_WIDTH); 87 theme->buttonHeight_ = themeConstants->GetDimension(THEME_PICKER_BUTTON_HEIGHT); 88 theme->buttonTopPadding_ = themeConstants->GetDimension(THEME_PICKER_BUTTON_TOP_PADDING); 89 theme->titleBottomPadding_ = themeConstants->GetDimension(THEME_PICKER_TITLE_BOTTOM_PADDING); 90 theme->popupOutDecoration_ = AceType::MakeRefPtr<Decoration>(); 91 theme->popupOutDecoration_->SetBackgroundColor(themeConstants->GetColor(THEME_PICKER_DIALOG_MASK_COLOR)); 92 auto timeSplitter = themeConstants->GetInt(THEME_PICKER_TIME_SPLITTER); 93 theme->timeSplitter_ = timeSplitter < 0 ? theme->timeSplitter_ : static_cast<uint32_t>(timeSplitter); 94 theme->rotateInterval_ = 15.0; // when rotate 15.0 angle handle scroll of picker column. 95 theme->dividerThickness_ = DIVIDER_THICKNESS; 96 theme->dividerSpacing_ = themeConstants->GetDimension(THEME_PICKER_SELECT_DIVIDER_SPACING); 97 theme->dividerColor_ = themeConstants->GetColor(THEME_PICKER_SELECT_DIVIDER_COLOR); 98 theme->gradientHeight_ = themeConstants->GetDimension(THEME_PICKER_GRADIENT_HEIGHT); 99 theme->columnFixedWidth_ = themeConstants->GetDimension(THEME_PICKER_COLUMN_FIXED_WIDTH); 100 theme->pressColor_ = themeConstants->GetColor(THEME_PICKER_PRESS_COLOR); 101 Parse(themeConstants->GetThemeStyle(), theme); 102 return theme; 103 } 104 Parse(const RefPtr<ThemeStyle> & style,const RefPtr<PickerTheme> & theme)105 void Parse(const RefPtr<ThemeStyle>& style, const RefPtr<PickerTheme>& theme) const 106 { 107 if (!style || !theme || !theme->popupDecoration_) { 108 return; 109 } 110 auto pattern = style->GetAttr<RefPtr<ThemeStyle>>("picker_pattern", nullptr); 111 if (!pattern) { 112 LOGE("Pattern of picker is null, please check!"); 113 return; 114 } 115 theme->hoverColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_HOVERED, theme->hoverColor_); 116 theme->pressColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_PRESSED, theme->pressColor_); 117 theme->paddingHorizontal_ = pattern->GetAttr<Dimension>("padding_horizontal", 24.0_vp); 118 if (SystemProperties::GetDeviceType() != DeviceType::PHONE) { 119 return; // light, dart color only for phone 120 } 121 theme->popupDecoration_->SetBackgroundColor( 122 pattern->GetAttr<Color>("popup_bg_color", theme->popupDecoration_->GetBackgroundColor())); 123 theme->focusColor_ = pattern->GetAttr<Color>(PATTERN_BG_COLOR_FOCUSED, theme->focusColor_); 124 theme->selectedOptionStyle_.SetTextColor( 125 pattern->GetAttr<Color>("selected_text_color", theme->selectedOptionStyle_.GetTextColor())); 126 theme->focusOptionStyle_.SetTextColor(theme->selectedOptionStyle_.GetTextColor()); 127 theme->normalOptionStyle_.SetTextColor( 128 pattern->GetAttr<Color>(PATTERN_TEXT_COLOR, theme->normalOptionStyle_.GetTextColor())); 129 theme->disappearOptionStyle_.SetTextColor(theme->normalOptionStyle_.GetTextColor()); 130 theme->titleStyle_.SetTextColor(theme->normalOptionStyle_.GetTextColor()); 131 theme->dividerColor_ = pattern->GetAttr<Color>("divider_color", theme->dividerColor_); 132 theme->dividerThickness_ = pattern->GetAttr<Dimension>("divider_thickness", 2.0_px); 133 theme->contentMarginVertical_ = pattern->GetAttr<Dimension>("content_margin_vertical", 8.0_vp); 134 theme->lunarswitchTextSize_ = 135 pattern->GetAttr<Dimension>("lunarswitch_text_size", theme->lunarswitchTextSize_); 136 theme->lunarswitchTextColor_ = 137 pattern->GetAttr<Color>("lunarswitch_text_color", theme->lunarswitchTextColor_); 138 } 139 140 private: InitializeButtonTextStyles(const RefPtr<PickerTheme> & theme,const RefPtr<ThemeConstants> & themeConstants)141 void InitializeButtonTextStyles(const RefPtr<PickerTheme>& theme, 142 const RefPtr<ThemeConstants>& themeConstants) const 143 { 144 theme->buttonStyle_.SetFontSize(themeConstants->GetDimension(THEME_PICKER_BUTTON_FONT_SIZE)); 145 theme->buttonStyle_.SetTextColor(themeConstants->GetColor(THEME_PICKER_BUTTON_TEXT_COLOR)); 146 } 147 InitializeTitleTextStyles(const RefPtr<PickerTheme> & theme,const RefPtr<ThemeConstants> & themeConstants)148 void InitializeTitleTextStyles(const RefPtr<PickerTheme>& theme, 149 const RefPtr<ThemeConstants>& themeConstants) const 150 { 151 theme->titleStyle_.SetFontSize(themeConstants->GetDimension(THEME_PICKER_TITLE_FONT_SIZE)); 152 theme->titleStyle_.SetTextColor(themeConstants->GetColor(THEME_PICKER_TITLE_TEXT_COLOR)); 153 theme->titleStyle_.SetFontWeight(FontWeight::W500); 154 theme->titleStyle_.SetMaxLines(1); 155 theme->titleStyle_.SetTextOverflow(TextOverflow::ELLIPSIS); 156 } 157 InitializeItemTextStyles(const RefPtr<PickerTheme> & theme,const RefPtr<ThemeConstants> & themeConstants)158 void InitializeItemTextStyles(const RefPtr<PickerTheme>& theme, 159 const RefPtr<ThemeConstants>& themeConstants) const 160 { 161 auto themeStyle = themeConstants->GetThemeStyle(); 162 if (themeStyle) { 163 auto pattern = themeStyle->GetAttr<RefPtr<ThemeStyle>>("picker_pattern", nullptr); 164 if (pattern) { 165 theme->selectedOptionStyle_.SetTextColor( 166 pattern->GetAttr<Color>("selected_text_color", Color(0x007DFF))); 167 theme->selectedOptionStyle_.SetFontSize( 168 pattern->GetAttr<Dimension>("selected_text_size", 20.0_vp)); 169 theme->selectedOptionStyle_.SetFontWeight(FontWeight::MEDIUM); 170 theme->selectedOptionStyle_.SetAdaptTextSize(theme->selectedOptionStyle_.GetFontSize(), 171 themeConstants->GetDimension(THEME_PICKER_SELECT_OPTION_MIN_FONT_SIZE)); 172 theme->selectedOptionStyle_.SetMaxLines(1); 173 theme->selectedOptionStyle_.SetTextOverflow(TextOverflow::ELLIPSIS); 174 175 theme->normalOptionStyle_.SetTextColor( 176 pattern->GetAttr<Color>("text_color", Color(0xff182431))); 177 theme->normalOptionStyle_.SetFontSize( 178 pattern->GetAttr<Dimension>("text_size", 16.0_fp)); 179 theme->normalOptionStyle_.SetFontWeight(FontWeight::REGULAR); 180 theme->normalOptionStyle_.SetAdaptTextSize(theme->normalOptionStyle_.GetFontSize(), 181 themeConstants->GetDimension(THEME_PICKER_NORMAL_OPTION_MIN_FONT_SIZE)); 182 theme->normalOptionStyle_.SetMaxLines(1); 183 theme->normalOptionStyle_.SetTextOverflow(TextOverflow::ELLIPSIS); 184 185 theme->disappearOptionStyle_.SetTextColor( 186 pattern->GetAttr<Color>("disappear_text_color", Color(0xff182431))); 187 theme->disappearOptionStyle_.SetFontSize( 188 pattern->GetAttr<Dimension>("disappear_text_size", 14.0_fp)); 189 theme->disappearOptionStyle_.SetFontWeight(FontWeight::REGULAR); 190 theme->disappearOptionStyle_.SetAdaptTextSize(theme->disappearOptionStyle_.GetFontSize(), 191 themeConstants->GetDimension(THEME_PICKER_NORMAL_OPTION_MIN_FONT_SIZE)); 192 theme->disappearOptionStyle_.SetMaxLines(1); 193 theme->disappearOptionStyle_.SetTextOverflow(TextOverflow::ELLIPSIS); 194 } 195 } 196 theme->focusOptionStyle_.SetFontSize(themeConstants->GetDimension(THEME_PICKER_FOCUS_OPTION_FONT_SIZE)); 197 theme->focusOptionStyle_.SetTextColor(themeConstants->GetColor(THEME_PICKER_FOCUS_OPTION_TEXT_COLOR)); 198 theme->focusOptionStyle_.SetFontWeight( 199 FontWeight(themeConstants->GetInt(THEME_PICKER_FOCUS_OPTION_WEIGHT))); 200 theme->focusOptionStyle_.SetAdaptTextSize(theme->focusOptionStyle_.GetFontSize(), 201 themeConstants->GetDimension(THEME_PICKER_SELECT_OPTION_MIN_FONT_SIZE)); 202 theme->focusOptionStyle_.SetMaxLines(1); 203 theme->focusOptionStyle_.SetTextOverflow(TextOverflow::ELLIPSIS); 204 205 if (SystemProperties::GetDeviceType() == DeviceType::PHONE) { 206 theme->focusOptionStyle_ = theme->selectedOptionStyle_; // focus style the same with selected on phone 207 } 208 } 209 InitializeTextStyles(const RefPtr<PickerTheme> & theme,const RefPtr<ThemeConstants> & themeConstants)210 void InitializeTextStyles(const RefPtr<PickerTheme>& theme, 211 const RefPtr<ThemeConstants>& themeConstants) const 212 { 213 InitializeItemTextStyles(theme, themeConstants); 214 InitializeTitleTextStyles(theme, themeConstants); 215 InitializeButtonTextStyles(theme, themeConstants); 216 } 217 }; 218 219 ~PickerTheme() override = default; 220 clone()221 RefPtr<PickerTheme> clone() const 222 { 223 auto theme = AceType::Claim(new PickerTheme()); 224 theme->selectedOptionSize_ = selectedOptionSize_; 225 theme->selectedOptionStyle_ = selectedOptionStyle_; 226 theme->normalOptionSize_ = normalOptionSize_; 227 theme->normalOptionStyle_ = normalOptionStyle_; 228 theme->disappearOptionStyle_ = disappearOptionStyle_; 229 theme->showOptionCount_ = showOptionCount_; 230 theme->optionSizeUnit_ = optionSizeUnit_; 231 theme->popupDecoration_ = popupDecoration_; 232 theme->focusColor_ = focusColor_; 233 theme->popupEdge_ = popupEdge_; 234 theme->focusOptionStyle_ = focusOptionStyle_; 235 theme->focusOptionDecoration_ = focusOptionDecoration_; 236 theme->selectedOptionDecoration_ = selectedOptionDecoration_; 237 theme->buttonStyle_ = buttonStyle_; 238 theme->showButtons_ = showButtons_; 239 theme->buttonWidth_ = buttonWidth_; 240 theme->buttonHeight_ = buttonHeight_; 241 theme->buttonTopPadding_ = buttonTopPadding_; 242 theme->jumpInterval_ = jumpInterval_; 243 theme->columnIntervalMargin_ = columnIntervalMargin_; 244 theme->focusRadius_ = focusRadius_; 245 theme->optionPadding_ = optionPadding_; 246 theme->titleStyle_ = titleStyle_; 247 theme->titleBottomPadding_ = titleBottomPadding_; 248 theme->popupOutDecoration_ = popupOutDecoration_; 249 theme->lunarWidth_ = lunarWidth_; 250 theme->lunarHeight_ = lunarHeight_; 251 theme->timeSplitter_ = timeSplitter_; 252 theme->rotateInterval_ = rotateInterval_; 253 theme->dividerThickness_ = dividerThickness_; 254 theme->dividerSpacing_ = dividerSpacing_; 255 theme->dividerColor_ = dividerColor_; 256 theme->gradientHeight_ = gradientHeight_; 257 theme->columnFixedWidth_ = columnFixedWidth_; 258 theme->disappearOptionStyle_ = disappearOptionStyle_; 259 theme->pressColor_ = pressColor_; 260 theme->hoverColor_ = hoverColor_; 261 theme->lunarswitchTextColor_ = lunarswitchTextColor_; 262 theme->lunarswitchTextSize_ = lunarswitchTextSize_; 263 theme->defaultStartDate_ = defaultStartDate_; 264 theme->defaultEndDate_ = defaultEndDate_; 265 return theme; 266 } 267 GetOptionStyle(bool selected,bool focus)268 const TextStyle& GetOptionStyle(bool selected, bool focus) const 269 { 270 if (!selected) { 271 return normalOptionStyle_; 272 } 273 274 if (focus) { 275 return focusOptionStyle_; 276 } 277 278 return selectedOptionStyle_; 279 } SetOptionStyle(bool selected,bool focus,const TextStyle & value)280 void SetOptionStyle(bool selected, bool focus, const TextStyle& value) 281 { 282 if (!selected) { 283 normalOptionStyle_ = value; 284 } else if (focus) { 285 focusOptionStyle_ = value; 286 } else { 287 selectedOptionStyle_ = value; 288 } 289 } 290 GetDisappearOptionStyle()291 const TextStyle& GetDisappearOptionStyle() const 292 { 293 return disappearOptionStyle_; 294 } SetDisappearOptionStyle(const TextStyle & value)295 void SetDisappearOptionStyle(const TextStyle& value) 296 { 297 disappearOptionStyle_ = value; 298 } 299 GetButtonStyle()300 const TextStyle& GetButtonStyle() const 301 { 302 return buttonStyle_; 303 } 304 GetOptionDecoration(bool focus)305 const RefPtr<Decoration>& GetOptionDecoration(bool focus) 306 { 307 if (focus) { 308 return focusOptionDecoration_; 309 } 310 311 return selectedOptionDecoration_; 312 } SetOptionDecoration(bool focus,const RefPtr<Decoration> & value)313 void SetOptionDecoration(bool focus, const RefPtr<Decoration>& value) 314 { 315 if (focus) { 316 focusOptionDecoration_ = value; 317 } else { 318 selectedOptionDecoration_ = value; 319 } 320 } 321 GetOptionSize(bool selected)322 const Size& GetOptionSize(bool selected) const 323 { 324 if (selected) { 325 return selectedOptionSize_; 326 } 327 328 return normalOptionSize_; 329 } 330 GetShowOptionCount()331 uint32_t GetShowOptionCount() const 332 { 333 return showOptionCount_; 334 } 335 GetOptionSizeUnit()336 DimensionUnit GetOptionSizeUnit() const 337 { 338 return optionSizeUnit_; 339 } 340 GetPopupDecoration(bool isOutBox)341 const RefPtr<Decoration>& GetPopupDecoration(bool isOutBox) const 342 { 343 if (!isOutBox) { 344 return popupDecoration_; 345 } 346 return popupOutDecoration_; 347 } 348 GetFocusColor()349 const Color& GetFocusColor() const 350 { 351 return focusColor_; 352 } 353 GetPopupEdge()354 const Edge& GetPopupEdge() const 355 { 356 return popupEdge_; 357 } 358 GetShowButtons()359 bool GetShowButtons() const 360 { 361 return showButtons_; 362 } 363 GetButtonWidth()364 const Dimension& GetButtonWidth() const 365 { 366 return buttonWidth_; 367 } 368 GetButtonHeight()369 const Dimension& GetButtonHeight() const 370 { 371 return buttonHeight_; 372 } 373 GetButtonTopPadding()374 const Dimension& GetButtonTopPadding() const 375 { 376 return buttonTopPadding_; 377 } 378 GetJumpInterval()379 const Dimension& GetJumpInterval() const 380 { 381 return jumpInterval_; 382 } 383 GetColumnIntervalMargin()384 const Dimension& GetColumnIntervalMargin() const 385 { 386 return columnIntervalMargin_; 387 } 388 GetFocusRadius()389 const Radius& GetFocusRadius() const 390 { 391 return focusRadius_; 392 } 393 GetOptionPadding()394 double GetOptionPadding() const 395 { 396 return optionPadding_; 397 } SetOptionPadding(double value)398 void SetOptionPadding(double value) 399 { 400 optionPadding_ = value; 401 } 402 GetTitleStyle()403 const TextStyle& GetTitleStyle() const 404 { 405 return titleStyle_; 406 } 407 GetTitleBottomPadding()408 const Dimension& GetTitleBottomPadding() const 409 { 410 return titleBottomPadding_; 411 } 412 GetLunarWidth()413 const Dimension& GetLunarWidth() const 414 { 415 return lunarWidth_; 416 } 417 GetLunarHeight()418 const Dimension& GetLunarHeight() const 419 { 420 return lunarHeight_; 421 } 422 HasTimeSplitter()423 bool HasTimeSplitter() const 424 { 425 return (timeSplitter_ > 0); 426 } 427 GetRotateInterval()428 double GetRotateInterval() const 429 { 430 return rotateInterval_; 431 } 432 GetDividerThickness()433 const Dimension& GetDividerThickness() const 434 { 435 return dividerThickness_; 436 } 437 GetDividerSpacing()438 const Dimension& GetDividerSpacing() const 439 { 440 return dividerSpacing_; 441 } 442 GetDividerColor()443 const Color& GetDividerColor() const 444 { 445 return dividerColor_; 446 } 447 GetGradientHeight()448 const Dimension& GetGradientHeight() const 449 { 450 return gradientHeight_; 451 } 452 GetColumnFixedWidth()453 const Dimension& GetColumnFixedWidth() const 454 { 455 return columnFixedWidth_; 456 } 457 GetColumnBottomTotalHeight(bool hasLunar)458 Dimension GetColumnBottomTotalHeight(bool hasLunar) const 459 { 460 if (hasLunar) { 461 return buttonHeight_ + lunarHeight_ + buttonTopPadding_ * 2 + popupEdge_.Bottom(); 462 } else { 463 return buttonHeight_ + buttonTopPadding_ + popupEdge_.Bottom(); 464 } 465 } 466 GetPressColor()467 const Color& GetPressColor() const 468 { 469 return pressColor_; 470 } 471 GetHoverColor()472 const Color& GetHoverColor() const 473 { 474 return hoverColor_; 475 } 476 GetPaddingHorizontal()477 const Dimension& GetPaddingHorizontal() const 478 { 479 return paddingHorizontal_; 480 } 481 GetContentMarginVertical()482 const Dimension& GetContentMarginVertical() const 483 { 484 return contentMarginVertical_; 485 } 486 GetLunarSwitchTextSize()487 const Dimension& GetLunarSwitchTextSize() const 488 { 489 return lunarswitchTextSize_; 490 } 491 GetLunarSwitchTextColor()492 const Color& GetLunarSwitchTextColor() const 493 { 494 return lunarswitchTextColor_; 495 } 496 GetDefaultStartDate()497 const PickerDate& GetDefaultStartDate() const 498 { 499 return defaultStartDate_; 500 } 501 GetDefaultEndDate()502 const PickerDate& GetDefaultEndDate() const 503 { 504 return defaultEndDate_; 505 } 506 507 private: 508 PickerTheme() = default; 509 510 Color focusColor_; 511 Color hoverColor_; 512 Color pressColor_; 513 Color lunarswitchTextColor_; 514 515 Radius focusRadius_; 516 uint32_t showOptionCount_ = 0; 517 bool showButtons_ = false; 518 Dimension jumpInterval_; 519 520 // popup style 521 RefPtr<Decoration> popupDecoration_; 522 RefPtr<Decoration> popupOutDecoration_; 523 Edge popupEdge_; 524 525 // column 526 Dimension columnIntervalMargin_; 527 528 // text style 529 TextStyle focusOptionStyle_; 530 TextStyle selectedOptionStyle_; 531 TextStyle normalOptionStyle_; 532 TextStyle disappearOptionStyle_; 533 TextStyle buttonStyle_; 534 TextStyle titleStyle_; 535 536 // text around decoration 537 RefPtr<Decoration> selectedOptionDecoration_; 538 RefPtr<Decoration> focusOptionDecoration_; 539 540 // option size 541 Size selectedOptionSize_; 542 Size normalOptionSize_; 543 double optionPadding_ = 0.0; 544 DimensionUnit optionSizeUnit_ = DimensionUnit::PX; 545 546 // buttons size 547 Dimension buttonWidth_; 548 Dimension buttonHeight_; 549 Dimension buttonTopPadding_; 550 Dimension titleBottomPadding_; 551 552 // lunar size 553 Dimension lunarWidth_; 554 Dimension lunarHeight_; 555 556 uint32_t timeSplitter_ = 0; 557 558 double rotateInterval_ = 0.0; 559 Dimension dividerThickness_; 560 Dimension dividerSpacing_; 561 Color dividerColor_; 562 Dimension gradientHeight_; 563 Dimension columnFixedWidth_; 564 565 Dimension paddingHorizontal_; 566 Dimension contentMarginVertical_; 567 Dimension lunarswitchTextSize_; 568 569 PickerDate defaultStartDate_ = PickerDate(1970, 1, 1); 570 PickerDate defaultEndDate_ = PickerDate(2100, 12, 31); 571 }; 572 573 } // namespace OHOS::Ace 574 575 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_PICKER_PICKER_THEME_H 576