Mercurial > minori
comparison include/gui/theme.h @ 279:657fda1b9cac
*: clean up enums
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Fri, 19 Apr 2024 13:24:06 -0400 |
| parents | 3ec7804abf17 |
| children | 47c9f8502269 |
comparison
equal
deleted
inserted
replaced
| 274:f6a756c19bfb | 279:657fda1b9cac |
|---|---|
| 1 #ifndef MINORI_GUI_THEME_H_ | 1 #ifndef MINORI_GUI_THEME_H_ |
| 2 #define MINORI_GUI_THEME_H_ | 2 #define MINORI_GUI_THEME_H_ |
| 3 | 3 |
| 4 #include <QStyle> | 4 #include <array> |
| 5 | |
| 6 enum class Themes { | |
| 7 OS, | |
| 8 LIGHT, | |
| 9 DARK | |
| 10 }; | |
| 11 | 5 |
| 12 namespace Theme { | 6 namespace Theme { |
| 13 | 7 |
| 14 class Theme final { | 8 enum class Theme { |
| 9 Default, | |
| 10 Light, | |
| 11 Dark | |
| 12 }; | |
| 13 | |
| 14 constexpr std::array<Theme, 3> Themes{ | |
| 15 Theme::Default, | |
| 16 Theme::Light, | |
| 17 Theme::Dark | |
| 18 }; | |
| 19 | |
| 20 class ThemeManager final { | |
| 15 public: | 21 public: |
| 16 Theme(Themes theme = Themes::OS); | 22 ThemeManager(Theme theme = Theme::Default); |
| 17 void SetTheme(Themes theme); | 23 void SetTheme(Theme theme); |
| 18 Themes GetTheme() const; | 24 Theme GetTheme() const; |
| 19 bool IsInDarkTheme() const; | 25 bool IsInDarkTheme() const; |
| 20 void RepaintCurrentTheme(); | 26 void RepaintCurrentTheme(); |
| 21 | 27 |
| 22 private: | 28 private: |
| 23 void SetToDarkTheme(); | 29 void SetToDarkTheme(); |
| 24 void SetToLightTheme(); | 30 void SetToLightTheme(); |
| 25 void SetStyleSheet(Themes theme); | 31 void SetStyleSheet(Theme theme); |
| 26 Themes GetCurrentOSTheme() const; | 32 Theme GetCurrentOSTheme() const; |
| 27 Themes theme; | 33 Theme theme; |
| 28 }; | 34 }; |
| 29 | 35 |
| 30 } // namespace Theme | 36 } // namespace Theme |
| 31 | 37 |
| 32 #endif // MINORI_GUI_THEME_H_ | 38 #endif // MINORI_GUI_THEME_H_ |
