multivalent.gui

Class VMenuButton

public class VMenuButton extends IParaBox implements EventListener

Menu button widget that pops up associated VMenu when mouse pressed. Scripts can be associated with menu items (which are arbitrary child Nodes--not subclasses--of VMenu). If a script is associated with VMenuButton itself, then it functions as a button when clicked, executing that script and not popping up the menu; and a menubutton when pressed. If parent is VMenu, operates as cascade; else as pulldown. For a popupmenu, simply invoke post in the VMenu.

VMenus can either be supplied as children (as in HTML), or can be made dynamic. Dynamic menus are constructed afresh each time they are posted, by instantiating an empty VMenu and passing around a semantic event with the message createWidget/dynamic-name. Common menus -- which may or may not actually exist in a given Browser -- are given in VMenu.

Can be given both a menu (either as a child or dynamically) and a script. In this case, a quick click executes the script, and a mouse press pops up the menu.

Version: $Revision: 1.8 $ $Date: 2003/06/02 05:19:35 $

Constructor Summary
VMenuButton(String name, Map<String,Object> attr, INode parent)
VMenuButton(String name, Map<String,Object> attr, INode parent, String script)
Method Summary
booleanbreakAfter()
booleanbreakBefore()
voidevent(AWTEvent e)
booleaneventNode(AWTEvent e, Point rel)
Just post associated menu and get out of the way.
booleanformatNode(int width, int height, Context cx)
Takes witdh and height from max dimensions of associated VMenu's children.
voidpaintNode(Rectangle docclip, Context cx)
Shows active child by drawing it directly.
voidpost()
Post associated menu on screen, under root.
voidsetDynamic(String name)
Menus can be dynamically generated.

Constructor Detail

VMenuButton

public VMenuButton(String name, Map<String,Object> attr, INode parent)

VMenuButton

public VMenuButton(String name, Map<String,Object> attr, INode parent, String script)

Method Detail

breakAfter

public boolean breakAfter()

breakBefore

public boolean breakBefore()

event

public void event(AWTEvent e)

eventNode

public boolean eventNode(AWTEvent e, Point rel)
Just post associated menu and get out of the way. If has script and click, treat as button; if no script or press and has menu, treat as menubutton.

formatNode

public boolean formatNode(int width, int height, Context cx)
Takes witdh and height from max dimensions of associated VMenu's children.

paintNode

public void paintNode(Rectangle docclip, Context cx)
Shows active child by drawing it directly.

post

public void post()
Post associated menu on screen, under root.

setDynamic

public void setDynamic(String name)
Menus can be dynamically generated. Each time such a menu is to be posted, it is created from scratch by sending an empty VMenu around in the semantic event createMenu/name, at which time behaviors build its content.