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).
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.dermetfan.gdx.scenes.scene2d.ui.Popup.Behavior

    Popup.Behavior.Adapter
  • Constructor Summary

    Constructors
    Constructor Description
    MenuBehavior()  
    MenuBehavior​(int... showButtons)  
  • Method Summary

    Modifier and Type Method Description
    int getShowButtons()  
    Popup.Reaction handle​(com.badlogic.gdx.scenes.scene2d.Event e, Popup popup)
    Shows on showButtons click and menu key press.
    void setShowButtons​(int showButtons)  
    int showNotOn​(int button)  
    int showOn​(int button)  

    Methods inherited from class net.dermetfan.gdx.scenes.scene2d.ui.Popup.Behavior.Adapter

    hide, show

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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