kdefx Library API Documentation

kstyle.h

00001 /* 00002 * $Id: kstyle.h,v 1.18 2004/09/13 13:28:29 staniek Exp $ 00003 * 00004 * KStyle 00005 * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> 00006 * 00007 * QWindowsStyle CC_ListView and style images were kindly donated by TrollTech, 00008 * Copyright (C) 1998-2000 TrollTech AS. 00009 * 00010 * Many thanks to Bradley T. Hughes for the 3 button scrollbar code. 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Library General Public 00014 * License version 2 as published by the Free Software Foundation. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public License 00022 * along with this library; see the file COPYING.LIB. If not, write to 00023 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00024 * Boston, MA 02111-1307, USA. 00025 */ 00026 00027 #ifndef __KSTYLE_H 00028 #define __KSTYLE_H 00029 00030 // W A R N I N G 00031 // ------------- 00032 // This API is still subject to change. 00033 // I will remove this warning when I feel the API is sufficiently flexible. 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 // Disable copy constructor and = operator 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 // vim: set noet ts=4 sw=4: 00343 #endif 00344
KDE Logo
This file is part of the documentation for kdefx Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:02:57 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003