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 >
Wrap
Text File
|
1986-11-20
|
3KB
|
109 lines
\ ---------------------------------------------------
\ CheckBoxBorder.f
\ ---------------------------------------------------
{ TBG.f and CSG.f Version 1.0
Text Boolean Gadgets and String/Integer gadget creation helper.
by Marc Lupien, Montreal, Canada.
June of 1988
CIS user no. 71550,640
}
{
This word allocate and define Borders and Coordinate pairs
for a gadget. Space is allocated in the dictionnary.
For use with TextBoolGadget defining word.
C.F file TBG.f
A check box border is used with ToggleSelect gadgets.
The design looks like a small square left of a text.
The box is either empty or contains a small cross
indicating that the gadget is selected or not.
This word will force a TextBoolGadget to be of type TOGGLESELECT.
Note also that with this border, you can't change the color of the
borders by using the myFrontPen and myHighlightPen global vars...
}
\ ---------------------------------------------------
Find GDefault_F not
Iftrue
include GDefault.f
Ifend
Find CheckBoxBorder_f not
Iftrue
cr ." loading CheckBoxBorder.f..." cr decimal
anew CheckBoxBorder_f
\ create appropriate PairData
15 constant xx
7 constant yy
Create CheckBoxPairs \ 5 pairs
0 w, 0 w,
xx w, 0 w,
xx w, yy w,
0 w, yy w,
0 w, 0 w,
Create CheckCrossPairs \ 4 pairs
0 w, 0 w,
xx w, yy w,
0 w, yy w,
xx w, 0 w,
\ This border draws a black box
Create CBoxbd
-25 w, \ +bdLeftEdge
2 w, \ +bdTopEdge
1 c, \ +bdFrontPen
0 c, \ +bdBackPen
JAM1 c, \ +bdDrawMode
5 c, \ +bdCount
CheckBoxPairs R, \ +bdXY
0 , \ +bdNextBorder
\ This border erase the cross in the box
\ and then redraws the black box
Create CheckBoxOffbd
-25 w, \ +bdLeftEdge
2 w, \ +bdTopEdge
0 c, \ +bdFrontPen
0 c, \ +bdBackPen
JAM1 c, \ +bdDrawMode
4 c, \ +bdCount
CheckCrossPairs R, \ +bdXY
CBoxbd R, \ +bdNextBorder
\ This border draws the cross in the box
\ and then draws the black box
Create CheckBoxOnbd
-25 w, \ +bdLeftEdge
2 w, \ +bdTopEdge
1 c, \ +bdFrontPen
0 c, \ +bdBackPen
JAM1 c, \ +bdDrawMode
4 c, \ +bdCount
CheckCrossPairs R, \ +bdXY
CBoxbd R, \ +bdNextBorder
axe xx axe yy axe CBoxbd
: CheckBoxBorder ( Gadget -- Gadget )
1 needed ?exec \ check stack depth and exec state
0 locals| bdStruct Gstruct |
Gstruct STRGADGET?
error" ERROR!!! CheckBox cannot be used with String gadgets"
GADGHIMAGE Gstruct +ggFlags w! \ use alternate image
RELVERIFY TOGGLESELECT | \ change the style
Gstruct +ggActivation w!
CheckBoxOffbd Gstruct +ggGadgetRender R!
CheckBoxOnbd Gstruct +ggSelectRender R!
Gstruct ; immediate
Ifend