src/gui/dialogs/qwizard_win_p.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
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 QWIZARD_WIN_P_H
       
    43 #define QWIZARD_WIN_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 purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #ifndef QT_NO_WIZARD
       
    57 #ifndef QT_NO_STYLE_WINDOWSVISTA
       
    58 
       
    59 #include <qt_windows.h>
       
    60 #include <qobject.h>
       
    61 #include <qwidget.h>
       
    62 #include <qabstractbutton.h>
       
    63 #include <QtGui/private/qwidget_p.h>
       
    64 
       
    65 QT_BEGIN_NAMESPACE
       
    66 
       
    67 class QVistaBackButton : public QAbstractButton
       
    68 {
       
    69 public:
       
    70     QVistaBackButton(QWidget *widget);
       
    71 
       
    72     QSize sizeHint() const;
       
    73     inline QSize minimumSizeHint() const
       
    74     { return sizeHint(); }
       
    75 
       
    76     void enterEvent(QEvent *event);
       
    77     void leaveEvent(QEvent *event);
       
    78     void paintEvent(QPaintEvent *event);
       
    79 };
       
    80 
       
    81 class QWizard;
       
    82 
       
    83 class QVistaHelper : public QObject
       
    84 {
       
    85     Q_OBJECT
       
    86 public:
       
    87     QVistaHelper(QWizard *wizard);
       
    88     ~QVistaHelper();
       
    89     enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
       
    90     bool setDWMTitleBar(TitleBarChangeType type);
       
    91     void setTitleBarIconAndCaptionVisible(bool visible);
       
    92     void mouseEvent(QEvent *event);
       
    93     bool handleWinEvent(MSG *message, long *result);
       
    94     void resizeEvent(QResizeEvent *event);
       
    95     void paintEvent(QPaintEvent *event);
       
    96     QVistaBackButton *backButton() const { return backButton_; }
       
    97     void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
       
    98     void hideBackButton() { if (backButton_) backButton_->hide(); }
       
    99     void setWindowPosHack();
       
   100     QColor basicWindowFrameColor();
       
   101     enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
       
   102     static VistaState vistaState();
       
   103     static int titleBarSize() { return frameSize() + captionSize(); }
       
   104     static int topPadding() { return 8; }
       
   105     static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); }
       
   106 
       
   107 private:
       
   108     static HFONT getCaptionFont(HANDLE hTheme);
       
   109     bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
       
   110     static bool drawBlackRect(const QRect &rect, HDC hdc);
       
   111 
       
   112     static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
       
   113     static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
       
   114 
       
   115     static int backButtonSize() { return 31; } // ### should be queried from back button itself
       
   116     static int iconSize() { return 16; } // Standard Aero
       
   117     static int padding() { return 7; } // Standard Aero
       
   118     static int leftMargin() { return backButtonSize() + padding(); }
       
   119     static int glowSize() { return 10; }
       
   120 
       
   121     int titleOffset();
       
   122     bool resolveSymbols();
       
   123     void drawTitleBar(QPainter *painter);
       
   124     void setMouseCursor(QPoint pos);
       
   125     void collapseTopFrameStrut();
       
   126     bool winEvent(MSG *message, long *result);
       
   127     void mouseMoveEvent(QMouseEvent *event);
       
   128     void mousePressEvent(QMouseEvent *event);
       
   129     void mouseReleaseEvent(QMouseEvent *event);
       
   130     bool eventFilter(QObject *obj, QEvent *event);
       
   131 
       
   132     static bool is_vista;
       
   133     static VistaState cachedVistaState;
       
   134     static bool isCompositionEnabled();
       
   135     static bool isThemeActive();
       
   136     enum Changes { resizeTop, movePosition, noChange } change;
       
   137     QPoint pressedPos;
       
   138     bool pressed;
       
   139     QRect rtTop;
       
   140     QRect rtTitle;
       
   141     QWizard *wizard;
       
   142     QVistaBackButton *backButton_;
       
   143 };
       
   144 
       
   145 
       
   146 QT_END_NAMESPACE
       
   147 
       
   148 #endif // QT_NO_STYLE_WINDOWSVISTA
       
   149 #endif // QT_NO_WIZARD
       
   150 #endif // QWIZARD_WIN_P_H