// C++ .h file for pc gplot display classes
// copyright 1992 Pittsburgh Supercomputing Center
#ifndef _gptdisp
#define _gptdisp
#include "cgmdisp.h" // basic display classes
#include "cgm.h" // basic Gplot
#include <windows.h>
enum patType { solid,dash, dot, dash_dot, dash_dot_dot};

// forward refs
class Window;
class Scroller;
class FrameWindow;
class FileObject;
class cgmFile;
class cgmObject;
class cgmMetafile;
class	cgmPicture;
//class cgmWindow;
//typedefs

//typedef cgmWindow   * CgmWindowPt;
typedef cgmObject   * CgmObjectPt;
typedef cgmFile     * CgmFilePt;
typedef cgmPicture  * CgmPicturePt;
typedef cgmMetafile * CgmMetafilePt;
// *** class pcDisplay

class pcDisplay : public baseDisplay {
private:
  int noElements;  // # of elements drawn
  RECT itsExtent;
  RECT clipr;
  vdcPts *myPxlExtent;
  float myxPxlSize, myyPxlSize;
  COLORREF RGBbackground;
  int line_pnsize;
  int now_pnsize;
  BOOL UseLinePen;    // false if polyline pen setup for text, marker
  BOOL edgeseen;
  BOOL useclip;  // if clip rectangle exists, use it
  BOOL solidpoly;
  BOOL hollowpoly;
  BOOL Index1Set;
  HDC hdc;          // device context
  HDC hdcMeta;      // Metafile context
  LOGPEN lEdgePen;
  LOGPEN lLinePen;
  LOGPEN lTextPen;
  LOGPEN lMarkerPen;
  LOGBRUSH lFillBrush;
  HPEN   hEdgePen;
  HPEN   hLinePen;
  HPEN   hTextPen;
  HPEN   hMarkerPen;
  HPEN   hHollowPen;
  HPEN   hPenUsed;
  HBRUSH hFillBrush;
  HBRUSH hBackgroundBrush;
  HBRUSH hBrushUsed;
  HANDLE hPenOrig;
  HANDLE hBrushOrig;
  BOOL LinePenOK;
  BOOL EdgePenOK;
  BOOL TextPenOK;
  BOOL MarkerPenOK;
  BOOL FillBrushOK;
  CgmWindowPt cgmWin;
  int myBackIndex;
public:
  pcDisplay(CgmWindowPt win,HDC hdc, HDC hdcMeta, HDC hdcInfo, RECT *rect); // constructor
  ~pcDisplay(); // destructor

  virtual void setExtent(RECT *inExtent) {itsExtent = *inExtent;}
  virtual void getExtent(RECT *outExtent) { *outExtent =  itsExtent;	}
  COLORREF getback() const {return RGBbackground;}
  LOGPALETTE *MakeDefaultPalette(void);
  virtual int getLineType(void) { return myLineType;}
  virtual const vdcR *getlineWidth(void){ return myLineWidth ;}
  virtual int getEdgeType(void) { return myEdgeType;}
  virtual const vdcR *getEdgeWidth(void){ return myEdgeWidth ;}
  virtual void backColr(const genColr&);
  void backColr2();
  void adjustPens();
  virtual int cells(const cellArray*); // overide baseDisplay function

  virtual int polyline(const vdcPts*); // display a polyline
  virtual int polygon(const vdcPts* ); // display a filled polyline
  virtual inline int invert() { return 1;} // do we need inversion ? - yes
  virtual void lineColr(const genColr &inColr );
  virtual void fillColr(const genColr &);
  virtual void edgeColr(const genColr &);
  virtual void textColr(const genColr &inColr);
  virtual int text(const genText *); // default function
  virtual void markerColr(const genColr &inColr);
  virtual int polymarker(const vdcPts *); // default function

  virtual void colrs(const colrTable *);  // set Mac palette to match color table
  virtual inline vdcPts *pxlExtent() {return myPxlExtent;}
  //virtual inline vdcPts *mmExtent() {return myMmExtent;}
  virtual float xPxlSize()          {return myxPxlSize;} // x pixel size in mm (required)
  virtual float yPxlSize()          {return myyPxlSize;} // y pixel size in mm (required)
  virtual void lineType(int inType); // overide {myLineType = inType;}
  virtual void lineWidth(const vdcR *inWidth); // overide {myLineWidth = inWidth;}
  virtual void edgeType(int inType); // overide {myEdgeType = inType;}
  virtual void edgeWidth(const vdcR *inWidth); // overide {myEdgeWidth = inWidth;}
  void SetLinePen();
  void SetEdgePen();
  void SetTextPen();
  void SetMarkerPen();
  void SetHollowPen(COLORREF);
  void SetBackBrush(COLORREF);
  void SetFillBrush();
  void ExtentRect();
  virtual void intStyle(int inStyle);
  virtual void edgeVis(int inVis);
  int width() {return myPxlExtent->i(2);  } // width of screen
  int height() {return myPxlExtent->i(3); } // height of screen

  // contol elements
  virtual void clipRect(const vdcPts *inPts);
  virtual void clip(int inClip);

};
#endif // __pcDisp_
