#ifndef SHSGRAPHICPLUGIN_H
#define SHSGRAPHICPLUGIN_H

#include <QObject>
#if QT_VERSION >= 0x050000
#  include <QtUiPlugin/QDesignerCustomWidgetInterface>
#else
#  include <QDesignerCustomWidgetInterface>
#endif
#include <QDesignerTaskMenuExtension>
#include <QDesignerPropertyEditorInterface>
#include <QExtensionFactory>
#include <QTreeWidget>
#include <QDialog>
#include "shs_graphic.h"


namespace Ui {
	class SHSGraphicMenuExtension;
}

class SHSGraphicMenuExtension: public QDialog, public QDesignerTaskMenuExtension
{
	Q_OBJECT
	Q_INTERFACES(QDesignerTaskMenuExtension)
public:
	SHSGraphicMenuExtension(SHSGraphic * widget, QObject * parent);
	~SHSGraphicMenuExtension();

	QAction * preferredEditAction() const;
	QList<QAction * > taskActions() const;

private slots:
	void on_treeVars_itemClicked(QTreeWidgetItem * item, int column);
	void on_treeVars_itemChanged(QTreeWidgetItem * item, int column);
	void action_default_triggered();
	void select_ok();

private:
	Ui::SHSGraphicMenuExtension * ui;
	SHSGraphic * widget;
	QAction * action_default;
	QIcon icon_command;
};


class SHSGraphicTaskMenuFactory: public QExtensionFactory
{
	Q_OBJECT
public:
	SHSGraphicTaskMenuFactory(QExtensionManager * parent = 0): QExtensionFactory(parent) {;}
protected:
	QObject * createExtension(QObject * object, const QString & iid, QObject * parent) const;
};


class SHSGraphicPlugin: public QObject, public QDesignerCustomWidgetInterface
{
	Q_OBJECT
	Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
	SHSGraphicPlugin(QObject * parent = 0);

	bool isContainer() const;
	bool isInitialized() const;
	QIcon icon() const;
	QString domXml() const;
	QString group() const;
	QString includeFile() const;
	QString name() const;
	QString toolTip() const;
	QString whatsThis() const;
	QWidget * createWidget(QWidget * parent);
	void initialize(QDesignerFormEditorInterface * core);

private:
	bool m_initialized, m_designer;
};

#endif // SHSGRAPHICPLUGIN_H
