• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

kcolorscheme.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
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,
00168         VisitedBackground = 4,
00172         NegativeBackground = 5,
00176         NeutralBackground = 6,
00180         PositiveBackground = 7
00181     };
00182 
00199     enum ForegroundRole {
00203         NormalText = 0,
00210         InactiveText = 1,
00215         ActiveText = 2,
00221         LinkText = 3,
00229         VisitedText = 4,
00234         NegativeText = 5,
00238         NeutralText = 6,
00243         PositiveText = 7
00244     };
00245 
00255     enum DecorationRole {
00259         FocusColor,
00264         HoverColor
00265     };
00266 
00275     enum ShadeRole {
00280         LightShade,
00284         MidlightShade,
00288         MidShade,
00292         DarkShade,
00297         ShadowShade
00298     };
00299 
00301     KColorScheme(const KColorScheme&);
00302 
00304     virtual ~KColorScheme();
00305 
00307     KColorScheme& operator=(const KColorScheme&);
00308 
00319     explicit KColorScheme(QPalette::ColorGroup, ColorSet = View, KSharedConfigPtr = KSharedConfigPtr());
00320 
00324     QBrush background(BackgroundRole = NormalBackground) const;
00325 
00329     QBrush foreground(ForegroundRole = NormalText) const;
00330 
00334     QBrush decoration(DecorationRole) const;
00335 
00349     QColor shade(ShadeRole) const;
00350 
00361     static QColor shade(const QColor&, ShadeRole);
00362 
00381     static QColor shade(const QColor&, ShadeRole,
00382                         qreal contrast, qreal chromaAdjust = 0.0);
00383 
00393     static void adjustBackground(QPalette &,
00394                                  BackgroundRole newRole = NormalBackground,
00395                                  QPalette::ColorRole color = QPalette::Base,
00396                                  ColorSet set = View,
00397                                  KSharedConfigPtr = KSharedConfigPtr());
00398 
00408     static void adjustForeground(QPalette &,
00409                                  ForegroundRole newRole = NormalText,
00410                                  QPalette::ColorRole color = QPalette::Text,
00411                                  ColorSet set = View,
00412                                  KSharedConfigPtr = KSharedConfigPtr());
00413 
00414 private:
00415     QExplicitlySharedDataPointer<KColorSchemePrivate> d;
00416 };
00417 
00441 class KDEUI_EXPORT KStatefulBrush
00442 {
00443 public:
00449     explicit KStatefulBrush();
00450 
00456     explicit KStatefulBrush(KColorScheme::ColorSet,
00457                             KColorScheme::ForegroundRole,
00458                             KSharedConfigPtr = KSharedConfigPtr());
00459 
00465     explicit KStatefulBrush(KColorScheme::ColorSet,
00466                             KColorScheme::BackgroundRole,
00467                             KSharedConfigPtr = KSharedConfigPtr());
00468 
00474     explicit KStatefulBrush(KColorScheme::ColorSet,
00475                             KColorScheme::DecorationRole,
00476                             KSharedConfigPtr = KSharedConfigPtr());
00477 
00486     explicit KStatefulBrush(const QBrush&, KSharedConfigPtr = KSharedConfigPtr());
00487 
00500     explicit KStatefulBrush(const QBrush&, const QBrush &background,
00501                             KSharedConfigPtr = KSharedConfigPtr());
00502 
00504     KStatefulBrush(const KStatefulBrush&);
00505 
00507     ~KStatefulBrush();
00508 
00510     KStatefulBrush& operator=(const KStatefulBrush&);
00511 
00517     QBrush brush(QPalette::ColorGroup) const;
00518 
00525     QBrush brush(const QPalette&) const;
00526 
00535     QBrush brush(const QWidget*) const;
00536 
00537 private:
00538     class KStatefulBrushPrivate *d;
00539 };
00540 
00541 Q_DECLARE_METATYPE(KStatefulBrush) /* so we can pass it in QVariant's */
00542 
00543 #endif // KCOLORSCHEME_H
00544 // kate: space-indent on; indent-width 4; replace-tabs on; auto-insert-doxygen on;

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal