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 int
getShowButtons()
Popup.Reaction
handle(com.badlogic.gdx.scenes.scene2d.Event e, Popup popup)
Shows
onshowButtons
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 callshowOn(int)
with
-
-
Method Details
-
handle
Shows
onshowButtons
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 theEvent.getListenerActor()
's children.- Specified by:
handle
in interfacePopup.Behavior
- Overrides:
handle
in 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
- thebutton
on whichclick
toshow
- Returns:
- the new value of
showButtons
-
showNotOn
public int showNotOn(int button)- Parameters:
button
- thebutton
on whichclick
not toshow
- Returns:
- the new value of
showButtons
-
getShowButtons
public int getShowButtons()- Returns:
- the
showButtons
-
setShowButtons
public void setShowButtons(int showButtons)- Parameters:
showButtons
- theshowButtons
to set
-