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

KStyles

helper.h

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