qgtkstyle.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QGTKSTYLE_H
00043 #define QGTKSTYLE_H
00044 
00045 #include <QtGui/QCleanlooksStyle>
00046 #include <QtGui/QPalette>
00047 #include <QtGui/QFont>
00048 #include <QtGui/QFileDialog>
00049 
00050 QT_BEGIN_HEADER
00051 
00052 QT_BEGIN_NAMESPACE
00053 
00054 QT_MODULE(Gui)
00055 
00056 #if !defined(QT_NO_STYLE_GTK)
00057 
00058 class QPainterPath;
00059 class QGtkStylePrivate;
00060 
00061 class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle
00062 {
00063     Q_OBJECT
00064     Q_DECLARE_PRIVATE(QGtkStyle)
00065 
00066 public:
00067     QGtkStyle();
00068     QGtkStyle(QGtkStylePrivate &dd);
00069 
00070     ~QGtkStyle();
00071 
00072     QPalette standardPalette() const;
00073 
00074     void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
00075                        QPainter *painter, const QWidget *widget) const;
00076     void drawControl(ControlElement control, const QStyleOption *option,
00077                      QPainter *painter, const QWidget *widget) const;
00078     void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
00079                             QPainter *painter, const QWidget *widget) const;
00080     void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
00081                         const QPixmap &pixmap) const;
00082     void drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
00083                       bool enabled, const QString& text, QPalette::ColorRole textRole) const;
00084 
00085     int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
00086                     const QWidget *widget = 0) const;
00087     int styleHint(StyleHint hint, const QStyleOption *option,
00088                   const QWidget *widget, QStyleHintReturn *returnData) const;
00089 
00090     QStyle::SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
00091                               const QPoint &pt, const QWidget *w) const;
00092 
00093     QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
00094                          SubControl subControl, const QWidget *widget) const;
00095     QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const;
00096     QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
00097 
00098 
00099     QSize sizeFromContents(ContentsType type, const QStyleOption *option,
00100                            const QSize &size, const QWidget *widget) const;
00101     QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option,
00102                            const QWidget *widget) const;
00103     QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
00104                                 const QStyleOption *opt) const;
00105 
00106     void polish(QWidget *widget);
00107     void polish(QApplication *app);
00108     void polish(QPalette &palette);
00109 
00110     void unpolish(QWidget *widget);
00111     void unpolish(QApplication *app);
00112 
00113     static bool getGConfBool(const QString &key, bool fallback = 0);
00114     static QString getGConfString(const QString &key, const QString &fallback = QString());
00115 
00116 
00117 protected Q_SLOTS:
00118     QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
00119                                      const QWidget *widget = 0) const;
00120 };
00121 
00122 #endif //!defined(QT_NO_STYLE_QGTK)
00123 
00124 QT_END_NAMESPACE
00125 
00126 QT_END_HEADER
00127 
00128 #endif //QGTKSTYLE_H