Qt 4.8
Macros | Typedefs | Functions | Variables
qwindowsvistastyle.cpp File Reference
#include "qwindowsvistastyle.h"
#include "qwindowsvistastyle_p.h"
#include <private/qstylehelper_p.h>
#include <private/qsystemlibrary_p.h>

Go to the source code of this file.

Macros

#define BP_COMMANDLINK   6
 
#define BP_COMMANDLINKGLYPH   7
 
#define CMDLGS_DISABLED   4
 
#define CMDLGS_HOT   2
 
#define CMDLGS_NORMAL   1
 
#define CMDLGS_PRESSED   3
 
#define LISS_DISABLED   4
 
#define LISS_HOT   2
 
#define LISS_HOTSELECTED   6
 
#define LISS_NORMAL   1
 
#define LISS_SELECTED   3
 
#define LISS_SELECTEDNOTFOCUS   5
 
#define PP_TRANSPARENTBAR   11
 
#define PP_TRANSPARENTBARVERT   12
 
#define TMT_CONTENTMARGINS   3602
 
#define TMT_SIZINGMARGINS   3601
 

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 * 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 * 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 HRESULT(WINAPI * PtrGetThemeTransitionDuration) (HTHEME hTheme, int iPartId, int iStateFromId, int iStateToId, int iPropId, int *pDuration)
 
typedef HRESULT(WINAPI * PtrIsThemePartDefined) (HTHEME hTheme, int iPartId, int iStateId)
 
typedef HTHEME(WINAPI * PtrOpenThemeData) (HWND hwnd, LPCWSTR pszClassList)
 
typedef HRESULT(WINAPI * PtrSetWindowTheme) (HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList)
 

Functions

static int buttonStateId (int flags, int partId)
 
static bool buttonVisible (const QStyle::SubControl sc, const QStyleOptionTitleBar *tb)
 

Variables

static PtrCloseThemeData pCloseThemeData = 0
 
static PtrDrawThemeBackground pDrawThemeBackground = 0
 
static PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx = 0
 
static PtrGetCurrentThemeName pGetCurrentThemeName = 0
 
static PtrGetThemeBool pGetThemeBool = 0
 
static PtrGetThemeColor pGetThemeColor = 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 PtrGetThemeTransitionDuration pGetThemeTransitionDuration = 0
 
static PtrIsThemePartDefined pIsThemePartDefined = 0
 
static PtrOpenThemeData pOpenThemeData = 0
 
static PtrSetWindowTheme pSetWindowTheme = 0
 
static const int windowsArrowHMargin = 6
 
static const int windowsItemFrame = 2
 
static const int windowsItemHMargin = 3
 
static const int windowsItemVMargin = 4
 
static const int windowsRightBorder = 15
 

Macro Definition Documentation

◆ BP_COMMANDLINK

#define BP_COMMANDLINK   6

Definition at line 72 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ BP_COMMANDLINKGLYPH

#define BP_COMMANDLINKGLYPH   7

◆ CMDLGS_DISABLED

#define CMDLGS_DISABLED   4

◆ CMDLGS_HOT

#define CMDLGS_HOT   2

◆ CMDLGS_NORMAL

#define CMDLGS_NORMAL   1

◆ CMDLGS_PRESSED

#define CMDLGS_PRESSED   3

◆ LISS_DISABLED

#define LISS_DISABLED   4

Definition at line 67 of file qwindowsvistastyle.cpp.

◆ LISS_HOT

#define LISS_HOT   2

Definition at line 65 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawPrimitive().

◆ LISS_HOTSELECTED

#define LISS_HOTSELECTED   6

Definition at line 69 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawPrimitive().

◆ LISS_NORMAL

#define LISS_NORMAL   1

Definition at line 64 of file qwindowsvistastyle.cpp.

◆ LISS_SELECTED

#define LISS_SELECTED   3

Definition at line 66 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawPrimitive().

◆ LISS_SELECTEDNOTFOCUS

#define LISS_SELECTEDNOTFOCUS   5

Definition at line 68 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawPrimitive().

◆ PP_TRANSPARENTBAR

