#ifndef _GRAPHIC_DISPLAY_QT_H_
#define _GRAPHIC_DISPLAY_QT_H_
//----------------------------------------------------------------------------
///
/// \brief  Newhaven Display
///
///         See implementation files for further information.
///
/// \date   20151226
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Includes-----------------------------------------------------------------

#include <QPixmap>
#include <QPainter>

//---Own------------------------------



//---Declaration--------------------------------------------------------------


class QWidget;
class QLabel;

class CGraphicDisplayQt
         :public CGraphicDisplay
{

   private:
         QLabel *m_widget;
         QPixmap *m_pixmap;
         //QPainter p;
         int m_fx1=0;
         int m_fx2=0;
         int m_fy1=0;
         int m_fy2=0;
   public:

      CGraphicDisplayQt(QLabel *widget, int xs, int ys);
      ~CGraphicDisplayQt();

      virtual void drawPixels( const TRgb *pixels, int count) override;
      virtual void drawPixel( const TRgb color) override;
      virtual void gotoxyHw() override;
      virtual void setFrame(int x1, int y1, int x2, int y2) override;
      virtual bool setRotation(bool rot) override;
      void checkFrame();
      bool save(const QString fileName)
      {
         if(!m_pixmap)
         {
            return(-1);
         }
         bool sta=m_pixmap->save(fileName);
         if(!sta)
         {
            qCritical("Could not stor image");
         }
         else
         {
            qCritical("stored image");
         }
         return( sta );
      }
      virtual void clear( const TRgb color ) override
      {
         if(m_pixmap)
         {
            m_pixmap->fill( Qt::black );
         }
      }
};


//---fin----------------------------------------------------------------------
#endif // ? ! _GRAPHIC_DISPLAY_QT_H_
