Class MenuItem

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
com.badlogic.gdx.scenes.scene2d.ui.Table
com.badlogic.gdx.scenes.scene2d.ui.Button
gaiasky.util.scene2d.MenuItem
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.utils.Cullable, com.badlogic.gdx.scenes.scene2d.utils.Disableable, com.badlogic.gdx.scenes.scene2d.utils.Layout

public class MenuItem extends com.badlogic.gdx.scenes.scene2d.ui.Button
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button

    com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle

    Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    com.badlogic.gdx.scenes.scene2d.ui.Table.Debug, com.badlogic.gdx.scenes.scene2d.ui.Table.DebugRect
  • Field Summary

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    backgroundBottom, backgroundLeft, backgroundRight, backgroundTop, debugActorColor, debugCellColor, debugTableColor
  • Constructor Summary

    Constructors
    Constructor
    Description
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, MenuItem.MenuItemStyle style)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, String styleName)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, MenuItem.MenuItemStyle style)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, String styleName)
     
    MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
     
    com.badlogic.gdx.scenes.scene2d.ui.Image
     
    com.badlogic.gdx.scenes.scene2d.ui.Cell<?>
     
    com.badlogic.gdx.scenes.scene2d.ui.Label
     
    com.badlogic.gdx.scenes.scene2d.ui.Cell<?>
     
     
    com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Label>
     
     
     
    com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Image>
     
     
    boolean
     
    boolean
     
    void
    setGenerateDisabledImage(boolean generateDisabledImage)
    Changes generateDisabledImage property, when true that function is enabled.
    protected void
    setParent(com.badlogic.gdx.scenes.scene2d.Group parent)
     
    setShortcut(int keycode)
    Set shortcuts text displayed in this menu item.
    setShortcut(int... keycodes)
    Creates platform dependent shortcut text.
    Set shortcuts text displayed in this menu item.
    protected void
    setStage(com.badlogic.gdx.scenes.scene2d.Stage stage)
     
    void
    setStyle(com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle style)
     
    void
     
    void
     

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button

    getBackgroundDrawable, getButtonGroup, getClickListener, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, isChecked, isDisabled, isPressed, setChecked, setDisabled, setProgrammaticChangeEvents, toggle

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table

    add, add, add, add, add, add, add, align, background, background, bottom, center, clearChildren, clip, clip, columnDefaults, debug, debug, debugActor, debugAll, debugCell, debugTable, defaults, drawBackground, drawDebug, drawDebugBounds, getAlign, getBackground, getCell, getCells, getClip, getColumnMinWidth, getColumnPrefWidth, getColumns, getColumnWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getRow, getRowHeight, getRowMinHeight, getRowPrefHeight, getRows, getSkin, getTableDebug, hit, invalidate, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, removeActor, removeActor, removeActorAt, reset, right, row, setBackground, setBackground, setClip, setDebug, setRound, setSkin, stack, top

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup

    childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group

    act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, clear, clearChildren, computeTransform, drawChildren, drawDebugChildren, findActor, getChild, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setCullingArea, setDebug, setTransform, swapActor, swapActor, toString

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, String styleName)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, String styleName)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener changeListener)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, String styleName)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.ui.Image image, MenuItem.MenuItemStyle style)
    • MenuItem

      public MenuItem(String text, com.badlogic.gdx.scenes.scene2d.ui.Skin skin, com.badlogic.gdx.scenes.scene2d.utils.Drawable drawable, MenuItem.MenuItemStyle style)
  • Method Details

    • getSubMenu

      public ContextMenu getSubMenu()
    • setSubMenu

      public void setSubMenu(ContextMenu subMenu)
    • setParent

      protected void setParent(com.badlogic.gdx.scenes.scene2d.Group parent)
      Overrides:
      setParent in class com.badlogic.gdx.scenes.scene2d.Actor
    • getStyle

      public MenuItem.MenuItemStyle getStyle()
      Overrides:
      getStyle in class com.badlogic.gdx.scenes.scene2d.ui.Button
    • setStyle

      public void setStyle(com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle style)
      Overrides:
      setStyle in class com.badlogic.gdx.scenes.scene2d.ui.Button
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Overrides:
      draw in class com.badlogic.gdx.scenes.scene2d.ui.Button
    • isOver

      public boolean isOver()
      Overrides:
      isOver in class com.badlogic.gdx.scenes.scene2d.ui.Button
    • isGenerateDisabledImage

      public boolean isGenerateDisabledImage()
    • setGenerateDisabledImage

      public void setGenerateDisabledImage(boolean generateDisabledImage)
      Changes generateDisabledImage property, when true that function is enabled. When it is enabled and this MenuItem is disabled then image color will be changed to gray meaning that it is disabled, by default it is enabled.
    • getShortcut

      public CharSequence getShortcut()
    • setShortcut

      public MenuItem setShortcut(int keycode)
      Set shortcuts text displayed in this menu item. This DOES NOT set actual hot key for this menu item, it only makes shortcut text visible in item.
      Parameters:
      keycode - from Input.Keys.
    • setShortcut

      public MenuItem setShortcut(String text)
      Set shortcuts text displayed in this menu item. This DOES NOT set actual hot key for this menu item, it only makes shortcut text visible in item.
      Parameters:
      text - text that will be displayed
      Returns:
      this object for the purpose of chaining methods
    • setShortcut

      public MenuItem setShortcut(int... keycodes)
      Creates platform dependent shortcut text. Converts int keycodes to String text. Eg. Keys.CONTROL_LEFT, Keys.SHIFT_LEFT, Keys.F5 will be converted to Ctrl+Shift+F5 on Windows and Linux, and to ⌘⇧F5 on Mac.

      CONTROL_LEFT and CONTROL_RIGHT are mapped to Ctrl. The same goes for Alt (ALT_LEFT, ALT_RIGHT) and Shift (SHIFT_LEFT, SHIFT_RIGHT).

      This DOES NOT set actual hot key for this menu item, it only makes shortcut text visible in item.

      Parameters:
      keycodes - keycodes from Input.Keys that are used to create shortcut text
      Returns:
      this object for the purpose of chaining methods
    • setStage

      protected void setStage(com.badlogic.gdx.scenes.scene2d.Stage stage)
      Overrides:
      setStage in class com.badlogic.gdx.scenes.scene2d.Group
    • getImage

      public com.badlogic.gdx.scenes.scene2d.ui.Image getImage()
    • getImageCell

      public com.badlogic.gdx.scenes.scene2d.ui.Cell<?> getImageCell()
    • getLabel

      public com.badlogic.gdx.scenes.scene2d.ui.Label getLabel()
    • getLabelCell

      public com.badlogic.gdx.scenes.scene2d.ui.Cell<?> getLabelCell()
    • getText

      public CharSequence getText()
    • setText

      public void setText(CharSequence text)
    • getSubMenuIconCell

      public com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Image> getSubMenuIconCell()
    • getShortcutCell

      public com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Label> getShortcutCell()