qs60style.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 QS60STYLE_H
00043 #define QS60STYLE_H
00044 
00045 #include <QtGui/qcommonstyle.h>
00046 
00047 QT_BEGIN_HEADER
00048 
00049 QT_BEGIN_NAMESPACE
00050 
00051 QT_MODULE(Gui)
00052 
00053 //Public custom pixel metrics values.
00054 //These can be used to fetch custom pixel metric value from outside QS60Style.
00055 enum {
00056     PM_FrameCornerWidth = QStyle::PM_CustomBase + 1,
00057     PM_FrameCornerHeight,
00058     PM_BoldLineWidth,
00059     PM_ThinLineWidth,
00060     PM_MessageBoxHeight
00061     };
00062 
00063 class QS60StylePrivate;
00064 
00065 class Q_GUI_EXPORT QS60Style : public QCommonStyle
00066 {
00067     Q_OBJECT
00068     Q_DECLARE_PRIVATE(QS60Style)
00069 
00070 public:
00071     QS60Style();
00072     ~QS60Style();
00073 
00074     void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
00075     void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
00076     void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
00077     int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
00078     QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const;
00079     int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
00080                   QStyleHintReturn *shret = 0) const;
00081     QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget = 0) const;
00082     QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const;
00083     void polish(QWidget *widget);
00084     void unpolish(QWidget *widget);
00085     void polish(QApplication *application);
00086     void unpolish(QApplication *application);
00087 #ifndef Q_NO_USING_KEYWORD
00088     using QCommonStyle::polish;
00089 #endif
00090     bool event(QEvent *e);
00091 
00092 #ifndef Q_OS_SYMBIAN
00093     static QStringList partKeys();
00094     static QStringList colorListKeys();
00095     void setS60Theme(const QHash<QString, QPicture> &parts,
00096         const QHash<QPair<QString , int>, QColor> &colors);
00097     bool loadS60ThemeFromBlob(const QString &blobFile);
00098     bool saveS60ThemeToBlob(const QString &blobFile) const;
00099 #endif // !Q_OS_SYMBIAN
00100 
00101 protected Q_SLOTS:
00102     QIcon standardIconImplementation(
00103             StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const;
00104 
00105 protected:
00106     void timerEvent(QTimerEvent *event);
00107     bool eventFilter(QObject *o, QEvent *e);
00108 private:
00109     Q_DISABLE_COPY(QS60Style)
00110     friend class QStyleFactory;
00111     friend class QApplicationPrivate;
00112 };
00113 
00114 QT_END_NAMESPACE
00115 
00116 QT_END_HEADER
00117 
00118 #endif // QS60STYLE_H