#include "Cevo/CevoEOTButton.h" #include "Cevo/CevoScreenTools.h" namespace Cevo { EOTButton::EOTButton(QWidget *parent) : ButtonBase(parent), m_buffer(48, 48), m_back(48, 48) { resize(48, 48); } void EOTButton::paint(Dpi::Canvas &canvas) { if (m_graphic && m_template) { unshareBitmap(m_buffer); bitBltBitmap(m_buffer, 0, 0, 48, 48, m_back, 0, 0); imageOpCBC(m_buffer, *m_template, 0, 0, 133, 149 + 48 * (down() ? 1 : 0), 48, 48, 0x000000, 0xFFFFFF); if (m_index >= 0) { imageOpCBC(m_buffer, *m_template, 8, 8, 1 + 32 * m_index, 246, 32, 32, 0x000000, 0xFFFFFF); } canvas.draw(0, 0, m_buffer.image()); } else { canvas.brush().setColor(colorFromDelphi(0x0000FF)); canvas.frameRect(QRect(0, 0, 48, 48)); } } void EOTButton::setButtonIndex(int value) { if (value != m_index) { m_index = value; update(); } } void EOTButton::setButtonIndexFast(int value) { if (isVisible() && value != m_index) { m_index = value; repaint(); } } void EOTButton::setBack(Dpi::Canvas &canvas, int x, int y) { m_back.canvas().copyRect(QRect(0, 0, 48, 48), canvas, QRect(x, y, 48, 48)); } } // namespace Cevo