1 | /* vi: ts=8 sts=4 sw=4 |
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 | * |
22 | * Sepecifies which colors will be used when recoloring icons as its stylesheet. |
23 | * |
24 | * KIconLoader supports re-coloring svg icons based on a set of colors. This |
25 | * class will define them. |
26 | * |
27 | * @see KIconEngine |
28 | * @see KDE::icon |
29 | */ |
30 | class KICONTHEMES_EXPORT KIconColors |
31 | { |
32 | public: |
33 | /** |
34 | * Will fill the colors based on the default QPalette() constructor. |
35 | */ |
36 | KIconColors(); |
37 | |
38 | /** |
39 | * Makes all the color property be @p colors |
40 | */ |
41 | explicit KIconColors(const QColor &colors); |
42 | |
43 | /** |
44 | * Uses @palette to define text, highlight, highlightedText, accent and background. |
45 | * The rest being positiveText, negativeText and neutralText are filled from |
46 | * KColorScheme(QPalette::Active, KColorScheme::Window); |
47 | */ |
48 | explicit KIconColors(const QPalette &palette); |
49 | |
50 | KIconColors(const KIconColors &other); |
51 | ~KIconColors(); |
52 | KIconColors operator=(const KIconColors &other); |
53 | |
54 | QColor text() const; |
55 | QColor highlight() const; |
56 | QColor highlightedText() const; |
57 | QColor accent() const; |
58 | QColor background() const; |
59 | QColor neutralText() const; |
60 | QColor positiveText() const; |
61 | QColor negativeText() const; |
62 | QColor activeText() const; |
63 | |
64 | void setText(const QColor &color); |
65 | void setHighlight(const QColor &color); |
66 | void setHighlightedText(const QColor &color); |
67 | void setAccent(const QColor &color); |
68 | void setBackground(const QColor &color); |
69 | void setNeutralText(const QColor &color); |
70 | void setPositiveText(const QColor &color); |
71 | void setNegativeText(const QColor &color); |
72 | void setActiveText(const QColor& color); |
73 | |
74 | protected: |
75 | /** |
76 | * @returns a CSS stylesheet to be used SVG icon files. |
77 | * @param state defines the state we are rendering the stylesheet for |
78 | * |
79 | * Specifies: .ColorScheme-Text, .ColorScheme-Background, .ColorScheme-Highlight, |
80 | * .ColorScheme-HighlightedText, .ColorScheme-PositiveText, .ColorScheme-NeutralText |
81 | * .ColorScheme-NegativeText, .ColorScheme-ActiveText, .ColorScheme-Complement, |
82 | * .ColorScheme-Contrast, .ColorScheme-Accent, |
83 | */ |
84 | QString stylesheet(KIconLoader::States state) const; |
85 | |
86 | private: |
87 | Q_DECLARE_PRIVATE(KIconColors) |
88 | friend class KIconLoaderPrivate; |
89 | |
90 | QExplicitlySharedDataPointer<KIconColorsPrivate> d_ptr; |
91 | }; |
92 | |
93 | #endif |
94 | |