29 lines
1.3 KiB
C
29 lines
1.3 KiB
C
#pragma once
|
|
|
|
#include <QColor>
|
|
#include <QFont>
|
|
#include <QPixmap>
|
|
#include <QSize>
|
|
#include <QString>
|
|
|
|
// Renders `text` followed by `icon` to its right, vertically centered, onto a
|
|
// transparent pixmap sized to fit both (REQ-UI-BLOCKS-ICON, REQ-UI-BUILD-COST,
|
|
// REQ-UI-EXPAND-BUTTON). Used where a caption must show an inline item icon in
|
|
// place of a trailing word — something QPushButton/QLabel cannot do natively.
|
|
//
|
|
// `textColor` and `font` come from the target widget so the caption stays
|
|
// theme-correct; the result is devicePixelRatio-aware so text and icon stay crisp.
|
|
QPixmap renderCaptionWithIcon(const QString& text, const QPixmap& icon,
|
|
const QFont& font, const QColor& textColor);
|
|
|
|
// A pixmap's size in device-independent pixels. The pixmaps composed by
|
|
// renderCaptionWithIcon and its callers are rasterized at the device pixel ratio, so
|
|
// their raw size is not the size to lay them out at.
|
|
QSize getLogicalSize(const QPixmap& pixmap);
|
|
|
|
// Item id of the building blocks resource, whose icon stands in for the "Blocks"
|
|
// word wherever a cost or stock is captioned (REQ-UI-BLOCKS-ICON, REQ-UI-BUILD-COST,
|
|
// REQ-UI-EXPAND-BUTTON). It lives next to the caption helper because every caller of
|
|
// one is a caller of the other.
|
|
const char* const kBlockItemId = "building_block";
|