#ifndef _XGRASS_DLIB_H
#define _XGRASS_DLIB_H

#include "xgrass_lib.h"
#include "bbox.h"
#include "object.h"
#include "patterns.h"
#include "gis.h"
#include "Caption.h"

/* alloccolor.c */
Status _XgdAllocCells(
#ifndef _NO_PROTO
Display dpy, Colormap cmap, XColor * xcolor
#endif
);

/* error.c */
void XgdError(
#ifndef _NO_PROTO
char *s
#endif
);

/* linebutton.c */
Widget XgdCreateLinePatternPad(
#ifndef _NO_PROTO
Widget parent, char *string
#endif
);

#define XGD_LINE_PATTERN_SOLID        0
#define XGD_LINE_PATTERN_DOT_DASHED   1
#define XGD_LINE_PATTERN_DOTTED       2
#define XGD_LINE_PATTERN_LONG_DASHED  3
#define XGD_LINE_PATTERN_ODD_DASHED   4
#define XGD_LINE_PATTERN_SHORT_DASHED 5
#define XGD_LINE_PATTERN_NONE         6

static struct _XGDlinePatternButtonTable {
    char *label;
    BITMAPS_H_TYPE *bitmap;
    int width, height;
} __XGDlinePatternButtonTable[] = {
    {"Solid Line", solidline_bits, solidline_width, solidline_height },
    { "Dot Dashed", dot_dashed_bits, dot_dashed_width, dot_dashed_height},
    { "Dotted", dotted_bits, dotted_width, dotted_height},
    { "Long Dashed", long_dashed_bits, long_dashed_width, long_dashed_height},
    {"Odd Dashed", odd_dashed_bits, odd_dashed_width, odd_dashed_height},
    {"Short Dashed", short_dashed_bits,short_dashed_width,short_dashed_height},
    {"None", NULL, 0, 0 } 
};

/* fillbutton.c */
Widget XgdCreateFillPatternPad(
#ifndef _NO_PROTO
Widget parent, char *string
#endif
);

#define XGD_FILL_PATTERN_NONE       0
#define XGD_FILL_PATTERN_SOLID      1
#define XGD_FILL_PATTERN_VERTICAL   2
#define XGD_FILL_PATTERN_CHECK      3
#define XGD_FILL_PATTERN_CROSS      4
#define XGD_FILL_PATTERN_HORIZONTAL 5
#define XGD_FILL_PATTERN_LEFT       6
#define XGD_FILL_PATTERN_RIGHT      7

static struct _XGDfillPatternButtonTable {
    char *label;
    BITMAPS_H_TYPE *bitmap;
    int width, height;
} __XGDfillPatternButtonTable[] = {
    { "None", NULL, 16, 16 },
    { "Solid", NULL, 16, 16 },
    { "Vertical", verticalpat_bits, verticalpat_width, verticalpat_height },
    { "Check", check_bits, check_width, check_height },
    { "Cross", cross_bits, cross_width, cross_height },
    {"Horizontal", horizpat_bits, horizpat_width, horizpat_width},
    {"Ptleft", ptleft_bits, ptleft_width, ptleft_height},
    {"Ptright", ptright_bits, ptright_width, ptright_height}
};



/* sethilite.c */
Pixel XgdSetHighlightColor(
#ifndef _NO_PROTO
Display * dpy, Colormap cmap, char *color
#endif
);

/*************/
/*  bbox.c   */
/*************/
Status XgdBoxesOverlap(
#ifndef _NO_PROTO
XgdRect b1, b2;
#endif
);

Status XgdBoxContains(
#ifndef _NO_PROTO
     XgdRect b1, b2;
#endif
);

Status XgdPointInBox(
#ifndef _NO_PROTO
     XgdRect b;
     int     x;
     int     y;
#endif
);

XgdBox XgdSetBox(
#ifndef _NO_PROTO
     int t;
     int b;
     int l;
     int r;
#endif
);

Status XgdLineIntersectBox(
#ifndef _NO_PROTO
     XgdRect box;
     XgdLine line;
#endif			   
);

Status XgdLineContainedInBox(
#ifndef _NO_PROTO
     XgdLine l;
     XgdRect b;
#endif
);



/*  object.c */

XgdObject *XgdCreateObject(
#ifndef _NO_PROTO
     int type;
#endif
);

void XgdInitObject(
#ifndef _NO_PROTO
     XgdObject *obj;
     int       fp;       /* Fill Pattern */
     int       lp;       /* line pattern */
     Pixel     fg;       /* foreground color */
     Pixel     bg;       /* background color */
     int       lw;       /* line width */
#endif
);

void XgdConfigureObject(
#ifndef _NO_PROTO
     XgdObject *obj;
     int x, y;
     int width, height;
#endif
);

void XgdDrawObject(
#ifndef _NO_PROTO
     XgdObject *obj;
#endif
);

Pixmap
XgdGetFillPixmap(
#ifndef _NO_PROTO
     XgdObject *obj;
     Pixel fg, bg;
     int fp;
#endif
);

void XgdDrawRaster(
#ifndef _NO_PROTO
     XgdObject *obj;
     char      *name;
     char      *mapset;
#endif
);		   


void XgdDestroyObject(
#ifndef _NO_PROTO
     XgdObject *obj;
#endif
);

GC XgdGetGCOfObject(
#ifndef _NO_PROTO
     XgdObject *obj;
#endif
);

void XgdSetObjectPosition(
#ifndef _NO_PROTO
     XgdObject *obj;
     int       x;
     int       y;
#endif
);

void XgdGetObjectPosition(
#ifndef _NO_PROTO
     XgdObject *obj;
     int       *x;
     int       *y;
#endif
);


/* setvectcolor.c */
/* 
 *                          *****WARNING*******
 * XGD_NUM_VECT_COLORS *MUST* equal the number of colors in this list!! 
 *                          *****WARNING*******
 */
#define XGD_NUM_VECT_COLORS 11
static char *__XGDMonoColors[] = {
    "white", 
    "black",
};

static char *__XGDVectColors[] = {
    "white", 
    "black",
    "red",
    "orange", 
    "yellow", 
    "green",
    "blue", 
    "brown", 
    "magenta",
    "aquamarine", 
    "gray"
};
Pixel * XgdInitVectorColors(
#ifndef _NO_PROTO
Display * dpy, Colormap cmap, int *num
#endif
);
char ** XgdGetVectColorNames(
#ifndef _NO_PROTO
void
#endif
);

/* warning.c */
void XgdWarning(
#ifndef _NO_PROTO
char *s
#endif
);

/* initxgd.c */
void XgdInit( 
#ifndef _NO_PROTO
Display *dpy, Colormap cmap, XVisualInfo *vinfo
#endif
);
#ifdef __XGD_INIT
Boolean __XGDMonochrome;
#else
extern Boolean __XGDMonochrome;
#endif

#endif /* _XGRASS_DLIB_H */
