00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __KSTYLE_H
00028 #define __KSTYLE_H
00029
00030
00031
00032
00033
00034
00035 #include <qcommonstyle.h>
00036
00037 #include <kdelibs_export.h>
00038
00039 class KPixmap;
00040
00041 struct KStylePrivate;
00057 class KDEFX_EXPORT KStyle: public QCommonStyle
00058 {
00059 Q_OBJECT
00060
00061 public:
00062
00079 typedef uint KStyleFlags;
00080 enum KStyleOption {
00081 Default = 0x00000000,
00082 AllowMenuTransparency = 0x00000001,
00083 FilledFrameWorkaround = 0x00000002
00084 };
00085
00109 enum KStyleScrollBarType {
00110 WindowsStyleScrollBar = 0x00000000,
00111 PlatinumStyleScrollBar = 0x00000001,
00112 ThreeButtonScrollBar = 0x00000002,
00113 NextStyleScrollBar = 0x00000004
00114 };
00115
00135 KStyle( KStyleFlags flags = KStyle::Default,
00136 KStyleScrollBarType sbtype = KStyle::WindowsStyleScrollBar );
00137
00141 ~KStyle();
00142
00146 static QString defaultStyle();
00147
00159 void setScrollBarType(KStyleScrollBarType sbtype);
00160
00166 KStyleFlags styleFlags() const;
00167
00168
00169
00181 virtual void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup& cg,
00182 const QPopupMenu* popup ) const;
00183
00227 enum KStylePrimitive {
00228 KPE_DockWindowHandle,
00229 KPE_ToolBarHandle,
00230 KPE_GeneralHandle,
00231
00232 KPE_SliderGroove,
00233 KPE_SliderHandle,
00234
00235 KPE_ListViewExpander,
00236 KPE_ListViewBranch
00237 };
00238
00248 virtual void drawKStylePrimitive( KStylePrimitive kpe,
00249 QPainter* p,
00250 const QWidget* widget,
00251 const QRect &r,
00252 const QColorGroup &cg,
00253 SFlags flags = Style_Default,
00254 const QStyleOption& = QStyleOption::Default ) const;
00255
00256
00257 enum KStylePixelMetric {
00258 KPM_MenuItemSeparatorHeight = 0x00000001,
00259 KPM_MenuItemHMargin = 0x00000002,
00260 KPM_MenuItemVMargin = 0x00000004,
00261 KPM_MenuItemHFrame = 0x00000008,
00262 KPM_MenuItemVFrame = 0x00000010,
00263 KPM_MenuItemCheckMarkHMargin = 0x00000020,
00264 KPM_MenuItemArrowHMargin = 0x00000040,
00265 KPM_MenuItemTabSpacing = 0x00000080,
00266 KPM_ListViewBranchThickness = 0x00000100
00267 };
00268
00269 int kPixelMetric( KStylePixelMetric kpm, const QWidget* widget = 0 ) const;
00270
00271
00272
00273 void polish( QWidget* widget );
00274 void unPolish( QWidget* widget );
00275 void polishPopupMenu( QPopupMenu* );
00276
00277 void drawPrimitive( PrimitiveElement pe,
00278 QPainter* p,
00279 const QRect &r,
00280 const QColorGroup &cg,
00281 SFlags flags = Style_Default,
00282 const QStyleOption& = QStyleOption::Default ) const;
00283
00284 void drawControl( ControlElement element,
00285 QPainter* p,
00286 const QWidget* widget,
00287 const QRect &r,
00288 const QColorGroup &cg,
00289 SFlags flags = Style_Default,
00290 const QStyleOption& = QStyleOption::Default ) const;
00291
00292 void drawComplexControl( ComplexControl control,
00293 QPainter *p,
00294 const QWidget* widget,
00295 const QRect &r,
00296 const QColorGroup &cg,
00297 SFlags flags = Style_Default,
00298 SCFlags controls = SC_All,
00299 SCFlags active = SC_None,
00300 const QStyleOption& = QStyleOption::Default ) const;
00301
00302 SubControl querySubControl( ComplexControl control,
00303 const QWidget* widget,
00304 const QPoint &pos,
00305 const QStyleOption& = QStyleOption::Default ) const;
00306
00307 QRect querySubControlMetrics( ComplexControl control,
00308 const QWidget* widget,
00309 SubControl sc,
00310 const QStyleOption& = QStyleOption::Default ) const;
00311
00312 int pixelMetric( PixelMetric m,
00313 const QWidget* widget = 0 ) const;
00314
00315 QRect subRect( SubRect r,
00316 const QWidget* widget ) const;
00317
00318 QPixmap stylePixmap( StylePixmap stylepixmap,
00319 const QWidget* widget = 0,
00320 const QStyleOption& = QStyleOption::Default ) const;
00321
00322 int styleHint( StyleHint sh,
00323 const QWidget* w = 0,
00324 const QStyleOption &opt = QStyleOption::Default,
00325 QStyleHintReturn* shr = 0 ) const;
00326
00327 protected:
00328 bool eventFilter( QObject* object, QEvent* event );
00329
00330 private:
00331
00332 KStyle( const KStyle & );
00333 KStyle& operator=( const KStyle & );
00334
00335 protected:
00336 virtual void virtual_hook( int id, void* data );
00337 private:
00338 KStylePrivate *d;
00339 };
00340
00341
00342
00343 #endif
00344