#define PP_TRANSPARENTBAR   11

Definition at line 80 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ PP_TRANSPARENTBARVERT

#define PP_TRANSPARENTBARVERT   12

Definition at line 81 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ TMT_CONTENTMARGINS

#define TMT_CONTENTMARGINS   3602

◆ TMT_SIZINGMARGINS

#define TMT_SIZINGMARGINS   3601

Typedef Documentation

◆ PtrCloseThemeData

typedef HRESULT(WINAPI * PtrCloseThemeData) (HTHEME hTheme)

Definition at line 90 of file qwindowsvistastyle.cpp.

◆ PtrDrawThemeBackground

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

Definition at line 91 of file qwindowsvistastyle.cpp.

◆ PtrDrawThemeBackgroundEx

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

Definition at line 92 of file qwindowsvistastyle.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 93 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeBool

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

Definition at line 94 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeColor

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

Definition at line 95 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeEnumValue

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

Definition at line 96 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeFilename

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

Definition at line 97 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeFont

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

Definition at line 98 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeInt

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

Definition at line 99 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeIntList

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

Definition at line 100 of file qwindowsvistastyle.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 101 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeMetric

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

Definition at line 102 of file qwindowsvistastyle.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 87 of file qwindowsvistastyle.cpp.

◆ PtrGetThemePosition

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

Definition at line 104 of file qwindowsvistastyle.cpp.

◆ PtrGetThemePropertyOrigin

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

Definition at line 110 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeRect

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

Definition at line 105 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeString

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

Definition at line 106 of file qwindowsvistastyle.cpp.

◆ PtrGetThemeTransitionDuration

typedef HRESULT(WINAPI * PtrGetThemeTransitionDuration) (HTHEME hTheme, int iPartId, int iStateFromId, int iStateToId, int iPropId, int *pDuration)

Definition at line 107 of file qwindowsvistastyle.cpp.

◆ PtrIsThemePartDefined

typedef HRESULT(WINAPI * PtrIsThemePartDefined) (HTHEME hTheme, int iPartId, int iStateId)

Definition at line 108 of file qwindowsvistastyle.cpp.

◆ PtrOpenThemeData

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

Definition at line 88 of file qwindowsvistastyle.cpp.

◆ PtrSetWindowTheme

typedef HRESULT(WINAPI * PtrSetWindowTheme) (HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList)

Definition at line 109 of file qwindowsvistastyle.cpp.

Function Documentation

◆ buttonStateId()

static int buttonStateId ( int  flags,
int  partId 
)
static

Definition at line 170 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl(), and QWindowsVistaStyle::drawPrimitive().

