// simpledraw.h
// combination of code from Harriet Fell and Jon Baudanza


#ifndef SIMPLEDRAW_H_
#define SIMPLEDRAW_H_

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <iostream.h>

class SimpleDraw {
 
  // Xlib Variables
  Display         *mydisplay;
  Window           mywindow;
  GC               mygc;
  XEvent           myevent;
  XMappingEvent    myMappingEvent;
  KeySym           myKey;
  XSizeHints       myhint;
  int              myscreen;

  int screen;
  // Colors
  unsigned long black, white;

// for RGB colors
  int            gMx; // greenMax
  int            bMx; // blueMax

// Values we will keep track of ourselves
  unsigned long  myForeground, myBackground; // colors
  int cx, cy;                      // current position
    // will be updated by Move, MoveTo, Line, LineTo, DrawLine


  public:

  SimpleDraw(int x=0, int y=0, int width=200, int height=200);
  ~SimpleDraw();
 
  // Graphics functions
  void AwaitClick (void);
  void GetPosition(int& x, int& y);
  char GetKey (void);
  void Clear (void);
  void DrawPoint(int x, int y);
  void FillRectangle(int x, int y, unsigned int width, unsigned int height);
  void SetForeColor(short r, short g, short b);
  void SetForeColor(unsigned long pixval);
  void SetBackColor(short r, short g, short b);
  void SetBackColor( unsigned long pixval);
  unsigned long White();
  unsigned long Black();
  void SetPixel(int x_coord, int y_coord);
  void DrawLine(int x1, int y1, int x2, int y2);
  void Move(int dx, int dy);
  void MoveTo(int x, int y);
  void Line(int dx, int dy);
  void LineTo(int x, int y);
  void SetLineWidth(int w);
  void FrameCircle(int x, int y, int r);
  void PaintCircle(int x, int y, int r);
  void InvertCircle(int x, int y, int r);
  void EraseCircle(int x, int y, int r);
  void FrameRect(int left, int top, int right, int bottom);
  void PaintRect(int left, int top, int right, int bottom);
  void InvertRect(int left, int top, int right, int bottom);
  void EraseRect(int left, int top, int right, int bottom);
  void FrameOval(int left, int top, int right, int bottom);
  void PaintOval(int left, int top, int right, int bottom);
  void InvertOval(int left, int top, int right, int bottom);
  void EraseOval(int left, int top, int right, int bottom);
  void DrawString(char *s, int x, int y);

};

#endif 



