43 #ifndef QT_NO_STYLE_WINDOWSVISTA 46 #include <private/qsystemlibrary_p.h> 50 #include <QtGui/QMouseEvent> 51 #include <QtGui/QDesktopWidget> 56 # if (__W32API_MAJOR_VERSION >= 3 || (__W32API_MAJOR_VERSION == 2 && __W32API_MINOR_VERSION >= 5)) 60 # define _WIN32_WINNT 0x0501 61 # include <commctrl.h> 97 #define WIZ_WM_THEMECHANGED 0x031A 98 #define WIZ_WM_DWMCOMPOSITIONCHANGED 0x031E 104 #define WIZ_WTNCA_NODRAWCAPTION 0x00000001 105 #define WIZ_WTNCA_NODRAWICON 0x00000002 107 #define WIZ_DT_CENTER 0x00000001 //DT_CENTER 108 #define WIZ_DT_VCENTER 0x00000004 109 #define WIZ_DT_SINGLELINE 0x00000020 110 #define WIZ_DT_NOPREFIX 0x00000800 125 #define WIZ_TMT_CAPTIONFONT (801) //TMT_CAPTIONFONT 126 #define WIZ_DTT_COMPOSITED (1UL << 13) //DTT_COMPOSITED 127 #define WIZ_DTT_GLOWSIZE (1UL << 11) //DTT_GLOWSIZE 129 #define WIZ_WM_NCMOUSELEAVE 674 //WM_NCMOUSELEAVE 131 #define WIZ_WP_CAPTION 1 //WP_CAPTION 132 #define WIZ_CS_ACTIVE 1 //CS_ACTIVE 133 #define WIZ_TMT_FILLCOLORHINT 3821 //TMT_FILLCOLORHINT 134 #define WIZ_TMT_BORDERCOLORHINT 3822 //TMT_BORDERCOLORHINT 136 typedef BOOL (WINAPI *
PtrDwmDefWindowProc)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult);
194 return QSize(width, height);
221 clipRect.top = r.
top() + yoffset;
222 clipRect.bottom = r.
bottom() + yoffset;
223 clipRect.left = r.
left() + xoffset;
224 clipRect.right = r.
right() + xoffset;
276 value = (SUCCEEDED(hr) && bEnabled);
308 BYTE r = GetRValue(rgb);
309 BYTE g = GetGValue(rgb);
310 BYTE b = GetBValue(rgb);
324 value = SUCCEEDED(hr);
339 const int verticalCenter = (btnTop + btnHeight / 2) - 1;
345 int textHeight = brect.
height();
346 int textWidth = brect.
width();
361 QRect(titleLeft, verticalCenter - textHeight / 2, textWidth, textHeight),
371 DrawIconEx(hdc, rect.
left(), rect.
top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
391 switch (msg->message) {
395 if (
pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
400 lResult = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
404 if (lResult == HTCLOSE || lResult == HTMAXBUTTON || lResult == HTMINBUTTON || lResult == HTHELP)
413 NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
414 *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
423 if (
pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
445 switch (event->
type()) {
470 SetWindowPos(
wizard->
winId(), 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
499 if (message->message == WM_NCCALCSIZE) {
502 }
else if (message->message == WM_NCPAINT) {
605 msg.message = WM_NCHITTEST;
607 msg.lParam = MAKELPARAM(mouseEvent->
globalX(), mouseEvent->
globalY());
611 msg.message = WM_NCMOUSEMOVE;
619 msg.message = WM_NCHITTEST;
621 msg.lParam = MAKELPARAM(mouseEvent->
globalX(), mouseEvent->
globalY());
625 msg.message = WM_NCLBUTTONDOWN;
634 msg.message = WM_NCHITTEST;
636 msg.lParam = MAKELPARAM(mouseEvent->
globalX(), mouseEvent->
globalY());
640 msg.message = WM_NCLBUTTONUP;
656 NONCLIENTMETRICS ncm = {
sizeof(NONCLIENTMETRICS)};
657 SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS), &ncm,
false);
658 lf = ncm.lfMessageFont;
660 return CreateFontIndirect(&lf);
668 if (!hTheme)
return false;
672 BITMAPINFO dib = {{0}};
673 dcMem = CreateCompatibleDC(hdc);
675 dib.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
676 dib.bmiHeader.biWidth = rect.
width();
677 dib.bmiHeader.biHeight = -rect.
height();
678 dib.bmiHeader.biPlanes = 1;
679 dib.bmiHeader.biBitCount = 32;
680 dib.bmiHeader.biCompression = BI_RGB;
682 bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
686 HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
687 HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
698 BitBlt(hdc, rect.
left(), rect.
top(), rect.
width(), rect.
height(), dcMem, 0, 0, SRCCOPY);
699 SelectObject(dcMem, (HGDIOBJ) hOldBmp);
700 SelectObject(dcMem, (HGDIOBJ) hOldFont);
702 DeleteObject(hCaptionFont);
718 BITMAPINFO dib = {{0}};
719 dcMem = CreateCompatibleDC(hdc);
721 dib.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
722 dib.bmiHeader.biWidth = rect.
width();
723 dib.bmiHeader.biHeight = -rect.
height();
724 dib.bmiHeader.biPlanes = 1;
725 dib.bmiHeader.biBitCount = 32;
726 dib.bmiHeader.biCompression = BI_RGB;
728 bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
729 HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
731 BitBlt(hdc, rect.
left(), rect.
top(), rect.
width(), rect.
height(), dcMem, 0, 0, SRCCOPY);
732 SelectObject(dcMem, (HGDIOBJ) hOldBmp);
740 #if !defined(_MSC_VER) || _MSC_VER < 1700 743 return GetSystemMetrics(SM_CYSIZEFRAME);
745 #else // !_MSC_VER || _MSC_VER < 1700 751 RECT rect = {0, 0, 0, 0};
752 AdjustWindowRectEx(&rect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
WS_THICKFRAME | WS_DLGFRAME,
FALSE, 0);
753 return qAbs(rect.bottom);
755 #endif // _MSC_VER >= 1700 764 return GetSystemMetrics(SM_CYCAPTION);
769 static bool tried =
false;
822 static const int aeroOffset =
830 #endif // QT_NO_STYLE_WINDOWSVISTA 832 #endif // QT_NO_WIZARD #define WIZ_TMT_CAPTIONFONT
The QPainter class performs low-level painting on widgets and other paint devices.
void mouseMoveEvent(QMouseEvent *event)
The QColor class provides colors based on RGB, HSV or CMYK values.
void mousePressEvent(QMouseEvent *event)
bool setDWMTitleBar(TitleBarChangeType type)
void mouseReleaseEvent(QMouseEvent *event)
static PtrIsThemeActive pIsThemeActive
#define WIZ_WTNCA_NODRAWCAPTION
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
void disconnectBackButton()
static PtrDrawThemeBackground pDrawThemeBackground
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate...
void paintEvent(QPaintEvent *event)
QVistaBackButton * backButton_
static PtrDrawThemeTextEx pDrawThemeTextEx
static VistaState vistaState()
static VistaState cachedVistaState
static PtrDwmDefWindowProc pDwmDefWindowProc
bool(WINAPI * PtrIsAppThemed)()
static bool drawBlackRect(const QRect &rect, HDC hdc)
void resizeEvent(QResizeEvent *event)
static PtrGetThemePartSize pGetThemePartSize
WIZ_WINDOWTHEMEATTRIBUTETYPE
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
static LibLoadStatus status
QColor basicWindowFrameColor()
HRESULT(WINAPI * PtrGetThemeColor)(HANDLE hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor)
enum QVistaHelper::Changes change
int height() const
Returns the height of the rectangle.
static const WinVersion WindowsVersion
the version of the Windows operating system on which the application is run (Windows only) ...
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
#define WIZ_DT_SINGLELINE
HRESULT(WINAPI * PtrSetWindowThemeAttribute)(HWND hwnd, enum WIZ_WINDOWTHEMEATTRIBUTETYPE eAttribute, PVOID pvAttribute, DWORD cbAttribute)
void drawTitleBar(QPainter *painter)
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
#define WIZ_TMT_BORDERCOLORHINT
bool(WINAPI * PtrIsThemeActive)()
#define SIZE(large, small, mini)
WizardStyle wizardStyle
the look and feel of the wizard
#define WIZ_DTT_COMPOSITED
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
static PtrCloseThemeData pCloseThemeData
HRESULT(WINAPI * PtrCloseThemeData)(HANDLE hTheme)
static QFont font()
Returns the default application font.
HRESULT(WINAPI * PtrGetThemePartSize)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz)
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
void getCoords(int *x1, int *y1, int *x2, int *y2) const
Extracts the position of the rectangle's top-left corner to *x1 and *y1, and the position of the bott...
bool winEvent(MSG *message, long *result)
virtual HDC getDC() const
Empty default implementation.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define WIZ_WTNCA_NODRAWICON
#define WIZ_WM_DWMCOMPOSITIONCHANGED
bool eventFilter(QObject *obj, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object...
static int titleBarSize()
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
static PtrIsAppThemed pIsAppThemed
The QResizeEvent class contains event parameters for resize events.
int globalX() const
Returns the global x position of the mouse cursor at the time of the event.
bool handleWinEvent(MSG *message, long *result)
QVistaHelper(QWizard *wizard)
static bool isThemeActive()
#define FALSE
Synonym for false.
HRESULT(WINAPI * PtrDrawThemeTextEx)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT pRect, const WIZ_DTTOPTS *pOptions)
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
void setMouseCursor(QPoint pos)
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
HRESULT(WINAPI * PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const WIZ_MARGINS *pMarInset)
Qt::MouseButton button() const
Returns the button that caused the event.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
static PtrSetWindowThemeAttribute pSetWindowThemeAttribute
The QMouseEvent class contains parameters that describe a mouse event.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
qreal dpiScaled(qreal value)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
HANDLE(WINAPI * PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList)
int top() const
Returns the y-coordinate of the rectangle's top edge.
void * resolve(const char *symbol)
HRESULT(WINAPI * PtrDwmIsCompositionEnabled)(BOOL *pfEnabled)
int right() const
Returns the x-coordinate of the rectangle's right edge.
static PtrGetThemeSysFont pGetThemeSysFont
HICON toWinHICON() const
Returns the HICON handle.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int globalY() const
Returns the global y position of the mouse cursor at the time of the event.
int x() const
Returns the x-coordinate of the rectangle's left edge.
void collapseTopFrameStrut()
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea
The QPoint class defines a point in the plane using integer precision.
static PtrGetThemeColor pGetThemeColor
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
#define WIZ_WM_THEMECHANGED
static int getWindowBottomMargin()
int y() const
Returns the y coordinate of this point.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
The QSize class defines the size of a two-dimensional object using integer point precision.
#define Q_DECLARE_PRIVATE(Class)
int x() const
Returns the x coordinate of this point.
HRESULT(WINAPI * PtrGetThemeSysFont)(HANDLE hTheme, int iFontId, LOGFONTW *plf)
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
static HFONT getCaptionFont(HANDLE hTheme)
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
#define WIZ_TMT_FILLCOLORHINT
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void setTitleBarIconAndCaptionVisible(bool visible)
static bool isCompositionEnabled()
HRESULT(WINAPI * PtrDrawThemeBackground)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect)
static PtrOpenThemeData pOpenThemeData
BOOL(WINAPI * PtrDwmDefWindowProc)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
The QWizard class provides a framework for wizards.
void mouseEvent(QEvent *event)
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled