Qt 4.8
Typedefs | Functions | Variables
qwindowsxpstyle.cpp File Reference
#include "qwindowsxpstyle.h"
#include "qwindowsxpstyle_p.h"
#include <private/qobject_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qapplication_p.h>
#include <private/qstylehelper_p.h>
#include <private/qwidget_p.h>
#include <private/qsystemlibrary_p.h>
#include <qpainter.h>
#include <qpaintengine.h>
#include <qwidget.h>
#include <qapplication.h>
#include <qpixmapcache.h>
#include <qdesktopwidget.h>
#include <qtoolbutton.h>
#include <qtabbar.h>
#include <qcombobox.h>
#include <qscrollbar.h>
#include <qheaderview.h>
#include <qspinbox.h>
#include <qlistview.h>
#include <qstackedwidget.h>
#include <qpushbutton.h>
#include <qtoolbar.h>
#include <qlabel.h>
#include <qvarlengtharray.h>
#include <qdebug.h>

Go to the source code of this file.

Typedefs

typedef HRESULT(WINAPI * PtrCloseThemeData) (HTHEME hTheme)
 
typedef HRESULT(WINAPI * PtrDrawThemeBackground) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect)
 
typedef HRESULT(WINAPI * PtrDrawThemeBackgroundEx) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions)
 
typedef HRESULT(WINAPI * PtrGetCurrentThemeName) (OUT LPWSTR pszThemeFileName, int cchMaxNameChars, OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars, OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars)
 
typedef HRESULT(WINAPI * PtrGetThemeBackgroundRegion) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion)
 
typedef HRESULT(WINAPI * PtrGetThemeBool) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT BOOL *pfVal)
 
typedef HRESULT(WINAPI * PtrGetThemeColor) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor)
 
typedef HRESULT(WINAPI * PtrGetThemeDocumentationProperty) (LPCWSTR pszThemeName, LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars)
 
typedef HRESULT(WINAPI * PtrGetThemeEnumValue) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal)
 
typedef HRESULT(WINAPI * PtrGetThemeFilename) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars)
 
typedef HRESULT(WINAPI * PtrGetThemeFont) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT LOGFONT *pFont)
 
typedef HRESULT(WINAPI * PtrGetThemeInt) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal)
 
typedef HRESULT(WINAPI * PtrGetThemeIntList) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT INTLIST *pIntList)
 
typedef HRESULT(WINAPI * PtrGetThemeMargins) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins)
 
typedef HRESULT(WINAPI * PtrGetThemeMetric) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT int *piVal)
 
typedef HRESULT(WINAPI * PtrGetThemePartSize) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz)
 
typedef HRESULT(WINAPI * PtrGetThemePosition) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT POINT *pPoint)
 
typedef HRESULT(WINAPI * PtrGetThemePropertyOrigin) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin)
 
typedef HRESULT(WINAPI * PtrGetThemeRect) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT RECT *pRect)
 
typedef HRESULT(WINAPI * PtrGetThemeString) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars)
 
typedef bool(WINAPI * PtrIsAppThemed) ()
 
typedef bool(WINAPI * PtrIsThemeActive) ()
 
typedef BOOL(WINAPI * PtrIsThemeBackgroundPartiallyTransparent) (HTHEME hTheme, int iPartId, int iStateId)
 
typedef HTHEME(WINAPI * PtrOpenThemeData) (HWND hwnd, LPCWSTR pszClassList)
 

Functions

static bool buttonVisible (const QStyle::SubControl sc, const QStyleOptionTitleBar *tb)
 
QRegion qt_region_from_HRGN (HRGN rgn)
 
Q_GUI_EXPORT HDC qt_win_display_dc ()
 

Variables

static PtrCloseThemeData pCloseThemeData = 0
 
static PtrDrawThemeBackground pDrawThemeBackground = 0
 
static PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx = 0
 
static PtrGetCurrentThemeName pGetCurrentThemeName = 0
 
static PtrGetThemeBackgroundRegion pGetThemeBackgroundRegion = 0
 
