home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff204.lzh / PopInfo / GetFile.c < prev    next >
C/C++ Source or Header  |  1989-04-30  |  2KB  |  85 lines

  1. #include <intuition/intuitionbase.h>
  2. #include <stdio.h>
  3.  
  4. #define OKAY 1
  5. #define CANCEL 0
  6.  
  7. char dobuffer[255],undobuffer[255];
  8.  
  9. struct StringInfo sinfo={
  10.     dobuffer,undobuffer,0,80,0};
  11. short borderxy[]={
  12.     -2,-1,283,-1,283,10,-2,10,-2,-1};
  13. struct Border gadborder={
  14.     -1,-1,1,0,JAM1,5,borderxy,NULL};
  15. struct Gadget stringgadget={
  16.     NULL,10,15,280,15,GADGHCOMP,TOGGLESELECT|RELVERIFY,STRGADGET,
  17.     (APTR)&gadborder,NULL,NULL,NULL,(APTR)&sinfo,OKAY,NULL};
  18. struct IntuiText oktext={
  19.     1,1,JAM1,5,2,NULL,"   OKAY!!",NULL};
  20. short borderxy1[]={
  21.     0,0,101,0,101,12,0,12,0,0};
  22. struct Border gadborder1={
  23.     -1,-1,1,0,JAM1,5,borderxy1,NULL};
  24. struct Gadget okgadget={
  25.     &stringgadget,8,34,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
  26.     (APTR)&gadborder1,NULL,&oktext,NULL,NULL,OKAY,NULL};
  27. struct IntuiText notext={
  28.     1,1,JAM1,5,2,NULL,"   CANCEL",NULL};
  29. short borderxy2[]={
  30.     0,0,101,0,101,12,0,12,0,0};
  31. struct Border gadborder2={
  32.     -1,-1,1,0,JAM1,5,borderxy2,NULL};
  33. struct Gadget nogadget={
  34.     &okgadget,191,34,100,11,GADGHCOMP,RELVERIFY,BOOLGADGET,
  35.     (APTR)&gadborder2,NULL,¬ext,NULL,NULL,CANCEL,NULL};
  36.  
  37. struct NewWindow fw={
  38.     0,0,299,50,
  39.     0,3,
  40.     GADGETUP,
  41.     WINDOWDRAG|ACTIVATE|RMBTRAP,
  42.     &nogadget,
  43.     NULL,
  44.     "",
  45.     NULL,NULL,
  46.     0,0,0,0,CUSTOMSCREEN
  47. };
  48.  
  49. struct Window *MyWindow;
  50. struct IntuiMessage *MyMsg;
  51. struct IntuitionBase *IntuitionBase;
  52.  
  53. gf(title,x,y)
  54. char *title;
  55. int x,y;
  56. {
  57.     struct Gadget *gad;
  58.     int a,gadgetid,mx,my;
  59.     IntuitionBase=(struct IntuitionBase *) OpenLibrary("intuition.library",0);
  60.     fw.Title=title;
  61.     if (x+300>640) x=340;
  62.     if (y+50>200) y=150;
  63.     fw.TopEdge=y;
  64.     fw.LeftEdge=x;
  65.     fw.Screen=(struct Screen *) IntuitionBase->ActiveScreen;
  66.     MyWindow=(struct Window *) OpenWindow(&fw);
  67.     ActivateGadget(&stringgadget,MyWindow,NULL);
  68.     for (;;) {
  69.         Wait (1L<<MyWindow->UserPort->mp_SigBit);
  70.         while (MyMsg=GetMsg(MyWindow->UserPort)) {
  71.             ReplyMsg(MyMsg);
  72.             if (MyMsg->Class==GADGETUP) {
  73.                 gad=(struct Gadget *) MyMsg->IAddress;
  74.                 gadgetid=gad->GadgetID;
  75.                 if (gadgetid!=OKAY && gadgetid!=CANCEL) break;
  76.                 CloseWindow(MyWindow);
  77.                 CloseLibrary(IntuitionBase);
  78.                 if (gadgetid==CANCEL) return(NULL);
  79.                 return(dobuffer);
  80.             }
  81.         }
  82.     }
  83. }
  84.  
  85.