• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KStyles

helper.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
00003  * Copyright 2007 Casper Boemann <cbr@boemann.dk>
00004  * Copyright 2007 Fredrik Höglund <fredrik@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License version 2 as published by the Free Software Foundation.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef __OXYGEN_HELPER_H
00022 #define __OXYGEN_HELPER_H
00023 
00024 #include <ksharedconfig.h>
00025 #include <kcomponentdata.h>
00026 
00027 #include <QtGui/QColor>
00028 #include <QtGui/QPixmap>
00029 #include <QtGui/QLinearGradient>
00030 #include <QtCore/QCache>
00031 
00032 #define _glowBias 0.9 // not likely to be configurable
00033 
00034 // WARNING - OxygenHelper must be a K_GLOBAL_STATIC!
00035 class OxygenHelper
00036 {
00037 public:
00038     explicit OxygenHelper(const QByteArray &componentName);
00039     virtual ~OxygenHelper() {}
00040 
00041     KSharedConfigPtr config() const;
00042     void reloadConfig();
00043 
00044     void renderWindowBackground(QPainter *p, const QRect &clipRect, const QWidget *widget, const QPalette & pal);
00045     virtual void invalidateCaches();
00046 
00047     static bool lowThreshold(const QColor &color);
00048 
00049     static QColor alphaColor(QColor color, double alpha);
00050 
00051     QColor calcLightColor(const QColor &color) const;
00052     QColor calcDarkColor(const QColor &color) const;
00053     QColor calcShadowColor(const QColor &color) const;
00054 
00055     QColor backgroundColor(const QColor &color, int height, int y);
00056 
00057     QColor backgroundRadialColor(const QColor &color) const;
00058     QColor backgroundTopColor(const QColor &color) const;
00059     QColor backgroundBottomColor(const QColor &color) const;
00060 
00061     QPixmap verticalGradient(const QColor &color, int height);
00062     QPixmap radialGradient(const QColor &color, int width);
00063 
00064     QLinearGradient decoGradient(const QRect &r, const QColor &color);
00065 
00066     QPixmap windecoButton(const QColor &color, bool pressed, int size = 21);
00067 
00068     void drawFloatFrame(QPainter *p, const QRect r, const QColor &color) const;
00069 
00070 protected:
00071     void drawShadow(QPainter&, const QColor&, int size) const;
00072     static QPixmap glow(const QColor&, int size, int rsize);
00073 
00074     static const double _shadowGain;
00075 
00076     KComponentData _componentData;
00077     KSharedConfigPtr _config;
00078     qreal _contrast;
00079     qreal _bgcontrast;
00080 
00081     QCache<quint64, QPixmap> m_backgroundCache;
00082     QCache<quint64, QPixmap> m_windecoButtonCache;
00083 };
00084 
00085 #endif // __OXYGEN_HELPER_H

KStyles

Skip menu "KStyles"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference 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