Files
c-evo-evo/widget/include/Cevo/CevoEOTButton.h
T

42 lines
1.0 KiB
C++

#pragma once
#include "Cevo/CevoButtonBase.h"
namespace Cevo {
enum {
eotBlinkOff = -1,
eotCancel = 0,
eotGray = 1,
eotBlinkOn = 2,
eotBackToNego = 3,
};
// TEOTButton equivalent: the End-Of-Turn button, animated by swapping
// ButtonIndex between the eot* states above.
class EOTButton : public ButtonBase {
Q_OBJECT
public:
explicit EOTButton(QWidget *parent = nullptr);
Dpi::Bitmap *tmpl() const { return m_template; }
void setTemplate(Dpi::Bitmap *value) { m_template = value; }
int buttonIndex() const { return m_index; }
void setButtonIndex(int value);
// Immediately repaints (bypassing the event queue) if the index changed,
// mirroring SetButtonIndexFast's use during time-critical animation.
void setButtonIndexFast(int value);
void setBack(Dpi::Canvas &canvas, int x, int y);
protected:
void paint(Dpi::Canvas &canvas) override;
private:
Dpi::Bitmap *m_template = nullptr;
int m_index = -1;
Dpi::Bitmap m_buffer;
Dpi::Bitmap m_back;
};
} // namespace Cevo