/***************************************************************************
 * trackclassicaldurationview.h: implementation of TrackDurationView class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2007 the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#ifndef TRACKCLASSICALDURATIONVIEW_H
#define TRACKCLASSICALDURATIONVIEW_H

#include <list>

#include <QGraphicsItem>

#include "drawingitem.h"
#include "tablature/tabduration.h"

class Cm;
class QPointCm;
class TabTime;

class TrackClassicalDurationView : public DrawingItem
{
public:
	TrackClassicalDurationView(const TabTime* tabTime, uint dpi);
	virtual ~TrackClassicalDurationView();
	
	virtual void setNextDuration(Duration nextDuration);
	virtual Duration nextDuration() const;
	
	virtual void setBarHeight(const Cm& i);
	virtual Cm barHeight() const;
	
	virtual void setTimeSpace(const Cm& i);
	virtual Cm timeSpace() const;
	
	virtual void hide();
	virtual void show();
	
	virtual QRectCm boundingRect() const;
	virtual Cm height() const;
	virtual Cm width() const;
private:
	typedef std::list<QGraphicsItem*>::iterator iterator;
	typedef std::list<QGraphicsItem*>::const_iterator const_iterator;
	
	static const Cm queueSpace;
	
	void drawVerticalLine();
	void drawFirstDuration();
	void drawLastDuration();
	
	const TabTime* mTabTime;
	
	Cm barHeightDur;
	Cm timeSpaceDur;
	
	std::list<QGraphicsItem*> itemCollection;
	Duration mNextDuration;
};

#endif
