Krita Source Code Documentation
Loading...
Searching...
No Matches
kcolorscheme.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KCOLORSCHEME_H
8#define KCOLORSCHEME_H
9
10#include <kritawidgetutils_export.h>
11#include <ksharedconfig.h>
12
13#include <QExplicitlySharedDataPointer>
14
15#include <QPalette>
16
17class QColor;
18class QBrush;
19
21
52class KRITAWIDGETUTILS_EXPORT KColorScheme
53{
54public:
55
102
116 NormalBackground = 0,
123 AlternateBackground = 1,
133 ActiveBackground = 2,
142 LinkBackground = 3,
150 VisitedBackground = 4,
154 NegativeBackground = 5,
158 NeutralBackground = 6,
162 PositiveBackground = 7
163 };
164
185 NormalText = 0,
192 InactiveText = 1,
197 ActiveText = 2,
203 LinkText = 3,
211 VisitedText = 4,
216 NegativeText = 5,
220 NeutralText = 6,
225 PositiveText = 7
226 };
227
246 HoverColor
247 };
248
281
283 KColorScheme(const KColorScheme &);
284
286 virtual ~KColorScheme();
287
289 KColorScheme &operator=(const KColorScheme &);
290
301 explicit KColorScheme(QPalette::ColorGroup, ColorSet = View, KSharedConfigPtr = KSharedConfigPtr());
302
306 QBrush background(BackgroundRole = NormalBackground) const;
307
311 QBrush foreground(ForegroundRole = NormalText) const;
312
316 QBrush decoration(DecorationRole) const;
317
331 QColor shade(ShadeRole) const;
332
338 static int contrast();
339
347 static qreal contrastF(const KSharedConfigPtr &config = KSharedConfigPtr());
348
359 static QColor shade(const QColor &, ShadeRole);
360
381 static QColor shade(const QColor &, ShadeRole,
382 qreal contrast, qreal chromaAdjust = 0.0);
383
393 static void adjustBackground(QPalette &,
394 BackgroundRole newRole = NormalBackground,
395 QPalette::ColorRole color = QPalette::Base,
396 ColorSet set = View,
397 KSharedConfigPtr = KSharedConfigPtr());
398
408 static void adjustForeground(QPalette &,
409 ForegroundRole newRole = NormalText,
410 QPalette::ColorRole color = QPalette::Text,
411 ColorSet set = View,
412 KSharedConfigPtr = KSharedConfigPtr());
413
424 static QPalette createApplicationPalette(const KSharedConfigPtr &config);
425
426private:
427 QExplicitlySharedDataPointer<KColorSchemePrivate> d;
428};
429
453class KRITAWIDGETUTILS_EXPORT KStatefulBrush
454{
455public:
461 explicit KStatefulBrush();
462
470 KSharedConfigPtr = KSharedConfigPtr());
471
479 KSharedConfigPtr = KSharedConfigPtr());
480
488 KSharedConfigPtr = KSharedConfigPtr());
489
498 explicit KStatefulBrush(const QBrush &, KSharedConfigPtr = KSharedConfigPtr());
499
514 explicit KStatefulBrush(const QBrush &, const QBrush &background,
515 KSharedConfigPtr = KSharedConfigPtr());
516
519
522
524 KStatefulBrush &operator=(const KStatefulBrush &);
525
531 QBrush brush(QPalette::ColorGroup) const;
532
539 QBrush brush(const QPalette &) const;
540
549 QBrush brush(const QWidget *) const;
550
551private:
553};
554
555Q_DECLARE_METATYPE(KStatefulBrush) /* so we can pass it in QVariant's */
556
557#endif // KCOLORSCHEME_H
QExplicitlySharedDataPointer< KColorSchemePrivate > d
class KStatefulBrushPrivate * d
Definition View.h:25
Q_DECLARE_METATYPE(KisPaintopLodLimitations)