#ifndef TCLAHEADER_H
#define TCLAHEADER_H

#include <tcla/menu.h>
#include <tcla/window.h>

/* this is our header structure for various tcla apps stuff such as
 * windowing and the event loop that we pass around as
 * client data under the Tcl clientdata capability */

#define MAX_TCLA_WINDOWS 16

#define MAX_STRING_GADGET_SIZE 100

struct TclaHeader
{
	struct Node node;
	struct Task *taskid;
	struct List WindowList;
	struct List FontList;
	struct TclaWindow *CurrentTclaWindow;
	long next_window_number;
	long seed;

	struct List EventRoutineList;
	short EventLoopRunning;
	short panic_in_progress;

	short flags;

	/* stuff for communicating between Tcl programs */
	struct MsgPort *MyRequestPort;
	struct MsgPort *async_request_reply_port;
	struct MsgPort *sync_request_reply_port;
	struct AmigaTclMessage *request_message;

	char *progname;
	char *tclportname;
	BPTR output_file;	/* we Open "*" to get the current window as a file*/
	int (*out_of_memory_routine)(long);
	void (*cleanup_routine)(void);
	void (*panic_routine)(char *);
	char undo_buffer[MAX_STRING_GADGET_SIZE];
};

#define HEADER_LOOP_INITIALIZED_FLAG 1
#define DOING_WINDOWEVENTS_FLAG 2
#define WINDOW_CLOSED_FLAG 4

#endif
