/*
 *	Xgraf.h
 *
 *	Public header file for Xgraf.
 */


/* Values for pen state variable */
typedef enum {
  OnPixel, OffPixel, InvertPixel
} PlotAttribute;

/* Line Styles */
typedef enum {
    LineSolidStyle,
    LineDashStyle,
    LineDoubleDashStyle
} LineStyle;

/* event types */
typedef enum
{
    NoEvent, EventExpose, EventKeypress, EventKeyrelease,
    EventMouseUp, EventMouseDown, EventEnter, EventLeave,
    EventMove, EventResize
} EventType;

/* Event Masks */
typedef enum
{
  MaskNull        = 0,
  MaskKeypress        = 1,
  MaskKeyrelease      = 2,
  MaskMouseUp     = 4,
  MaskMouseDown       = 8,
  MaskEnter       = 16,
  MaskLeave       = 32,
  MaskButtonMotion    = 64,
  MaskAllMotion       = 128,
  MaskResize      = 256
} EventMask;

#define MaskKeys        (MaskKeypress | MaskKeyrelease)
#define MaskMouse       (MaskMouseUp | MaskMouseDown)
#define MaskInOut       (MaskEnter | MaskLeave)

/* Fill styles for "Fill___" procedures to use */
typedef enum {
  SolidStyle, FineVertStyle, FineHorizStyle,
  ThickVertStyle, ThickHorizStyle,
  FineLeftDiagStyle, FineRightDiagStyle,
  ThickLeftDiagStyle, ThickRightDiagStyle,
  FineCheckStyle, ThickCheckStyle, GreyStyle
} FillingStyle;

/*
 *      There are local copies of the "Xgraf and allied" files
 *      here in this directory
 *      (modified to use "filename.h" syntax
 *      rather than <filename.h> syntax as needed)
 *      because it would be far too complicated to try to
 *      resurrect and re-install
 *      the various mixed Modula-2 / C {compiling, linking, library-generating}
 *      mechanisms of old.
 *      Hence the "filename.h" syntax rather than <filename.h> syntax below.
 */
#include "Xcolours.h"



typedef char String[200];

typedef struct
{
  char ch;        /* when Event Keypresss/Keyrelease */
  int keycode;
  int keystate;
  int x, y;       /* when Event MouseMove */
  int w, h;       /* when Event Resize */
  int button;     /* when Event MouseDown/MouseUp */
} EventData;

 void EnquireSystem( int * , int * , float * , float * );
 void UseSharedColourMap( void );
 void UseOwnColourMap( void );
 void UseRGBColourMap( void );
 void DebugImportant( void );
 void DebugAll( void );
 void InitialiseGraf( void );
 void CloseDownGraf( void );
 Window RootWin( void );
 void SetEventMask( EventMask );
 void SetWBackground( Colour );
 void SetWMinSize( int , int );
 void SetWMaxSize( int , int );
 void SetWBackingStore( void );
 void SetWSaveUnder( void );
 void SetWNotShown( void );
 Window MakeWindow( Window , char * , int , int , int , int );
 void SelectWindow( Window );
 void ShowWindow( void );
 void HideWindow( void );
 void MoveResizeWindow( int , int , int , int );
 void MoveWindow( int , int );
 void ResizeWindow( int , int );
 void CloseWindow( void );
 void ClearWindow( void );
 Font LoadFont( char * );
 Font DefaultFont( void );
 void SelectFont( Font );
 void GetFontName( Font , char * );
 void CharSize( char , int * , int * );
 void StringSize( char * , int * , int * );
 void SetRGB( Colour , int , int , int );
 void GetRGB( Colour , int * , int * , int * );
 void SetColour( Colour );
 void SetBackColour( Colour );
 void GetColourName( Colour , char * );
 Colour FirstColour( void );
 Colour LastColour( void );
 int NumColours( void );
 void AllowNoEvent( void );
 void GetEvent( Window * , EventType * , EventData * );
 int EventPending( void );
 void SetPlotAttribute( PlotAttribute );
 void SetLineThickness( int );
 void SetLineStyle( LineStyle );
 void ResetLineThicknessAndStyle( void );
 void SetFillStyle( FillingStyle );
 FillingStyle FirstStyle( void );
 FillingStyle LastStyle( void );
 void DrawPoint( int , int );
 void DrawLine( int , int , int , int );
 void DrawRectangle( int , int , int , int );
 void FillRectangle( int , int , int , int );
 void FillPolygon( int * , int * , int );
 void DrawChar( int , int , char );
 void DrawString( int , int , char * );
 void DrawArc( int , int , int , int , int );
 void DrawCircle( int , int , int );
 void FillArc( int , int , int , int , int );
 void FillCircle( int , int , int );
 void OnCursor( void );
 void BusyCursor( void );
 void OffCursor( void );
 void SetClipList( void );
 void ClearClipList( void );
 void FlushOutput( void );

Pixmap CreatePixmap(int width, int height ) ;

void CopyToWin(Pixmap p, int src_x, int src_y, int width, int height,
			   int dest_x, int dest_y);
void CopyFromWin(Pixmap p, int src_x, int src_y, int width, int height,
			   int dest_x, int dest_y);

void PutImage( XImage * image,int src_x, int src_y,int dest_x,int dest_y,
    int width,int height);

XImage *GetImage(int x,int y, int width,int height,int format) ;

XImage *CreateImage(unsigned int depth, int format, int offset,
					char *data, unsigned int width, unsigned int height,
					int bitmap_pad, int bytes_per_line);


/*
To access the Display, add:
     Display * GetDisplay( void );
at the top of your C file.
*/

