Class Popup.MenuBehavior

java.lang.Object
net.dermetfan.gdx.scenes.scene2d.ui.Popup.Behavior.Adapter
net.dermetfan.gdx.scenes.scene2d.ui.Popup.MenuBehavior
All Implemented Interfaces:
Popup.Behavior
Enclosing class:
Popup<T extends com.badlogic.gdx.scenes.scene2d.Actor>

public static class Popup.MenuBehavior extends Popup.Behavior.Adapter
The behavior of a menu such as a menu bar or context menu. Shows and hides but does not position the popup. Add this to the Popup of the Actor that the user should be able to click. Note that this can only hide on events of other actors if it receives them, so consider adding all your menus to an EventMultiplexer high up in the hierarchy (e.g. added to the Stage).
  • Constructor Details

    • MenuBehavior

      public MenuBehavior()
    • MenuBehavior

      public MenuBehavior(int... showButtons)
      Parameters:
      showButtons - the buttons to call showOn(int) with
  • Method Details

    • handle

      public Popup.Reaction handle(com.badlogic.gdx.scenes.scene2d.Event e, Popup popup)
      Shows on showButtons click and menu key press. Hides on all other clicks, escape key and back key. Note that this will not hide on clicks on other actors except the Event.getListenerActor()'s children.
      Specified by:
      handle in interface Popup.Behavior
      Overrides:
      handle in class Popup.Behavior.Adapter
      Parameters:
      e - the Event to handle
      popup - the Popup this Behavior is attached to
      Returns:
      null
    • showOn

      public int showOn(int button)
      Parameters:
      button - the button on which click to show
      Returns:
      the new value of showButtons
    • showNotOn

      public int showNotOn(int button)
      Parameters:
      button - the button on which click not to show
      Returns:
      the new value of showButtons
    • getShowButtons

      public int getShowButtons()
      Returns:
      the showButtons
    • setShowButtons

      public void setShowButtons(int showButtons)
      Parameters:
      showButtons - the showButtons to set