static PtrGetThemeBool pGetThemeBool = 0
 
static PtrGetThemeColor pGetThemeColor = 0
 
static PtrGetThemeDocumentationProperty pGetThemeDocumentationProperty = 0
 
static PtrGetThemeEnumValue pGetThemeEnumValue = 0
 
static PtrGetThemeFilename pGetThemeFilename = 0
 
static PtrGetThemeFont pGetThemeFont = 0
 
static PtrGetThemeInt pGetThemeInt = 0
 
static PtrGetThemeIntList pGetThemeIntList = 0
 
static PtrGetThemeMargins pGetThemeMargins = 0
 
static PtrGetThemeMetric pGetThemeMetric = 0
 
static PtrGetThemePartSize pGetThemePartSize = 0
 
static PtrGetThemePosition pGetThemePosition = 0
 
static PtrGetThemePropertyOrigin pGetThemePropertyOrigin = 0
 
static PtrGetThemeRect pGetThemeRect = 0
 
static PtrGetThemeString pGetThemeString = 0
 
static PtrIsAppThemed pIsAppThemed = 0
 
static PtrIsThemeActive pIsThemeActive = 0
 
static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTransparent = 0
 
static PtrOpenThemeData pOpenThemeData = 0
 
static const int windowsArrowHMargin = 6
 
static const int windowsItemFrame = 2
 
static const int windowsItemHMargin = 3
 
static const int windowsItemVMargin = 0
 
static const int windowsRightBorder = 12
 

Typedef Documentation

◆ PtrCloseThemeData

typedef HRESULT(WINAPI * PtrCloseThemeData) (HTHEME hTheme)

Definition at line 80 of file qwindowsxpstyle.cpp.

◆ PtrDrawThemeBackground

typedef HRESULT(WINAPI * PtrDrawThemeBackground) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect)

Definition at line 81 of file qwindowsxpstyle.cpp.

◆ PtrDrawThemeBackgroundEx

typedef HRESULT(WINAPI * PtrDrawThemeBackgroundEx) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions)

Definition at line 82 of file qwindowsxpstyle.cpp.

◆ PtrGetCurrentThemeName

typedef HRESULT(WINAPI * PtrGetCurrentThemeName) (OUT LPWSTR pszThemeFileName, int cchMaxNameChars, OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars, OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars)

Definition at line 83 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeBackgroundRegion

typedef HRESULT(WINAPI * PtrGetThemeBackgroundRegion) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion)

Definition at line 99 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeBool

typedef HRESULT(WINAPI * PtrGetThemeBool) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT BOOL *pfVal)

Definition at line 85 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeColor

typedef HRESULT(WINAPI * PtrGetThemeColor) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor)

Definition at line 86 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeDocumentationProperty

typedef HRESULT(WINAPI * PtrGetThemeDocumentationProperty) (LPCWSTR pszThemeName, LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars)

Definition at line 84 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeEnumValue

typedef HRESULT(WINAPI * PtrGetThemeEnumValue) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal)

Definition at line 87 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeFilename

typedef HRESULT(WINAPI * PtrGetThemeFilename) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars)

Definition at line 88 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeFont

typedef HRESULT(WINAPI * PtrGetThemeFont) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT LOGFONT *pFont)

Definition at line 89 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeInt

typedef HRESULT(WINAPI * PtrGetThemeInt) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal)

Definition at line 90 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeIntList

typedef HRESULT(WINAPI * PtrGetThemeIntList) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT INTLIST *pIntList)

Definition at line 91 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeMargins

typedef HRESULT(WINAPI * PtrGetThemeMargins) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins)

Definition at line 92 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeMetric

typedef HRESULT(WINAPI * PtrGetThemeMetric) (HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT int *piVal)

Definition at line 93 of file qwindowsxpstyle.cpp.

◆ PtrGetThemePartSize

typedef HRESULT(WINAPI * PtrGetThemePartSize) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz)

Definition at line 78 of file qwindowsxpstyle.cpp.

◆ PtrGetThemePosition

typedef HRESULT(WINAPI * PtrGetThemePosition) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT POINT *pPoint)

