#ifndef CDDIRECTK_H
#define CDDIRECTK_H

#include "cdgraphics.h"
#include "ui_cddirectk.h"
#include "cddirectk_type_dialog.h"

class QFormLayout;


class KDockWidget: public QDockWidget {
	Q_OBJECT
public:
	KDockWidget(QString title = QString(), QMainWindow * p = 0);

	void addK(const CDUtils::CDType & t, CDDirectKTypeDialog::TypeInfo ti);
	QByteArray save() const;
	void load(QByteArray ba);
	void clear();
	void changedGlobal();

	QFormLayout * lay;

private:
	bool eventFilter(QObject * o, QEvent * e);
	void contextMenuEvent(QContextMenuEvent * e);
	void removeRow(int r);

	QMenu * menu, * menu_k;
	QList<QAction*> dactions;
	QMainWindow * da;
	CDDirectKTypeDialog * type_dialog;
	PIVector<PIDeque<int> > k_list;
	QVector<CDDirectKTypeDialog::TypeInfo> info_list;

private slots:
	void rename();
	void removeK();

signals:
	void removeRequest();

};




class CDDirectK: public QWidget, public Ui::CDDirectK
{
	Q_OBJECT
public:
	explicit CDDirectK(QWidget *parent = 0);
	~CDDirectK();

	void reset();
	QByteArray save() const;
	void load(QByteArray ba);

private:
	void addArea();

	QList<KDockWidget * > docks;
	QMainWindow * da;

public slots:
	void changedGlobal();

private slots:
	void removeArea();
	void on_buttonAdd_clicked();
	void on_buttonRemoveAll_clicked();

signals:

};

#endif // CDDIRECTK_H
