Package gaiasky.util.scene2d
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 ClassesNested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyleNested 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
ConstructorsConstructorDescriptionMenuItem(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) -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) com.badlogic.gdx.scenes.scene2d.ui.ImagegetImage()com.badlogic.gdx.scenes.scene2d.ui.Cell<?> com.badlogic.gdx.scenes.scene2d.ui.LabelgetLabel()com.badlogic.gdx.scenes.scene2d.ui.Cell<?> com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Label> getStyle()com.badlogic.gdx.scenes.scene2d.ui.Cell<com.badlogic.gdx.scenes.scene2d.ui.Image> getText()booleanbooleanisOver()voidsetGenerateDisabledImage(boolean generateDisabledImage) Changes generateDisabledImage property, when true that function is enabled.protected voidsetParent(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.setShortcut(String text) Set shortcuts text displayed in this menu item.protected voidsetStage(com.badlogic.gdx.scenes.scene2d.Stage stage) voidsetStyle(com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle style) voidsetSubMenu(ContextMenu subMenu) voidsetText(CharSequence text) Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
getBackgroundDrawable, getButtonGroup, getClickListener, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, isChecked, isDisabled, isPressed, setChecked, setDisabled, setProgrammaticChangeEvents, toggleMethods 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, topMethods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateMethods 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, toStringMethods 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
-
Constructor Details
-
MenuItem
-
MenuItem
-
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
-
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
-
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
-
setSubMenu
-
setParent
protected void setParent(com.badlogic.gdx.scenes.scene2d.Group parent) - Overrides:
setParentin classcom.badlogic.gdx.scenes.scene2d.Actor
-
getStyle
- Overrides:
getStylein classcom.badlogic.gdx.scenes.scene2d.ui.Button
-
setStyle
public void setStyle(com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle style) - Overrides:
setStylein classcom.badlogic.gdx.scenes.scene2d.ui.Button
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha) - Overrides:
drawin classcom.badlogic.gdx.scenes.scene2d.ui.Button
-
isOver
public boolean isOver()- Overrides:
isOverin classcom.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
-
setShortcut
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- fromInput.Keys.
-
setShortcut
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
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 fromInput.Keysthat 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:
setStagein classcom.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
-
setText
-
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()
-