/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012 - 2013                                                                        *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
    Description:
    Description du fichier si nécessaire.

*/

/* ************************************************************************** */
/* Revision:
### 20131030 JFM
    Verision d'origine.

### 20131107 Description du besoin ou du bug
    Description du changement.
 */

/* ************************************************************************** */

#ifndef RANKRULERWIDGET_H
#define RANKRULERWIDGET_H

#include "GlobalDefine.h"
#include <QGraphicsWidget>

class CRankWidgetItem
{
public:
    QString mLabel;
    quint64 mStartTime;
    quint64 mEndTime;
};

class CRankRulerWidget : public QGraphicsWidget
{
    Q_OBJECT
public:
    CRankRulerWidget(qreal RulerPixelWidth,QGraphicsItem *Parent = 0);
	~CRankRulerWidget();


    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    unsigned int SetRange(quint64 StartTime, quint64 EndTime);
    unsigned int AddRankItem(QString Rank,quint64 StartTime,quint64 EndTime);
    void SetLabel(QString Label,int Offset);
	void ClearRuler();
    void resizeEvent(QGraphicsSceneResizeEvent *event);


private:
    qreal mPixelWidth;
    quint64 mStartTime, mEndTime, mTimeOffset;
    qreal mPixelPitch;
    QGraphicsTextItem *mLabel;

    QPixmap *mRulerPixmap;

    QList<CRankWidgetItem> mRankItems;


    void Render();

};

#endif // RANKRULERWIDGET_H
