kdefx Library API Documentation

kstyle.h

00001 /* 00002 * $Id: kstyle.h,v 1.15 2003/10/07 22:40:42 mueller 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 class KPixmap; 00038 00039 class KStylePrivate; 00055 class KStyle: public QCommonStyle 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 00077 typedef uint KStyleFlags; 00078 enum KStyleOption { 00079 Default = 0x00000000, 00080 AllowMenuTransparency = 0x00000001, 00081 FilledFrameWorkaround = 0x00000002 00082 }; 00083 00107 enum KStyleScrollBarType { 00108 WindowsStyleScrollBar = 0x00000000, 00109 PlatinumStyleScrollBar = 0x00000001, 00110 ThreeButtonScrollBar = 0x00000002, 00111 NextStyleScrollBar = 0x00000004 00112 }; 00113 00133 KStyle( KStyleFlags flags = KStyle::Default, 00134 KStyleScrollBarType sbtype = KStyle::WindowsStyleScrollBar ); 00135 00139 ~KStyle(); 00140 00144 static QString defaultStyle(); 00145 00157 void setScrollBarType(KStyleScrollBarType sbtype); 00158 00164 KStyleFlags styleFlags() const; 00165 00166 // --------------------------------------------------------------------------- 00167 00179 virtual void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup& cg, 00180 const QPopupMenu* popup ) const; 00181 00225 enum KStylePrimitive { 00226 KPE_DockWindowHandle, 00227 KPE_ToolBarHandle, 00228 KPE_GeneralHandle, 00229 00230 KPE_SliderGroove, 00231 KPE_SliderHandle, 00232 00233 KPE_ListViewExpander, 00234 KPE_ListViewBranch 00235 }; 00236 00246 virtual void drawKStylePrimitive( KStylePrimitive kpe, 00247 QPainter* p, 00248 const QWidget* widget, 00249 const QRect &r, 00250 const QColorGroup &cg, 00251 SFlags flags = Style_Default, 00252 const QStyleOption& = QStyleOption::Default ) const; 00253 00254 00255 enum KStylePixelMetric { 00256 KPM_MenuItemSeparatorHeight = 0x00000001, 00257 KPM_MenuItemHMargin = 0x00000002, 00258 KPM_MenuItemVMargin = 0x00000004, 00259 KPM_MenuItemHFrame = 0x00000008, 00260 KPM_MenuItemVFrame = 0x00000010, 00261 KPM_MenuItemCheckMarkHMargin = 0x00000020, 00262 KPM_MenuItemArrowHMargin = 0x00000040, 00263 KPM_MenuItemTabSpacing = 0x00000080, 00264 KPM_ListViewBranchThickness = 0x00000100 00265 }; 00266 00267 int kPixelMetric( KStylePixelMetric kpm, const QWidget* widget = 0 ) const; 00268 00269 // --------------------------------------------------------------------------- 00270 00271 void polish( QWidget* widget ); 00272 void unPolish( QWidget* widget ); 00273 void polishPopupMenu( QPopupMenu* ); 00274 00275 void drawPrimitive( PrimitiveElement pe, 00276 QPainter* p, 00277 const QRect &r, 00278 const QColorGroup &cg, 00279 SFlags flags = Style_Default, 00280 const QStyleOption& = QStyleOption::Default ) const; 00281 00282 void drawControl( ControlElement element, 00283 QPainter* p, 00284 const QWidget* widget, 00285 const QRect &r, 00286 const QColorGroup &cg, 00287 SFlags flags = Style_Default, 00288 const QStyleOption& = QStyleOption::Default ) const; 00289 00290 void drawComplexControl( ComplexControl control, 00291 QPainter *p, 00292 const QWidget* widget, 00293 const QRect &r, 00294 const QColorGroup &cg, 00295 SFlags flags = Style_Default, 00296 SCFlags controls = SC_All, 00297 SCFlags active = SC_None, 00298 const QStyleOption& = QStyleOption::Default ) const; 00299 00300 SubControl querySubControl( ComplexControl control, 00301 const QWidget* widget, 00302 const QPoint &pos, 00303 const QStyleOption& = QStyleOption::Default ) const; 00304 00305 QRect querySubControlMetrics( ComplexControl control, 00306 const QWidget* widget, 00307 SubControl sc, 00308 const QStyleOption& = QStyleOption::Default ) const; 00309 00310 int pixelMetric( PixelMetric m, 00311 const QWidget* widget = 0 ) const; 00312 00313 QRect subRect( SubRect r, 00314 const QWidget* widget ) const; 00315 00316 QPixmap stylePixmap( StylePixmap stylepixmap, 00317 const QWidget* widget = 0, 00318 const QStyleOption& = QStyleOption::Default ) const; 00319 00320 int styleHint( StyleHint sh, 00321 const QWidget* w = 0, 00322 const QStyleOption &opt = QStyleOption::Default, 00323 QStyleHintReturn* shr = 0 ) const; 00324 00325 protected: 00326 bool eventFilter( QObject* object, QEvent* event ); 00327 00328 private: 00329 // Disable copy constructor and = operator 00330 KStyle( const KStyle & ); 00331 KStyle& operator=( const KStyle & ); 00332 00333 protected: 00334 virtual void virtual_hook( int id, void* data ); 00335 private: 00336 KStylePrivate *d; 00337 }; 00338 00339 00340 // vim: set noet ts=4 sw=4: 00341 #endif 00342
KDE Logo
This file is part of the documentation for kdefx Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 16 17:21:31 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003