#ifndef __GRID_H__
#define __GRID_H__


#include <QResizeEvent>
#include <QMouseEvent>
#include <QWidget>


class GridEditor : public QWidget
{
    Q_OBJECT
public:
    GridEditor( QWidget *parent, const char *name=0 );
    ~GridEditor();

    void setMap( QRgb **m, int w, int h );

public slots:
    void setColor( QRgb c );

signals:
    void changed();

protected:
    void mousePressEvent( QMouseEvent * );
    void mouseMoveEvent( QMouseEvent * );
    void paintEvent( QPaintEvent * );

private:
    int gw;
    int gh;
    int cs;
    QRgb **map;
    QPoint last;
    QRgb currColor;
    bool clear;
};


#endif // __GRID_H__

