• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_DIALOG_DIALOG_THEME_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DIALOG_DIALOG_THEME_H
18 
19 #include "base/utils/system_properties.h"
20 #include "core/components/common/properties/color.h"
21 #include "core/components/common/properties/edge.h"
22 #include "core/components/common/properties/radius.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 
28 namespace OHOS::Ace {
29 namespace {
30 constexpr double PRIMARY_RGBA_OPACITY = 0.9f;
31 constexpr double SECONDARY_RGBA_OPACITY = 0.6f;
32 } // namespace
33 /**
34  * DialogTheme defines color and styles of DialogComponent. DialogTheme should be built
35  * using DialogTheme::Builder.
36  */
37 class DialogTheme : public virtual Theme {
38     DECLARE_ACE_TYPE(DialogTheme, Theme);
39 
40 public:
41     class Builder {
42     public:
43         Builder() = default;
44         ~Builder() = default;
45 
Build(const RefPtr<ThemeConstants> & themeConstants)46         RefPtr<DialogTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const
47         {
48             RefPtr<DialogTheme> theme = AceType::Claim(new DialogTheme());
49             if (!themeConstants) {
50                 return theme;
51             }
52             // init theme from global data
53             theme->backgroundColor_ = themeConstants->GetColor(THEME_DIALOG_BACKGROUND_COLOR);
54             theme->titleTextStyle_.SetTextColor(themeConstants->GetColor(THEME_DIALOG_TITLE_TEXT_COLOR));
55             theme->titleTextStyle_.SetFontSize(themeConstants->GetDimension(THEME_DIALOG_TITLE_TEXT_FONTSIZE));
56             theme->titleTextStyle_.SetFontWeight(
57                 FontWeight(themeConstants->GetInt(THEME_DIALOG_TITLE_TEXT_FONTWEIGHT)));
58             theme->subtitleTextStyle_.SetTextColor(themeConstants->GetColor(THEME_DIALOG_TITLE_TEXT_COLOR));
59             theme->subtitleTextStyle_.SetFontSize(themeConstants->GetDimension(THEME_OHOS_TEXT_SIZE_SUBTITLE3));
60             theme->titleMinFontSize_ = themeConstants->GetDimension(THEME_DIALOG_TITLE_TEXT_FONTSIZE_MIN);
61             theme->contentMinFontSize_ = themeConstants->GetDimension(THEME_DIALOG_CONTENT_TEXT_FONTSIZE_MIN);
62             auto titleMaxLines = themeConstants->GetInt(THEME_DIALOG_TITLE_TEXT_MAX_LINES);
63             theme->titleMaxLines_ = titleMaxLines < 0 ? theme->titleMaxLines_ : static_cast<uint32_t>(titleMaxLines);
64             theme->contentTextStyle_.SetTextColor(themeConstants->GetColor(THEME_DIALOG_CONTENT_TEXT_COLOR));
65             theme->contentTextStyle_.SetFontSize(themeConstants->GetDimension(THEME_DIALOG_CONTENT_TEXT_FONTSIZE));
66             theme->defaultPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT),
67                 themeConstants->GetDimension(THEME_DIALOG_PADDING_TOP),
68                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT),
69                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM));
70             theme->adjustPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT_ADJUST),
71                 themeConstants->GetDimension(THEME_DIALOG_PADDING_TOP_ADJUST),
72                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT_ADJUST),
73                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM_ADJUST));
74             theme->titleDefaultPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT),
75                 themeConstants->GetDimension(THEME_DIALOG_TITLE_PADDING_VERTICAL),
76                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT),
77                 themeConstants->GetDimension(THEME_DIALOG_TITLE_PADDING_VERTICAL));
78             theme->titleAdjustPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT_ADJUST),
79                 themeConstants->GetDimension(THEME_DIALOG_TITLE_PADDING_VERTICAL),
80                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT_ADJUST),
81                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM_ADJUST));
82             theme->contentDefaultPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT),
83                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM),
84                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT),
85                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM));
86             theme->contentAdjustPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_LEFT_ADJUST),
87                 themeConstants->GetDimension(THEME_DIALOG_TITLE_PADDING_VERTICAL),
88                 themeConstants->GetDimension(THEME_DIALOG_PADDING_RIGHT_ADJUST),
89                 themeConstants->GetDimension(THEME_DIALOG_PADDING_BOTTOM_ADJUST));
90             theme->actionsPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_ACTIONS_LEFT),
91                 themeConstants->GetDimension(THEME_DIALOG_PADDING_ACTIONS_TOP),
92                 themeConstants->GetDimension(THEME_DIALOG_PADDING_ACTIONS_RIGHT),
93                 themeConstants->GetDimension(THEME_DIALOG_PADDING_ACTIONS_BOTTOM));
94             theme->buttonPaddingLeft_ =
95                 Edge(themeConstants->GetDimension(THEME_DIALOG_PADDING_MIN).Value(), 0.0, 0.0, 0.0, DimensionUnit::VP);
96             theme->buttonPaddingRight_ =
97                 Edge(0.0, 0.0, themeConstants->GetDimension(THEME_DIALOG_PADDING_MIN).Value(), 0.0, DimensionUnit::VP);
98             theme->buttonPaddingCenter_ = Edge(0.0, themeConstants->GetDimension(THEME_DIALOG_PADDING_MID).Value(), 0.0,
99                 themeConstants->GetDimension(THEME_DIALOG_PADDING_MID).Value(), DimensionUnit::VP);
100             theme->buttonSpacingHorizontal_ = themeConstants->GetDimension(THEME_DIALOG_BUTTON_SPACING_HORIZONTAL);
101             theme->buttonSpacingVertical_ = themeConstants->GetDimension(THEME_DIALOG_BUTTON_SPACING_VERTICAL);
102             theme->buttonBackgroundColor_ = themeConstants->GetColor(THEME_DIALOG_BUTTON_BG_COLOR);
103             theme->buttonClickedColor_ = themeConstants->GetColor(THEME_DIALOG_BUTTON_CLICKED_COLOR);
104             theme->frameStart_ = themeConstants->GetDouble(THEME_DIALOG_FRAME_START);
105             theme->frameEnd_ = themeConstants->GetDouble(THEME_DIALOG_FRAME_END);
106             theme->scaleStart_ = themeConstants->GetDouble(THEME_DIALOG_SCALE_START);
107             theme->scaleEnd_ = themeConstants->GetDouble(THEME_DIALOG_SCALE_END);
108             theme->opacityStart_ = themeConstants->GetDouble(THEME_DIALOG_OPACITY_START);
109             theme->opacityEnd_ = themeConstants->GetDouble(THEME_DIALOG_OPACITY_END);
110             theme->maskColorStart_ = themeConstants->GetColor(THEME_DIALOG_MASK_COLOR_START);
111             theme->maskColorEnd_ = themeConstants->GetColor(THEME_DIALOG_MASK_COLOR_END);
112             theme->animationDurationIn_ = themeConstants->GetInt(THEME_DIALOG_ANIMATION_DURATION_IN);
113             theme->animationDurationOut_ = themeConstants->GetInt(THEME_DIALOG_ANIMATION_DURATION_OUT);
114             theme->translateValue_ = Dimension(themeConstants->GetDouble(THEME_DIALOG_TRANSLATE), DimensionUnit::PX);
115             theme->dividerColor_ = themeConstants->GetColor(THEME_DIALOG_DIVIDER_COLOR);
116             theme->dividerWidth_ = themeConstants->GetDimension(THEME_DIALOG_DIVIDER_WIDTH);
117             theme->dividerHeight_ = themeConstants->GetDimension(THEME_DIALOG_DIVIDER_HEIGHT);
118             theme->dividerPadding_ = Edge(themeConstants->GetDimension(THEME_DIALOG_DIVIDER_PADDING_HORIZON),
119                 themeConstants->GetDimension(THEME_DIALOG_DIVIDER_PADDING_VERTICAL),
120                 themeConstants->GetDimension(THEME_DIALOG_DIVIDER_PADDING_HORIZON),
121                 themeConstants->GetDimension(THEME_DIALOG_DIVIDER_PADDING_VERTICAL));
122             theme->marginBottom_ = themeConstants->GetDimension(THEME_OHOS_DIMENS_DIALOG_BOTTOM);
123             theme->marginLeft_ = themeConstants->GetDimension(THEME_OHOS_DIMENS_DIALOG_START);
124             theme->marginRight_ = themeConstants->GetDimension(THEME_OHOS_DIMENS_DIALOG_END);
125             ParsePattern(themeConstants->GetThemeStyle(), theme);
126             return theme;
127         }
128 
ParsePattern(const RefPtr<ThemeStyle> & themeStyle,const RefPtr<DialogTheme> & theme)129         void ParsePattern(const RefPtr<ThemeStyle>& themeStyle, const RefPtr<DialogTheme>& theme) const
130         {
131             if (!themeStyle) {
132                 LOGI("progress theme style is null");
133                 return;
134             }
135             auto dialogPattern = themeStyle->GetAttr<RefPtr<ThemeStyle>>(THEME_PATTERN_DIALOG, nullptr);
136             if (!dialogPattern) {
137                 return;
138             }
139             theme->backgroundColor_ = dialogPattern->GetAttr<Color>(PATTERN_BG_COLOR, Color(0xd9ffffff));
140             auto textColor = dialogPattern->GetAttr<Color>("title_text_color", Color::BLACK);
141             auto textOpacity = dialogPattern->GetAttr<double>("attribute_alpha_content_primary", PRIMARY_RGBA_OPACITY);
142             theme->titleTextStyle_.SetTextColor(textColor.BlendOpacity(textOpacity));
143             theme->titleTextStyle_.SetFontSize(dialogPattern->GetAttr<Dimension>("title_text_font_size", 20.0_fp));
144             theme->titleTextStyle_.SetFontWeight(FontWeight::MEDIUM);
145             textOpacity = dialogPattern->GetAttr<double>("attribute_alpha_content_secondary", SECONDARY_RGBA_OPACITY);
146             theme->subtitleTextStyle_.SetTextColor(textColor.BlendOpacity(textOpacity));
147             theme->subtitleTextStyle_.SetFontSize(
148                 dialogPattern->GetAttr<Dimension>("subtitle_text_font_size", 14.0_fp));
149             theme->contentTextStyle_.SetTextColor(dialogPattern->GetAttr<Color>("content_text_color", Color::BLACK));
150             theme->contentTextStyle_.SetFontSize(dialogPattern->GetAttr<Dimension>("content_text_font_size", 16.0_fp));
151             theme->buttonBackgroundColor_ = dialogPattern->GetAttr<Color>("button_bg_color", Color::BLACK);
152             theme->radius_ = Radius(dialogPattern->GetAttr<Dimension>("radius", 24.0_vp));
153             theme->dividerLength_ = dialogPattern->GetAttr<Dimension>(DIALOG_DIVIDER_LENGTH, 24.0_vp);
154             theme->dividerBetweenButtonWidth_ =
155                 dialogPattern->GetAttr<Dimension>(DIALOG_DIVIDER_BETWEEN_BUTTON_WIDTH, 2.0_px);
156             theme->dividerColor_ = dialogPattern->GetAttr<Color>("divider_color", Color(0x33000000));
157 
158             auto defaultPadding = dialogPattern->GetAttr<Dimension>(DIALOG_CONTENT_TOP_PADDING, 24.0_vp);
159             theme->contentAdjustPadding_ = Edge(defaultPadding, defaultPadding, defaultPadding, 0.0_vp);
160             theme->defaultPaddingBottomFixed_ =
161                 dialogPattern->GetAttr<Dimension>("default_padding_bottom_fixed", 24.0_vp);
162             theme->defaultDialogMarginBottom_ =
163                 dialogPattern->GetAttr<Dimension>("default_dialog_margin_bottom", 16.0_vp);
164             theme->buttonHighlightBgColor_ =
165                 dialogPattern->GetAttr<Color>("button_bg_highlight_color", Color(0xff007dff));
166             theme->buttonHighlightFontColor_ = dialogPattern->GetAttr<Color>("first_button_text_color", Color::WHITE);
167             theme->buttonDefaultBgColor_ = dialogPattern->GetAttr<Color>("button_default_bg_color", Color::TRANSPARENT);
168             theme->buttonDefaultFontColor_ =
169                 dialogPattern->GetAttr<Color>("button_default_font_color", Color(0xff007dff));
170             theme->buttonPaddingBottom_ = dialogPattern->GetAttr<Dimension>("button_padding_bottom", 16.0_vp);
171             theme->singleButtonPaddingStart_ =
172                 dialogPattern->GetAttr<Dimension>("single_button_padding_start", 16.0_vp);
173             theme->singleButtonPaddingEnd_ = dialogPattern->GetAttr<Dimension>("single_button_padding_end", 16.0_vp);
174             theme->mutiButtonPaddingStart_ = dialogPattern->GetAttr<Dimension>("muti_button_padding_start", 16.0_vp);
175             theme->mutiButtonPaddingEnd_ = dialogPattern->GetAttr<Dimension>("muti_button_padding_end", 16.0_vp);
176             theme->mutiButtonPaddingHorizontal_ =
177                 dialogPattern->GetAttr<Dimension>("muti_button_padding_horizontal", 8.0_vp);
178             theme->mutiButtonPaddingVertical_ =
179                 dialogPattern->GetAttr<Dimension>("muti_button_padding_vertical", 4.0_vp);
180 
181             if (SystemProperties::GetDeviceType() != DeviceType::CAR) {
182                 return;
183             }
184             auto titlePadding = dialogPattern->GetAttr<Dimension>(DIALOG_TITLE_TOP_PADDING, 0.0_vp);
185             auto actionsTopPadding = dialogPattern->GetAttr<Dimension>(DIALOG_ACTIONS_TOP_PADDING, 0.0_vp);
186             theme->titleAdjustPadding_ = Edge(defaultPadding, titlePadding, defaultPadding, titlePadding);
187             theme->titleDefaultPadding_ = Edge(defaultPadding, titlePadding, defaultPadding, titlePadding);
188             theme->defaultPadding_ = Edge(defaultPadding, defaultPadding, defaultPadding, defaultPadding);
189             theme->adjustPadding_ = Edge(defaultPadding, defaultPadding, defaultPadding, 0.0_vp);
190             theme->contentDefaultPadding_ = Edge(defaultPadding, 0.0_vp, defaultPadding, defaultPadding);
191             theme->contentAdjustPadding_ = Edge(defaultPadding, 0.0_vp, defaultPadding, 0.0_vp);
192             theme->actionsPadding_ = Edge(defaultPadding, actionsTopPadding, defaultPadding, actionsTopPadding);
193             theme->buttonHeight_ = dialogPattern->GetAttr<Dimension>(DIALOG_BUTTON_HEIGHT, 0.0_vp);
194             theme->titleMaxLines_ = static_cast<uint32_t>(dialogPattern->GetAttr<int32_t>(DIALOG_TITLE_MAX_LINES, 2));
195             theme->buttonSpacingHorizontal_ = actionsTopPadding;
196             theme->commonButtonTextColor_ =
197                 dialogPattern->GetAttr<Color>(DIALOG_COMMON_BUTTON_TEXT_COLOR, Color::WHITE);
198             theme->buttonMinTextSize_ = dialogPattern->GetAttr<Dimension>(DIALOG_MIN_BUTTON_TEXT_SIZE, 10.0_vp);
199             theme->minButtonWidth_ = dialogPattern->GetAttr<Dimension>(DIALOG_MIN_BUTTON_WIDTH, 104.0_vp);
200             theme->maxButtonWidth_ = dialogPattern->GetAttr<Dimension>(DIALOG_MAX_BUTTON_WIDTH, 260.0_vp);
201             theme->maskColorEnd_ = dialogPattern->GetAttr<Color>(DIALOG_MASK_COLOR_END, Color::WHITE);
202             // pattern config
203             theme->titleTextStyle_.SetFontSize(dialogPattern->GetAttr<Dimension>("title_text_font_size", 20.0_vp));
204             theme->titleMinFontSize_ = dialogPattern->GetAttr<Dimension>("title_text_font_size_min", 20.0_vp);
205             theme->commonButtonBgColor_ = dialogPattern->GetAttr<Color>("common_button_bg_color", Color::GRAY);
206             theme->emphasizeButtonBgColor_ = dialogPattern->GetAttr<Color>("first_button_bg_color", Color::BLACK);
207             theme->emphasizeButtonTextColor_ = dialogPattern->GetAttr<Color>("first_button_text_color", Color::WHITE);
208             theme->buttonTextSize_ = dialogPattern->GetAttr<Dimension>("button_text_font_size", 16.0_vp);
209             theme->buttonClickedColor_ = dialogPattern->GetAttr<Color>("button_bg_color_clicked", Color::BLACK);
210             theme->contentTextStyle_.SetFontSize(themeStyle->GetAttr<Dimension>("content_text_font_size", 16.0_vp));
211             theme->contentMinFontSize_ = themeStyle->GetAttr<Dimension>("content_text_font_size_min", 16.0_vp);
212         }
213     };
214 
215     ~DialogTheme() override = default;
216 
GetRadius()217     const Radius& GetRadius() const
218     {
219         return radius_;
220     }
221 
GetBackgroundColor()222     const Color& GetBackgroundColor() const
223     {
224         return backgroundColor_;
225     }
226 
GetCommonButtonBgColor()227     const Color& GetCommonButtonBgColor() const
228     {
229         return commonButtonBgColor_;
230     }
231 
GetEmphasizeButtonBgColor()232     const Color& GetEmphasizeButtonBgColor() const
233     {
234         return emphasizeButtonBgColor_;
235     }
236 
GetTitleTextStyle()237     const TextStyle& GetTitleTextStyle() const
238     {
239         return titleTextStyle_;
240     }
241 
GetSubTitleTextStyle()242     const TextStyle& GetSubTitleTextStyle() const
243     {
244         return subtitleTextStyle_;
245     }
246 
GetTitleMinFontSize()247     const Dimension& GetTitleMinFontSize() const
248     {
249         return titleMinFontSize_;
250     }
251 
GetContentMinFontSize()252     const Dimension& GetContentMinFontSize() const
253     {
254         return contentMinFontSize_;
255     }
256 
GetTitleMaxLines()257     uint32_t GetTitleMaxLines() const
258     {
259         return titleMaxLines_;
260     }
261 
GetContentTextStyle()262     const TextStyle& GetContentTextStyle() const
263     {
264         return contentTextStyle_;
265     }
266 
GetDefaultPadding()267     const Edge& GetDefaultPadding() const
268     {
269         return defaultPadding_;
270     }
271 
GetAdjustPadding()272     const Edge& GetAdjustPadding() const
273     {
274         return adjustPadding_;
275     }
276 
GetTitleDefaultPadding()277     const Edge& GetTitleDefaultPadding() const
278     {
279         return titleDefaultPadding_;
280     }
281 
GetTitleAdjustPadding()282     const Edge& GetTitleAdjustPadding() const
283     {
284         return titleAdjustPadding_;
285     }
286 
GetContentDefaultPadding()287     const Edge& GetContentDefaultPadding() const
288     {
289         return contentDefaultPadding_;
290     }
291 
GetContentAdjustPadding()292     const Edge& GetContentAdjustPadding() const
293     {
294         return contentAdjustPadding_;
295     }
296 
GetActionsPadding()297     const Edge& GetActionsPadding() const
298     {
299         return actionsPadding_;
300     }
301 
GetButtonPaddingLeft()302     const Edge& GetButtonPaddingLeft() const
303     {
304         return buttonPaddingLeft_;
305     }
306 
GetButtonPaddingRight()307     const Edge& GetButtonPaddingRight() const
308     {
309         return buttonPaddingRight_;
310     }
311 
GetButtonPaddingCenter()312     const Edge& GetButtonPaddingCenter() const
313     {
314         return buttonPaddingCenter_;
315     }
316 
GetButtonPaddingBottom()317     const Dimension& GetButtonPaddingBottom() const
318     {
319         return buttonPaddingBottom_;
320     }
321 
GetSingleButtonPaddingStart()322     const Dimension& GetSingleButtonPaddingStart() const
323     {
324         return singleButtonPaddingStart_;
325     }
326 
GetSingleButtonPaddingEnd()327     const Dimension& GetSingleButtonPaddingEnd() const
328     {
329         return singleButtonPaddingEnd_;
330     }
331 
GetMutiButtonPaddingStart()332     const Dimension& GetMutiButtonPaddingStart() const
333     {
334         return mutiButtonPaddingStart_;
335     }
336 
GetMutiButtonPaddingEnd()337     const Dimension& GetMutiButtonPaddingEnd() const
338     {
339         return mutiButtonPaddingEnd_;
340     }
341 
GetMutiButtonPaddingHorizontal()342     const Dimension& GetMutiButtonPaddingHorizontal() const
343     {
344         return mutiButtonPaddingHorizontal_;
345     }
346 
GetMutiButtonPaddingVertical()347     const Dimension& GetMutiButtonPaddingVertical() const
348     {
349         return mutiButtonPaddingVertical_;
350     }
351 
GetButtonSpacingHorizontal()352     const Dimension& GetButtonSpacingHorizontal() const
353     {
354         return buttonSpacingHorizontal_;
355     }
356 
GetButtonSpacingVertical()357     const Dimension& GetButtonSpacingVertical() const
358     {
359         return buttonSpacingVertical_;
360     }
361 
GetDividerLength()362     const Dimension& GetDividerLength() const
363     {
364         return dividerLength_;
365     }
366 
GetDividerBetweenButtonWidth_()367     const Dimension& GetDividerBetweenButtonWidth_() const
368     {
369         return dividerBetweenButtonWidth_;
370     }
371 
GetButtonBackgroundColor()372     const Color& GetButtonBackgroundColor() const
373     {
374         return buttonBackgroundColor_;
375     }
376 
GetButtonClickedColor()377     const Color& GetButtonClickedColor() const
378     {
379         return buttonClickedColor_;
380     }
381 
GetButtonHighlightBgColor()382     const Color& GetButtonHighlightBgColor() const
383     {
384         return buttonHighlightBgColor_;
385     }
386 
GetButtonHighlightFontColor()387     const Color& GetButtonHighlightFontColor() const
388     {
389         return buttonHighlightFontColor_;
390     }
391 
GetButtonDefaultBgColor()392     const Color& GetButtonDefaultBgColor() const
393     {
394         return buttonDefaultBgColor_;
395     }
396 
GetButtonDefaultFontColor()397     const Color& GetButtonDefaultFontColor() const
398     {
399         return buttonDefaultFontColor_;
400     }
401 
GetFrameStart()402     double GetFrameStart() const
403     {
404         return frameStart_;
405     }
406 
GetFrameEnd()407     double GetFrameEnd() const
408     {
409         return frameEnd_;
410     }
411 
GetScaleStart()412     double GetScaleStart() const
413     {
414         return scaleStart_;
415     }
416 
GetScaleEnd()417     double GetScaleEnd() const
418     {
419         return scaleEnd_;
420     }
421 
GetOpacityStart()422     double GetOpacityStart() const
423     {
424         return opacityStart_;
425     }
426 
GetOpacityEnd()427     double GetOpacityEnd() const
428     {
429         return opacityEnd_;
430     }
431 
GetTranslateValue()432     const Dimension& GetTranslateValue() const
433     {
434         return translateValue_;
435     }
436 
GetMaskColorStart()437     const Color& GetMaskColorStart() const
438     {
439         return maskColorStart_;
440     }
441 
GetMaskColorEnd()442     const Color& GetMaskColorEnd() const
443     {
444         return maskColorEnd_;
445     }
446 
GetCommonButtonTextColor()447     const Color& GetCommonButtonTextColor() const
448     {
449         return commonButtonTextColor_;
450     }
451 
GetEmphasizeButtonTextColor()452     const Color& GetEmphasizeButtonTextColor() const
453     {
454         return emphasizeButtonTextColor_;
455     }
456 
GetOpacityAnimationDurIn()457     int32_t GetOpacityAnimationDurIn() const
458     {
459         return opacityAnimationDurIn_;
460     }
461 
GetAnimationDurationIn()462     int32_t GetAnimationDurationIn() const
463     {
464         return animationDurationIn_;
465     }
466 
GetAnimationDurationOut()467     int32_t GetAnimationDurationOut() const
468     {
469         return animationDurationOut_;
470     }
471 
GetDividerColor()472     const Color& GetDividerColor()
473     {
474         return dividerColor_;
475     }
476 
GetDividerWidth()477     const Dimension& GetDividerWidth()
478     {
479         return dividerWidth_;
480     }
481 
GetDividerHeight()482     const Dimension& GetDividerHeight()
483     {
484         return dividerHeight_;
485     }
486 
GetDividerPadding()487     const Edge& GetDividerPadding()
488     {
489         return dividerPadding_;
490     }
491 
GetMarginBottom()492     const Dimension& GetMarginBottom() const
493     {
494         return marginBottom_;
495     }
496 
GetMarginLeft()497     const Dimension& GetMarginLeft() const
498     {
499         return marginLeft_;
500     }
501 
GetMarginRight()502     const Dimension& GetMarginRight() const
503     {
504         return marginRight_;
505     }
506 
GetButtonHeight()507     const Dimension& GetButtonHeight() const
508     {
509         return buttonHeight_;
510     }
511 
GetButtonTextSize()512     const Dimension& GetButtonTextSize() const
513     {
514         return buttonTextSize_;
515     }
516 
GetMinButtonTextSize()517     const Dimension& GetMinButtonTextSize() const
518     {
519         return buttonMinTextSize_;
520     }
521 
GetDefaultPaddingBottomFixed()522     const Dimension& GetDefaultPaddingBottomFixed()
523     {
524         return defaultPaddingBottomFixed_;
525     }
526 
GetDefaultDialogMarginBottom()527     const Dimension& GetDefaultDialogMarginBottom()
528     {
529         return defaultDialogMarginBottom_;
530     }
531 
532 protected:
533     DialogTheme() = default;
534 
535 private:
536     Radius radius_;
537     Color backgroundColor_;
538     TextStyle titleTextStyle_;
539     TextStyle subtitleTextStyle_;
540     TextStyle contentTextStyle_;
541     Dimension titleMinFontSize_;
542     Dimension contentMinFontSize_;
543     uint32_t titleMaxLines_ = 1;
544     Edge defaultPadding_;
545     Edge adjustPadding_;
546     Edge titleDefaultPadding_;
547     Edge titleAdjustPadding_;
548     Edge contentDefaultPadding_;
549     Edge contentAdjustPadding_;
550     Edge actionsPadding_;
551     Edge buttonPaddingLeft_;
552     Edge buttonPaddingRight_;
553     Edge buttonPaddingCenter_;
554     Dimension buttonSpacingHorizontal_;
555     Dimension buttonSpacingVertical_;
556     Dimension dividerLength_;
557     Dimension dividerBetweenButtonWidth_;
558     Color buttonBackgroundColor_;
559     Color buttonClickedColor_;
560     Color buttonHighlightBgColor_;
561     Color buttonHighlightFontColor_;
562     Color buttonDefaultBgColor_;
563     Color buttonDefaultFontColor_;
564     Color emphasizeButtonTextColor_;
565     Dimension translateValue_;
566     double frameStart_ = 0.0;
567     double frameEnd_ = 1.0;
568     double scaleStart_ = 0.0;
569     double scaleEnd_ = 1.0;
570     double opacityStart_ = 0.0;
571     double opacityEnd_ = 1.0;
572     int32_t animationDurationIn_ = 250;
573     int32_t opacityAnimationDurIn_ = 150;
574     int32_t animationDurationOut_ = 250;
575     Color maskColorStart_;
576     Color maskColorEnd_;
577     Color dividerColor_;
578     Color commonButtonBgColor_;
579     Color commonButtonTextColor_;
580     Color emphasizeButtonBgColor_;
581     Dimension dividerWidth_;
582     Dimension dividerHeight_;
583     Edge dividerPadding_;
584     Dimension marginLeft_;
585     Dimension marginRight_;
586     Dimension marginBottom_;
587     Dimension buttonHeight_;
588     Dimension buttonTextSize_;
589     Dimension buttonMinTextSize_;
590     Dimension minButtonWidth_;
591     Dimension maxButtonWidth_;
592     Dimension defaultPaddingBottomFixed_;
593     Dimension defaultDialogMarginBottom_;
594     Dimension buttonPaddingBottom_;
595     Dimension singleButtonPaddingStart_;
596     Dimension singleButtonPaddingEnd_;
597     Dimension mutiButtonPaddingStart_;
598     Dimension mutiButtonPaddingEnd_;
599     Dimension mutiButtonPaddingHorizontal_;
600     Dimension mutiButtonPaddingVertical_;
601 };
602 
603 } // namespace OHOS::Ace
604 
605 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_DIALOG_DIALOG_THEME_H
606