// C++ code Copyright (C) David R. Evans G4AMJ/NQ0I

//  surface class for sunview

#ifndef SURF_SUNH
#define SURF_SUNH

#include <gf_sun.h>
#include <surface.h>

#include <colour.h>
#include <window.h>

class sunscreen : public surface
{ canvas* cv;
  Pixwin* pw;
  int clr, _x, _y;
  colourmap _cmap;

public:
  sunscreen(const int x0 = 0, const int y0 = 0, const int x1 = 639,
            const int y1 = 479, const int ofsx = 0, const int ofsy = 0);
  void operator=(canvas&);
  void operator=(frame&);
  void operator=(int new_colour);
  surface& operator<<(LINE&);
  surface& operator<<(dot&);
  surface& operator<<(text&);
  int width(void);
  int height(void);
  void clear(void);
  canvas& canv(void) { return *cv; }
  void invert(void);
  colourmap& cmap(void) { return _cmap; }
  sunscreen& cmap(colourmap& cm) { _cmap = cm; return *this; }
  void batch_on(void) { pw_batch_on(pw); }
  void batch_off(void) { pw_batch_off(pw); }
  surface& dump(const char* filename);

// we can't use the defaults for the following functions because
// resizing may occur at any time
  inline int usable_height(void)
    { return height(); }
  inline int usable_width(void)
    { return width(); }
  inline int usable_left(void)
    { return 0; }
  inline int usable_right(void)
    { return width() - 1; }
  inline int usable_top(void)
    { return 0; }
  inline int usable_bottom(void)
    { return height() - 1; }

  sunscreen& width(int);
  sunscreen& height(int);

  void print(const char* printer_name);
  inline void moveto(const int x, const int y)
    { _x = x; _y = y; }

  void flush(void);
  inline boolean hardcopy(void) { return false; }
};

#endif
