#ifndef PQHBOXLAYOUT
#define PQHBOXLAYOUT

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

class PQHBoxLayout;
class PQHBoxLayout : public QHBoxLayout {
    Q_OBJECT
    PQ_OBJECT_EX(QHBoxLayout)

    Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
    Q_PROPERTY( int margin READ margin WRITE setMargin )

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

    Q_INVOKABLE int addSpacer(int w, int h, int hData = 1, int vData = 1);
    Q_INVOKABLE bool removeSpacer(int index);
    Q_INVOKABLE void setSpacing(int spacing);
    Q_INVOKABLE int spacing();
    Q_INVOKABLE void setContentsMargins(int left, int top, int right, int bottom);
    Q_INVOKABLE int margin();
    Q_INVOKABLE int count();

    Q_INVOKABLE bool setAlignment(QWidget *w, int alignment);
    Q_INVOKABLE bool setAlignment(QLayout *l, int alignment);

public Q_SLOTS:
    Q_INVOKABLE void addWidget(QWidget *qw);
    Q_INVOKABLE void addLayout(QLayout *layout);
    Q_INVOKABLE void setMargin(int margin);

private:
    QHash<int, QSpacerItem *> spacers;
};

Q_DECLARE_METATYPE(PQHBoxLayout*)

#endif // PQHBOXLAYOUT

