home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 298.lha / PopInfo_v3.1 / GetFile.c < prev    next >
C/C++ Source or Header  |  1980-12-04  |  2KB  |  73 lines

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