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#include <QQmlEngine>
9
10namespace cutehmi {
11namespace gui {
12
20class CUTEHMI_GUI_API Palette:
21 public QObject
22{
23 Q_OBJECT
24 QML_NAMED_ELEMENT(Palette)
25
26 public:
30 Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged)
31
32
35 Q_PROPERTY(cutehmi::gui::ColorSet * alarm READ alarm WRITE setAlarm NOTIFY alarmChanged RESET resetAlarm)
36
37
40 Q_PROPERTY(cutehmi::gui::ColorSet * warning READ warning WRITE setWarning NOTIFY warningChanged RESET resetWarning)
41
42
45 Q_PROPERTY(cutehmi::gui::ColorSet * active READ active WRITE setActive NOTIFY activeChanged RESET resetActive)
46
47
50 Q_PROPERTY(cutehmi::gui::ColorSet * inactive READ inactive WRITE setInactive NOTIFY inactiveChanged RESET resetInactive)
51
52
55 Q_PROPERTY(cutehmi::gui::ColorSet * neutral READ neutral WRITE setNeutral NOTIFY neutralChanged RESET resetNeutral)
56
57 Palette(QObject * parent = nullptr);
58
59 QColor background() const;
60
61 void setBackground(QColor background);
62
63 ColorSet * alarm() const;
64
65 void setAlarm(ColorSet * alarm);
66
67 void resetAlarm();
68
69 ColorSet * warning() const;
70
71 void setWarning(ColorSet * warning);
72
73 void resetWarning();
74
75 ColorSet * active() const;
76
77 void setActive(ColorSet * active);
78
79 void resetActive();
80
81 ColorSet * inactive() const;
82
83 void setInactive(ColorSet * inactive);
84
85 void resetInactive();
86
87 ColorSet * neutral() const;
88
89 void setNeutral(ColorSet * neutral);
90
91 void resetNeutral();
92
93 signals:
95
97
99
101
103
105
106 protected:
107 static ColorSet & DefaultAlarm();
108
109 static ColorSet & DefaultWarning();
110
111 static ColorSet & DefaultActive();
112
113 static ColorSet & DefaultInactive();
114
115 static ColorSet & DefaultNeutral();
116
117 private:
118 static constexpr Qt::GlobalColor INITIAL_BACKGROUND = Qt::white;
119
120 struct Members
121 {
122 QColor background;
123 ColorSet * alarm;
124 ColorSet * warning;
125 ColorSet * active;
126 ColorSet * inactive;
127 ColorSet * neutral;
128
129 Members():
130 background(INITIAL_BACKGROUND),
131 alarm(& DefaultAlarm()),
132 warning(& DefaultWarning()),
133 active(& DefaultActive()),
134 inactive(& DefaultInactive()),
135 neutral(& DefaultNeutral())
136 {
137 }
138 };
139
141};
142
143}
144}
145
146#endif
147
148//(c)C: Copyright © 2020-2022, Michał Policht <michal@policht.pl>. All rights reserved.
149//(c)C: SPDX-License-Identifier: LGPL-3.0-or-later OR MIT
150//(c)C: This file is a part of CuteHMI.
151//(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.
152//(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.
153//(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/>.
154//(c)C: Additionally, this file is licensed under terms of MIT license as expressed below.
155//(c)C: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
156//(c)C: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
157//(c)C: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Color set.
Definition: ColorSet.hpp:18
Palette.
Definition: Palette.hpp:22
GlobalColor