#ifndef PQHEADERVIEW_H
#define PQHEADERVIEW_H

#include "pqwidget.h"
#include <QHeaderView>

class PQHeaderView : public QHeaderView {
    Q_OBJECT
    PQ_WIDGET_EX(QHeaderView)

    Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown)
    Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections)
    Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection)
    Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes WRITE setCascadingSectionResizes)
    Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize RESET resetDefaultSectionSize)
    Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize)
    Q_PROPERTY(int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize)
    Q_PROPERTY(int defaultAlignment READ defaultAlignment WRITE setDefaultAlignment)

    // QAbstractItemView
    Q_PROPERTY(bool autoScroll READ hasAutoScroll WRITE setAutoScroll)
    Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin)
    Q_PROPERTY(bool tabKeyNavigation READ tabKeyNavigation WRITE setTabKeyNavigation)
    Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors)
    Q_PROPERTY(int textElideMode READ textElideMode WRITE setTextElideMode)
    Q_PROPERTY(int verticalScrollMode READ verticalScrollMode WRITE setVerticalScrollMode)
    Q_PROPERTY(int horizontalScrollMode READ horizontalScrollMode WRITE setHorizontalScrollMode)

public:
    Q_INVOKABLE explicit PQHeaderView(int orientation, QWidget *parent = 0);
    ~PQHeaderView();

    Q_INVOKABLE bool isSortIndicatorShown() const;
    Q_INVOKABLE bool highlightSections() const;
    Q_INVOKABLE bool stretchLastSection() const;
    Q_INVOKABLE bool cascadingSectionResizes() const;
    Q_INVOKABLE int defaultSectionSize() const;
    Q_INVOKABLE int minimumSectionSize() const;
    Q_INVOKABLE int maximumSectionSize() const;
    Q_INVOKABLE int defaultAlignment() const;
    Q_INVOKABLE bool hasAutoScroll() const;
    Q_INVOKABLE int autoScrollMargin() const;
    Q_INVOKABLE bool tabKeyNavigation() const;
    Q_INVOKABLE bool alternatingRowColors() const;
    Q_INVOKABLE int textElideMode() const;
    Q_INVOKABLE int verticalScrollMode() const;
    Q_INVOKABLE int horizontalScrollMode() const;
    Q_INVOKABLE QSize iconSize() const;

    Q_INVOKABLE void setSectionHidden(int logicalIndex, bool hide);
    Q_INVOKABLE void setSectionResizeMode(int mode);
    Q_INVOKABLE void setSectionResizeMode(int logicalIndex, int mode);
    Q_INVOKABLE void setSectionsClickable(bool clickable);
    Q_INVOKABLE void setSectionsMovable(bool movable);
    Q_INVOKABLE void setSortIndicator(int logicalIndex, int order);
    Q_INVOKABLE void showSection(int logicalIndex);
    Q_INVOKABLE void hideSection(int logicalIndex);

public slots:
    Q_INVOKABLE void setSortIndicatorShown(bool showSortIndicator);
    Q_INVOKABLE void setHighlightSections(bool highlightSections);
    Q_INVOKABLE void setStretchLastSection(bool stretchLastSection);
    Q_INVOKABLE void setCascadingSectionResizes(bool cascadingSectionResizes);
    Q_INVOKABLE void setDefaultSectionSize(int defaultSectionSize);
    Q_INVOKABLE void setMinimumSectionSize(int minimumSectionSize);
    Q_INVOKABLE void setMaximumSectionSize(int maximumSectionSize);
    Q_INVOKABLE void setDefaultAlignment(int defaultAlignment);
    Q_INVOKABLE void setAutoScroll(bool autoScroll);
    Q_INVOKABLE void setAutoScrollMargin(int autoScrollMargin);
    Q_INVOKABLE void setTabKeyNavigation(bool tabKeyNavigation);
    Q_INVOKABLE void setAlternatingRowColors(bool alternatingRowColors);
    Q_INVOKABLE void setTextElideMode(int textElideMode);
    Q_INVOKABLE void setVerticalScrollMode(int verticalScrollMode);
    Q_INVOKABLE void setHorizontalScrollMode(int horizontalScrollMode);
    Q_INVOKABLE void setIconSize(int width, int height);

    PQ_ON_SIGNAL_DECL_START {
    } PQ_ON_SIGNAL_DECL_END
};

Q_DECLARE_METATYPE(QHeaderView*)
Q_DECLARE_METATYPE(PQHeaderView*)

#endif // PQHEADERVIEW_H