Definition at line 95 of file qwindowsxpstyle.cpp.

◆ PtrGetThemePropertyOrigin

typedef HRESULT(WINAPI * PtrGetThemePropertyOrigin) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin)

Definition at line 96 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeRect

typedef HRESULT(WINAPI * PtrGetThemeRect) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT RECT *pRect)

Definition at line 97 of file qwindowsxpstyle.cpp.

◆ PtrGetThemeString

typedef HRESULT(WINAPI * PtrGetThemeString) (HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars)

Definition at line 98 of file qwindowsxpstyle.cpp.

◆ PtrIsAppThemed

typedef bool(WINAPI * PtrIsAppThemed) ()

Definition at line 76 of file qwindowsxpstyle.cpp.

◆ PtrIsThemeActive

typedef bool(WINAPI * PtrIsThemeActive) ()

Definition at line 77 of file qwindowsxpstyle.cpp.

◆ PtrIsThemeBackgroundPartiallyTransparent

typedef BOOL(WINAPI * PtrIsThemeBackgroundPartiallyTransparent) (HTHEME hTheme, int iPartId, int iStateId)

Definition at line 100 of file qwindowsxpstyle.cpp.

◆ PtrOpenThemeData

typedef HTHEME(WINAPI * PtrOpenThemeData) (HWND hwnd, LPCWSTR pszClassList)

Definition at line 79 of file qwindowsxpstyle.cpp.

Function Documentation

◆ buttonVisible()

static bool buttonVisible ( const QStyle::SubControl  sc,
const QStyleOptionTitleBar tb 
)
static

Definition at line 3461 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStyle::subControlRect().

3461  {
3462 
3463  bool isMinimized = tb->titleBarState & Qt::WindowMinimized;
3464  bool isMaximized = tb->titleBarState & Qt::WindowMaximized;
3465  const uint flags = tb->titleBarFlags;
3466  bool retVal = false;
3467  switch (sc) {
3469  if (flags & Qt::WindowContextHelpButtonHint)
3470  retVal = true;
3471  break;
3473  if (!isMinimized && (flags & Qt::WindowMinimizeButtonHint))
3474  retVal = true;
3475  break;
3477  if (isMinimized && (flags & Qt::WindowMinimizeButtonHint))
3478  retVal = true;
3479  else if (isMaximized && (flags & Qt::WindowMaximizeButtonHint))
3480  retVal = true;
3481  break;
3483  if (!isMaximized && (flags & Qt::WindowMaximizeButtonHint))
3484  retVal = true;
3485  break;
3487  if (!isMinimized && flags & Qt::WindowShadeButtonHint)
3488  retVal = true;
3489  break;
3491  if (isMinimized && flags & Qt::WindowShadeButtonHint)
3492  retVal = true;
3493  break;
3495  if (flags & Qt::WindowSystemMenuHint)
3496  retVal = true;
3497  break;
3499  if (flags & Qt::WindowSystemMenuHint)
3500  retVal = true;
3501  break;
3502  default :
3503  retVal = true;
3504  }
3505  return retVal;
3506 }
unsigned int uint
Definition: qglobal.h:996
Qt::WindowFlags titleBarFlags
the widget flags for the title bar
Definition: qstyleoption.h:825
int titleBarState
the state of the title bar
Definition: qstyleoption.h:824

◆ qt_region_from_HRGN()

QRegion qt_region_from_HRGN ( HRGN  rgn)

Definition at line 80 of file qregion_win.cpp.

Referenced by QWindowsXPStylePrivate::region().

81 {
82  int numBytes = GetRegionData(rgn, 0, 0);
83  if (numBytes == 0)
84  return QRegion();
85 
86  char *buf = new char[numBytes];
87  if (buf == 0)
88  return QRegion();
89 
90  RGNDATA *rd = reinterpret_cast<RGNDATA*>(buf);
91  if (GetRegionData(rgn, numBytes, rd) == 0) {
92  delete [] buf;
93  return QRegion();
94  }
95 
96  QRegion region;
97  RECT *r = reinterpret_cast<RECT*>(rd->Buffer);
98  for (uint i = 0; i < rd->rdh.nCount; ++i) {
99  QRect rect;
100  rect.setCoords(r->left, r->top, r->right - 1, r->bottom - 1);
101  ++r;
102  region |= rect;
103  }
104 
105  delete [] buf;
106 
107  return region;
108 }
unsigned int uint
Definition: qglobal.h:996
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ qt_win_display_dc()

