#ifndef WORKAREA_HPP
#define WORKAREA_HPP

#include <string>

#include <QWidget>
#include <QPainter>
#include <QMouseEvent>
#include <QPoint>
#include <QImage>



class WorkArea: public QWidget
{
  
  Q_OBJECT

  
private:
  const int taillePoint = 10;
  const int epaisseurLigne = 3;
  
  unsigned int screenSizeX, screenSizeY;
  bool readOnly;
  
  QImage *img;
  double resizeFactor;
  QList < QPoint * >liste_points;
  int indexPointClicked;

  int maxLines;

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

  
public:
  WorkArea (int screenSizeX, int screenSizeY, QWidget * parent = nullptr);
  WorkArea (int screenSizeX, int screenSizeY, const std::string & filename, QWidget * parent = nullptr);
  WorkArea (int screenSizeX, int screenSizeY, const std::string & imageFilename, const std::string & SLFilename, bool readOnly, QWidget * parent = nullptr);
   ~WorkArea ();
  
  void paint (QPainter & painter);
  void loadImage (const std::string & filename);
  void loadSL (const std::string & filename);
  void saveStrengthLine (const std::string & filename);
  void setReadOnly(bool readOnly);

};

#endif
