home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaDemoCD1.iso / DEMOS / ?-JoinTheUnion.DMS / ?-JoinTheUnion.adf / Art / 17 < prev   
Encoding:
Text File  |  1990-11-03  |  3.1 KB  |  96 lines

  1. /*
  2.     Demo - how to attach a menu to a CON: window
  3.  
  4.     JtU-Member
  5.     E. Lenz
  6.  
  7.     All Rights Reserved                                 */
  8.  
  9. #include <libraries/dos.h>
  10. #include <intuition/intuition.h>
  11. #include <intuition/intuitionbase.h>
  12.  
  13. extern void *OpenLibrary(),*Open();
  14.  
  15. struct IntuitionBase *IntuitionBase;
  16. struct FileHandle *conhandle;
  17.  
  18. char MyCon[]="CON:0/0/600/200/CON Window";
  19.  
  20. struct IntuiText Redraw =
  21. {       0,1,                           /* frontpen, backpen */
  22.         JAM1,                          /* drawmode */
  23.         1,1,                           /* leftedge, topedge */
  24.         NULL,                          /* TextAttr */
  25.         (UBYTE *)"Punkt 2",            /* IText */
  26.         NULL,                          /* NextText */
  27. };
  28.  
  29. struct MenuItem draw =
  30. {       (struct MenuItem *) NULL,
  31.         0,10,                               /* LeftEdge, TopEdge */
  32.         150,10,                             /* Width, Height */
  33.         ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
  34.         0,                                  /* Mutual Exclude */
  35.         (APTR)&Redraw,                      /* ItemFill */
  36.         NULL,                               /* SelectFill */
  37.         0,                                  /* Command    */
  38.         NULL,                               /* Subitem */
  39.         0,                                  /* NextSelect */
  40. };
  41.  
  42. struct IntuiText Noth =
  43. {       0,1,                           /* frontpen, backpen */
  44.         JAM1,                          /* drawmode */
  45.         1,1,                           /* leftedge, topedge */
  46.         NULL,                          /* TextAttr */
  47.         (UBYTE *)"Punkt 1",            /* IText */
  48.         NULL,                          /* NextText */
  49. };
  50.  
  51. struct MenuItem nothing =
  52. {       (struct MenuItem *) &draw,
  53.         0,0,                               /* LeftEdge, TopEdge */
  54.         150,10,                             /* Width, Height */
  55.         ITEMTEXT | HIGHCOMP | ITEMENABLED,  /* Flags */
  56.         0,                                  /* Mutual Exclude */
  57.         (APTR)&Noth,                        /* ItemFill */
  58.         NULL,                               /* SelectFill */
  59.         0,                                  /* Command    */
  60.         NULL,                               /* Subitem */
  61.         0,                                  /* NextSelect */
  62. };
  63.  
  64. struct Menu menu =
  65. {       (struct Menu *) NULL,        /* NEXT menu */
  66.         0, 0, 150, 0,                /* LeftEdge, TopEdge, Width, Height */
  67.         MENUENABLED,                 /* Flags */
  68.         (BYTE *) "Mein menu",        /* MenuName */
  69.         (struct MenuItem *)¬hing, /* First item */
  70.         0,0,0,0,                     /* JazzX,JazzY, BeatX, BeatY */
  71. };
  72.  
  73. quit()
  74. { CloseLibrary(IntuitionBase);
  75.   if (conhandle) Close(conhandle);
  76.   exit(0);
  77. }
  78.  
  79. main()
  80. { struct Window *Window;
  81.   int i;
  82.  
  83.   if (!(IntuitionBase=OpenLibrary("intuition.library",NULL))) exit(0);
  84.   if (!(conhandle=Open(MyCon,MODE_OLDFILE))) quit();
  85.   Window=IntuitionBase->ActiveWindow;
  86.   SetMenuStrip(Window, &menu);
  87.  
  88.   Write(conhandle,"\n\2334;32;43mPress <RETURN>\2330;31;40m",33L);
  89.   Read(conhandle,&i,1L);
  90.   quit();
  91. }
  92.  
  93.  
  94.  
  95.  
  96.