Class zebkit.ui.Menu
extends <zebkit.ui.CompList>
<zebkit.ui>

Menu UI component class. The class implements popup menu UI component.

var m = new Menu([
    {
        content: "Menu Item 1",
        sub    : [
            {
                content: "SubMenu Checked Item 1",
                checked: true
            },
            {
                content: "SubMenu Checked Item 2",
                checked: false
            },
            "-", // line
            {
                content: "SubMenu Checked Item 3",
                checked: false
            }
        ]
     },
    "Menu Item 2",
    "Menu Item 3"
 ]);
Constructor:
zebkit.ui.Menu ([list])

Parameters:
  • [list] <Object>

    menu items description




Inherited methods:
$pointerMoved(x, y)    $select(o)    $setConstraints(c)    add(constr, d)    byConstraints([p], c)    byPath(path, [cb])    calcMaxItemSize( )    calcPreferredSize(target)    doLayout( )    drawView(g, id, x, y, w, h)    drawViewAt(g, id, index)    findSelectable(off, d)    fire(event, [path], [params])    fireSelected(prev)    focused( )    getBottom( )    getCanvas( )    getComponentAt(x, y)    getHorPadding( )    getItemIdxAt(x, y)    getItemLocation(i)    getItemSize(i)    getLeft( )    getLines( )    getLineSize(l)    getMaxOffset( )    getPreferredSize( )    getRight( )    getSelected( )    getTop( )    getValue( )    getVerPadding( )    hasFocus( )    indexOf(c)    insert(i, constr, d)    invalidate( )    invalidateLayout( )    isItemSelectable(i)    isSelected(i)    keyTyped(e)    kidAdded(index, constr, l)    kidRemoved(i, l)    laidout( )    load(JSON)    lookupItem(ch)    off([eventName], [path], [cb])    on([eventName], [path], cb)    pageSize(d)    paintComponent(g)    paintViewAt(g, ax, ay, v)    properties([path], props)    property([path], name, value)    recalc( )    relocated(px, py)    remove(c)    removeAll( )    removeAt(i)    removeByConstraints(ctr)    removeMe([after])    repaint([x], [y], [w], [h])    repaintByOffsets(p, n)    requestFocus( )    requestFocusIn([timeout])    resized(pw, ph)    select(index)    setAt(i, d)    setBackground(v)    setBorder([v])    setBottomPadding(bottom)    setBounds(x, y, w, h)    setByConstraints(constr, c)    setConstraints(ctr)    setEnabled(b)    setId(id)    setKids(a)    setLayout(m)    setLeftPadding(left)    setLocation(xx, yy)    setModel(m)    setPadding(v)    setParent(o)    setPosition(c)    setPreferredSize(w, h)    setProperties([path], props)    setRightPadding(right)    setSize(w, h)    setTopPadding(top)    setValue(v)    setViewProvider(v)    setViews(views)    setVisible(b)    toBack( )    toFront( )    toPreferredHeight( )    toPreferredSize( )    toPreferredWidth( )    toView(target)    validate( )    validateMetric( )    vrp( )   


protected void $canceled (m)

Called when the menu or a sub-menu has been canceled (key ESCAPE has been pressed).


Parameters:
protected <zebkit.ui.Menu> $childMenu ( )

Get a sub menu that is shown at the given moment.


Returns: <zebkit.ui.Menu>

a child sub menu. null if no child sub-menu has been shown

protected void $hideMenu ( )

Hide the menu and all visible sub-menus

protected void $showSubMenu (sub)

Show the given sub menu


Parameters:
protected <zebkit.ui.Menu> $topMenu ( )

Get the top menu in the given shown popup menu hierarchy


Returns: <zebkit.ui.Menu>

a top menu

public void addDecorative (c)

Add the specified component as a decorative item of the menu


Parameters:
public void childCompEnabled (e)

Define component events handler.


Parameters:
public <zebkit.ui.Menu> getMenuAt (index)

Get a sub menu for the given menu item


Parameters:
  • index <Integer>

    a menu item index


Returns: <zebkit.ui.Menu>

a sub menu or null if no sub menu is defined for the given menu item

public <zebkit.ui.Panel> getMenuItem (i)

Get a menu item by the given index


Parameters:
  • i <Integer>

    a menu item index


Returns: <zebkit.ui.Panel>

a menu item component

public <Boolean> hasSelectableItems ( )

Test if the menu has a selectable item


Returns: <Boolean>

true if the menu has at least one selectable item

public <Integer> indexMenuOf (menu)

Get the specified sub-menu index


Parameters:
Returns: <Integer>

a sub menu index. -1 if the menu is not a sub menu of the given menu

public <Boolean> isDecorative (i)

Test if the given menu item is a decorative (not selectable) menu item. Menu item is considered as decorative if it has been added with addDecorative(...) method or has "$isDecorative" property set to "true"


Parameters:
  • i <Integer>

    a menu item index


Returns: <Boolean>

true if the given menu item is decorative

public void keyPressed (e)

Override key pressed events handler to handle key events according to context menu component requirements


Parameters:
public void pointerExited (e)

Define pointer exited events handler


Parameters:
public chainable setMenuAt (i, m)

Set the given menu as a sub-menu for the specified menu item


Parameters:
  • i <Integer>

    an index of a menu item for that a sub menu has to be attached

  • m <zebkit.ui.Menu>

    a sub menu to be attached



Inherited attributes:
public zebkit.draw.View bg    public zebkit.draw.View border    public Boolean canHaveFocus    public Object constraints    public Integer height    public Boolean isComboMode    public Boolean isEnabled    public Boolean isValid    public Boolean isVisible    public Array kids    public zebkit.layout.Layout layout    public model    public zebkit.layout.Layoutable parent    public zebkit.util.Position position    protected zebkit.ui.ScrollManager scrollManager    public Integer selectedIndex    public Integer width    public Integer x    public Integer y