48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "Cevo/CevoButtonBase.h"
|
|
#include "Cevo/CevoGraphicSet.h"
|
|
|
|
namespace Cevo {
|
|
|
|
// TButtonG equivalent: a button whose background and glyph are looked up by
|
|
// index or name in a GraphicSet (used for the city/government icon
|
|
// buttons), instead of fixed sprite-sheet coordinates.
|
|
class ButtonG : public ButtonBase {
|
|
Q_OBJECT
|
|
public:
|
|
explicit ButtonG(QWidget *parent = nullptr);
|
|
|
|
GraphicSet *graphicSet() const { return m_graphicSet; }
|
|
void setGraphicSet(GraphicSet *value) { m_graphicSet = value; }
|
|
|
|
int backgroundUpIndex() const { return m_backgroundUpIndex; }
|
|
void setBackgroundUpIndex(int value);
|
|
QString backgroundUpName() const { return m_backgroundUpName; }
|
|
void setBackgroundUpName(const QString &value);
|
|
int backgroundDownIndex() const { return m_backgroundDownIndex; }
|
|
void setBackgroundDownIndex(int value);
|
|
QString backgroundDownName() const { return m_backgroundDownName; }
|
|
void setBackgroundDownName(const QString &value);
|
|
int glyphIndex() const { return m_glyphIndex; }
|
|
void setGlyphIndex(int value);
|
|
QString glyphName() const { return m_glyphName; }
|
|
void setGlyphName(const QString &value);
|
|
|
|
protected:
|
|
void paint(Dpi::Canvas &canvas) override;
|
|
|
|
private:
|
|
GraphicSetItem *resolveItem(int index, const QString &name) const;
|
|
|
|
GraphicSet *m_graphicSet = nullptr;
|
|
int m_backgroundUpIndex = -1;
|
|
QString m_backgroundUpName;
|
|
int m_backgroundDownIndex = -1;
|
|
QString m_backgroundDownName;
|
|
int m_glyphIndex = -1;
|
|
QString m_glyphName;
|
|
};
|
|
|
|
} // namespace Cevo
|