#ifndef PQTABWIDGET
#define PQTABWIDGET

#include "classes/pqwidget.h"
#include <QTabWidget>

class PQTabWidget;
class PQTabWidget : public QTabWidget {
    Q_OBJECT
    PQ_WIDGET_EX(QTabWidget)

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

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

    Q_INVOKABLE void addTab(QWidget *w, QString title);
    Q_INVOKABLE void addTab(QWidget *w, QString title, QString iconPath);
    Q_INVOKABLE QWidget *widget(int index);
    Q_INVOKABLE void setCurrentIndex(int index);
    Q_INVOKABLE int currentIndex();
    Q_INVOKABLE void setMovable(bool movable);
    Q_INVOKABLE bool isMovable();
    Q_INVOKABLE bool tabsClosable();
    Q_INVOKABLE void setTabsClosable(bool b);
    Q_INVOKABLE int count();
    Q_INVOKABLE void setTabIcon(int index, const QString &path);
    Q_INVOKABLE void setIconSize(int w, int h);
    Q_INVOKABLE QSize iconSize();
    Q_INVOKABLE void setTabText(int index, const QString &text);
    Q_INVOKABLE QString tabText(int index);
    Q_INVOKABLE void setTabEnabled(int index, bool enabled);
    Q_INVOKABLE bool isTabEnabled(int index);
    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);
    Q_INVOKABLE void removeTab(int index);

public Q_SLOTS:
    void currentChanged_pslot(int index);
    void tabBarClicked_pslot(int index);
    void tabBarDoubleClicked_pslot(int index);
    void tabCloseRequested_pslot(int index);

    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));
        PQWIDGET_ON_SIGNALS();
    } PQ_ON_SIGNAL_DECL_END

};

#endif // PQTABWIDGET

