5#ifndef QQUICKWINDOWSXPSTYLE_P_P_H
6#define QQUICKWINDOWSXPSTYLE_P_P_H
21#include <private/qquickwindowsstyle_p_p.h>
23#include <QtCore/qmap.h>
24#include <QtCore/qt_windows.h>
38#if TMT_TEXTSHADOWCOLOR != 3818
39#undef TMT_TEXTSHADOWCOLOR
40#define TMT_TEXTSHADOWCOLOR 3818
49#define MINBS_INACTIVE 5
52#define MAXBS_INACTIVE 5
71 explicit XPThemeData(
const QWindow *w =
nullptr, QPainter *p =
nullptr,
int themeIn = -1,
72 int part = 0,
int state = 0,
const QRect &r = QRect())
87 static QSizeF themeSize(
const QWindow *w =
nullptr, QPainter *p =
nullptr,
int themeIn = -1,
int part = 0,
int state = 0);
88 static QMarginsF themeMargins(
const QRect &rect,
const QWindow *w =
nullptr, QPainter *p =
nullptr,
int themeIn = -1,
153#ifndef QT_NO_DEBUG_STREAM
161 Q_DECLARE_PUBLIC(QWindowsXPStyle)
193 static int fixedPixelMetric(QStyle::PixelMetric pm,
const QStyleOption *option =
nullptr,
const QWidget *widget =
nullptr);
195 static HWND winId(
const QWindow *window);
197 void init(
bool force =
false);
198 void cleanup(
bool force =
false);
205 static bool useXP(
bool update =
false);
226 static inline bool hasTheme(
int theme) {
return theme >= 0 && theme < NThemes && m_themes[theme]; }
238 static bool initVistaTreeViewTheming();
239 static void cleanupVistaTreeViewTheming();
241 static QBasicAtomicInt ref;
244 QHash<ThemeMapKey, ThemeMapData> alphaCache;
245 HDC bufferDC =
nullptr;
246 HBITMAP bufferBitmap =
nullptr;
247 HBITMAP nullBitmap =
nullptr;
248 uchar *bufferPixels =
nullptr;
252 static HWND m_vistaTreeViewHelper;
253 static HTHEME m_themes[
NThemes];
261 if (SUCCEEDED(GetThemePartSize(handle(),
nullptr,
partId,
stateId,
nullptr, TS_TRUE, &size)))
262 result = QSize(size.cx, size.cy);
269 QMarginsF result(0, 0, 0 ,0);
272 RECT rect = XPThemeData::toRECT(qRect);
273 if (SUCCEEDED(GetThemeMargins(handle(),
nullptr,
partId,
stateId, propId, &rect, &margins)))
274 result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
281 QMarginsF result(0, 0, 0 ,0);
284 if (SUCCEEDED(GetThemeMargins(handle(),
nullptr,
partId,
stateId, propId,
nullptr, &margins)))
285 result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
290inline QSizeF
XPThemeData::themeSize(
const QWindow *w, QPainter *p,
int themeIn,
int part,
int state)
296inline QMarginsF
XPThemeData::themeMargins(
const QRect &rect,
const QWindow *w, QPainter *p,
int themeIn,
297 int part,
int state,
int propId)
300 return theme.margins(rect, propId);
303inline QMarginsF
XPThemeData::themeMargins(
const QWindow *w, QPainter *p,
int themeIn,
304 int part,
int state,
int propId)
307 return theme.margins(propId);
bool fixAlphaChannel(const QRect &rect)
bool drawBackground(XPThemeData &themeData, qreal correctionFactor=1)
bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal aditionalDevicePixelRatio)
static bool hasTheme(int theme)
bool hasAlphaChannel(const QRect &rect)
void init(bool force=false)
static HWND winId(const QWindow *window)
QRegion region(XPThemeData &themeData)
static QRect scrollBarGripperBounds(QStyle::State flags, XPThemeData *theme)
HBITMAP buffer(int w=0, int h=0)
static QString themeName(int theme)
static bool isItemViewDelegateLineEdit(const QWidget *widget)
bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, qreal aditionalDevicePixelRatio, qreal correctionFactor)
static int fixedPixelMetric(QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr)
bool isTransparent(XPThemeData &themeData)
static bool useXP(bool update=false)
void cleanup(bool force=false)
~QWindowsXPStylePrivate()
bool swapAlphaChannel(const QRect &rect, bool allPixels=false)
QRgb groupBoxTextColorDisabled
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option=nullptr)
static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
static HTHEME createTheme(int theme, HWND hwnd)
The QWindowsXPStyle class provides a Microsoft Windows XP-like look and feel.
QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option) const override
void drawPrimitive(PrimitiveElement pe, const QStyleOption *option, QPainter *p) const override
QRect subElementRect(SubElement r, const QStyleOption *option) const override
QMargins ninePatchMargins(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, const QSize &imageSize) const override
QWindowsXPStyle(QWindowsXPStylePrivate &dd)
int styleHint(StyleHint hint, const QStyleOption *option=nullptr, QStyleHintReturn *returnData=nullptr) const override
~QWindowsXPStyle() override
QSize sizeFromContents(ContentsType ct, const QStyleOption *option, const QSize &contentsSize) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr) const override
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, QPainter *p) const override
void drawControl(ControlElement element, const QStyleOption *option, QPainter *p) const override
int pixelMetric(PixelMetric pm, const QStyleOption *option=nullptr) const override
QPalette standardPalette() const override
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc) const override
QMarginsF margins(const QRect &rect, int propId=TMT_CONTENTMARGINS)
static RECT toRECT(const QRect &qr)
static QSizeF themeSize(const QWindow *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0)
static QMarginsF themeMargins(const QRect &rect, const QWindow *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0, int propId=TMT_CONTENTMARGINS)
QMarginsF margins(int propId=TMT_CONTENTMARGINS)
static QMarginsF themeMargins(const QWindow *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0, int propId=TMT_CONTENTMARGINS)
XPThemeData(const QWindow *w=nullptr, QPainter *p=nullptr, int themeIn=-1, int part=0, int state=0, const QRect &r=QRect())
static const int windowsItemHMargin
static void populateTitleBarButtonTheme(const QStyle *proxy, const QStyleOptionComplex *option, QStyle::SubControl subControl, bool isTitleBarActive, int part, XPThemeData *theme)
static HRGN qt_hrgn_from_qregion(const QRegion ®ion)
static const int windowsArrowHMargin
static HWND createTreeViewHelperWindow()
static QRegion scaleRegion(const QRegion ®ion, qreal factor)
static const int windowsRightBorder
static void qt_add_rect(HRGN &winRegion, QRect r)
static Qt::Orientation progressBarOrientation(const QStyleOption *option=nullptr)
static const int windowsItemFrame
static const int windowsItemVMargin
static const wchar_t * themeNames[QWindowsXPStylePrivate::NThemes]
static bool buttonVisible(const QStyle::SubControl sc, const QStyleOptionTitleBar *tb)
size_t qHash(const ThemeMapKey &key)
static QRectF scaleRect(const QRectF &r, qreal factor)
bool operator==(const ThemeMapKey &k1, const ThemeMapKey &k2)
#define TMT_TEXTSHADOWCOLOR
AlphaChannelType alphaType
ThemeMapKey(const XPThemeData &data)