#ifndef TIMELINEWIDGET_H
#define TIMELINEWIDGET_H

#include "global.h"
#include <QGraphicsView>

class TimeLineWidgetPrivate;

class TimeLineWidget : public QGraphicsView
{
    Q_OBJECT

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

    void setBackground(QColor);
    void setTimelineColor(QColor);
    void setTimeScaleSize(int); //设置时间刻度大小(像素)
    void setTimeScaleUnit(TimeUnit); //设置时间刻度单位

    void setDateTime(const QDateTime&);
    void setDisplayState(DateTimeWidgetState);

    void syncTimeUnit();

signals:
    void viewHistoricalData(QDateTime);
    void timeScaleUnitChanged(TimeUnit);

protected:
    virtual void resizeEvent(QResizeEvent*) override;
    virtual void mousePressEvent(QMouseEvent*) override;
    virtual void mouseMoveEvent(QMouseEvent*) override;
    virtual void mouseReleaseEvent(QMouseEvent*) override;
    virtual void wheelEvent(QWheelEvent*) override;

private:
    void updateAll();

    TimeLineWidgetPrivate* d_ptr;
}; // class TimeLineWidget


#endif
