delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kstyles / highcolor / highcolor.h
blobe7fd56740a5ac2ce9db630fd11a342fad613a763
1 /*
2 * KDE3 HighColor Style (version 1.0)
3 * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
4 * (C) 2001-2002 Fredrik Höglund <fredrik@kde.org>
6 * Drawing routines adapted from the KDE2 HCStyle,
7 * Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
8 * (C) 2000 Dirk Mueller <mueller@kde.org>
9 * (C) 2001 Martijn Klingens <klingens@kde.org>
11 * Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License version 2 as published by the Free Software Foundation.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA.
28 #ifndef __HIGHCOLOR_H
29 #define __HIGHCOLOR_H
31 #include <QtGui/QBitmap>
32 #include <kdrawutil.h>
33 #include <kpixmap.h>
34 #include <kstyle.h>
37 enum GradientType{ VSmall=0, VMed, VLarge, HMed, HLarge, GradientCount };
39 class GradientSet
41 public:
42 GradientSet(const QColor &baseColor);
43 ~GradientSet();
45 KPixmap* gradient(GradientType type);
46 QColor* color() { return(&c); }
47 private:
48 KPixmap *gradients[5];
49 QColor c;
53 class QMenu;
55 class HighColorStyle : public KStyle
57 Q_OBJECT
59 public:
60 enum StyleType { HighColor = 0, Default, B3 };
62 HighColorStyle( StyleType );
63 virtual ~HighColorStyle();
65 void polish( QWidget* widget );
66 void unPolish( QWidget* widget );
68 void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup &cg,
69 const QMenu* popup ) const;
71 void drawKStylePrimitive( KStylePrimitive kpe,
72 QPainter* p,
73 const QWidget* widget,
74 const QRect &r,
75 const QColorGroup &cg,
76 SFlags flags = Style_Default,
77 const QStyleOption& = QStyleOption::Default ) const;
79 void drawPrimitive( PrimitiveElement pe,
80 QPainter* p,
81 const QRect &r,
82 const QColorGroup &cg,
83 SFlags flags = Style_Default,
84 const QStyleOption& = QStyleOption::Default ) const;
86 void drawControl( ControlElement element,
87 QPainter *p,
88 const QWidget *widget,
89 const QRect &r,
90 const QColorGroup &cg,
91 SFlags flags = Style_Default,
92 const QStyleOption& = QStyleOption::Default ) const;
94 void drawControlMask( ControlElement element,
95 QPainter *p,
96 const QWidget *widget,
97 const QRect &r,
98 const QStyleOption& = QStyleOption::Default ) const;
100 void drawComplexControl( ComplexControl control,
101 QPainter *p,
102 const QWidget *widget,
103 const QRect &r,
104 const QColorGroup &cg,
105 SFlags flags = Style_Default,
106 SCFlags controls = SC_All,
107 SCFlags active = SC_None,
108 const QStyleOption& = QStyleOption::Default ) const;
110 void drawComplexControlMask( ComplexControl control,
111 QPainter *p,
112 const QWidget *widget,
113 const QRect &r,
114 const QStyleOption& = QStyleOption::Default ) const;
116 void drawItem( QPainter *p,
117 const QRect &r,
118 int flags,
119 const QColorGroup &cg,
120 bool enabled,
121 const QPixmap *pixmap,
122 const QString &text,
123 int len = -1,
124 const QColor *penColor = 0 ) const;
126 int pixelMetric( PixelMetric m,
127 const QWidget *widget = 0 ) const;
129 QSize sizeFromContents( ContentsType contents,
130 const QWidget *widget,
131 const QSize &contentSize,
132 const QStyleOption& opt ) const;
134 QRect subRect( SubRect r,
135 const QWidget *widget ) const;
137 // Fix Qt3's wacky image positions
138 QPixmap stylePixmap( StylePixmap stylepixmap,
139 const QWidget *widget = 0,
140 const QStyleOption& = QStyleOption::Default ) const;
142 protected:
143 bool eventFilter( QObject *object, QEvent *event );
145 void renderGradient( QPainter* p,
146 const QRect& r,
147 QColor clr,
148 bool horizontal,
149 int px=0,
150 int py=0,
151 int pwidth=-1,
152 int pheight=-1 ) const;
154 QWidget *hoverWidget;
155 StyleType type;
156 bool highcolor;
157 mutable bool selectionBackground;
159 private:
160 // Disable copy constructor and = operator
161 HighColorStyle( const HighColorStyle & );
162 HighColorStyle& operator=( const HighColorStyle & );
165 // vim: set noet ts=4 sw=4:
167 #endif