/*[
 * This file is part of the SharedComponents Software.
 * 
 * Copyright 2008 Paradigm B.V. and/or its affiliates and subsidiaries.
 * All rights reserved.
 * 
 * Use of this software is subject to the terms and conditions of the license
 * agreement with Paradigm Geophysical B.V. and/or its affiliates and
 * subsidiaries (collectively "Paradigm").
 * 
 * Warning: This computer program is protected by copyright law and international
 * treaties. Unauthorized reproduction or distribution of this program, or any
 * portion of it, may result in severe civil and criminal penalties, and will be
 * prosecuted to the maximum extent possible under the law.
]*/

#ifndef PDGM_DESIGNER_PLUGINS_H
#define PDGM_DESIGNER_PLUGINS_H

#include <designer/export.h>

#include <QtDesigner/QDesignerCustomWidgetInterface>
#include <QtDesigner/QDesignerTaskMenuExtension>
#include <QtDesigner/QExtensionFactory>
#include <QtDesigner/QDesignerContainerExtension>
#include <QtCore/QList>
#include <QtGui/QAction>

namespace pdgm {
namespace gui {

/*!
    \class ParadigmCustomWidgetCollectionInterface
    \brief ParadigmCustomWidgetCollectionInterface is the collection of custom widget plugins
*/

class PDGM_DESIGNER_EXPORT ParadigmCustomWidgetCollectionInterface :
    public QObject,
    public QDesignerCustomWidgetCollectionInterface
{
    Q_OBJECT
    Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)

public:
    ParadigmCustomWidgetCollectionInterface(QObject* parent = 0);

    virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;

private:
    QList<QDesignerCustomWidgetInterface*> custom_widgets_;
};

/*!
    \class ParadigmCustomWidgetInterface
    \brief ParadigmCustomWidgetInterface is a common base class for Paradigm widget plugin
*/

class PDGM_DESIGNER_EXPORT ParadigmCustomWidgetInterface: public QObject, public QDesignerCustomWidgetInterface
{
    Q_OBJECT
    Q_INTERFACES(QDesignerCustomWidgetInterface)

public:
    struct Data;

    ParadigmCustomWidgetInterface(
        const Data& data,
        QObject* parent = NULL
    );

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

private:
    const Data& data_;
    bool initialized_;
};



class PDGM_DESIGNER_EXPORT RangeTaskMenuExtension: public QObject, public QDesignerTaskMenuExtension
{
    Q_OBJECT
    Q_INTERFACES(QDesignerTaskMenuExtension)

public:
    RangeTaskMenuExtension(QWidget* widget, QObject* parent);

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

private Q_SLOTS:
    void editProperties();
    void applyProperties( const QString& );

private:
    QAction* editAction_ ;
    QWidget* widget_ ;
};


}} // pdgm::gui

#endif

