#ifndef ORDERWIDGET_H
#define ORDERWIDGET_H

#include <QWidget>
#include <QtGui>

/**
  Widget to merge the dimensions of topologies with 4-6 dimensions:
  merge 2 dimensions into one
  */
class OrderWidget : public QFrame
{
    Q_OBJECT
public:
    explicit OrderWidget(int places[], const QStringList &dimnames);
    void paintEvent(QPaintEvent*);
    virtual QSize minimumSizeHint() const;
    std::vector<std::vector<int> > getValues() const;

signals:
    void foldingDimensionsChanged();

protected:
    void mousePressEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);

private:
    void drawElement(QPainter &painter, int x, int elemnr);
    int dims;  // number of dims
    int slot;  // slots per dim
    int width; // width of each element
    int labelHeight; // height of the legend
    int movedNr; // element nr to move
    int currentX; // current position of mouse while dragging
    int place[6];
    QStringList dimnames;
};

#endif // ORDERWIDGET_H
