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
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 intgetShowButtons()Popup.Reactionhandle(com.badlogic.gdx.scenes.scene2d.Event e, Popup popup)ShowsonshowButtonsclick and menu key press.voidsetShowButtons(int showButtons)intshowNotOn(int button)intshowOn(int button)Methods inherited from class net.dermetfan.gdx.scenes.scene2d.ui.Popup.Behavior.Adapter
hide, showMethods 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 callshowOn(int)with
-
-
Method Details
-
handle
ShowsonshowButtonsclick 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 theEvent.getListenerActor()'s children.- Specified by:
handlein interfacePopup.Behavior- Overrides:
handlein classPopup.Behavior.Adapter- Parameters:
e- the Event to handlepopup- the Popup this Behavior is attached to- Returns:
null
-
showOn
public int showOn(int button)- Parameters:
button- thebuttonon whichclicktoshow- Returns:
- the new value of
showButtons
-
showNotOn
public int showNotOn(int button)- Parameters:
button- thebuttonon whichclicknot toshow- Returns:
- the new value of
showButtons
-
getShowButtons
public int getShowButtons()- Returns:
- the
showButtons
-
setShowButtons
public void setShowButtons(int showButtons)- Parameters:
showButtons- theshowButtonsto set
-