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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • colors
kcolorscheme.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  * Copyright (C) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KCOLORSCHEME_H
21 #define KCOLORSCHEME_H
22 
23 #include <kdeui_export.h>
24 #include <ksharedconfig.h>
25 
26 #include <QtCore/QExplicitlySharedDataPointer>
27 
28 #include <QtGui/QPalette>
29 
30 class QColor;
31 class QBrush;
32 
33 class KColorSchemePrivate;
34 
71 class KDEUI_EXPORT KColorScheme {
72 public:
73 
81  enum ColorSet {
87  View,
93  Window,
101  Button,
109  Selection,
118  Tooltip
119  };
120 
130  enum BackgroundRole {
134  NormalBackground = 0,
141  AlternateBackground = 1,
151  ActiveBackground = 2,
160  LinkBackground = 3,
168  VisitedBackground = 4,
172  NegativeBackground = 5,
176  NeutralBackground = 6,
180  PositiveBackground = 7
181  };
182 
199  enum ForegroundRole {
203  NormalText = 0,
210  InactiveText = 1,
215  ActiveText = 2,
221  LinkText = 3,
229  VisitedText = 4,
234  NegativeText = 5,
238  NeutralText = 6,
243  PositiveText = 7
244  };
245 
255  enum DecorationRole {
259  FocusColor,
264  HoverColor
265  };
266 
275  enum ShadeRole {
280  LightShade,
284  MidlightShade,
288  MidShade,
292  DarkShade,
297  ShadowShade
298  };
299 
301  KColorScheme(const KColorScheme&);
302 
304  virtual ~KColorScheme();
305 
307  KColorScheme& operator=(const KColorScheme&);
308 
319  explicit KColorScheme(QPalette::ColorGroup, ColorSet = View, KSharedConfigPtr = KSharedConfigPtr());
320 
324  QBrush background(BackgroundRole = NormalBackground) const;
325 
329  QBrush foreground(ForegroundRole = NormalText) const;
330 
334  QBrush decoration(DecorationRole) const;
335 
349  QColor shade(ShadeRole) const;
350 
361  static QColor shade(const QColor&, ShadeRole);
362 
381  static QColor shade(const QColor&, ShadeRole,
382  qreal contrast, qreal chromaAdjust = 0.0);
383 
393  static void adjustBackground(QPalette &,
394  BackgroundRole newRole = NormalBackground,
395  QPalette::ColorRole color = QPalette::Base,
396  ColorSet set = View,
397  KSharedConfigPtr = KSharedConfigPtr());
398 
408  static void adjustForeground(QPalette &,
409  ForegroundRole newRole = NormalText,
410  QPalette::ColorRole color = QPalette::Text,
411  ColorSet set = View,
412  KSharedConfigPtr = KSharedConfigPtr());
413 
414 private:
415  QExplicitlySharedDataPointer<KColorSchemePrivate> d;
416 };
417 
441 class KDEUI_EXPORT KStatefulBrush
442 {
443 public:
449  explicit KStatefulBrush();
450 
456  explicit KStatefulBrush(KColorScheme::ColorSet,
457  KColorScheme::ForegroundRole,
458  KSharedConfigPtr = KSharedConfigPtr());
459 
465  explicit KStatefulBrush(KColorScheme::ColorSet,
466  KColorScheme::BackgroundRole,
467  KSharedConfigPtr = KSharedConfigPtr());
468 
474  explicit KStatefulBrush(KColorScheme::ColorSet,
475  KColorScheme::DecorationRole,
476  KSharedConfigPtr = KSharedConfigPtr());
477 
486  explicit KStatefulBrush(const QBrush&, KSharedConfigPtr = KSharedConfigPtr());
487 
500  explicit KStatefulBrush(const QBrush&, const QBrush &background,
501  KSharedConfigPtr = KSharedConfigPtr());
502 
504  KStatefulBrush(const KStatefulBrush&);
505 
507  ~KStatefulBrush();
508 
510  KStatefulBrush& operator=(const KStatefulBrush&);
511 
517  QBrush brush(QPalette::ColorGroup) const;
518 
525  QBrush brush(const QPalette&) const;
526 
535  QBrush brush(const QWidget*) const;
536 
537 private:
538  class KStatefulBrushPrivate *d;
539 };
540 
541 Q_DECLARE_METATYPE(KStatefulBrush) /* so we can pass it in QVariant's */
542 
543 #endif // KCOLORSCHEME_H
544 // kate: space-indent on; indent-width 4; replace-tabs on; auto-insert-doxygen on;
KSharedPtr
QWidget
KColorScheme::LightShade
The light color is lighter than dark() or shadow() and contrasts with the base color.
Definition: kcolorscheme.h:280
KColorScheme::ShadeRole
ShadeRole
This enumeration describes the color shade being selected from the given set.
Definition: kcolorscheme.h:275
KColorScheme::FocusColor
Color used to draw decorations for items which have input focus.
Definition: kcolorscheme.h:259
KColorScheme::Selection
Selected items in views.
Definition: kcolorscheme.h:109
QBrush
KColorScheme::Window
Non-editable window elements; for example, menus.
Definition: kcolorscheme.h:93
KColorScheme::DarkShade
The dark color is in between mid() and shadow().
Definition: kcolorscheme.h:292
KColorScheme::DecorationRole
DecorationRole
This enumeration describes the decoration color being selected from the given set.
Definition: kcolorscheme.h:255
KColorScheme::MidlightShade
The midlight color is in between base() and light().
Definition: kcolorscheme.h:284
KStatefulBrush
A container for a "state-aware" brush.
Definition: kcolorscheme.h:441
Tooltip
ksharedconfig.h
KColorScheme::View
Views; for example, frames, input fields, etc.
Definition: kcolorscheme.h:87
QColor
KColorUtils::shade
QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount=0.0)
Adjust the luma and chroma components of a color.
Definition: kcolorutils.cpp:71
KColorScheme::Button
Buttons and button-like controls.
Definition: kcolorscheme.h:101
KColorScheme::ForegroundRole
ForegroundRole
This enumeration describes the foreground color being selected from the given set.
Definition: kcolorscheme.h:199
KColorScheme
A set of methods used to work with colors.
Definition: kcolorscheme.h:71
KColorScheme::BackgroundRole
BackgroundRole
This enumeration describes the background color being selected from the given set.
Definition: kcolorscheme.h:130
kdeui_export.h
KColorScheme::ColorSet
ColorSet
This enumeration describes the color set for which a color is being selected.
Definition: kcolorscheme.h:81
KColorScheme::MidShade
The mid color is in between base() and dark().
Definition: kcolorscheme.h:288
QExplicitlySharedDataPointer< KColorSchemePrivate >
QPalette
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal