CuteHMI - Graphical User Interface (CuteHMI.GUI.0)
Theme.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_GUI_0_INCLUDE_CUTEHMI_GUI_THEME_HPP
2 #define H_EXTENSIONS_CUTEHMI_GUI_0_INCLUDE_CUTEHMI_GUI_THEME_HPP
3 
4 #include "internal/common.hpp"
5 #include "Palette.hpp"
6 #include "Units.hpp"
7 #include "Fonts.hpp"
8 
9 #include <QObject>
10 
11 namespace cutehmi {
12 namespace gui {
13 
19 class CUTEHMI_GUI_API Theme:
20  public QObject
21 {
22  Q_OBJECT
23 
24  public:
25  Q_PROPERTY(Palette * palette READ palette WRITE setPalette NOTIFY paletteChanged RESET resetPalette)
26 
27  Q_PROPERTY(Units * units READ units WRITE setUnits NOTIFY unitsChanged RESET resetUnits)
28 
29  Q_PROPERTY(Fonts * fonts READ fonts WRITE setFonts NOTIFY fontsChanged RESET resetFonts)
30 
31  Theme(QObject * parent = nullptr);
32 
33  Palette * palette() const;
34 
35  void setPalette(Palette * palette);
36 
37  void resetPalette();
38 
39  Units * units() const;
40 
41  void setUnits(Units * units);
42 
43  void resetUnits();
44 
45  Fonts * fonts() const;
46 
47  void setFonts(Fonts * fonts);
48 
49  void resetFonts();
50 
51  signals:
52  void paletteChanged();
53 
54  void unitsChanged();
55 
56  void fontsChanged();
57 
58  protected:
59  static Palette & DefaultPalette();
60 
61  static Units & DefaultUnits();
62 
63  static Fonts & DefaultFonts();
64 
65  private:
66  void establishFontBindings();
67 
68  struct Members
69  {
70  Palette * palette;
71  Units * units;
72  Fonts * fonts;
73 
74  Members():
75  palette(& DefaultPalette()),
76  units(& DefaultUnits()),
77  fonts(& DefaultFonts())
78  {
79  }
80  };
81 
82  MPtr<Members> m;
83 };
84 
85 }
86 }
87 
88 #endif
89 
90 //(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
91 //(c)C: This file is a part of CuteHMI.
92 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
93 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
94 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
cutehmi::gui::Fonts
Definition: Fonts.hpp:12
cutehmi::gui::Units
Unit.
Definition: Units.hpp:14
cutehmi::MPtr< Members >
QObject
cutehmi
cutehmi::gui::Theme
Theme.
Definition: Theme.hpp:19
cutehmi::gui::Palette
Palette.
Definition: Palette.hpp:19