home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377a.lha / libraries / intuition / gadgets / gadgets.h < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-04  |  7.7 KB  |  233 lines

  1. /* gadgets.h -- has all of the structures needed for the gadgets */
  2. /* Copyright (c) 1990 Commodore-Amiga, Inc.
  3.  *
  4.  * This example is provided in electronic form by Commodore-Amiga, Inc. for
  5.  * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  6.  * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  7.  * information on the correct usage of the techniques and operating system
  8.  * functions presented in this example.  The source and executable code of
  9.  * this example may only be distributed in free electronic form, via bulletin
  10.  * board or as part of a fully non-commercial and freely redistributable
  11.  * diskette.  Both the source and executable code (including comments) must
  12.  * be included, without modification, in any copy.  This example may not be
  13.  * published in printed form or distributed with any commercial product.
  14.  * However, the programming techniques and support routines set forth in
  15.  * this example may be used in the development of original executable
  16.  * software products for Commodore Amiga computers.
  17.  * All other rights reserved.
  18.  * This example is provided "as-is" and is subject to change; no warranties
  19.  * are made.  All use is at your own risk.  No liability or responsibility
  20.  * is assumed.
  21.  */
  22.  
  23.  
  24. struct TextAttr TOPAZ80 = 
  25.     {
  26.     (STRPTR)"topaz.font",TOPAZ_EIGHTY,0,0
  27.     };
  28.  
  29. UBYTE   Buffer[512];    /* This is for showing any messages or entries */
  30.  
  31. struct IntuiText Messages =
  32.     {
  33.     1,0,JAM2,0,0,&TOPAZ80,&Buffer[0],NULL
  34.     };
  35.  
  36. struct Image BackImage1 = 
  37.     {
  38.     0,0,                /* X, Y origin relative to TopLeft of Gadget */
  39.     150,90,             /* Image width and height in pixels */
  40.     0,                  /* number of bitplanes in Image */
  41.     NULL,               /* pointer to ImageData, NULL for Rectangle */
  42.     0x0000,0x0002,      /* PlanePick and PlaneOnOff */
  43.     NULL                /* next Image structure */
  44.     };
  45.  
  46. struct Gadget BackDrop =     /* This is just for our blank images */
  47.     {
  48.     NULL,5,1,1,1,GADGIMAGE,NULL,BOOLGADGET,(APTR)&BackImage1,
  49.     NULL,NULL,NULL,NULL,0,NULL
  50.     };
  51.  
  52. USHORT chip MaskData1[]=     /* No Border Button Mask Data */
  53.     {
  54.     0x07FF,0xFFFF,0xFFFF,0xFFFF,0xF000,0x3FFF,0xFFFF,0xFFFF,
  55.     0xFFFF,0xFE00,0x7FFF,0xFFFF,0xFFFF,0xFFFF,0xFF00,0xFFFF,
  56.     0xFFFF,0xFFFF,0xFFFF,0xFF80,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
  57.     0xFF80,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF80,0xFFFF,0xFFFF,
  58.     0xFFFF,0xFFFF,0xFF80,0x7FFF,0xFFFF,0xFFFF,0xFFFF,0xFF00,
  59.     0x3FFF,0xFFFF,0xFFFF,0xFFFF,0xFE00,0x07FF,0xFFFF,0xFFFF,
  60.     0xFFFF,0xF000
  61.     };
  62.  
  63. struct Image ButtonI1 = 
  64.     {
  65.     0,0,73,10,1,MaskData1,0x0001,0x0000,NULL
  66.     };
  67.  
  68. /* Text for our buttons */
  69. struct IntuiText IText1 = {2,0,JAM1,14,1,&TOPAZ80,"Cancel",NULL};
  70. struct IntuiText IText2 = {2,0,JAM1,20,1,&TOPAZ80,"OKAY",NULL};
  71.  
  72. /* Mask information for gadget */
  73. struct BoolInfo OkayMask = {BOOLMASK,MaskData1,0};
  74.  
  75. struct Gadget ButtonGads[] =
  76.     {
  77.        {
  78.        &BackDrop,     100,106, 73,10, GADGHCOMP|GADGIMAGE, 
  79.        RELVERIFY|GADGIMMEDIATE|BOOLEXTEND, BOOLGADGET, (APTR)&ButtonI1,
  80.        NULL, &IText1, NULL, (APTR)&OkayMask, 7, NULL
  81.        },
  82.        {
  83.        &ButtonGads[0],  5,106, 73,10, GADGHCOMP|GADGIMAGE,
  84.        RELVERIFY|GADGIMMEDIATE|BOOLEXTEND, BOOLGADGET, (APTR)&ButtonI1,
  85.        NULL, &IText2, NULL, (APTR)&OkayMask, 6, NULL
  86.        }
  87.     };
  88.  
  89. SHORT BorderVectors3[] = {
  90.     0,0,
  91.     151,0,
  92.     151,91,
  93.     0,91,
  94.     0,0
  95. };
  96. struct Border Border3 = {
  97.     -1,-1,              /* XY origin relative to TopLeft */
  98.     1,0,JAM1,           /* front pen, back pen and drawmode */
  99.     5,                  /* number of XY vectors */
  100.     BorderVectors3,     /* pointer to XY vectors */
  101.     NULL                /* next border in list */
  102. };
  103.  
  104. struct Gadget EntryBox = {
  105.     &ButtonGads[1],     /* next gadget */
  106.     5,1,                /* origin XY of hit box relative to window TopLeft */
  107.     150,90,             /* hit box width and height */
  108.     GADGHBOX|GADGHIMAGE,/* gadget flags */
  109.     RELVERIFY|GADGIMMEDIATE,    /* activation flags */
  110.     BOOLGADGET,         /* gadget type flags */
  111.     (APTR)&Border3,     /* gadget border or image to be rendered */
  112.     NULL,               /* alternate imagery for selection */
  113.     NULL,               /* first IntuiText structure */
  114.     NULL,               /* gadget mutual-exclude long word */
  115.     NULL,               /* SpecialInfo structure */
  116.     1,                  /* user-definable data */
  117.     NULL                /* pointer to user-definable data */
  118. };
  119.  
  120. SHORT BorderVectors4[] = {
  121.     0,0,
  122.     169,0,
  123.     169,10,
  124.     0,10,
  125.     0,0
  126. };
  127. struct Border Border4 = {
  128.     -1,-1,                        /* XY origin relative to TopLeft */
  129.     1,0,JAM1,                     /* front pen, back pen and drawmode */
  130.     5,                            /* number of XY vectors */
  131.     BorderVectors4,               /* pointer to XY vectors */
  132.     NULL                          /* next border in list */
  133. };
  134.  
  135. UBYTE UNDOBUFFER[255];
  136. UBYTE NameGadSIBuff[255];
  137.  
  138. struct StringInfo NameGadSInfo = {
  139.     NameGadSIBuff,      /* buffer where text will be edited */
  140.     UNDOBUFFER,         /* optional undo buffer */
  141.     0,                  /* character position in buffer */
  142.     25,                 /* maximum number of characters to allow */
  143.     0,                  /* first displayed character buffer position */
  144.     0,0,0,0,0,          /* Intuition initialized and maintained variables */
  145.     0,                  /* Rastport of gadget */
  146.     0,                  /* initial value for integer gadgets */
  147.     NULL                /* alternate keymap (fill in if you set the flag) */
  148. };
  149.  
  150. struct Gadget NameGad = {
  151.     &EntryBox,
  152.     5,94,
  153.     168,9,
  154.     NULL,
  155.     RELVERIFY|GADGIMMEDIATE|LONGINT, /* Make into a Integer gadget */
  156.     STRGADGET,                    /* String gadget */
  157.     (APTR)&Border4,
  158.     NULL,
  159.     NULL,
  160.     NULL,
  161.     (APTR)&NameGadSInfo,          /* SpecialInfo structure */
  162.     5,
  163.     NULL
  164. };
  165.  
  166. USHORT chip DArrowData[] =        /* Down Arrow */
  167.     {
  168.     0xFFFF,0xF81F,0xF81F,0xF81F,0xF81F,0x8001,0xE007,0xF81F,0xFE7F
  169.     };
  170.  
  171. USHORT chip UArrowData[] =        /* Up Arrow */
  172.     {
  173.     0xFE7F,0xF81F,0xE007,0x8001,0xF81F,0xF81F,0xF81F,0xF81F,0xFFFF
  174.     };
  175.  
  176. USHORT chip RArrowData[] =        /* Right Arrow */
  177.     {
  178.     0xFFFF,0xFF3F,0xFF0F,0xC003,0xC000,0xC003,0xFF0F,0xFF3F,0xFFFF
  179.     };
  180.  
  181. USHORT chip LArrowData[] =        /* Left Arrow */
  182.     {
  183.     0xFFFF,0xFCFF,0xF0FF,0xC003,0x0003,0xC003,0xF0FF,0xFCFF,0xFFFF
  184.     };
  185.  
  186. struct Image Arrows[] =
  187.     {
  188.     {0,0,16,9,2,UArrowData,0x0001,0x0000,NULL},
  189.     {0,0,16,9,2,DArrowData,0x0001,0x0000,NULL},
  190.     {0,0,16,9,2,LArrowData,0x0001,0x0000,NULL},
  191.     {0,0,16,9,2,RArrowData,0x0001,0x0000,NULL}
  192.     };
  193.  
  194. struct Gadget ArrowGads[] =
  195.     {
  196.        {
  197.        &NameGad,     158, 73, 16,9, GADGIMAGE, RELVERIFY|GADGIMMEDIATE,
  198.        BOOLGADGET,(APTR)&Arrows[0], NULL, NULL, NULL, NULL, 4, NULL
  199.        },
  200.        {
  201.        &ArrowGads[0],158, 83,16,9,GADGIMAGE, RELVERIFY|GADGIMMEDIATE,
  202.        BOOLGADGET,(APTR)&Arrows[1], NULL, NULL, NULL, NULL, 3, NULL
  203.        }
  204.     };
  205.  
  206. struct PropInfo VertSliderSInfo = {
  207.     AUTOKNOB|FREEVERT, /* PropInfo flags */
  208.     -1,-1,             /* horizontal and vertical pot values */
  209.     -1,-1,             /* horizontal and vertical body values */
  210. };
  211.  
  212. struct Image Image3 = 
  213.     {0,0,7,72,0, NULL,0x0000,0x0000, NULL};
  214.  
  215. struct Gadget VertSlider =
  216.     {
  217.     &ArrowGads[1], 158,0, 16,72, NULL,
  218.     RELVERIFY|GADGIMMEDIATE,
  219.     PROPGADGET,                   /* Proportional Gadget */
  220.     (APTR)&Image3,                /* Slider Imagry */
  221.     NULL,NULL,NULL,
  222.     (APTR)&VertSliderSInfo,       /* SpecialInfo structure */
  223.     2, NULL
  224.     };
  225.  
  226. struct NewWindow NewWindow = {
  227.     160,25, 178,150, 0,1,
  228.     INTUITICKS|GADGETDOWN|GADGETUP|CLOSEWINDOW,
  229.     WINDOWDRAG|WINDOWDEPTH|
  230.     WINDOWCLOSE|ACTIVATE|NOCAREREFRESH,
  231.     NULL,NULL, "Gadgets", NULL, NULL, 0,0, -1,-1, WBENCHSCREEN 
  232. };
  233.