171 {
172  int stateId = 0;
173  if (partId == BP_RADIOBUTTON || partId == BP_CHECKBOX) {
174  if (!(flags & QStyle::State_Enabled))
175  stateId = RBS_UNCHECKEDDISABLED;
176  else if (flags & QStyle::State_Sunken)
177  stateId = RBS_UNCHECKEDPRESSED;
178  else if (flags & QStyle::State_MouseOver)
179  stateId = RBS_UNCHECKEDHOT;
180  else
181  stateId = RBS_UNCHECKEDNORMAL;
182 
183  if (flags & QStyle::State_On)
184  stateId += RBS_CHECKEDNORMAL-1;
185 
186  } else if (partId == BP_PUSHBUTTON) {
187  if (!(flags & QStyle::State_Enabled))
188  stateId = PBS_DISABLED;
189  else if (flags & (QStyle::State_Sunken | QStyle::State_On))
190  stateId = PBS_PRESSED;
191  else if (flags & QStyle::State_MouseOver)
192  stateId = PBS_HOT;
193  else
194  stateId = PBS_NORMAL;
195  } else {
196  Q_ASSERT(1);
197  }
198  return stateId;
199 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ buttonVisible()

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

Definition at line 2105 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::subControlRect().

2105  {
2106 
2107  bool isMinimized = tb->titleBarState & Qt::WindowMinimized;
2108  bool isMaximized = tb->titleBarState & Qt::WindowMaximized;
2109  const uint flags = tb->titleBarFlags;
2110  bool retVal = false;
2111  switch (sc) {
2113  if (flags & Qt::WindowContextHelpButtonHint)
2114  retVal = true;
2115  break;
2117  if (!isMinimized && (flags & Qt::WindowMinimizeButtonHint))
2118  retVal = true;
2119  break;
2121  if (isMinimized && (flags & Qt::WindowMinimizeButtonHint))
2122  retVal = true;
2123  else if (isMaximized && (flags & Qt::WindowMaximizeButtonHint))
2124  retVal = true;
2125  break;
2127  if (!isMaximized && (flags & Qt::WindowMaximizeButtonHint))
2128  retVal = true;
2129  break;
2131  if (!isMinimized && flags & Qt::WindowShadeButtonHint)
2132  retVal = true;
2133  break;
2135  if (isMinimized && flags & Qt::WindowShadeButtonHint)
2136  retVal = true;
2137  break;
2139  if (flags & Qt::WindowSystemMenuHint)
2140  retVal = true;
2141  break;
2143  if (flags & Qt::WindowSystemMenuHint)
2144  retVal = true;
2145  break;
2146  default :
2147  retVal = true;
2148  }
2149  return retVal;
2150 }
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

Variable Documentation

◆ pCloseThemeData

PtrCloseThemeData pCloseThemeData = 0
static

Definition at line 114 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pDrawThemeBackground

PtrDrawThemeBackground pDrawThemeBackground = 0
static

Definition at line 115 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pDrawThemeBackgroundEx

PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx = 0
static

Definition at line 116 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetCurrentThemeName

PtrGetCurrentThemeName pGetCurrentThemeName = 0
static

Definition at line 117 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeBool

PtrGetThemeBool pGetThemeBool = 0
static

Definition at line 118 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeColor

PtrGetThemeColor pGetThemeColor = 0
static

◆ pGetThemeEnumValue

PtrGetThemeEnumValue pGetThemeEnumValue = 0
static

◆ pGetThemeFilename

PtrGetThemeFilename pGetThemeFilename = 0
static

Definition at line 121 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeFont

PtrGetThemeFont pGetThemeFont = 0
static

Definition at line 122 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeInt

PtrGetThemeInt pGetThemeInt = 0
static

◆ pGetThemeIntList

PtrGetThemeIntList pGetThemeIntList = 0
static

Definition at line 124 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeMargins

PtrGetThemeMargins pGetThemeMargins = 0
static

◆ pGetThemeMetric

PtrGetThemeMetric pGetThemeMetric = 0
static

Definition at line 126 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemePartSize

PtrGetThemePartSize pGetThemePartSize = 0
static

◆ pGetThemePosition

PtrGetThemePosition pGetThemePosition = 0
static

Definition at line 128 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemePropertyOrigin

PtrGetThemePropertyOrigin pGetThemePropertyOrigin = 0
static

◆ pGetThemeRect

PtrGetThemeRect pGetThemeRect = 0
static

Definition at line 129 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeString

PtrGetThemeString pGetThemeString = 0
static

Definition at line 130 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pGetThemeTransitionDuration

PtrGetThemeTransitionDuration pGetThemeTransitionDuration = 0
static

◆ pIsThemePartDefined

PtrIsThemePartDefined pIsThemePartDefined = 0
static

Definition at line 112 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStylePrivate::resolveSymbols().

◆ pOpenThemeData

PtrOpenThemeData pOpenThemeData = 0
static

◆ pSetWindowTheme

PtrSetWindowTheme pSetWindowTheme = 0
static

◆ windowsArrowHMargin

const int windowsArrowHMargin = 6
static

Definition at line 54 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ windowsItemFrame

const int windowsItemFrame = 2
static

Definition at line 51 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ windowsItemHMargin

const int windowsItemHMargin = 3
static

◆ windowsItemVMargin

const int windowsItemVMargin = 4
static

Definition at line 53 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().

◆ windowsRightBorder

const int windowsRightBorder = 15
static

Definition at line 55 of file qwindowsvistastyle.cpp.

Referenced by QWindowsVistaStyle::drawControl().