#ifndef TRANSACTION_H
#define TRANSACTION_H
#include <qimage.h>
#include <qevent.h>
#include <qapplication.h>
#include <qpen.h>
#include <qbrush.h>
#include <map>
#include <vector>
#include "GraphicsData.h"
#include <CompuCell3D/plugins/PlayerSettings/PlayerSettings.h>

class Transaction
{
public:
    virtual QImage apply(const QImage &image) = 0;
    virtual void applySimulation(){}
    virtual QString messageStr() = 0;
    virtual ~Transaction(){}

    void setTargetWidget(QWidget *widget){targetWidget=widget;}
    QWidget * getTargetWidget(){return targetWidget;}
private:
   QWidget *targetWidget;
    
};


enum { TransactionStart = 1001, AllTransactionsDone = 1002 , TransactionRefresh = 1003, TransactionFinish=1004 };

class Projection2DData;

class TransactionStartEvent : public QCustomEvent
{
public:
    TransactionStartEvent();

    int xSize, ySize, zSize;
    PlayerSettings playerSettings;
    //std::map<unsigned short,QPen> *typePenMapPtr;
    //std::map<unsigned short,QBrush> *typeBrushMapPtr;
    //Projection2DData *projDataPtr;
    QString message;
};


class Graphics2D;//forward declaration

class TransactionRefreshEvent : public QCustomEvent
{
public:
    TransactionRefreshEvent();
    //Graphics2D *graphics2DPtr;
    unsigned int mcStep;
    QString message;
};

class TransactionFinishEvent : public QCustomEvent
{
public:
    TransactionFinishEvent();
    QString message;
};



#endif
