17 #include <QStringList>
40 virtual QRect
paint(QPainter &painter,
const QPointF &position,
41 const city *pcity)
const = 0;
74 QRect
paint(QPainter &painter,
const QPointF &position,
75 const city *pcity)
const override;
77 bool has_flag()
const override {
return false; }
79 bool has_size()
const override {
return false; }
87 QRect
paint(QPainter &painter,
const QPointF &position,
88 const city *pcity)
const override;
96 QRect
paint(QPainter &painter,
const QPointF &position,
97 const city *pcity)
const override;
Abstraction for city bars of various styles.
virtual bool has_size() const
Returns whether the city size is shown in the bar.
static void option_changed(option *opt)
Called by the option code when the option has changed.
static const QVector< QString > * available_vector(const option *)
Returns the list of all available city bar styles.
static void set_current(const QString &name)
Sets the current city bar style.
static QStringList available()
Returns the list of all available city bar styles.
virtual QRect paint(QPainter &painter, const QPointF &position, const city *pcity) const =0
Draws a city bar under the given position.
static std::unique_ptr< citybar_painter > s_current
Pointer to the city bar painter currently in use.
static citybar_painter * current()
Returns the current painter (never null).
virtual bool has_flag() const
Returns whether the flag is shown in the bar.
virtual ~citybar_painter()=default
virtual bool has_units() const
Returns whether the units inside are shown in the bar.
A polished city bar, more like certain commercial game.
QRect paint(QPainter &painter, const QPointF &position, const city *pcity) const override
Draws the "polished" city bar.
A simple city bar that draws simple text on the map.
bool has_units() const override
Returns whether the units inside are shown in the bar.
bool has_flag() const override
Returns whether the flag is shown in the bar.
bool has_size() const override
Returns whether the city size is shown in the bar.
QRect paint(QPainter &painter, const QPointF &position, const city *pcity) const override
Draws a simple city bar.
The traditional box-based city bar.
QRect paint(QPainter &painter, const QPointF &position, const city *pcity) const override
Draws the traditional city bar with a dark background, two lines of text and colored borders.
The base class for options.