| # kdefx Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kstyle.h

    00001 /*
    00002  * $Id: kstyle.h,v 1.11 2002/10/26 08:59:39 gallium 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 TransparencyHandler;
    00038 class KPixmap;
    00039
    00040 class KStylePrivate;
    00056 class KStyle: public QCommonStyle
    00057 {
    00058         Q_OBJECT
    00059
    00060         public:
    00061
    00078                 typedef uint KStyleFlags;
    00079                 enum KStyleOption {
    00080                         Default                           =             0x00000000,             // All options disabled.
    00081                         AllowMenuTransparency =         0x00000001,
    00082                         FilledFrameWorkaround =         0x00000002
    00083                 };
    00084
    00106                 enum KStyleScrollBarType {
    00107                         WindowsStyleScrollBar  =        0x00000000,
    00108                         PlatinumStyleScrollBar =        0x00000001,
    00109                         ThreeButtonScrollBar   =        0x00000002,
    00110                         NextStyleScrollBar     =        0x00000004
    00111                 };
    00112
    00130                 KStyle( KStyleFlags flags = KStyle::Default,
    00131                                 KStyleScrollBarType sbtype = KStyle::WindowsStyleScrollBar );
    00132
    00136                 ~KStyle();
    00137
    00141                 static QString defaultStyle();
    00142
    00152                 void setScrollBarType(KStyleScrollBarType sbtype);
    00153
    00159                 KStyleFlags styleFlags() const;
    00160
    00161                 // ---------------------------------------------------------------------------
    00162
    00174                 virtual void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup& cg,
    00175                                                                                         const QPopupMenu* popup ) const;
    00176
    00220                 enum KStylePrimitive {
    00221                         KPE_DockWindowHandle,
    00222                         KPE_ToolBarHandle,
    00223                         KPE_GeneralHandle,
    00224
    00225                         KPE_SliderGroove,
    00226                         KPE_SliderHandle,
    00227
    00228                         KPE_ListViewExpander,
    00229                         KPE_ListViewBranch
    00230                 };
    00231
    00241                 virtual void drawKStylePrimitive( KStylePrimitive kpe,
    00242                                         QPainter* p,
    00243                                         const QWidget* widget,
    00244                                         const QRect &r,
    00245                                         const QColorGroup &cg,
    00246                                         SFlags flags = Style_Default,
    00247                                         const QStyleOption& = QStyleOption::Default ) const;
    00248
    00249
    00250                 enum KStylePixelMetric {
    00251                         KPM_MenuItemSeparatorHeight             = 0x00000001,
    00252                         KPM_MenuItemHMargin                             = 0x00000002,
    00253                         KPM_MenuItemVMargin                             = 0x00000004,
    00254                         KPM_MenuItemHFrame                              = 0x00000008,
    00255                         KPM_MenuItemVFrame                              = 0x00000010,
    00256                         KPM_MenuItemCheckMarkHMargin    = 0x00000020,
    00257                         KPM_MenuItemArrowHMargin                = 0x00000040,
    00258                         KPM_MenuItemTabSpacing                  = 0x00000080,
    00259
    00260                         KPM_ListViewBranchThickness             = 0x00000100
    00261                 };
    00262
    00263                 int kPixelMetric( KStylePixelMetric kpm, const QWidget* widget = 0 ) const;
    00264
    00265                 // ---------------------------------------------------------------------------
    00266
    00267                 void polish( QWidget* widget );
    00268                 void unPolish( QWidget* widget );
    00269                 void polishPopupMenu( QPopupMenu* );
    00270
    00271                 void drawPrimitive( PrimitiveElement pe,
    00272                                         QPainter* p,
    00273                                         const QRect &r,
    00274                                         const QColorGroup &cg,
    00275                                         SFlags flags = Style_Default,
    00276                                         const QStyleOption& = QStyleOption::Default ) const;
    00277
    00278                 void drawControl( ControlElement element,
    00279                                         QPainter* p,
    00280                                         const QWidget* widget,
    00281                                         const QRect &r,
    00282                                         const QColorGroup &cg,
    00283                                         SFlags flags = Style_Default,
    00284                                         const QStyleOption& = QStyleOption::Default ) const;
    00285
    00286                 void drawComplexControl( ComplexControl control,
    00287                                         QPainter *p,
    00288                                         const QWidget* widget,
    00289                                         const QRect &r,
    00290                                         const QColorGroup &cg,
    00291                                         SFlags flags = Style_Default,
    00292                                         SCFlags controls = SC_All,
    00293                                         SCFlags active = SC_None,
    00294                                         const QStyleOption& = QStyleOption::Default ) const;
    00295
    00296                 SubControl querySubControl( ComplexControl control,
    00297                                         const QWidget* widget,
    00298                                         const QPoint &pos,
    00299                                         const QStyleOption& = QStyleOption::Default ) const;
    00300
    00301                 QRect querySubControlMetrics( ComplexControl control,
    00302                                         const QWidget* widget,
    00303                                         SubControl sc,
    00304                                         const QStyleOption& = QStyleOption::Default ) const;
    00305
    00306                 int pixelMetric( PixelMetric m,
    00307                                         const QWidget* widget = 0 ) const;
    00308
    00309                 QRect subRect( SubRect r,
    00310                                         const QWidget* widget ) const;
    00311
    00312                 QPixmap stylePixmap( StylePixmap stylepixmap,
    00313                                         const QWidget* widget = 0,
    00314                                         const QStyleOption& = QStyleOption::Default ) const;
    00315
    00316                 int styleHint( StyleHint sh,
    00317                                         const QWidget* w = 0,
    00318                                         const QStyleOption &opt = QStyleOption::Default,
    00319                                         QStyleHintReturn* shr = 0 ) const;
    00320
    00321         protected:
    00322                 bool eventFilter( QObject* object, QEvent* event );
    00323
    00324         private:
    00325                 // Disable copy constructor and = operator
    00326                 KStyle( const KStyle & );
    00327                 KStyle& operator=( const KStyle & );
    00328
    00329         protected:
    00330                 virtual void virtual_hook( int id, void* data );
    00331         private:
    00332                 KStylePrivate *d;
    00333 };
    00334
    00335
    00336 // vim: set noet ts=4 sw=4:
    00337 #endif
    00338

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:44:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001