| 1 | /* |
| 2 | |
| 3 | This file is part of the KDE project, module kdecore. |
| 4 | SPDX-FileCopyrightText: 2000 Geert Jansen <jansen@kde.org> |
| 5 | SPDX-FileCopyrightText: 2000 Antonio Larrosa <larrosa@kde.org> |
| 6 | |
| 7 | SPDX-License-Identifier: LGPL-2.0-only |
| 8 | */ |
| 9 | |
| 10 | #ifndef KICONCOLORS_H |
| 11 | #define KICONCOLORS_H |
| 12 | |
| 13 | #include "kiconloader.h" |
| 14 | #include <QPalette> |
| 15 | #include <QSharedDataPointer> |
| 16 | |
| 17 | class KIconColorsPrivate; |
| 18 | |
| 19 | /*! |
| 20 | * \class KIconColors |
| 21 | * \inmodule KIconThemes |
| 22 | * |
| 23 | * \brief Sepecifies which colors will be used when recoloring icons as its stylesheet. |
| 24 | * |
| 25 | * KIconLoader supports re-coloring svg icons based on a set of colors. This |
| 26 | * class will define them. |
| 27 | * |
| 28 | * \sa KIconEngine |
| 29 | * \sa KDE::icon |
| 30 | */ |
| 31 | class KICONTHEMES_EXPORT KIconColors |
| 32 | { |
| 33 | public: |
| 34 | /*! |
| 35 | * Will fill the colors based on the default QPalette() constructor. |
| 36 | */ |
| 37 | KIconColors(); |
| 38 | |
| 39 | /*! |
| 40 | * Makes all the color properties be \a color. |
| 41 | */ |
| 42 | explicit KIconColors(const QColor &color); |
| 43 | |
| 44 | /*! |
| 45 | * Uses \a palette to define text, highlight, highlightedText, accent and background. |
| 46 | * |
| 47 | * The rest being positiveText, negativeText and neutralText are filled from |
| 48 | * KColorScheme(QPalette::Active, KColorScheme::Window); |
| 49 | */ |
| 50 | explicit KIconColors(const QPalette &palette); |
| 51 | |
| 52 | KIconColors(const KIconColors &other); |
| 53 | ~KIconColors(); |
| 54 | KIconColors operator=(const KIconColors &other); |
| 55 | |
| 56 | /*! |
| 57 | * |
| 58 | */ |
| 59 | QColor text() const; |
| 60 | |
| 61 | /*! |
| 62 | * |
| 63 | */ |
| 64 | QColor highlight() const; |
| 65 | |
| 66 | /*! |
| 67 | * |
| 68 | */ |
| 69 | QColor highlightedText() const; |
| 70 | |
| 71 | /*! |
| 72 | * |
| 73 | */ |
| 74 | QColor accent() const; |
| 75 | |
| 76 | /*! |
| 77 | * |
| 78 | */ |
| 79 | QColor background() const; |
| 80 | |
| 81 | /*! |
| 82 | * |
| 83 | */ |
| 84 | QColor neutralText() const; |
| 85 | |
| 86 | /*! |
| 87 | * |
| 88 | */ |
| 89 | QColor positiveText() const; |
| 90 | |
| 91 | /*! |
| 92 | * |
| 93 | */ |
| 94 | QColor negativeText() const; |
| 95 | |
| 96 | /*! |
| 97 | * |
| 98 | */ |
| 99 | QColor activeText() const; |
| 100 | |
| 101 | /*! |
| 102 | * |
| 103 | */ |
| 104 | void setText(const QColor &color); |
| 105 | |
| 106 | /*! |
| 107 | * |
| 108 | */ |
| 109 | void setHighlight(const QColor &color); |
| 110 | |
| 111 | /*! |
| 112 | * |
| 113 | */ |
| 114 | void setHighlightedText(const QColor &color); |
| 115 | |
| 116 | /*! |
| 117 | * |
| 118 | */ |
| 119 | void setAccent(const QColor &color); |
| 120 | |
| 121 | /*! |
| 122 | * |
| 123 | */ |
| 124 | void setBackground(const QColor &color); |
| 125 | |
| 126 | /*! |
| 127 | * |
| 128 | */ |
| 129 | void setNeutralText(const QColor &color); |
| 130 | |
| 131 | /*! |
| 132 | * |
| 133 | */ |
| 134 | void setPositiveText(const QColor &color); |
| 135 | |
| 136 | /*! |
| 137 | * |
| 138 | */ |
| 139 | void setNegativeText(const QColor &color); |
| 140 | |
| 141 | /*! |
| 142 | * |
| 143 | */ |
| 144 | void setActiveText(const QColor &color); |
| 145 | |
| 146 | protected: |
| 147 | /*! |
| 148 | * Returns a CSS stylesheet to be used SVG icon files. |
| 149 | * \a state defines the state we are rendering the stylesheet for |
| 150 | * |
| 151 | * Specifies: \c .ColorScheme-Text, \c .ColorScheme-Background, \c .ColorScheme-Highlight, |
| 152 | * \c .ColorScheme-HighlightedText, \c .ColorScheme-PositiveText, \c .ColorScheme-NeutralText |
| 153 | * \c .ColorScheme-NegativeText, \c .ColorScheme-ActiveText, \c .ColorScheme-Complement, |
| 154 | * \c .ColorScheme-Contrast, \c .ColorScheme-Accent |
| 155 | */ |
| 156 | QString stylesheet(KIconLoader::States state) const; |
| 157 | |
| 158 | private: |
| 159 | Q_DECLARE_PRIVATE(KIconColors) |
| 160 | friend class KIconLoaderPrivate; |
| 161 | |
| 162 | QExplicitlySharedDataPointer<KIconColorsPrivate> d_ptr; |
| 163 | }; |
| 164 | |
| 165 | #endif |
| 166 | |