/*
 * File: xmanager.h
 * Last modified on Fri Jul 22 12:24:59 1994 by eroberts
 * -----------------------------------------------------
 * This file is the interface to the xmanager module, which is the
 * portion of the graphics implementation responsible for all of the
 * interaction with X.
 */

#ifndef _xmanager_h
#define _xmanager_h

#include "genlib.h"

/*
 * Constants
 * ---------
 * CommandBufferSize -- Size of internal command buffer
 * MaxFontName       -- Maximum length of font name
 * MaxTextString     -- Length limit for DrawTextString
 */

#define CommandBufferSize  200
#define MaxFontName         25
#define MaxTextString      120

/*
 * Type: commandT
 * --------------
 * The client side of the graphics implementation and the X side of
 * the implementation communicate by means of commands sent across a
 * communication pipe.  This enumeration type defines the command
 * codes.
 */

typedef enum {
   LineCmd,
   ArcCmd,
   TextCmd,
   WidthCmd,
   SetEraseCmd,
   StartRegionCmd,
   EndRegionCmd,
   ClearCmd,
   UpdateCmd,
   SetFontCmd,
   SetTitleCmd,
   GetWidthCmd,
   GetHeightCmd,
} commandT;

/*
 * Function: InitXManager
 * Usage: InitXManager(title);
 * ---------------------------
 * This function starts the X manager process.  The title argument is
 * a string to use as the title bar for the new window.
 */

void InitXManager(string title);

/*
 * Function: SendCommand
 * Usage: SendCommand(cmd, args);
 * ------------------------------
 * This function sends the specified command to the X manager
 * process along with an argument string.
 */

void SendCommand(commandT cmd, string args);

/*
 * Function: GetResponse
 * Usage: str = GetResponse();
 * ---------------------------
 * This function reads a line from the X manager in response to
 * a command message.  The string is dynamically allocated and
 * should be freed by the client.
 */

string GetResponse(void);

#endif
