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

  1. \ ---------------------------------------------------
  2. \ CheckBoxBorder.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. This word allocate and define Borders and Coordinate pairs
  12.    for a gadget.  Space is allocated in the dictionnary.
  13.  
  14. For use with TextBoolGadget defining word.
  15.     C.F file TBG.f
  16.  
  17. A check box border is used with ToggleSelect gadgets.
  18.   The design looks like a small square left of a text. 
  19.   The box is either empty or contains a small cross
  20.   indicating that the gadget is selected or not.
  21.  
  22. This word will force a TextBoolGadget to be of type TOGGLESELECT.
  23.  
  24. Note also that with this border, you can't change the color of the
  25. borders by using the myFrontPen and myHighlightPen global vars...
  26. }
  27. \ ---------------------------------------------------
  28.  
  29. Find GDefault_F not
  30. Iftrue
  31.   include GDefault.f
  32. Ifend
  33.  
  34. Find CheckBoxBorder_f not
  35. Iftrue
  36. cr ." loading CheckBoxBorder.f..." cr  decimal
  37.  
  38. anew CheckBoxBorder_f
  39.  
  40. \ create appropriate PairData
  41.  
  42.     15 constant xx
  43.      7 constant yy
  44.  
  45.     Create CheckBoxPairs    \ 5 pairs
  46.      0 w,  0 w,
  47.     xx w,  0 w,
  48.     xx w, yy w,
  49.      0 w, yy w,
  50.      0 w,  0 w,
  51.  
  52.     Create CheckCrossPairs    \ 4 pairs
  53.      0 w,  0 w,
  54.     xx w, yy w,
  55.      0 w, yy w,
  56.     xx w,  0 w,
  57.  
  58.     \ This border draws a black box
  59.     Create CBoxbd
  60.      -25 w,            \ +bdLeftEdge
  61.        2 w,            \ +bdTopEdge
  62.        1 c,            \ +bdFrontPen
  63.        0 c,            \ +bdBackPen
  64.     JAM1 c,            \ +bdDrawMode
  65.        5 c,            \ +bdCount
  66.     CheckBoxPairs R,    \ +bdXY
  67.        0 ,            \ +bdNextBorder
  68.  
  69.     \ This border erase the cross in the box
  70.     \ and then redraws the black box
  71.     Create CheckBoxOffbd
  72.      -25 w,            \ +bdLeftEdge
  73.        2 w,            \ +bdTopEdge
  74.        0 c,            \ +bdFrontPen
  75.        0 c,            \ +bdBackPen
  76.     JAM1 c,            \ +bdDrawMode
  77.        4 c,            \ +bdCount
  78.     CheckCrossPairs R,    \ +bdXY
  79.     CBoxbd R,        \ +bdNextBorder
  80.  
  81.     \ This border draws the cross in the box
  82.     \ and then draws the black box
  83.     Create CheckBoxOnbd
  84.      -25 w,            \ +bdLeftEdge
  85.        2 w,            \ +bdTopEdge
  86.        1 c,            \ +bdFrontPen
  87.        0 c,            \ +bdBackPen
  88.     JAM1 c,            \ +bdDrawMode
  89.        4 c,            \ +bdCount
  90.     CheckCrossPairs R,    \ +bdXY
  91.     CBoxbd R,        \ +bdNextBorder
  92.  
  93. axe xx  axe yy  axe CBoxbd
  94.  
  95. : CheckBoxBorder  ( Gadget -- Gadget )
  96.     1 needed ?exec        \ check stack depth and exec state
  97.     0 locals| bdStruct Gstruct |
  98.     Gstruct STRGADGET?
  99.        error" ERROR!!! CheckBox cannot be used with String gadgets"
  100.     GADGHIMAGE Gstruct +ggFlags w!    \ use alternate image
  101.     RELVERIFY TOGGLESELECT |    \ change the style
  102.         Gstruct +ggActivation w!
  103.     CheckBoxOffbd Gstruct  +ggGadgetRender R!
  104.     CheckBoxOnbd  Gstruct  +ggSelectRender R!
  105.     Gstruct ; immediate
  106.  
  107. Ifend
  108.