/***************************************************************************
 * tracksystemview.h: implementation of TrackSystemView class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2006 the KGuitar development team <mrgwen@gmail.com>
 * copyright (C) 2002-2003 the KGuitar 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 TRACKSYSTEMVIEW_H
#define TRACKSYSTEMVIEW_H

#include <QList>

#include "drawingitem.h"

class Cm;
class QPointCm;
class TabBar;
class TabNote;
class TabTime;
class TrackBarView;
class TrackPos;

class TrackSystemView : public DrawingItem
{
public:
	TrackSystemView(uint dpi);
	virtual ~TrackSystemView();
	
	virtual void setSystem(QList<TrackBarView*>& system);
	virtual QList<TrackBarView*> system();
	
	virtual void appendBar(TrackBarView* trackBarView);
	
	virtual void lastSystem(bool b);
	virtual bool isLastSystem() const;
	
	virtual void hide();
	virtual void show();
	virtual void refreshBarAt(uint barNumber, const TabBar* tabBar);
	virtual void refreshTimeAt(uint bar, uint time, const TabTime* tabTime);
	virtual void refreshNoteAt(const TrackPos& position, const TabNote* tabNote);
	
	virtual bool hasBarNumber(uint barNumber) const;
	virtual TrackBarView* barAt(uint barNumber) const;
	
	virtual TrackPos cursorPositionAt(const QPointCm& point);
	virtual bool isPointInSystem(const QPointCm& point) const;
	
	virtual QRectCm boundingRect() const;
	virtual void setHeight(const Cm& cm);
	virtual Cm height() const;
	virtual void setWidth(const Cm& cm);
	virtual Cm width() const;
	
	virtual Cm minimalSystemWidth();
	
	virtual bool areBarsOnSamePositionY() const;
	virtual bool areBarsNotOnSamePositionX() const;
private:
	typedef QList<TrackBarView*>::iterator iterator;
	typedef QList<TrackBarView*>::const_iterator const_iterator;
	
	uint mDpi;
	QList<TrackBarView*> mSystem;
	Cm mSystemHeight;
	Cm mSystemWidth;
	Cm mHeight;
	Cm mWidth;
	bool mLastSystem;
};

#endif
