| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTDATAVIS3D_Q3DTHEME_H |
| 5 | #define QTDATAVIS3D_Q3DTHEME_H |
| 6 | |
| 7 | #include <QtDataVisualization/qdatavisualizationglobal.h> |
| 8 | #include <QtCore/QObject> |
| 9 | #include <QtGui/QLinearGradient> |
| 10 | #include <QtGui/QFont> |
| 11 | #include <QtGui/QColor> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class Q3DThemePrivate; |
| 16 | |
| 17 | class Q_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | Q_ENUMS(ColorStyle) |
| 21 | Q_ENUMS(Theme) |
| 22 | Q_PROPERTY(Theme type READ type WRITE setType NOTIFY typeChanged) |
| 23 | Q_PROPERTY(QList<QColor> baseColors READ baseColors WRITE setBaseColors NOTIFY baseColorsChanged) |
| 24 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) |
| 25 | Q_PROPERTY(QColor windowColor READ windowColor WRITE setWindowColor NOTIFY windowColorChanged) |
| 26 | Q_PROPERTY(QColor labelTextColor READ labelTextColor WRITE setLabelTextColor NOTIFY labelTextColorChanged) |
| 27 | Q_PROPERTY(QColor labelBackgroundColor READ labelBackgroundColor WRITE setLabelBackgroundColor NOTIFY labelBackgroundColorChanged) |
| 28 | Q_PROPERTY(QColor gridLineColor READ gridLineColor WRITE setGridLineColor NOTIFY gridLineColorChanged) |
| 29 | Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged) |
| 30 | Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor NOTIFY multiHighlightColorChanged) |
| 31 | Q_PROPERTY(QColor lightColor READ lightColor WRITE setLightColor NOTIFY lightColorChanged) |
| 32 | Q_PROPERTY(QList<QLinearGradient> baseGradients READ baseGradients WRITE setBaseGradients NOTIFY baseGradientsChanged) |
| 33 | Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged) |
| 34 | Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged) |
| 35 | Q_PROPERTY(float lightStrength READ lightStrength WRITE setLightStrength NOTIFY lightStrengthChanged) |
| 36 | Q_PROPERTY(float ambientLightStrength READ ambientLightStrength WRITE setAmbientLightStrength NOTIFY ambientLightStrengthChanged) |
| 37 | Q_PROPERTY(float highlightLightStrength READ highlightLightStrength WRITE setHighlightLightStrength NOTIFY highlightLightStrengthChanged) |
| 38 | Q_PROPERTY(bool labelBorderEnabled READ isLabelBorderEnabled WRITE setLabelBorderEnabled NOTIFY labelBorderEnabledChanged) |
| 39 | Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) |
| 40 | Q_PROPERTY(bool backgroundEnabled READ isBackgroundEnabled WRITE setBackgroundEnabled NOTIFY backgroundEnabledChanged) |
| 41 | Q_PROPERTY(bool gridEnabled READ isGridEnabled WRITE setGridEnabled NOTIFY gridEnabledChanged) |
| 42 | Q_PROPERTY(bool labelBackgroundEnabled READ isLabelBackgroundEnabled WRITE setLabelBackgroundEnabled NOTIFY labelBackgroundEnabledChanged) |
| 43 | Q_PROPERTY(ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged) |
| 44 | |
| 45 | public: |
| 46 | enum ColorStyle { |
| 47 | ColorStyleUniform = 0, |
| 48 | ColorStyleObjectGradient, |
| 49 | ColorStyleRangeGradient |
| 50 | }; |
| 51 | |
| 52 | enum Theme { |
| 53 | ThemeQt = 0, |
| 54 | ThemePrimaryColors, |
| 55 | ThemeDigia, |
| 56 | ThemeStoneMoss, |
| 57 | ThemeArmyBlue, |
| 58 | ThemeRetro, |
| 59 | ThemeEbony, |
| 60 | ThemeIsabelle, |
| 61 | ThemeUserDefined |
| 62 | }; |
| 63 | |
| 64 | public: |
| 65 | explicit Q3DTheme(QObject *parent = nullptr); |
| 66 | explicit Q3DTheme(Theme themeType, QObject *parent = nullptr); |
| 67 | virtual ~Q3DTheme(); |
| 68 | |
| 69 | void setType(Theme themeType); |
| 70 | Theme type() const; |
| 71 | |
| 72 | void setBaseColors(const QList<QColor> &colors); |
| 73 | QList<QColor> baseColors() const; |
| 74 | |
| 75 | void setBackgroundColor(const QColor &color); |
| 76 | QColor backgroundColor() const; |
| 77 | |
| 78 | void setWindowColor(const QColor &color); |
| 79 | QColor windowColor() const; |
| 80 | |
| 81 | void setLabelTextColor(const QColor &color); |
| 82 | QColor labelTextColor() const; |
| 83 | |
| 84 | void setLabelBackgroundColor(const QColor &color); |
| 85 | QColor labelBackgroundColor() const; |
| 86 | |
| 87 | void setGridLineColor(const QColor &color); |
| 88 | QColor gridLineColor() const; |
| 89 | |
| 90 | void setSingleHighlightColor(const QColor &color); |
| 91 | QColor singleHighlightColor() const; |
| 92 | |
| 93 | void setMultiHighlightColor(const QColor &color); |
| 94 | QColor multiHighlightColor() const; |
| 95 | |
| 96 | void setLightColor(const QColor &color); |
| 97 | QColor lightColor() const; |
| 98 | |
| 99 | void setBaseGradients(const QList<QLinearGradient> &gradients); |
| 100 | QList<QLinearGradient> baseGradients() const; |
| 101 | |
| 102 | void setSingleHighlightGradient(const QLinearGradient &gradient); |
| 103 | QLinearGradient singleHighlightGradient() const; |
| 104 | |
| 105 | void setMultiHighlightGradient(const QLinearGradient &gradient); |
| 106 | QLinearGradient multiHighlightGradient() const; |
| 107 | |
| 108 | void setLightStrength(float strength); |
| 109 | float lightStrength() const; |
| 110 | |
| 111 | void setAmbientLightStrength(float strength); |
| 112 | float ambientLightStrength() const; |
| 113 | |
| 114 | void setHighlightLightStrength(float strength); |
| 115 | float highlightLightStrength() const; |
| 116 | |
| 117 | void setLabelBorderEnabled(bool enabled); |
| 118 | bool isLabelBorderEnabled() const; |
| 119 | |
| 120 | void setFont(const QFont &font); |
| 121 | QFont font() const; |
| 122 | |
| 123 | void setBackgroundEnabled(bool enabled); |
| 124 | bool isBackgroundEnabled() const; |
| 125 | |
| 126 | void setGridEnabled(bool enabled); |
| 127 | bool isGridEnabled() const; |
| 128 | |
| 129 | void setLabelBackgroundEnabled(bool enabled); |
| 130 | bool isLabelBackgroundEnabled() const; |
| 131 | |
| 132 | void setColorStyle(ColorStyle style); |
| 133 | ColorStyle colorStyle() const; |
| 134 | |
| 135 | Q_SIGNALS: |
| 136 | void typeChanged(Q3DTheme::Theme themeType); |
| 137 | void baseColorsChanged(const QList<QColor> &colors); |
| 138 | void backgroundColorChanged(const QColor &color); |
| 139 | void windowColorChanged(const QColor &color); |
| 140 | void labelTextColorChanged(const QColor &color); |
| 141 | void labelBackgroundColorChanged(const QColor &color); |
| 142 | void gridLineColorChanged(const QColor &color); |
| 143 | void singleHighlightColorChanged(const QColor &color); |
| 144 | void multiHighlightColorChanged(const QColor &color); |
| 145 | void lightColorChanged(const QColor &color); |
| 146 | void baseGradientsChanged(const QList<QLinearGradient> &gradients); |
| 147 | void singleHighlightGradientChanged(const QLinearGradient &gradient); |
| 148 | void multiHighlightGradientChanged(const QLinearGradient &gradient); |
| 149 | void lightStrengthChanged(float strength); |
| 150 | void ambientLightStrengthChanged(float strength); |
| 151 | void highlightLightStrengthChanged(float strength); |
| 152 | void labelBorderEnabledChanged(bool enabled); |
| 153 | void fontChanged(const QFont &font); |
| 154 | void backgroundEnabledChanged(bool enabled); |
| 155 | void gridEnabledChanged(bool enabled); |
| 156 | void labelBackgroundEnabledChanged(bool enabled); |
| 157 | void colorStyleChanged(Q3DTheme::ColorStyle style); |
| 158 | |
| 159 | protected: |
| 160 | explicit Q3DTheme(Q3DThemePrivate *d, Theme themeType, QObject *parent = nullptr); |
| 161 | |
| 162 | QScopedPointer<Q3DThemePrivate> d_ptr; |
| 163 | |
| 164 | private: |
| 165 | Q_DISABLE_COPY(Q3DTheme) |
| 166 | |
| 167 | friend class ThemeManager; |
| 168 | friend class Abstract3DRenderer; |
| 169 | friend class Bars3DController; |
| 170 | friend class AbstractDeclarative; |
| 171 | friend class Abstract3DController; |
| 172 | }; |
| 173 | |
| 174 | QT_END_NAMESPACE |
| 175 | |
| 176 | #endif |
| 177 | |