• Skip to content
  • Skip to link menu
KDE 4.1 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,
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) /* so we can pass it in QVariant's */
00531 
00532 #endif // KCOLORSCHEME_H
00533 // 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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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