home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 465.lha / ParM_v2.5r / Menus.c < prev    next >
C/C++ Source or Header  |  1991-01-05  |  4KB  |  132 lines

  1. /*
  2.  *    Menus.c - Copyright © 1990 by S.R. & P.C.
  3.  *
  4.  *    Created:    16 Jun 1990
  5.  *    Modified:    20 Nov 1990  21:13:18
  6.  *
  7.  *    Make>> make
  8.  */
  9.  
  10. extern struct WBStartup *WBenchMsg;
  11.  
  12.  
  13. static struct IntuiText SubText2 = {
  14.     3,2,JAM1,    /* front and back text pens, drawmode and fill byte */
  15.     22,1,        /* XY origin relative to container TopLeft */
  16.     NULL,        /* font pointer or NULL for default */
  17.     (UBYTE *)"Shell",    /* pointer to text */
  18.     NULL        /* next IntuiText structure */
  19. };
  20.  
  21. static struct MenuItem SubItem2 = {
  22.     NULL,        /* next SubItem structure */
  23.     104,10,        /* XY of Item hitbox relative to TopLeft of parent hitbox */
  24.     72,10,        /* hit box width and height */
  25.     CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP,    /* Item flags */
  26.     1,            /* each bit mutually-excludes a same-level Item */
  27.     NULL,    /* Item render  (IntuiText or Image or NULL) */
  28.     NULL,        /* Select render */
  29.     NULL,        /* alternate command-key */
  30.     NULL,        /* no SubItem list for SubItems */
  31.     MENUNULL    /* filled in by Intuition for drag selections */
  32. };
  33.  
  34. static struct IntuiText SubText1 = {
  35.     3,2,JAM1,    /* front and back text pens, drawmode and fill byte */
  36.     22,1,        /* XY origin relative to container TopLeft */
  37.     NULL,        /* font pointer or NULL for default */
  38.     (UBYTE *)"Simple",    /* pointer to text */
  39.     NULL        /* next IntuiText structure */
  40. };
  41.  
  42. struct MenuItem SubItem1 = {
  43.     NULL,    /* next SubItem structure */
  44.     104,0,        /* XY of Item hitbox relative to TopLeft of parent hitbox */
  45.     72,10,        /* hit box width and height */
  46.     CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED,    /* Item flags */
  47.     2,            /* each bit mutually-excludes a same-level Item */
  48.     NULL,    /* Item render  (IntuiText or Image or NULL) */
  49.     NULL,        /* Select render */
  50.     NULL,        /* alternate command-key */
  51.     NULL,        /* no SubItem list for SubItems */
  52.     MENUNULL    /* filled in by Intuition for drag selections */
  53. };
  54.  
  55.  
  56. struct Menu Menu1 = {
  57.     NULL,        /* next Menu structure */
  58.     0,0,        /* XY origin of Menu hit box relative to screen TopLeft */
  59.     48,0,        /* Menu hit box width and height */
  60.     MENUENABLED,    /* Menu flags */
  61.     "ParM",        /* text of Menu name */
  62.     NULL        /* MenuItem linked list pointer */
  63. };
  64.  
  65. static struct IntuiText Line = {
  66.     2, 0, JAM1,    /* front and back text pens, drawmode and fill byte */
  67.     0, 9,        /* XY origin relative to container TopLeft */
  68.     NULL,        /* font pointer or NULL for default */
  69.     (UBYTE *)"-------------",        /* pointer to text */
  70.     NULL        /* next IntuiText structure */
  71. };
  72.  
  73. static struct {
  74.     char *MenuName;
  75.     char Command;
  76.     char line;
  77. } MenuTab[] = {
  78.     {"Open",'O',0},
  79.     {"UpDate",'U',0},
  80.     {"Std Cfg",0,1},
  81.     {"Cmd Mode",0,0},
  82.     {"Command",'C',1},
  83.     {"Change Dir",0,1},
  84.     {"Quit",'Q',0}
  85. };
  86.  
  87. #define NUMBER_OF_ITEM 7
  88.  
  89. void CreateParMenu(short Color)
  90. {
  91.     struct MenuItem *mi,**miptr;
  92.     struct IntuiText *it;
  93.     struct Menu *ParM;
  94.     short top = 0,i;
  95.  
  96.     ParM = &Menu1;
  97.     miptr = &ParM->FirstItem;
  98.     Line.FrontPen = Color;
  99.     for( i=0 ; i<NUMBER_OF_ITEM ; i++ ) {
  100.         mi = ArpAlloc(sizeof(struct MenuItem));
  101.         it = ArpAlloc(sizeof(struct IntuiText));
  102.         mi->ItemFill = (APTR)it;
  103.         mi->Width = 104;
  104.         mi->Height = 10;
  105.         mi->TopEdge = top;
  106.         mi->Flags = ITEMTEXT+ITEMENABLED+HIGHCOMP;
  107.         if (MenuTab[i].Command) {
  108.             mi->Command = MenuTab[i].Command;
  109.             mi->Flags |= COMMSEQ;
  110.         }
  111.         top += 10;
  112.         it->IText = (UBYTE *)MenuTab[i].MenuName;
  113.         it->FrontPen = Color;
  114.         it->LeftEdge = it->TopEdge = 1;
  115.         if (MenuTab[i].line) {
  116.             it->NextText = &Line;
  117.             top += 5;
  118.         }
  119.         if (i == 3) {
  120.             SubItem1.ItemFill = (APTR)&SubText1;
  121.             SubText1.FrontPen = Color;
  122.             SubItem1.NextItem = &SubItem2;
  123.             SubItem2.ItemFill = (APTR)&SubText2;
  124.             SubText2.FrontPen = Color;
  125.             mi->SubItem = &SubItem1;
  126.         }
  127.         *miptr = mi;
  128.         miptr = &mi->NextItem;
  129.     }
  130. }
  131.  
  132.