// MenuDefs.d

get "Streams.d"
get "AltoFileSys.d"

external// procedures from Menu.bcpl
[
ScanMenu
InsideMenu
DeSelect
ShowMenu
CreateMenuDisplayStream
MenuSize
DeleteFromMenu
WaitUntilPressed
WaitUntilReleased
MenuIdle
]
external// statics from Menu.bcpl
[
MenuData
EverythingActive
]


external
// procedures from MenuBox.bcpl
[
CreateBox
CursorInside
OutlineBox
FillBox
NearestBox
FindDCB
ConvertToRelative
WriteBox
]

external// procedures from MenuBoxStreams.bcpl
[
CreateBoxStream
CreateTextLineMenu
BoxEraseBits
BoxResetLine
GetString
]

external
// procedures from MenuBoxUtils.asm
[
write
puts
CallBitBlt
select
]

external// procedures from MenuEditWindow.bcpl
[
SelectWindow
MoveWindow
ChangeWindow
]



structure MENU
[length word;box↑1,256word]


structure BOX:
[
dcbword
flagsword =
[
outlinebit 2// outline type, see manifests below
backgroundbit 2// box color, see manifests below
inactivebit// box inactive if bit on
selectedbit// box selected if bit on
boldbit// box bold if bit on
bitsbit 9// outline width in bits
]
xo word =
[
xmodebit 2// offset from left if on, centered if off
xbitbit 4// xoffset rem 16
xoriginbit 10
]
yo word =
[
ymodebit 2// offset from top if on, centered if off
ybitbit 4// yoffset rem 16
yoriginbit 10
]
xc word =
[
xwordbit 6// xoffset/16
xcornerbit 10
]
yc word =
[
ywordbit 6// yoffset/16
ycornerbit 10
]
]
manifest lBOX=(size BOX)/16


// colors for OutlineBox and FillBox
manifest
[
unfilled=0 ; flip=0
black=1
grey=2 ; gray=2
white=3
]

structure DATA [
menu word
stringlist word
menuDCB word
]

manifest MaxLength=257

structure BS [
// Box Stream
box word
font word
closes word// Closes routine
zone word
puts word// Puts routine
resets word// Resets routine
lineOrMenu word// line position defn starts from 0
startline word
wordpos word
bitpos word
nlines word
height word
wrap word
]
manifest lBS=(size BS)/16