#ifndef MATH_PLOT
#define MATH_PLOT

#include <QtGui>
#include "MathPlotPanel.h"

class MathPlot : public QWidget{
	Q_OBJECT
	private:
		QGridLayout * topLayout;
		MathPlotPanel plotPanel;
		QButtonGroup * rmGroup;
		QList<QWidget *> sigControls;
		QList<QPushButton *> rmButtons;
		QList<QCheckBox *> anChecks;
		
	public:
		MathPlot(QWidget * parent=0);
		virtual ~MathPlot();
		
		bool isEmpty();
		
	protected:
		void dragLeaveEvent(QDragLeaveEvent *);
		void dragMoveEvent(QDragMoveEvent *);
		void dragEnterEvent( QDragEnterEvent *);
		void dropEvent(QDropEvent *);


	private:
		void createUI();
		void createControl(int id);
		void updateColors(int from = 0);
		void updateLayout(int emptyPos = 0);
		void updateIds(int from = 0);

	public slots:
		void signalAddedToPanel();
		void removeClicked(int);
		void checkChanged();
};


#endif
