Package snap.view

Class MenuBar

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class MenuBar extends ParentView
A View to display menus in a menu bar.
  • Field Details

    • DEFAULT_MENU_BAR_PADDING

      public static Insets DEFAULT_MENU_BAR_PADDING
  • Constructor Details

    • MenuBar

      public MenuBar()
      Constructor.
  • Method Details

    • getMenus

      public Menu[] getMenus()
      Returns the child menus.
    • addMenu

      public void addMenu(Menu aMenu)
      Adds a Menu.
    • removeMenu

      public View removeMenu(int anIndex)
      Remove's the child at the given index from this node's children list.
    • removeMenu

      public int removeMenu(View aChild)
      Removes the given menu from this node's children list.
    • getMenuShowing

      public Menu getMenuShowing()
      Returns the menu showing (or null).
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Override to handle accelerators.
      Overrides:
      processEvent in class View
    • getMatchingMenuItem

      public MenuItem getMatchingMenuItem(MenuItem aMenuItem, ViewEvent anEvent)
      Returns a matching menu item.
    • paintBack

      protected void paintBack(Painter aPntr)
      Paints background.
      Overrides:
      paintBack in class View
    • getMinHeightImpl

      protected double getMinHeightImpl()
      Returns the preferred height.
      Overrides:
      getMinHeightImpl in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Layout children.
      Overrides:
      layoutImpl in class ParentView
    • getDefaultFont

      public Font getDefaultFont()
      Returns the default font.
      Overrides:
      getDefaultFont in class View
    • toXMLChildren

      protected void toXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML archival of children.
      Overrides:
      toXMLChildren in class ParentView
    • fromXMLChildren

      protected void fromXMLChildren(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival for shape children.
      Overrides:
      fromXMLChildren in class ParentView
    • createMenuBarView

      public static ColView createMenuBarView(MenuBar aMenuBar, View aView)
      Creates a ColView holding given MenuBar and content view with a Key EventListener to send shortcut keys to MenuBar.