#ifndef STATUSBUTTON_H
#define STATUSBUTTON_H

#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QStylePainter>
#include <QStyleOption>

enum BUTTONSTATUS {
    NORMAL,
    HOVER,
    SELECT,
    CLICKED,
};

enum BUTTONTYPE {
    BOTBUTTON,
    BIOBUTTON,
    POWERBUTTON,
};

class StatusButton : public QPushButton
{
    Q_OBJECT
public:
    explicit StatusButton(QWidget *parent = nullptr, int type = BOTBUTTON);
    /**
     * @brief 设置按钮当前状态
     * @param selected 是否选中
     * @return
     */
    void setClickedStatus(int status);

    void setDrivedId(int drivedId);

    inline int getDrivedId() { return m_drivedId; }
    inline int getButtonTyoe() { return buttonType; }
protected:
    void paintEvent(QPaintEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e);
    void mousePressEvent(QMouseEvent *e);
Q_SIGNALS:
    /**
     * @brief 响应点击事件
     * @return
     */
    void clicked();
    void buttonClicked(int drivedId);

private:
    int curStatus = NORMAL;
    int buttonType;
    int m_drivedId;
};

#endif // STATUSBUTTON_H
