#include #define OKAY 1 #define CANCEL 0 short YesNoXYBorder[]={ 0,0,101,0,101,12,0,12,0,0}; struct Border YesNoBorder={ -1,-1,1,0,JAM1,5,YesNoXYBorder,NULL}; struct IntuiText OkayText={ 1,1,JAM1,5,2,NULL," OKAY",NULL}; struct IntuiText CancelText={ 1,1,JAM1,5,2,NULL," CANCEL",NULL}; struct Gadget OkayGadget={ NULL,8,20,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET, (APTR)&YesNoBorder,NULL,&OkayText,NULL,NULL,OKAY,NULL}; struct Gadget CancelGadget={ &OkayGadget,120,20,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET, (APTR)&YesNoBorder,NULL,&CancelText,NULL,NULL,CANCEL,NULL}; struct IntuiText YesNoText={ 1,1,JAM1,8,7,NULL,NULL,NULL}; struct NewWindow YesNoWindow={ 50,30,230,36,0,3,GADGETUP|VANILLAKEY,ACTIVATE|RMBTRAP,&CancelGadget, NULL,NULL,NULL,NULL,0,0,0,0,CUSTOMSCREEN}; struct Window *QWindow; struct IntuiMessage *MyMsg; struct IntuitionBase *IntuitionBase; YesNo(text) char *text; { int Class,Code; char key; IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",0); YesNoWindow.Screen=(struct Screen *) IntuitionBase->ActiveScreen; QWindow=(struct Window *) OpenWindow(&YesNoWindow); YesNoText.IText=text; PrintIText(QWindow->RPort,&YesNoText,0,0); waitforinput: Wait (1<UserPort->mp_SigBit); MyMsg=GetMsg(QWindow->UserPort); ReplyMsg(MyMsg); Class=MyMsg->Class; Code=MyMsg->Code; key=toupper((char ) Code); if (Class==VANILLAKEY && key!='Y' && key!='N') goto waitforinput; CloseWindow(QWindow); CloseLibrary(IntuitionBase); if (((struct Gadget *) MyMsg->IAddress)->GadgetID==OKAY || key=='Y') return(TRUE); return(FALSE); }