• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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,
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) /* so we can pass it in QVariant's */
00532 
00533 #endif // KCOLORSCHEME_H
00534 // 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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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