/****************************************************************************/
/*																			*/
/*																			*/
/*																1993/10/12	*/
/****************************************************************************/

#define				TEXTSTR				100
#define				EXTENDSTR			20

#ifndef	XWINS_H
#define	XWINS_H


#include			<stdlib.h>
#include			<X11/Xlib.h>
#include			<X11/Xutil.h>
#include			<X11/Xresource.h>


typedef struct{
	Window				xid,
						parent;
	void				*data;
	int					(*event_handler)();
}XWIN;

typedef struct _Dir{
	char				date[15],
						name[100];
	int					flag;
	struct _Dir			*next;
}DIRLIST;

typedef struct{
	DIRLIST				*top;
	int					dir_pnt,
						fcnt;
	char				extend[EXTENDSTR],
						text[TEXTSTR],
						message[EXTENDSTR + TEXTSTR];
	XWIN				*FileDialog,
						*FileTextStage,
						*FileText,
						*FileExtend,
						*FileMessage,
						*FileLoad,
						*FileSave;
}Dirdata;

typedef struct{
	char				extend[EXTENDSTR],
						text[TEXTSTR],
						message[EXTENDSTR + TEXTSTR];
	XWIN				*FileDialog,
						*FileTextStage,
						*FileText,
						*FileExtend,
						*FileMessage,
						*FileLoad,
						*FileSave;
}Dirdata2;

typedef struct{
	DIRLIST				*top;
	int					dir_pnt,
						fcnt,
						number;
	Dirdata2			*texts;
}DirDatas;


/* Function prototypes */
void				xwin_init(void);

XWIN				*MakeXButton(int x, int y,
						unsigned width, unsigned height, unsigned bdwidth,
						unsigned long bdcolor, unsigned long bgcolor,
						Window parent, char *text, int (*button_action)(),
						caddr_t action_data, int mode);

int					write16(Display *dis, Window window, GC g, int x, int y, char *s);


XWIN				*MakeXGraphic(int x, int y,
						unsigned width, unsigned height, unsigned bdwidth,
						unsigned long bdcolor, unsigned long bgcolor,
						Window parent, char *label, caddr_t action_data, int mode,...);

XWIN				*MakeXDirset(int x, int y, unsigned bdwidth,
						unsigned long bdcolor, unsigned long bgcolor,
						Window parent, char *label, caddr_t action_data,...);

XWIN				*MakeXDirset2(int x, int y, unsigned bdwidth,
						unsigned long bdcolor, unsigned long bgcolor,
						Window parent, char *label, caddr_t action_data,...);

/* Global variable */
#ifdef XWIN_UTIL

XContext			xwin_context;

#else

extern XContext			xwin_context;

#endif	/* #ifdef  XWIN_UTIL */
#endif	/* #ifndef XWINS_H */


#define				BUTTONMODE			0
#define				BUTTON16MODE		1
#define				LABELMODE			2
#define				LABEL16MODE			3
#define				LABELV16MODE		4
#define				LABEL216MODE		5
#define				LABELV16MODES		6

#define				NORMAL				0

