Package tripleplay.ui

Class MenuHost

java.lang.Object
tripleplay.ui.MenuHost

public class MenuHost extends Object
Provides a context for popping up a menu.
  • Field Details

    • TRIGGER_POINT

      public static final Style<MenuHost.TriggerPoint> TRIGGER_POINT
      The point on an element where menus should be placed, subject to boundary constraints. This is only used if the element is set to a MenuHost.Pop.trigger. By default, uses the top left corner of the trigger.
    • rootLayer

      public final GroupLayer rootLayer
      The root layer that will contain all menus that pop up. It should normally be close to the top of the hierarchy so that it draws on top of everything.
    • iface

      public final Interface iface
      The interface we use to create the menu's root and do animation.
  • Constructor Details

    • MenuHost

      public MenuHost(Interface iface, Elements<?> root)
      Creates a menu host using the given values. The root layer is set to the layer of the given root and the stylesheet to its stylesheet.
    • MenuHost

      public MenuHost(Interface iface, GroupLayer rootLayer)
      Creates a new menu host using the given values. The stylesheet is set to an empty one and can be changed via the setStylesheet(Stylesheet) method.
  • Method Details

    • relative

      public static MenuHost.TriggerPoint relative(BoxPoint location)
      Gets a trigger point relative to an element using the given box point.
    • absolute

      public static MenuHost.TriggerPoint absolute(float x, float y)
      Gets a fixed trigger point for the given screen coordinates.
    • pointer

      public static MenuHost.TriggerPoint pointer()
      Gets a trigger point exactly under the pointer position.
    • relayEvents

      public static react.Closeable relayEvents(Layer from, Menu to)
    • setStylesheet

      public MenuHost setStylesheet(Stylesheet sheet)
      Sets the stylesheet for menus popped by this host.
    • deactivate

      public void deactivate()
      Deactivates the current menu, if any is showing.
    • setScreenArea

      public void setScreenArea(pythagoras.f.IRectangle screenArea)
      Sets the area to which menus should be confined when there isn't any other associated bounds.
    • getScreenArea

      public pythagoras.f.IRectangle getScreenArea()
      Gets the area to which menus should be confined when there isn't any other associated bounds. By default, the entire available area is used, as given by Graphics.
    • popup

      public void popup(MenuHost.Pop pop)
      Displays the menu specified by the given pop, incorporating all the configured attributes therein.
    • activePop

      public MenuHost.Pop activePop()
    • active

      public Menu active()