#include <intuition/intuitionbase.h>
/* messagereq.c: ruft Messagerequester auf */

struct Gadget MOK =
{
  NULL, 0, 40, 90, 14, GADGHCOMP, RELVERIFY | ENDGADGET, BOOLGADGET | REQGADGET, NULL,
  NULL, NULL, 0, NULL, 41, NULL
};

struct Requester MsgReq =
{
  NULL, 0, 0, 120, 60, 0, 0, &MOK, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL
};

void	  MessageReq(Window, text, background, shadow, textcol)
struct Window *Window;
char	 *text;
int	  background, shadow, textcol;
{
  register int ende = 0;

  if ((strlen(text) * 8 + 15) > 120)
    MsgReq.Width = strlen(text) * 8 + 20;
  MsgReq.LeftEdge = (640 - MsgReq.Width) / 2;
  MsgReq.TopEdge = (256 - MsgReq.Height) / 2;
  MOK.LeftEdge = MsgReq.Width - 115;
  Request(&MsgReq, Window);
  ReqBlock(&MsgReq, shadow, 4, 2, MsgReq.Width - 4, 58);
  ReqBlock(&MsgReq, background, 0, 0, MsgReq.Width - 4, 58);
  ReqBox(&MsgReq, textcol, background, 2, 1, MsgReq.Width - 8, 56);
  ReqPrint(&MsgReq, text, textcol, background, 10, 20);
  ReqBox(&MsgReq, textcol, background, MOK.LeftEdge - 1, 39, 92, 16);
  ReqPrint(&MsgReq, "OK", textcol, background, MOK.LeftEdge + 37, 49);
  while (!ende)
  {
    if (Nachricht(Window) == GADGETUP)
      ende++;
  }
}
