home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 1: Collection A / 17Bit_Collection_A.iso / files / 1065.dms / 1065.adf / TextPlus / SrcE.lzh / SrcE / gadgetsE.c < prev    next >
C/C++ Source or Header  |  1990-08-10  |  3KB  |  119 lines

  1. /*
  2.  *       gadgetsE.c         © by Martin Steppler
  3.  */
  4.  
  5. USHORT DArrowData[] =        /* Down Arrow */
  6.     {
  7.     0xFFFF,0xF81F,0xF81F,0xF81F,0xF81F,0x8001,0xE007,0xF81F,0xFE7F
  8. };
  9.  
  10. USHORT UArrowData[] =        /* Up Arrow */
  11.     {
  12.     0xFE7F,0xF81F,0xE007,0x8001,0xF81F,0xF81F,0xF81F,0xF81F,0xFFFF
  13. };
  14.  
  15. struct Image Arrows[] =
  16.     {
  17.     {0,0,16,9,2,UArrowData,0x0001,0x0000,NULL},
  18.     {0,0,16,9,2,DArrowData,0x0001,0x0000,NULL},
  19. };
  20.  
  21. struct Gadget ArrowGads[] =
  22.     {
  23.        {
  24.        NULL,       624, ABSMAY*8-12, 16,9, GADGIMAGE, RELVERIFY|GADGIMMEDIATE,
  25.        BOOLGADGET|GZZGADGET,(APTR)&Arrows[0], NULL, NULL, EOS, NULL, 4, NULL
  26.        },
  27.        {
  28.        &ArrowGads[0],624, ABSMAY*8-3,16,9,GADGIMAGE, RELVERIFY|GADGIMMEDIATE,
  29.        BOOLGADGET|GZZGADGET,(APTR)&Arrows[1], NULL, NULL, EOS, NULL, 3, NULL
  30.        }
  31. };
  32.  
  33. struct PropInfo VertSliderSInfo = {
  34.     AUTOKNOB|FREEVERT, /* PropInfo flags */
  35.     -1,-1,             /* horizontal and vertical pot values */
  36.     -1,-1,             /* horizontal and vertical body values */
  37. };
  38.  
  39. struct Image Image3 =
  40.     {0,0,7,ABSMAY*8-41-12,0, NULL,0x0000,0x0000, NULL};
  41.  
  42. struct Gadget VertSlider =
  43.     {
  44.     &ArrowGads[1], 624,41, 16,ABSMAY*8-41-12, NULL,
  45.     GADGIMMEDIATE|RELVERIFY,
  46.     PROPGADGET|GZZGADGET,                   /* Proportional Gadget */
  47.     (APTR)&Image3,                /* Slider Imagry */
  48.     NULL,NULL,EOS,
  49.     (APTR)&VertSliderSInfo,       /* SpecialInfo structure */
  50.     2, NULL
  51.     };
  52.  
  53. #define LINE_HEIGHT     9
  54.  
  55. /* for showing the list information */
  56. int TOT_DISPLAY=ABSMAY-MIY, numentries, topentry;
  57.  
  58. /* Initialize the proportional gadget
  59.  */
  60.  
  61. InitSlider(g)
  62. struct Gadget *g;
  63. {
  64.    int oldnum=numentries;
  65.  
  66.     numentries=se*(SEITE+1)+ze;
  67.     if(numentries>TOT_DISPLAY)
  68.     {
  69.        NewModifyProp(g,Fenster,NULL,AUTOKNOB|FREEVERT,
  70.          NULL,((MAXBODY*topentry)/(numentries)),
  71.          MAXBODY,((MAXBODY*TOT_DISPLAY)/numentries),1L);
  72.     }
  73.     else if(oldnum!=numentries)
  74.     {
  75.        NewModifyProp(g,Fenster,NULL,AUTOKNOB|FREEVERT,
  76.          NULL,NULL,MAXBODY,MAXBODY,1L);
  77.     }
  78. }
  79.  
  80.  
  81. /* Get the current entry, based on either the movement of the
  82.  * proportional gadget, or the pressing of the arrow keys.
  83.  */
  84.  
  85. GetSlider(g, dir)
  86. struct Gadget *g;
  87. SHORT dir;
  88. {
  89.    struct  PropInfo *p;
  90.    int oldtop=topentry, len;
  91.  
  92.    p=(struct PropInfo *)g->SpecialInfo;
  93.    if(dir!=0)
  94.    {
  95.       if(dir==1) {
  96.          if(y<MAY) CrsrBot();
  97.          for(len=1; len<=MAY-MIY; len++) YZPlus();
  98.       }
  99.       else {
  100.          if(y>MIY) CrsrTop();
  101.          for(len=1; len<=MAY-MIY; len++) YZMinus();
  102.       }
  103.     }
  104.     else
  105.     {
  106.        if(numentries>TOT_DISPLAY)
  107.           topentry=(p->VertPot*(numentries-TOT_DISPLAY))/MAXBODY;
  108.        else topentry=0L;
  109.        if(oldtop!=topentry) {
  110.           s=topentry/(SEITE+1); z=topentry%(SEITE+1); y=MIY;
  111.           if(blo==2) {
  112.             if(oldtop>topentry) blo=6; else blo=4;
  113.           }
  114.           SText(); ZSDisplay();
  115.        }
  116.     }
  117.     meld=FALSE;
  118. }
  119.