#ifndef CUSTOMWIDGET_H
#define CUSTOMWIDGET_H

#include <QWidget>
#include <QElapsedTimer>

struct WidgetData;

class MyCustomWidget : public QWidget
{
    Q_OBJECT
public:
    explicit MyCustomWidget(QWidget *parent = 0);
    void replot(WidgetData &data);
    void setHoehe(double value);
    void setLaenge(double value);
    void setAnzahl(int value);
    void resetMax();

protected:
    // reimplemented methods:
    virtual void timerEvent(QTimerEvent *event);
    virtual void paintEvent(QPaintEvent *event);
    virtual void resizeEvent(QResizeEvent *event);
//    virtual void mouseDoubleClickEvent(QMouseEvent *event);
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);
//    virtual void mouseMoveEvent(QMouseEvent *event);
//    virtual void wheelEvent(QWheelEvent *event);
    void draw();
    void drawStatic();
    void calc();
    void calcInit();
    void drawStaticData();
    void createRects();
    double arcusTangens(double x, double y);

private:
    QPixmap m_buffer;
    QColor m_backgroundColor;
    QPoint m_mousePoint;
    QRectF m_baseRect;
    double m_hoehe;
    double m_laenge;
    int m_anzahl;
    double m_time;
    double x;
    double y;
    int m_timerId;
    QRect m_rect;
    QVector<QRectF> m_rects;
    QElapsedTimer m_measureTimer;
    int m_maxTime;
    int m_numOld;
    bool m_isActiveDraw;
    double m_scaleFactorX;
    double m_scaleFactorY;
    std::vector<QPointF> m_pointData;
    int m_countPoins;

signals:

public slots:
    void updateVisu();

};

#endif // CUSTOMWIDGET_H
