/*
	QAD - Qt ADvanced

	Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef EDOCKWIDGET_H
#define EDOCKWIDGET_H

#include <QDockWidget>
#include <QLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QIcon>
#include <QToolButton>
#include <QDebug>
#include "qad_application_export.h"


class QAD_APPLICATION_EXPORT EDockWidget: public QDockWidget
{
	Q_OBJECT
public:
	explicit EDockWidget(const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()): QDockWidget(title, parent, flags) {init();}
	explicit EDockWidget(QWidget * parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()): 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);
	void setWindowIcon(const QIcon & icon);
	
private:
	bool event(QEvent * e);
	void init();
	void updateStyle();
	
	QFrame * header;
	QLabel * lbl_title, * lbl_icon;
	QToolButton * btn_hide, * btn_dock;
	
private slots:
	void dockClicked() {setFloating(!isFloating());}
	
};

#endif // EDOCKWIDGET_H
