<* PRAGMA SPEC *>A
ToolBox.T
is a collection of buttons that activate drawing tools.
INTERFACEToolBox ; IMPORT Drawing, View, Editor; IMPORT VBT, ButtonVBT, MenuBtnVBT; TYPE T = VBT.Split; Button <: ButtonPublic; ButtonPublic = ButtonVBT.T OBJECT METHODS init(root: View.Root; name: TEXT; tl: Drawing.ArgTool): Button END; SetButton <: SetButtonPublic; SetButtonPublic = MenuBtnVBT.T OBJECT METHODS init(root: View.Root; name: TEXT; tl: Drawing.SetTool): SetButton END;
NEW(Button).init(rt, nm, tl)
returns a button displaying the name nm
that applies the drawing tool tl
to the drawing view of root
.
The call NEW(SetButton).init(rt, nm, tl)
does the same thing, but is
activated by selecting it while dragging through a menu.
<* SPEC Update REQUIRES sup(LL) = VBT.mu *> PROCEDURE Update(t: T; ed: Editor.T; rt: View.Root; n := 0; anon := TRUE);
Replace all children int
after the firstn
with buttons for the public predicates, (functions), and procedures defined in the editored
. All of these buttons apply to the rootrt
. Ifanon = TRUE
, then theMODULE
declaration (if any) is ignored, so all the button names will be unqualified.
PROCEDURE Unselect(rt: View.Root);
Unhighlight and unselect (in the drawing view) the currently selected tool
rt.currButton
.
<* SPEC SwapButton REQUIRES sup(LL) = VBT.mu *> PROCEDURE SwapButton(t: T; curr, new: Drawing.ArgTool; newLabel: TEXT);
Letb
be the button inT
with associated toolcurr
. Install a new button inb
's place with the new labelnewLabel
and associated toolnew
. Requirescurr
to be a tool inT
.
END ToolBox.