Eneboo - Documentación para desarrolladores
src/plugins/styles/qtcurve/qtc_kstyle.h
Ir a la documentación de este archivo.
00001 /*
00002  * $Id$
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., 51 Franklin Street, Fifth Floor,
00024  * Boston, MA 02110-1301, USA.
00025  */
00026 
00027 #ifndef __QTC_KSTYLE_H
00028 #define __QTC_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 struct QtCKStylePrivate;
00053 class QtCKStyle: public QCommonStyle
00054 {
00055         Q_OBJECT
00056 
00057         public:
00058 
00075                 typedef uint KStyleFlags;
00076                 enum KStyleOption {
00077                         Default               =         0x00000000, 
00078                         AllowMenuTransparency =         0x00000001, 
00079                         FilledFrameWorkaround =         0x00000002  
00080                 };
00081 
00105                 enum KStyleScrollBarType {
00106                         WindowsStyleScrollBar  =        0x00000000, 
00107                         PlatinumStyleScrollBar =        0x00000001, 
00108                         ThreeButtonScrollBar   =        0x00000002, 
00109                         NextStyleScrollBar     =        0x00000004  
00110                 };
00111 
00131                 QtCKStyle( KStyleFlags flags = QtCKStyle::Default,
00132                         KStyleScrollBarType sbtype = QtCKStyle::WindowsStyleScrollBar );
00133 
00137                 ~QtCKStyle();
00138 
00142                 static QString defaultStyle();
00143 
00155                 void setScrollBarType(KStyleScrollBarType sbtype);
00156 
00162                 KStyleFlags styleFlags() const;
00163 
00207                 enum KStylePrimitive {
00208                         KPE_DockWindowHandle,
00209                         KPE_ToolBarHandle,
00210                         KPE_GeneralHandle,
00211 
00212                         KPE_SliderGroove,
00213                         KPE_SliderHandle,
00214 
00215                         KPE_ListViewExpander,
00216                         KPE_ListViewBranch
00217                 };
00218 
00228                 virtual void drawKStylePrimitive( KStylePrimitive kpe,
00229                                         QPainter* p,
00230                                         const QWidget* widget,
00231                                         const QRect &r,
00232                                         const QColorGroup &cg,
00233                                         SFlags flags = Style_Default,
00234                                         const QStyleOption& = QStyleOption::Default ) const;
00235 
00236 
00237                 enum KStylePixelMetric {
00238                         KPM_MenuItemSeparatorHeight             = 0x00000001,
00239                         KPM_MenuItemHMargin                     = 0x00000002,
00240                         KPM_MenuItemVMargin                     = 0x00000004,
00241                         KPM_MenuItemHFrame                      = 0x00000008,
00242                         KPM_MenuItemVFrame                      = 0x00000010,
00243                         KPM_MenuItemCheckMarkHMargin            = 0x00000020,
00244                         KPM_MenuItemArrowHMargin                = 0x00000040,
00245                         KPM_MenuItemTabSpacing                  = 0x00000080,
00246                         KPM_ListViewBranchThickness             = 0x00000100
00247                 };
00248 
00249                 int kPixelMetric( KStylePixelMetric kpm, const QWidget* widget = 0 ) const;
00250 
00251                 // ---------------------------------------------------------------------------
00252 
00253                 void polish( QWidget* widget );
00254                 void unPolish( QWidget* widget );
00255                 void polishPopupMenu( QPopupMenu* );
00256 
00257                 void drawPrimitive( PrimitiveElement pe,
00258                                         QPainter* p,
00259                                         const QRect &r,
00260                                         const QColorGroup &cg,
00261                                         SFlags flags = Style_Default,
00262                                         const QStyleOption& = QStyleOption::Default ) const;
00263 
00264                 void drawControl( ControlElement element,
00265                                         QPainter* p,
00266                                         const QWidget* widget,
00267                                         const QRect &r,
00268                                         const QColorGroup &cg,
00269                                         SFlags flags = Style_Default,
00270                                         const QStyleOption& = QStyleOption::Default ) const;
00271 
00272                 void drawComplexControl( ComplexControl control,
00273                                         QPainter *p,
00274                                         const QWidget* widget,
00275                                         const QRect &r,
00276                                         const QColorGroup &cg,
00277                                         SFlags flags = Style_Default,
00278                                         SCFlags controls = SC_All,
00279                                         SCFlags active = SC_None,
00280                                         const QStyleOption& = QStyleOption::Default ) const;
00281 
00282                 SubControl querySubControl( ComplexControl control,
00283                                         const QWidget* widget,
00284                                         const QPoint &pos,
00285                                         const QStyleOption& = QStyleOption::Default ) const;
00286 
00287                 QRect querySubControlMetrics( ComplexControl control,
00288                                         const QWidget* widget,
00289                                         SubControl sc,
00290                                         const QStyleOption& = QStyleOption::Default ) const;
00291 
00292                 int pixelMetric( PixelMetric m, 
00293                                         const QWidget* widget = 0 ) const;
00294 
00295                 QRect subRect( SubRect r, 
00296                                         const QWidget* widget ) const;
00297 
00298                 QPixmap stylePixmap( StylePixmap stylepixmap,
00299                                         const QWidget* widget = 0,
00300                                         const QStyleOption& = QStyleOption::Default ) const;
00301 
00302                 int styleHint( StyleHint sh, 
00303                                         const QWidget* w = 0,
00304                                         const QStyleOption &opt = QStyleOption::Default,
00305                                         QStyleHintReturn* shr = 0 ) const;
00306 
00307         protected:
00308                 bool eventFilter( QObject* object, QEvent* event );
00309 
00310         private:
00311                 // Disable copy constructor and = operator
00312                 QtCKStyle( const QtCKStyle & );
00313                 QtCKStyle& operator=( const QtCKStyle & );
00314 
00315         protected:
00316                 virtual void virtual_hook( int id, void* data );
00317         private:
00318                 QtCKStylePrivate *d;
00319 };
00320 
00321 
00322 // vim: set noet ts=4 sw=4:
00323 #endif
00324 
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'