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_Draw.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-29  |  2.9 KB  |  102 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_DrawBevelBox(LayoutHandle *handle,ObjectNode *node)
  11. {
  12.     DrawBevelBox(&handle -> RPort,node -> Left,node -> Top,node -> Width,node -> Height,
  13.         GT_VisualInfo,    handle -> VisualInfo,
  14.         GTBB_Recessed,    TRUE,
  15.     TAG_DONE);
  16. }
  17.  
  18.  
  19. /*****************************************************************************/
  20.  
  21.  
  22. VOID __regargs
  23. LTP_PlaceText(LayoutHandle *handle,STRPTR text,ULONG textLen,LONG x,LONG y)
  24. {
  25.     Move(&handle -> RPort,x,y);
  26.     Text(&handle -> RPort,text,textLen);
  27. }
  28.  
  29.  
  30. /*****************************************************************************/
  31.  
  32.  
  33. VOID __regargs
  34. LTP_TunnelDraw(struct RastPort *rp,LONG from,LONG to,LONG y,LONG left,LONG right)
  35. {
  36.     Draw(rp,from,y);
  37.     Draw(rp,left - 1,y);
  38.     Move(rp,right + 1,y);
  39.     Draw(rp,to,y);
  40. }
  41.  
  42.  
  43. /*****************************************************************************/
  44.  
  45.  
  46. VOID __regargs
  47. LTP_DrawGroove(LayoutHandle *handle,LONG left,LONG top,LONG width,LONG height,LONG from,LONG to)
  48. {
  49.     struct RastPort *rp = &handle -> RPort;
  50.  
  51.     LTP_SetAPen(rp,handle -> ShadowPen);
  52.  
  53.     Move(rp,left + 1,top + 1);
  54.     Draw(rp,left + 1,top + height - 2);
  55.     Draw(rp,left,top + height - 1);
  56.     LTP_TunnelDraw(rp,left,left + width - 2,top,from,to);
  57.     Draw(rp,left + width - 4,top + 2);
  58.     Draw(rp,left + width - 4,top + height - 3);
  59.     Move(rp,left + width - 3,top + 2);
  60.     Draw(rp,left + width - 3,top + height - 2);
  61.     Draw(rp,left + 3,top + height - 2);
  62.  
  63.     LTP_SetAPen(rp,handle -> ShinePen);
  64.     Move(rp,left + width - 2,top + height - 2);
  65.     Draw(rp,left + width - 2,top + 1);
  66.     Draw(rp,left + width - 1,top);
  67.     Draw(rp,left + width - 1,top + height - 1);
  68.     Draw(rp,left + 1,top + height - 1);
  69.     Draw(rp,left + 3,top + height - 3);
  70.     Draw(rp,left + 3,top + 2);
  71.     Move(rp,left + 2,top + height - 3);
  72.     LTP_TunnelDraw(rp,left + 2,left + width - 4,top + 1,from,to);
  73. }
  74.  
  75.  
  76. /*****************************************************************************/
  77.  
  78.  
  79. VOID __regargs
  80. LTP_DrawLabel(LayoutHandle *handle,ObjectNode *label)
  81. {
  82.     struct RastPort *rp;
  83.     LONG         left;
  84.  
  85.     left    = label -> Left + (label -> Width - label -> LabelWidth) / 2;
  86.     rp    = &handle -> RPort;
  87.  
  88.     LockLayerRom(rp -> Layer);
  89.  
  90.     if(label -> Label)
  91.     {
  92.         LTP_DrawGroove(handle,label -> Left + handle -> GlyphWidth / 2,label -> Top + handle -> RPort . TxHeight / 2,label -> Width - handle -> GlyphWidth,label -> Height - (handle -> RPort . TxHeight + handle -> InterHeight) / 2,left,left + label -> LabelWidth - 1);
  93.  
  94.         LTP_SetPens(rp,handle -> DrawInfo -> dri_Pens[HIGHLIGHTTEXTPEN],0,JAM1);
  95.         LTP_PlaceText(handle,label -> Label,strlen(label -> Label),left + handle -> GlyphWidth,label -> Top + handle -> RPort . TxBaseline);
  96.     }
  97.     else
  98.         LTP_DrawGroove(handle,label -> Left + handle -> GlyphWidth / 2,label -> Top,label -> Width - handle -> GlyphWidth,label -> Height - handle -> InterHeight / 2,left,left + label -> LabelWidth - 1);
  99.  
  100.     UnlockLayerRom(rp -> Layer);
  101. }
  102.