CuteHMI - Graphical User Interface (CuteHMI.GUI.1)
Palette.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_GUI_1_INCLUDE_CUTEHMI_GUI_PALETTE_HPP
2 #define H_EXTENSIONS_CUTEHMI_GUI_1_INCLUDE_CUTEHMI_GUI_PALETTE_HPP
3 
4 #include "internal/common.hpp"
5 #include "ColorSet.hpp"
6 
7 #include <QObject>
8 
9 namespace cutehmi {
10 namespace gui {
11 
19 class CUTEHMI_GUI_API Palette:
20  public QObject
21 {
22  Q_OBJECT
23 
24  public:
28  Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged)
29 
30 
33  Q_PROPERTY(ColorSet * alarm READ alarm WRITE setAlarm NOTIFY alarmChanged RESET resetAlarm)
34 
38  Q_PROPERTY(ColorSet * warning READ warning WRITE setWarning NOTIFY warningChanged RESET resetWarning)
39 
43  Q_PROPERTY(ColorSet * active READ active WRITE setActive NOTIFY activeChanged RESET resetActive)
44 
48  Q_PROPERTY(ColorSet * inactive READ inactive WRITE setInactive NOTIFY inactiveChanged RESET resetInactive)
49 
53  Q_PROPERTY(ColorSet * neutral READ neutral WRITE setNeutral NOTIFY neutralChanged RESET resetNeutral)
54 
55  Palette(QObject * parent = nullptr);
56 
57  QColor background() const;
58 
59  void setBackground(QColor background);
60 
61  ColorSet * alarm() const;
62 
63  void setAlarm(ColorSet * alarm);
64 
65  void resetAlarm();
66 
67  ColorSet * warning() const;
68 
69  void setWarning(ColorSet * warning);
70 
71  void resetWarning();
72 
73  ColorSet * active() const;
74 
75  void setActive(ColorSet * active);
76 
77  void resetActive();
78 
79  ColorSet * inactive() const;
80 
81  void setInactive(ColorSet * inactive);
82 
83  void resetInactive();
84 
85  ColorSet * neutral() const;
86 
87  void setNeutral(ColorSet * neutral);
88 
89  void resetNeutral();
90 
91  signals:
92  void backgroundChanged();
93 
94  void alarmChanged();
95 
96  void warningChanged();
97 
98  void activeChanged();
99 
100  void inactiveChanged();
101 
102  void neutralChanged();
103 
104  protected:
105  static ColorSet & DefaultAlarm();
106 
107  static ColorSet & DefaultWarning();
108 
109  static ColorSet & DefaultActive();
110 
111  static ColorSet & DefaultInactive();
112 
113  static ColorSet & DefaultNeutral();
114 
115  private:
116  struct Members
117  {
118  QColor background;
119  ColorSet * alarm;
120  ColorSet * warning;
121  ColorSet * active;
122  ColorSet * inactive;
123  ColorSet * neutral;
124 
125  Members():
126  background(Qt::white),
127  alarm(& DefaultAlarm()),
128  warning(& DefaultWarning()),
129  active(& DefaultActive()),
130  inactive(& DefaultInactive()),
131  neutral(& DefaultNeutral())
132  {
133  }
134  };
135 
136  MPtr<Members> m;
137 };
138 
139 }
140 }
141 
142 #endif
143 
144 //(c)C: Copyright © 2020, Michał Policht <michal@policht.pl>. All rights reserved.
145 //(c)C: This file is a part of CuteHMI.
146 //(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.
147 //(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.
148 //(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/>.
QColor
cutehmi::MPtr< Members >
QObject
cutehmi
cutehmi::gui::ColorSet
Color set.
Definition: ColorSet.hpp:15
cutehmi::gui::Palette
Palette.
Definition: Palette.hpp:19