/***************************************************************************
 * tracklist.h: implementation of TrackList class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2007 the KTabEdit 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 TRACKLIST_H
#define TRACKLIST_H

#include <QWidget>
#include "tablatureModel/tabsongobserver.h"

#include <QVector>

class InstrumentsList;
class TabSongModel;
class TabTrack;

class QContextMenuEvent;
class QTreeWidget;
class QTreeWidgetItem;

/**
\brief This class displays a widget with all tracks of the song
**/
class TrackList : public QWidget, public TabSongObserver
{
	Q_OBJECT
public:
	TrackList(const TabSongModel* song);
	virtual ~TrackList();
	
	virtual void songUpdated();
	virtual void trackAdded(TabTrack*);
	virtual void trackDeleted(TabTrack*);
	virtual void trackUpdated();
	
public slots:
	virtual void setTabTrack(TabTrack* track);
	virtual void clearView();
	virtual void updateTrackList();
	virtual void selectFirstTrack();
	virtual void redispatchDeleteTrack();
	
	signals:
	void trackChanged(TabTrack*);
	void addTrack();
	//TODO: not implemented?!?!
	void deleteTrack(TabTrack*);
	void trackProperties();
	
protected:
	void contextMenuEvent(QContextMenuEvent *event);

private slots:
	virtual void selectedTabTrack();

private:
	QTreeWidget* mTreeWidget;
	const TabSongModel* mSong;
	TabTrack* mCurrentTrack;
	InstrumentsList* mInstruments;
	QList<QTreeWidgetItem*> mTreeList;
};

#endif
