00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KCOLORSCHEME_H
00021 #define KCOLORSCHEME_H
00022
00023 #include <kdeui_export.h>
00024 #include <ksharedconfig.h>
00025
00026 #include <QtCore/QExplicitlySharedDataPointer>
00027
00028 #include <QtGui/QPalette>
00029
00030 class QColor;
00031 class QBrush;
00032
00033 class KColorSchemePrivate;
00034
00071 class KDEUI_EXPORT KColorScheme {
00072 public:
00073
00081 enum ColorSet {
00087 View,
00093 Window,
00101 Button,
00109 Selection,
00118 Tooltip
00119 };
00120
00130 enum BackgroundRole {
00134 NormalBackground = 0,
00141 AlternateBackground = 1,
00151 ActiveBackground = 2,
00160 LinkBackground = 3,
00164 VisitedBackground = 4,
00168 NegativeBackground = 5,
00172 NeutralBackground = 6,
00176 PositiveBackground = 7
00177 };
00178
00195 enum ForegroundRole {
00199 NormalText = 0,
00205 InactiveText = 1,
00210 ActiveText = 2,
00215 LinkText = 3,
00221 VisitedText = 4,
00225 NegativeText = 5,
00229 NeutralText = 6,
00233 PositiveText = 7
00234 };
00235
00245 enum DecorationRole {
00249 FocusColor,
00254 HoverColor
00255 };
00256
00265 enum ShadeRole {
00270 LightShade,
00274 MidlightShade,
00278 MidShade,
00282 DarkShade,
00287 ShadowShade
00288 };
00289
00291 KColorScheme(const KColorScheme&);
00292
00294 virtual ~KColorScheme();
00295
00297 KColorScheme& operator=(const KColorScheme&);
00298
00309 explicit KColorScheme(QPalette::ColorGroup, ColorSet = View, KSharedConfigPtr = KSharedConfigPtr());
00310
00314 QBrush background(BackgroundRole = NormalBackground) const;
00315
00319 QBrush foreground(ForegroundRole = NormalText) const;
00320
00324 QBrush decoration(DecorationRole) const;
00325
00339 QColor shade(ShadeRole) const;
00340
00351 static QColor shade(const QColor&, ShadeRole);
00352
00371 static QColor shade(const QColor&, ShadeRole,
00372 qreal contrast, qreal chromaAdjust = 0.0);
00373
00383 static void adjustBackground(QPalette &,
00384 BackgroundRole newRole = NormalBackground,
00385 QPalette::ColorRole color = QPalette::Base,
00386 ColorSet set = View,
00387 KSharedConfigPtr = KSharedConfigPtr());
00388
00398 static void adjustForeground(QPalette &,
00399 ForegroundRole newRole = NormalText,
00400 QPalette::ColorRole color = QPalette::Text,
00401 ColorSet set = View,
00402 KSharedConfigPtr = KSharedConfigPtr());
00403
00404 private:
00405 QExplicitlySharedDataPointer<KColorSchemePrivate> d;
00406 };
00407
00431 class KDEUI_EXPORT KStatefulBrush
00432 {
00433 public:
00439 explicit KStatefulBrush();
00440
00446 explicit KStatefulBrush(KColorScheme::ColorSet,
00447 KColorScheme::ForegroundRole,
00448 KSharedConfigPtr = KSharedConfigPtr());
00449
00455 explicit KStatefulBrush(KColorScheme::ColorSet,
00456 KColorScheme::BackgroundRole,
00457 KSharedConfigPtr = KSharedConfigPtr());
00458
00464 explicit KStatefulBrush(KColorScheme::ColorSet,
00465 KColorScheme::DecorationRole,
00466 KSharedConfigPtr = KSharedConfigPtr());
00467
00476 explicit KStatefulBrush(const QBrush&, KSharedConfigPtr = KSharedConfigPtr());
00477
00490 explicit KStatefulBrush(const QBrush&, const QBrush &background,
00491 KSharedConfigPtr = KSharedConfigPtr());
00492
00494 KStatefulBrush(const KStatefulBrush&);
00495
00497 ~KStatefulBrush();
00498
00500 KStatefulBrush& operator=(const KStatefulBrush&);
00501
00507 QBrush brush(QPalette::ColorGroup) const;
00508
00515 QBrush brush(const QPalette&) const;
00516
00525 QBrush brush(const QWidget*) const;
00526
00527 private:
00528 class KStatefulBrushPrivate *d;
00529 };
00530
00531 Q_DECLARE_METATYPE(KStatefulBrush)
00532
00533 #endif // KCOLORSCHEME_H
00534