src/gui/styles/qwindowsvistastyle_p.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QWINDOWSVISTASTYLE_P_H
       
    43 #define QWINDOWSVISTASTYLE_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists for the convenience
       
    50 // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp.  This header
       
    51 // file may change from version to version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include "qwindowsvistastyle.h"
       
    57 
       
    58 #if !defined(QT_NO_STYLE_WINDOWSVISTA)
       
    59 #include <private/qwindowsxpstyle_p.h>
       
    60 #include <private/qpaintengine_raster_p.h>
       
    61 #include <qlibrary.h>
       
    62 #include <qpaintengine.h>
       
    63 #include <qwidget.h>
       
    64 #include <qapplication.h>
       
    65 #include <qpixmapcache.h>
       
    66 #include <qstyleoption.h>
       
    67 #include <qpushbutton.h>
       
    68 #include <qradiobutton.h>
       
    69 #include <qcheckbox.h>
       
    70 #include <qlineedit.h>
       
    71 #include <qgroupbox.h>
       
    72 #include <qtoolbutton.h>
       
    73 #include <qspinbox.h>
       
    74 #include <qtoolbar.h>
       
    75 #include <qcombobox.h>
       
    76 #include <qscrollbar.h>
       
    77 #include <qprogressbar.h>
       
    78 #include <qdockwidget.h>
       
    79 #include <qlistview.h>
       
    80 #include <qtreeview.h>
       
    81 #include <qtextedit.h>
       
    82 #include <qmessagebox.h>
       
    83 #include <qdialogbuttonbox.h>
       
    84 #include <qinputdialog.h>
       
    85 #include <qtreeview.h>
       
    86 #include <qlistview.h>
       
    87 #include <qtableview.h>
       
    88 #include <qbasictimer.h>
       
    89 #include <qcommandlinkbutton.h>
       
    90 
       
    91 QT_BEGIN_NAMESPACE
       
    92 
       
    93 #if !defined(SCHEMA_VERIFY_VSSYM32)
       
    94 #define TMT_ANIMATIONDURATION       5006
       
    95 #define TMT_TRANSITIONDURATIONS     6000
       
    96 #define EP_EDITBORDER_NOSCROLL      6
       
    97 #define EP_EDITBORDER_HVSCROLL      9
       
    98 #define EP_BACKGROUND               3
       
    99 #define EBS_NORMAL                  1
       
   100 #define EBS_HOT                     2
       
   101 #define EBS_DISABLED                3
       
   102 #define EBS_READONLY                5
       
   103 #define PBS_DEFAULTED_ANIMATING     6
       
   104 #define MBI_NORMAL                  1
       
   105 #define MBI_HOT                     2
       
   106 #define MBI_PUSHED                  3
       
   107 #define MBI_DISABLED                4
       
   108 #define MB_ACTIVE                   1
       
   109 #define MB_INACTIVE                 2
       
   110 #define PP_FILL                     5
       
   111 #define PP_FILLVERT                 6
       
   112 #define PP_MOVEOVERLAY              8
       
   113 #define PP_MOVEOVERLAYVERT          10
       
   114 #define MENU_BARBACKGROUND          7
       
   115 #define MENU_BARITEM                8
       
   116 #define MENU_POPUPCHECK             11
       
   117 #define MENU_POPUPCHECKBACKGROUND   12
       
   118 #define MENU_POPUPGUTTER            13
       
   119 #define MENU_POPUPITEM              14
       
   120 #define MENU_POPUPBORDERS           10
       
   121 #define MENU_POPUPSEPARATOR         15
       
   122 #define MC_CHECKMARKNORMAL          1
       
   123 #define MC_CHECKMARKDISABLED        2
       
   124 #define MC_BULLETNORMAL             3
       
   125 #define MC_BULLETDISABLED           4
       
   126 #define ABS_UPHOVER                 17
       
   127 #define ABS_DOWNHOVER               18
       
   128 #define ABS_LEFTHOVER               19
       
   129 #define ABS_RIGHTHOVER              20
       
   130 #define CP_DROPDOWNBUTTONRIGHT      6
       
   131 #define CP_DROPDOWNBUTTONLEFT       7
       
   132 #define SCRBS_HOVER                 5
       
   133 #define TVP_HOTGLYPH                4
       
   134 #define SPI_GETCLIENTAREAANIMATION  0x1042
       
   135 #define TDLG_PRIMARYPANEL           1
       
   136 #define TDLG_SECONDARYPANEL         8
       
   137 #endif
       
   138 
       
   139 class Animation
       
   140 {
       
   141 public :
       
   142     Animation() : _running(true) { }
       
   143     virtual ~Animation() { }
       
   144     QWidget * widget() const { return _widget; }
       
   145     bool running() const { return _running; }
       
   146     const QTime &startTime() const { return _startTime; }
       
   147     void setRunning(bool val) { _running = val; }
       
   148     void setWidget(QWidget *widget) { _widget = widget; }
       
   149     void setStartTime(const QTime &startTime) { _startTime = startTime; }
       
   150     virtual void paint(QPainter *painter, const QStyleOption *option);
       
   151 
       
   152 protected:
       
   153     void drawBlendedImage(QPainter *painter, QRect rect, float value);
       
   154     QTime _startTime;
       
   155     QPointer<QWidget> _widget;
       
   156     QImage _primaryImage;
       
   157     QImage _secondaryImage;
       
   158     QImage _tempImage;
       
   159     bool _running;
       
   160 };
       
   161 
       
   162 
       
   163 // Handles state transition animations
       
   164 class Transition : public Animation
       
   165 {
       
   166 public :
       
   167     Transition() : Animation() {}
       
   168     virtual ~Transition() { }
       
   169     void setDuration(int duration) { _duration = duration; }
       
   170     void setStartImage(const QImage &image) { _primaryImage = image; }
       
   171     void setEndImage(const QImage &image) { _secondaryImage = image; }
       
   172     virtual void paint(QPainter *painter, const QStyleOption *option);
       
   173     int duration() const { return _duration; }
       
   174     int _duration; //set time in ms to complete a state transition
       
   175 };
       
   176 
       
   177 
       
   178 // Handles pulse animations (default buttons)
       
   179 class Pulse: public Animation
       
   180 {
       
   181 public :
       
   182     Pulse() : Animation() {}
       
   183     virtual ~Pulse() { }
       
   184     void setDuration(int duration) { _duration = duration; }
       
   185     void setPrimaryImage(const QImage &image) { _primaryImage = image; }
       
   186     void setAlternateImage(const QImage &image) { _secondaryImage = image; }
       
   187     virtual void paint(QPainter *painter, const QStyleOption *option);
       
   188     int duration() const { return _duration; }
       
   189     int _duration; //time in ms to complete a pulse cycle
       
   190 };
       
   191 
       
   192 
       
   193 class QWindowsVistaStylePrivate :  public QWindowsXPStylePrivate
       
   194 {
       
   195     Q_DECLARE_PUBLIC(QWindowsVistaStyle)
       
   196 
       
   197 public:
       
   198     QWindowsVistaStylePrivate();
       
   199     ~QWindowsVistaStylePrivate();
       
   200     static bool resolveSymbols();
       
   201     static inline bool useVista();
       
   202     void startAnimation(Animation *);
       
   203     void stopAnimation(const QWidget *);
       
   204     Animation* widgetAnimation(const QWidget *) const;
       
   205     void timerEvent();
       
   206     bool transitionsEnabled() const;
       
   207     QWidget *treeViewHelper();
       
   208 
       
   209 private:
       
   210     QList <Animation*> animations;
       
   211     QBasicTimer animationTimer;
       
   212     QWidget *m_treeViewHelper;
       
   213 };
       
   214 
       
   215 QT_END_NAMESPACE
       
   216 
       
   217 #endif // QT_NO_STYLE_WINDOWSVISTA
       
   218 
       
   219 #endif // QWINDOWSVISTASTYLE_P_H