#include #include extern struct Screen *screen; struct IntuiText MessageText = { 1,0,JAM2, /* front and back text pens, drawmode and fill byte */ 37,20, /* XY origin relative to container TopLeft */ NULL, /* font pointer or NULL for default */ NULL, /* pointer to text */ NULL /* next IntuiText structure */ }; SHORT OkayVectors[] = { 0,0, 118,0, 118,25, 0,25, 0,0 }; struct Border OkayBorder = { -2,-1, /* XY origin relative to container TopLeft */ 1,0,JAM1, /* front pen, back pen and drawmode */ 5, /* number of XY vectors */ OkayVectors, /* pointer to XY vectors */ NULL /* next border in list */ }; struct IntuiText OkayText = { 1,0,JAM2, /* front and back text pens, drawmode and fill byte */ 37,7, /* XY origin relative to container TopLeft */ NULL, /* font pointer or NULL for default */ "Okay", /* pointer to text */ NULL /* next IntuiText structure */ }; struct Gadget Okay = { NULL, /* next gadget */ 86,54, /* origin XY of hit box relative to window TopLeft */ 115,24, /* hit box width and height */ NULL, /* gadget flags */ RELVERIFY, /* activation flags */ BOOLGADGET, /* gadget type flags */ (APTR)&OkayBorder, /* gadget border or image to be rendered */ NULL, /* alternate imagery for selection */ &OkayText, /* first IntuiText structure */ NULL, /* gadget mutual-exclude long word */ NULL, /* SpecialInfo structure */ NULL, /* user-definable data */ NULL /* pointer to user-definable data */ }; struct NewWindow newmessage = { 140,100, /* window XY origin relative to TopLeft of screen */ 304,102, /* window width and height */ 2,1, /* detail and block pens */ GADGETUP, /* IDCMP flags */ NULL, /* other window flags */ &Okay, /* first gadget in gadget list */ NULL, /* custom CHECKMARK imagery */ NULL, /* window title */ NULL, /* custom screen pointer */ NULL, /* custom bitmap */ 5,5, /* minimum width and height */ 640,200, /* maximum width and height */ CUSTOMSCREEN /* destination screen type */ }; struct Window *p_MesWindow; #define GO 1 #define STOP 0 void Message(message) char *message; { USHORT QuitFlag; ULONG MesClass; /* Fields for storing */ APTR MesPointer; /* */ struct IntuiMessage *p_MesMessage; /* pointer to message */ struct RastPort *p; QuitFlag=GO; newmessage.Screen = screen; MessageText.IText = message; if( (p_MesWindow = (struct Window *)OpenWindow(&newmessage))==NULL) { printf("Unable to open message window"); exit(10); } p = p_MesWindow->RPort; PrintIText(p,&MessageText,0,0); while (QuitFlag !=STOP) { Wait(1l<UserPort->mp_SigBit); /* wait for a message */ while (p_MesMessage = (struct IntuiMessage *)GetMsg(p_MesWindow->UserPort)) { MesClass = p_MesMessage->Class; /* Store values */ MesPointer = p_MesMessage->IAddress; ReplyMsg(p_MesMessage); /* Reply to message */ if ( MesClass == GADGETUP) { QuitFlag=STOP; } } } CloseWindow(p_MesWindow); }