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,
00159 LinkBackground = 3,
00163 VisitedBackground = 4,
00167 NegativeBackground = 5,
00171 NeutralBackground = 6,
00175 PositiveBackground = 7
00176 };
00177
00194 enum ForegroundRole {
00198 NormalText = 0,
00204 InactiveText = 1,
00209 ActiveText = 2,
00214 LinkText = 3,
00220 VisitedText = 4,
00224 NegativeText = 5,
00228 NeutralText = 6,
00232 PositiveText = 7
00233 };
00234
00244 enum DecorationRole {
00248 FocusColor,
00253 HoverColor
00254 };
00255
00264 enum ShadeRole {
00269 LightShade,
00273 MidlightShade,
00277 MidShade,
00281 DarkShade,
00286 ShadowShade
00287 };
00288
00290 KColorScheme(const KColorScheme&);
00291
00293 virtual ~KColorScheme();
00294
00296 KColorScheme& operator=(const KColorScheme&);
00297
00308 explicit KColorScheme(QPalette::ColorGroup, ColorSet = View, KSharedConfigPtr = KSharedConfigPtr());
00309
00313 QBrush background(BackgroundRole = NormalBackground) const;
00314
00318 QBrush foreground(ForegroundRole = NormalText) const;
00319
00323 QBrush decoration(DecorationRole) const;
00324
00338 QColor shade(ShadeRole) const;
00339
00350 static QColor shade(const QColor&, ShadeRole);
00351
00370 static QColor shade(const QColor&, ShadeRole,
00371 qreal contrast, qreal chromaAdjust = 0.0);
00372
00382 static void adjustBackground(QPalette &,
00383 BackgroundRole newRole = NormalBackground,
00384 QPalette::ColorRole color = QPalette::Base,
00385 ColorSet set = View,
00386 KSharedConfigPtr = KSharedConfigPtr());
00387
00397 static void adjustForeground(QPalette &,
00398 ForegroundRole newRole = NormalText,
00399 QPalette::ColorRole color = QPalette::Text,
00400 ColorSet set = View,
00401 KSharedConfigPtr = KSharedConfigPtr());
00402
00403 private:
00404 QExplicitlySharedDataPointer<KColorSchemePrivate> d;
00405 };
00406
00430 class KDEUI_EXPORT KStatefulBrush
00431 {
00432 public:
00438 explicit KStatefulBrush();
00439
00445 explicit KStatefulBrush(KColorScheme::ColorSet,
00446 KColorScheme::ForegroundRole,
00447 KSharedConfigPtr = KSharedConfigPtr());
00448
00454 explicit KStatefulBrush(KColorScheme::ColorSet,
00455 KColorScheme::BackgroundRole,
00456 KSharedConfigPtr = KSharedConfigPtr());
00457
00463 explicit KStatefulBrush(KColorScheme::ColorSet,
00464 KColorScheme::DecorationRole,
00465 KSharedConfigPtr = KSharedConfigPtr());
00466
00475 explicit KStatefulBrush(const QBrush&, KSharedConfigPtr = KSharedConfigPtr());
00476
00489 explicit KStatefulBrush(const QBrush&, const QBrush &background,
00490 KSharedConfigPtr = KSharedConfigPtr());
00491
00493 KStatefulBrush(const KStatefulBrush&);
00494
00496 ~KStatefulBrush();
00497
00499 KStatefulBrush& operator=(const KStatefulBrush&);
00500
00506 QBrush brush(QPalette::ColorGroup) const;
00507
00514 QBrush brush(const QPalette&) const;
00515
00524 QBrush brush(const QWidget*) const;
00525
00526 private:
00527 class KStatefulBrushPrivate *d;
00528 };
00529
00530 Q_DECLARE_METATYPE(KStatefulBrush)
00531
00532 #endif // KCOLORSCHEME_H
00533