#ifndef CUSTOMTAB_H
#define CUSTOMTAB_H

#include <QFrame>

class QLabel;
class QBoxLayout;
class Dashboard;
class CustomTab : public QFrame
{
    Q_OBJECT

public:
    CustomTab(QWidget *parent = nullptr);
    virtual ~CustomTab();

    void setActive(bool);

    void setText(const QString&);
    QString text();

    void setIcon(const QIcon&);

    void setDashboard(Dashboard*);
    Dashboard* dashboard();

signals:
    void clicked();

protected:
    void mousePressEvent(QMouseEvent*);
    void mouseMoveEvent(QMouseEvent*);
    void mouseReleaseEvent(QMouseEvent*);

private:
    QIcon    m_Icon;
    QSize    m_IconSize;
    QLabel*  m_pIconLabel;
    QLabel*  m_pTitle;
    QBoxLayout*  m_pLayout;

    Dashboard* m_pDashboard; //所属于的dashboard

    QPoint    m_pStartPos;
    bool      m_bLeftButtonPressed;
    bool      m_bDragging;
};

#endif
