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

KStyles

highcontrast.h

Go to the documentation of this file.
00001 /*
00002  * High Contrast Style (version 1.0)
00003  *     Copyright (C) 2004 Olaf Schmidt <ojschmidt@kde.org>
00004  *
00005  * Derived from Axes Style
00006  *     Copyright (C) 2003 Maksim Orlovich <orlovich@cs.rochester.edu>
00007  * 
00008  * Axes Style based on KDE 3 HighColor Style,
00009  *     Copyright (C) 2001-2002 Karol Szwed      <gallium@kde.org>
00010  *               (C) 2001-2002 Fredrik Höglund  <fredrik@kde.org>
00011  * 
00012  * KDE 3 HighColor Style drawing routines adapted from the KDE2 HCStyle,
00013  *     Copyright (C) 2000 Daniel M. Duley       <mosfet@kde.org>
00014  *               (C) 2000 Dirk Mueller          <mueller@kde.org>
00015  *               (C) 2001 Martijn Klingens      <klingens@kde.org>
00016  *
00017  * Includes portions from KStyle,
00018  *     Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
00019  *
00020  * Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
00021  *
00022  * This library is free software; you can redistribute it and/or
00023  * modify it under the terms of the GNU Library General Public
00024  * License version 2 as published by the Free Software Foundation.
00025  *
00026  * This library is distributed in the hope that it will be useful,
00027  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00028  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00029  * Library General Public License for more details.
00030  *
00031  * You should have received a copy of the GNU Library General Public License
00032  * along with this library; see the file COPYING.LIB.  If not, write to
00033  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00034  * Boston, MA 02110-1301, USA.
00035  */
00036 
00037 #ifndef __HIGHCONTRAST_H
00038 #define __HIGHCONTRAST_H
00039 
00040 #include <QtGui/QBitmap>
00041 #include <kdrawutil.h>
00042 #include <kpixmap.h>
00043 #include <kstyle.h>
00044 
00045 class HighContrastStyle : public KStyle
00046 {
00047     Q_OBJECT
00048 
00049     public:
00050         HighContrastStyle();
00051         virtual ~HighContrastStyle();
00052         
00053         void polish( QPalette& pal );        
00054 
00055         void polish( QWidget* widget );
00056         void unPolish( QWidget* widget );
00057 
00058         void drawKStylePrimitive( KStylePrimitive kpe,
00059                     QPainter* p,
00060                     const QWidget* widget,
00061                     const QRect &r,
00062                     const QColorGroup &cg,
00063                     SFlags flags = Style_Default,
00064                     const QStyleOption& = QStyleOption::Default ) const;
00065 
00066         void drawPrimitive( PrimitiveElement pe,
00067                     QPainter* p,
00068                     const QRect &r,
00069                     const QColorGroup &cg,
00070                     SFlags flags = Style_Default,
00071                     const QStyleOption& = QStyleOption::Default ) const;
00072 
00073         void drawControl( ControlElement element,
00074                     QPainter *p,
00075                     const QWidget *widget,
00076                     const QRect &r,
00077                     const QColorGroup &cg,
00078                     SFlags flags = Style_Default,
00079                     const QStyleOption& = QStyleOption::Default ) const;
00080 
00081         void drawControlMask( ControlElement element,
00082                     QPainter *p,
00083                     const QWidget *widget,
00084                     const QRect &r,
00085                     const QStyleOption& = QStyleOption::Default ) const;
00086 
00087         void drawComplexControl( ComplexControl control,
00088                     QPainter *p,
00089                     const QWidget *widget,
00090                     const QRect &r,
00091                     const QColorGroup &cg,
00092                     SFlags flags = Style_Default,
00093                     SCFlags controls = SC_All,
00094                     SCFlags active = SC_None,
00095                     const QStyleOption& = QStyleOption::Default ) const;
00096 
00097         void drawComplexControlMask( ComplexControl control,
00098                     QPainter *p,
00099                     const QWidget *widget,
00100                     const QRect &r,
00101                     const QStyleOption& = QStyleOption::Default ) const;
00102 
00103         QRect querySubControlMetrics( ComplexControl control,
00104                     const QWidget* widget,
00105                     SubControl subcontrol,
00106                     const QStyleOption& opt = QStyleOption::Default ) const;
00107 
00108 
00109         void drawItem( QPainter *p,
00110                     const QRect &r,
00111                     int flags,
00112                     const QColorGroup &cg,
00113                     bool enabled,
00114                     const QPixmap *pixmap,
00115                     const QString &text,
00116                     int len = -1,
00117                     const QColor *penColor = 0 ) const;
00118 
00119         int pixelMetric( PixelMetric m,
00120                     const QWidget *widget = 0 ) const;
00121 
00122         int kPixelMetric( KStylePixelMetric m,
00123                     const QWidget *widget = 0 ) const;
00124 
00125         QSize sizeFromContents( ContentsType contents,
00126                     const QWidget *widget,
00127                     const QSize &contentSize,
00128                     const QStyleOption& opt ) const;
00129 
00130         QRect subRect (SubRect subrect, const QWidget * widget) const;
00131 
00132     protected:
00133         bool eventFilter( QObject *object, QEvent *event );
00134 
00135         QWidget     *hoverWidget;
00136 
00137     private:
00138         void setColorsNormal (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00139         void setColorsButton (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00140         void setColorsText (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
00141         void setColorsHighlight (QPainter* p, const QColorGroup& cg, int flags = Style_Enabled) const;
00142         void setColorsByState (QPainter* p, const QColorGroup& cg, const QColor& fg, const QColor& bg, int flags, int highlight) const;
00143 
00144         void drawRect (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00145         void drawRoundRect (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00146         void drawEllipse (QPainter* p, QRect r, int offset = 0, bool filled = true) const;
00147         void drawArrow (QPainter* p, QRect r, PrimitiveElement arrow, int offset = 0) const;
00148 
00149         int basicLineWidth;
00150         // Disable copy constructor and = operator
00151         HighContrastStyle( const HighContrastStyle & );
00152         HighContrastStyle& operator=( const HighContrastStyle & );
00153 };
00154 
00155 // vim: set noet ts=4 sw=4:
00156 // kate: indent-width 4; replace-tabs off; smart-indent on; tab-width 4;
00157 
00158 #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