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

KStyles

highcolor.h

Go to the documentation of this file.
00001 /*
00002  * KDE3 HighColor Style (version 1.0)
00003  * Copyright (C) 2001-2002 Karol Szwed      <gallium@kde.org>
00004  *           (C) 2001-2002 Fredrik Höglund  <fredrik@kde.org> 
00005  *
00006  * Drawing routines adapted from the KDE2 HCStyle,
00007  * Copyright (C) 2000 Daniel M. Duley       <mosfet@kde.org>
00008  *           (C) 2000 Dirk Mueller          <mueller@kde.org>
00009  *           (C) 2001 Martijn Klingens      <klingens@kde.org>
00010  *
00011  * Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Library General Public
00015  * License version 2 as published by the Free Software Foundation.
00016  *    
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Library General Public License for more details.
00021  *                   
00022  * You should have received a copy of the GNU Library General Public License
00023  * along with this library; see the file COPYING.LIB.  If not, write to
00024  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00025  * Boston, MA 02110-1301, USA.
00026  */
00027 
00028 #ifndef __HIGHCOLOR_H
00029 #define __HIGHCOLOR_H
00030 
00031 #include <QtGui/QBitmap>
00032 #include <kdrawutil.h>
00033 #include <kpixmap.h>
00034 #include <kstyle.h>
00035 
00036 
00037 enum GradientType{ VSmall=0, VMed, VLarge, HMed, HLarge, GradientCount };
00038  
00039 class GradientSet
00040 {
00041     public:
00042         GradientSet(const QColor &baseColor);
00043         ~GradientSet();
00044 
00045         KPixmap* gradient(GradientType type);
00046         QColor* color() { return(&c); }
00047     private:
00048         KPixmap *gradients[5];
00049         QColor c;
00050 };
00051 
00052 
00053 class QMenu;
00054 
00055 class HighColorStyle : public KStyle
00056 {
00057     Q_OBJECT
00058 
00059     public:
00060         enum StyleType { HighColor = 0, Default, B3 };
00061         
00062         HighColorStyle( StyleType );
00063         virtual ~HighColorStyle();
00064 
00065         void polish( QWidget* widget );
00066         void unPolish( QWidget* widget );
00067 
00068         void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup &cg,
00069                                     const QMenu* popup ) const;
00070 
00071         void drawKStylePrimitive( KStylePrimitive kpe,
00072                     QPainter* p,
00073                     const QWidget* widget,
00074                     const QRect &r,
00075                     const QColorGroup &cg,
00076                     SFlags flags = Style_Default,
00077                     const QStyleOption& = QStyleOption::Default ) const;
00078         
00079         void drawPrimitive( PrimitiveElement pe,
00080                     QPainter* p,
00081                     const QRect &r,
00082                     const QColorGroup &cg,
00083                     SFlags flags = Style_Default,
00084                     const QStyleOption& = QStyleOption::Default ) const;
00085 
00086         void drawControl( ControlElement element,
00087                     QPainter *p,
00088                     const QWidget *widget,
00089                     const QRect &r,
00090                     const QColorGroup &cg,
00091                     SFlags flags = Style_Default,
00092                     const QStyleOption& = QStyleOption::Default ) const;
00093 
00094         void drawControlMask( ControlElement element,
00095                     QPainter *p,
00096                     const QWidget *widget,
00097                     const QRect &r,
00098                     const QStyleOption& = QStyleOption::Default ) const;
00099         
00100         void drawComplexControl( ComplexControl control,
00101                     QPainter *p,
00102                     const QWidget *widget,
00103                     const QRect &r,
00104                     const QColorGroup &cg,
00105                     SFlags flags = Style_Default,
00106                     SCFlags controls = SC_All,
00107                     SCFlags active = SC_None,
00108                     const QStyleOption& = QStyleOption::Default ) const;
00109 
00110         void drawComplexControlMask( ComplexControl control,
00111                     QPainter *p,
00112                     const QWidget *widget,
00113                     const QRect &r,
00114                     const QStyleOption& = QStyleOption::Default ) const;
00115 
00116         void drawItem( QPainter *p,
00117                         const QRect &r,
00118                         int flags,
00119                         const QColorGroup &cg,
00120                         bool enabled,
00121                         const QPixmap *pixmap,
00122                         const QString &text,
00123                         int len = -1,
00124                         const QColor *penColor = 0 ) const;
00125 
00126         int pixelMetric( PixelMetric m, 
00127                     const QWidget *widget = 0 ) const;
00128 
00129         QSize sizeFromContents( ContentsType contents,
00130                     const QWidget *widget,
00131                     const QSize &contentSize,
00132                     const QStyleOption& opt ) const;
00133 
00134         QRect subRect( SubRect r, 
00135                     const QWidget *widget ) const;
00136 
00137         // Fix Qt3's wacky image positions
00138         QPixmap stylePixmap( StylePixmap stylepixmap,
00139                     const QWidget *widget = 0,
00140                     const QStyleOption& = QStyleOption::Default ) const;
00141 
00142     protected:
00143         bool eventFilter( QObject *object, QEvent *event );
00144 
00145         void renderGradient( QPainter* p, 
00146                     const QRect& r, 
00147                     QColor clr,
00148                     bool horizontal,
00149                     int px=0, 
00150                     int py=0,
00151                     int pwidth=-1,
00152                     int pheight=-1 ) const;
00153 
00154         QWidget     *hoverWidget;
00155         StyleType    type;
00156         bool         highcolor;
00157         mutable bool selectionBackground;
00158 
00159     private:
00160         // Disable copy constructor and = operator
00161         HighColorStyle( const HighColorStyle & );
00162         HighColorStyle& operator=( const HighColorStyle & );
00163 };
00164 
00165 // vim: set noet ts=4 sw=4:
00166 
00167 #endif

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