home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 144.lha / Gadgets_Forth / sb.f < prev    next >
Text File  |  1986-11-20  |  2KB  |  64 lines

  1. \ ---------------------------------------------------
  2. \ SimpleBorder.f
  3. \ ---------------------------------------------------
  4. {  TBG.f and CSG.f Version 1.0
  5.    Text Boolean Gadgets and String/Integer gadget creation helper.
  6.  
  7.    by Marc Lupien,  Montreal, Canada.
  8.    June of 1988
  9.    CIS user no. 71550,640
  10. }
  11. These words allocate and define Borders and coordinates pairs.
  12.  
  13. For use with words StringGadget, IntegerGadget and
  14.    TextBoolGadget.
  15. }
  16. \ ---------------------------------------------------
  17.  
  18. Find GDefault_F not
  19. Iftrue
  20.   include GDefault.f
  21. Ifend
  22.  
  23. Find SimpleBorder_f not
  24. Iftrue
  25. cr ." loading SimpleBorder.f..." cr  decimal
  26.  
  27. anew SimpleBorder_f
  28.  
  29. \ create appropriate PairData
  30.  
  31.     Create SimpleBdPdTight    \ tight around the select box
  32.     5 w,    \ 5 pairs defined
  33.     paABS w,    -1 w,    paABS w,    -1 w,
  34.     paWidth+ w,     0 w,    paABS w,    -1 w,
  35.     paWidth+ w,     0 w,    paHeight+ w,     0 w,
  36.     paABS w,    -1 w,    paHeight+ w,     0 w,
  37.     paABS w,    -1 w,    paABS w,    -1 w,
  38.  
  39.     Create SimpleBdPdSlack    \ slack around the select box
  40.     5 w,    \ 5 pairs defined
  41.     paABS w,    -3 w,    paABS w,    -2 w,
  42.     paWidth+ w,     3 w,    paABS w,    -2 w,
  43.     paWidth+ w,     3 w,    paHeight+ w,     1 w,
  44.     paABS w,    -3 w,    paHeight+ w,     1 w,
  45.     paABS w,    -3 w,    paABS w,    -2 w,
  46.  
  47. \ very simple box.  Nice for 320x200 or 640x400.
  48.  
  49. : SimpleBorder  ( Gadget -- Gadget )
  50.     1 needed ?exec        \ check stack depth and exec state
  51.     0 locals| bdStruct Gstruct |
  52.     myFrontPen AllotBorder to bdStruct
  53.     bdStruct Gstruct  +ggGadgetRender R!
  54.     bdStruct
  55.        Gstruct STRGADGET?
  56.         if   SimpleBdPdSlack      \ slack around string gadget
  57.         else SimpleBdPdTight then \ tight around other types
  58.        Gstruct AllotPairs
  59.     Gstruct ; immediate
  60.  
  61. Ifend
  62.  
  63.