QWindowsNativeStyle.h

00001 /*
00002  * @(#)QWindowsNativeStyle.h  0.2.0 / 2007-11-15
00003  *
00004  * Copyright (c) 2007, ETF and contributors. All rights reserved.
00005  *
00006  * This software is licensed under the LGPL, version 2.1, license.
00007  * A copy of the license is included in the file LICENSE-LGPL.txt.
00008  */
00009 #ifndef QWINDOWSNATIVESTYLE_H
00010 #define QWINDOWSNATIVESTYLE_H
00011 
00012 #include <QWindowsVistaStyle>
00013 
00014 /*^**************************************************************************^*/
00015 /*- QWindowsNativeStyle Class.                                              -*/
00016 /*^**************************************************************************^*/
00017 
00029 class QWindowsNativeStyle : public QWindowsVistaStyle
00030 {
00031 public:
00032   QWindowsNativeStyle();
00033 public:
00034   static void initialize(bool appThemed);
00035 public:
00036   inline static bool isPatchEnabled();
00037   inline static void setPatchEnabled(bool enabled);
00038   inline static bool isExplorerStyleEnabled();
00039   inline static void setExplorerStyleEnabled(bool enabled);
00040 public:
00041   void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
00042                      QPainter *painter, const QWidget *widget = 0) const;
00043   void drawControl(ControlElement element, const QStyleOption *option,
00044                    QPainter *painter, const QWidget *widget) const;
00045   void drawComplexControl(ComplexControl control,
00046                           const QStyleOptionComplex *option, QPainter *painter,
00047                           const QWidget *widget) const;
00048   QSize sizeFromContents(ContentsType type, const QStyleOption *option,
00049                          const QSize &size, const QWidget *widget) const;
00050   QRect subElementRect(SubElement element, const QStyleOption *option,
00051                        const QWidget *widget) const;
00052   QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
00053                        SubControl sc, const QWidget *widget) const;
00054   SubControl hitTestComplexControl(ComplexControl control,
00055                                    const QStyleOptionComplex *option,
00056                                    const QPoint &position,
00057                                    const QWidget *widget = 0) const;
00058   int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
00059                   const QWidget *widget = 0) const;
00060   int styleHint(StyleHint hint, const QStyleOption *opt = 0,
00061                 const QWidget *widget = 0,
00062                 QStyleHintReturn *returnData = 0) const;
00063   virtual QPalette standardPalette() const;
00064   QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
00065                          const QWidget *widget = 0) const;
00066   void polish(QWidget *widget);
00067   void unpolish(QWidget *widget);
00068   void polish(QPalette pal);
00069   void polish(QApplication *app);
00070   void unpolish(QApplication *app);
00071 private:
00072   mutable QRect m_currentTopRect; //current toolbar top area size
00073   mutable QRect m_currentBottomRect; //current toolbar bottom area size
00074 private:
00075   static bool sm_initialized;
00076   static bool sm_vista;
00077   static bool sm_appThemed;
00078   static bool sm_patchDisabled;
00079   static bool sm_explorerStyle;
00080 private:
00081   static QFont titleBarFont;
00082 };
00083 
00084 /*^**************************************************************************^*/
00085 /*- QWindowsNativeStyle :: Public Inline Member Functions.                   -*/
00086 /*^**************************************************************************^*/
00087 
00093 inline bool QWindowsNativeStyle::isPatchEnabled()
00094 {
00095   return !sm_patchDisabled;
00096 }
00097 
00103 inline void QWindowsNativeStyle::setPatchEnabled(bool enabled)
00104 {
00105   sm_patchDisabled = !enabled;
00106 }
00107 
00113 inline bool QWindowsNativeStyle::isExplorerStyleEnabled()
00114 {
00115   return sm_explorerStyle;
00116 }
00117 
00123 inline void QWindowsNativeStyle::setExplorerStyleEnabled(bool enabled)
00124 {
00125   sm_explorerStyle = enabled;
00126 }
00127 
00128 #endif // QWINDOWSNATIVESTYLE_H
00129 
00130 /*^*****************************************************************************
00131   File History:
00132 
00133  - 2007-06-08 Trolltech ASA
00134    ExplorerStyle version
00135 
00136  - 2007-11-15 14:12:50 Slobodan
00137    Initial version
00138 
00139 *****************************************************************************^*/
00140 
00141 // ExplorerStyle Header
00142 
00143 /****************************************************************************
00144 **
00145 ** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
00146 **
00147 ** Use, modification and distribution is allowed without limitation,
00148 ** warranty, liability or support of any kind.
00149 **
00150 ** explorerstyle.h - version 1.0
00151 ****************************************************************************/

Copyright © 2007 ETF and contributors. All Rights Reserved.