#ifndef EDOCKWIDGET_H
#define EDOCKWIDGET_H

#include <QDockWidget>
#include <QLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QIcon>
#include <QToolButton>
#include <QDebug>


class EDockWidget: public QDockWidget
{
	Q_OBJECT
public:
	explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0): QDockWidget(title, parent, flags) {init();}
	explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = 0): QDockWidget(parent, flags) {init();}
	~EDockWidget() {delete btn_hide; delete btn_dock; delete lbl_title; delete lbl_icon; delete header;}
	
	void setFeatures(QDockWidget::DockWidgetFeatures features);
	void setWindowTitle(const QString & title) {lbl_title->setText(title); QDockWidget::setWindowTitle(title);}
	void setWindowIcon(const QIcon & icon) {lbl_icon->setPixmap(icon.pixmap(QSize(24, 24))); QDockWidget::setWindowIcon(icon);}
	
private:
	void init();
	
	QFrame * header;
	QLabel * lbl_title, * lbl_icon;
	QToolButton * btn_hide, * btn_dock;
	
private slots:
	void dockClicked() {setFloating(!isFloating());}
	
};

#endif // EDOCKWIDGET_H
