#ifndef CUSTOMTABBAR_H
#define CUSTOMTABBAR_H

#include <QScrollArea>

class DashboardFrame;
class QBoxLayout;
class CustomTab;
class CustomTabBar : public QScrollArea
{
    Q_OBJECT

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

    void setFrame(DashboardFrame*);
    DashboardFrame* frame();
    void insertTab(int, CustomTab*);
    void addTab(CustomTab*);
    void removeTab(CustomTab*);
    CustomTab* tab(int);

protected:
    void dragEnterEvent(QDragEnterEvent* event) override;
    void dragMoveEvent(QDragMoveEvent* event) override;
    void dragLeaveEvent(QDragLeaveEvent* event) override;
    void dropEvent(QDropEvent* event) override;

private:
    int count();

public slots:
    void onTabClicked();

signals:
    void tabMoved(int, int);

private:
    DashboardFrame* m_pFrame;
    QWidget*        m_pTabsContainerWidget;
    QBoxLayout*     m_pTabsLayout;
    int             m_nCurrentIndex;
    QWidget*        m_pPosMarking;
};

#endif
