home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / term43-source.lha / Extras / Source / gtlayout-Source.lha / LTP_DrawBox.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-21  |  2.2 KB  |  97 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1994 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __regargs
  10. LTP_DrawBox(struct RastPort *rp,struct DrawInfo *drawInfo,LONG left,LONG top,LONG width,LONG height,BOOLEAN selected,BOOLEAN ghosted,ImageInfo *imageInfo)
  11. {
  12.     UWORD        *pens = drawInfo -> dri_Pens;
  13.     UWORD         pen1,pen2,pen3,pen4;
  14.     ImageTypes     imageType = imageInfo -> ImageType;
  15.  
  16.     if(selected)
  17.     {
  18.         pen1 = SHADOWPEN;
  19.         pen2 = SHINEPEN;
  20.         pen3 = FILLPEN;
  21.         pen4 = FILLTEXTPEN;
  22.     }
  23.     else
  24.     {
  25.         pen1 = SHINEPEN;
  26.         pen2 = SHADOWPEN;
  27.         pen3 = BACKGROUNDPEN;
  28.         pen4 = TEXTPEN;
  29.     }
  30.  
  31.     LTP_SetPens(rp,pens[pen1],0,JAM1);
  32.     Move(rp,left + 1,top + 1);
  33.     Draw(rp,left + 1,top + height - 2);
  34.     Draw(rp,left,top + height - 1);
  35.     Draw(rp,left,top);
  36.     Draw(rp,left + width - 2,top);
  37.  
  38.     LTP_SetAPen(rp,pens[pen2]);
  39.     Move(rp,left + width - 2,top + height - 2);
  40.     Draw(rp,left + width - 2,top + 1);
  41.     Draw(rp,left + width - 1,top);
  42.     Draw(rp,left + width - 1,top + height - 1);
  43.     Draw(rp,left + 1,top + height - 1);
  44.  
  45.     LTP_SetAPen(rp,pens[pen3]);
  46.     RectFill(rp,left + 2,top + 1,left + 2 + width - 5,top + 1 + height - 3);
  47.  
  48.     LTP_SetAPen(rp,pens[pen4]);
  49.  
  50.     switch(imageType)
  51.     {
  52.         case IMAGECLASS_PICKER:
  53.         {
  54.             LONG    Left    = left + 4,
  55.                 Top    = top + 2,
  56.                 Width    = width - 8,
  57.                 Height    = height - 4;
  58.  
  59.             LTP_DrawPicker(rp,FALSE,Left,Top,Width,Height);
  60.             break;
  61.         }
  62.  
  63.         case IMAGECLASS_LEFTINCREMENTER:
  64.         case IMAGECLASS_RIGHTINCREMENTER:
  65.  
  66.             LTP_DrawIncrementer(rp,imageType == IMAGECLASS_LEFTINCREMENTER,left + 2,top + 1,width - 4,height - 2);
  67.             break;
  68. #ifdef DO_TAPEDECK_KIND
  69.         case IMAGECLASS_BACKWARD:
  70.         case IMAGECLASS_FORWARD:
  71.         case IMAGECLASS_PREVIOUS:
  72.         case IMAGECLASS_NEXT:
  73.         case IMAGECLASS_RECORD:
  74.         case IMAGECLASS_PLAY:
  75.         case IMAGECLASS_STOP:
  76.         case IMAGECLASS_PAUSE:
  77.         case IMAGECLASS_EJECT:
  78.         case IMAGECLASS_REWIND:
  79.  
  80.             LTP_DrawTapeButton(rp,imageInfo,left,top,width,height,drawInfo -> dri_Resolution . X,drawInfo -> dri_Resolution . Y,pens[pen3]);
  81.             break;
  82. #endif    /* DO_TAPEDECK_KIND */
  83.     }
  84.  
  85.     if(ghosted)
  86.     {
  87.         if(width > 4 || height > 2)
  88.         {
  89.             LTP_SetAPen(rp,pens[BLOCKPEN]);
  90.  
  91.             SetAfPt(rp,(UWORD *)&ghostingPat,1);
  92.             RectFill(rp,left + 2,top + 1,left + width - 1 - 2,top + height - 1 - 1);
  93.             SetAfPt(rp,NULL,0);
  94.         }
  95.     }
  96. }
  97.