Q_GUI_EXPORT HDC qt_win_display_dc ( )

Definition at line 942 of file qapplication_win.cpp.

Referenced by QWindowsXPStylePrivate::buffer(), QWindowsXPStyle::drawComplexControl(), QRasterWindowSurface::flush(), QAxHostWidget::paintEvent(), and QWindowsXPStylePrivate::tabBody().

943 {
944  Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());
945  if (!displayDC)
946  displayDC = GetDC(0);
947  return displayDC;
948 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static HDC displayDC
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
#define qApp

Variable Documentation

◆ pCloseThemeData

PtrCloseThemeData pCloseThemeData = 0
static

◆ pDrawThemeBackground

PtrDrawThemeBackground pDrawThemeBackground = 0
static

◆ pDrawThemeBackgroundEx

PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx = 0
static

◆ pGetCurrentThemeName

PtrGetCurrentThemeName pGetCurrentThemeName = 0
static

◆ pGetThemeBackgroundRegion

PtrGetThemeBackgroundRegion pGetThemeBackgroundRegion = 0
static

◆ pGetThemeBool

PtrGetThemeBool pGetThemeBool = 0
static

◆ pGetThemeColor

PtrGetThemeColor pGetThemeColor = 0
static

◆ pGetThemeDocumentationProperty

PtrGetThemeDocumentationProperty pGetThemeDocumentationProperty = 0
static

◆ pGetThemeEnumValue

PtrGetThemeEnumValue pGetThemeEnumValue = 0
static

◆ pGetThemeFilename

PtrGetThemeFilename pGetThemeFilename = 0
static

◆ pGetThemeFont

PtrGetThemeFont pGetThemeFont = 0
static

◆ pGetThemeInt

PtrGetThemeInt pGetThemeInt = 0
static

◆ pGetThemeIntList

PtrGetThemeIntList pGetThemeIntList = 0
static

◆ pGetThemeMargins

PtrGetThemeMargins pGetThemeMargins = 0
static

◆ pGetThemeMetric

PtrGetThemeMetric pGetThemeMetric = 0
static

Definition at line 117 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStylePrivate::resolveSymbols().

◆ pGetThemePartSize

PtrGetThemePartSize pGetThemePartSize = 0
static

◆ pGetThemePosition

PtrGetThemePosition pGetThemePosition = 0
static

◆ pGetThemePropertyOrigin

PtrGetThemePropertyOrigin pGetThemePropertyOrigin = 0
static

◆ pGetThemeRect

PtrGetThemeRect pGetThemeRect = 0
static

◆ pGetThemeString

PtrGetThemeString pGetThemeString = 0
static

◆ pIsAppThemed

PtrIsAppThemed pIsAppThemed = 0
static

◆ pIsThemeActive

PtrIsThemeActive pIsThemeActive = 0
static

◆ pIsThemeBackgroundPartiallyTransparent

PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTransparent = 0
static

◆ pOpenThemeData

PtrOpenThemeData pOpenThemeData = 0
static

◆ windowsArrowHMargin

const int windowsArrowHMargin = 6
static

Definition at line 131 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStyle::drawControl().

◆ windowsItemFrame

const int windowsItemFrame = 2
static

Definition at line 128 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStyle::drawControl().

◆ windowsItemHMargin

const int windowsItemHMargin = 3
static

◆ windowsItemVMargin

const int windowsItemVMargin = 0
static

Definition at line 130 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStyle::drawControl().

◆ windowsRightBorder

const int windowsRightBorder = 12
static

Definition at line 132 of file qwindowsxpstyle.cpp.

Referenced by QWindowsXPStyle::drawControl().