#ifndef PQTABBAR
#define PQTABBAR

#include "classes/pqwidget.h"
#include "classes/pqmenu.h"
#include <QTabBar>

class PQTabBar;
class PQTabBar : public QTabBar {
    Q_OBJECT
    PQ_WIDGET_EX(QTabBar)

    Q_PROPERTY( int count READ count )
    Q_PROPERTY( int currentIndex READ currentIndex WRITE setCurrentIndex )
    Q_PROPERTY( bool expanding READ expanding WRITE setExpanding )
    Q_PROPERTY( bool movable READ isMovable WRITE setMovable )
    Q_PROPERTY( bool tabsClosable READ tabsClosable WRITE setTabsClosable )

public:
    Q_INVOKABLE explicit PQTabBar(QWidget * parent=0);
    virtual ~PQTabBar();

    Q_INVOKABLE int addTab(const QString &text);
    Q_INVOKABLE int addTab(const QString &icon, const QString &text);
    Q_INVOKABLE int count();
    Q_INVOKABLE int currentIndex();
    Q_INVOKABLE void setExpanding(bool b);
    Q_INVOKABLE bool expanding();
    Q_INVOKABLE void setIconSize(int w, int h);
    Q_INVOKABLE QSize iconSize();
    Q_INVOKABLE int insertTab(int index, const QString &text);
    Q_INVOKABLE int insertTab(int index, const QString &icon, const QString &text);
    Q_INVOKABLE void setMovable(bool movable);
    Q_INVOKABLE bool isMovable();
    Q_INVOKABLE void setTabEnabled(int index, bool enabled);
    Q_INVOKABLE bool isTabEnabled(int index);
    Q_INVOKABLE void moveTab(int from, int to);
    Q_INVOKABLE void removeTab(int index);
    Q_INVOKABLE void setTabButton(int index, int position, QWidget *widget);
    Q_INVOKABLE QWidget *tabButton(int index, int position);
    Q_INVOKABLE void setTabsClosable(bool closable);
    Q_INVOKABLE bool tabsClosable();
    Q_INVOKABLE void setTabIcon(int index, const QString &icon);
    Q_INVOKABLE void setTabText(int index, const QString &text);
    Q_INVOKABLE void setTabTextColor(int index, const QString &rgb);
    Q_INVOKABLE void setTabToolTip(int index, const QString &text);
    Q_INVOKABLE QString tabToolTip(int index);
    Q_INVOKABLE void setTabWhatsThis(int index, const QString &text);
    Q_INVOKABLE QString tabWhatsThis(int index);

public Q_SLOTS:
    Q_INVOKABLE void setCurrentIndex(int index);

    void currentChanged_pslot(int index);
    void tabBarClicked_pslot(int index);
    void tabBarDoubleClicked_pslot(int index);
    void tabCloseRequested_pslot(int index);
    void tabMoved_pslot(int from, int to);

    PQ_ON_SIGNAL_DECL_START {
        PQ_ON_SIGNAL(currentChanged_pslot(int));
        PQ_ON_SIGNAL(tabBarClicked_pslot(int));
        PQ_ON_SIGNAL(tabBarDoubleClicked_pslot(int));
        PQ_ON_SIGNAL(tabCloseRequested_pslot(int));
        PQ_ON_SIGNAL(tabMoved_pslot(int,int));
        PQWIDGET_ON_SIGNALS();
    } PQ_ON_SIGNAL_DECL_END

};

#endif // PQTABBAR

