An AnchorBtnVBT.T is a button that activates a pull-down menu when you click on it or roll into it from another anchor button.
Associated with each anchor button b is
The default pre method highlights the anchor button; the default cancel method unhighlights it.
In the common case in which the user down-clicks on the anchor, rolls over the menu, and up-clicks on one of the items, the upclick will be delivered to the item first, which will invoke the appropriate action, and then will be delivered to the anchor button (since the anchor button has the mouse focus), which will delete the menu.
A HighlightVBT is automatically inserted over the menu when it is inserted, and discarded when the menu is deleted. This allows the menu items to highlight themselves without interfering with the highlighting of the anchor button.
The action procedure and post method of an anchor button are never called. The pre and cancel methods can be overridden; for example, the pre method could prepare the menu before it is inserted. This is the reason the menu field is revealed in the type declaration.
The same menu can be associated with several anchor buttons, provided that only one of them is active at a time.
INTERFACE AnchorBtnVBT; IMPORT ButtonVBT, VBT; TYPE T <: Public; Public = ButtonVBT.T OBJECT menu: VBT.T METHODS <* LL.sup <= VBT.mu *> init(ch: VBT.T; menu: VBT.T; n: CARDINAL := 0; anchorParent: VBT.T := NIL; hfudge, vfudge := 0.0; ref: REFANY := NIL): T END;
The call v.init(...) initializes the button with the given attributes, and adds ref to v's property set if it is not NIL. This includes a call to ButtonVBT.T.init(v, ch).
You must not change the menu while the AnchorBtnVBT is active.
PROCEDURE New( ch: VBT.T; menu: VBT.T; n: CARDINAL := 0; anchorParent: VBT.T := NIL; hfudge, vfudge := 0.0; ref: REFANY := NIL): T; <* LL.sup <= VBT.mu *>
PROCEDURE SetParent(v: T; p: VBT.T); <* LL.sup = VBT.mu *>
Set the anchor parent of v to be p. If v is active, this is a checked runtime error.
PROCEDURE GetParent(v: T): VBT.T; <* LL.sup = VBT.mu *>
Return the anchor parent of v.
PROCEDURE Set(v: T; n: CARDINAL; hfudge, vfudge: REAL); <* LL.sup = VBT.mu *>
Set the attributes of v. If v is active, this is a checked runtime error.
PROCEDURE Get(v: T; VAR n: CARDINAL; VAR hfudge, vfudge: REAL); <* LL.sup = VBT.mu *>
Fetch the attributes of v.
PROCEDURE IsActive(v: T): BOOLEAN; <* LL.sup = VBT.mu *>
Return TRUE if and only if v is active.
END AnchorBtnVBT.
New(...) is equivalent to NEW(T).init(...).