#ifndef EWINDOW_H
#define EWINDOW_H

#include <QListWidget>
#include "eobject.h"

class eWindow : public eObject
{
    Q_OBJECT
public:
    struct Data {
        QList<eObject *> eList;
        eObject          *eCur;
        int              index;
        eWindow          *self;
    };

public:
    explicit eWindow(QRectF rectInit,InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
    explicit eWindow(const QJsonObject &json, const QString pRoot, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
    virtual ~eWindow() override;

//public:
//    static void setElement(const QJsonObject &json, Data &attr);

public:
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;

public:
    virtual int type() const override { return eObject::Window; }
    virtual QWidget* wAttr() override;
    virtual QWidget* wAttrElement() override;
    virtual QJsonObject save(const QString &pRoot) override;
    virtual QStringList filesList() const override;
    virtual QJsonObject elementJson() const override;

protected:
    void restoreElement(const QJsonObject &json, const QString &pRoot);

signals:

public slots:
    virtual void playElectment() override;
    virtual void stopElectment() override;

private:
    Data m_attr;
};

#endif // EWINDOW_H
