Package tripleplay.ui
Class MenuItem
An item in a menu. This overrides clicking with a two phase click behavior: clicking an
unselected menu item selects it; clicking a selected menu item triggers it.
-
Nested Class Summary
Nested classes/interfaces inherited from class tripleplay.ui.Element
Element.Take
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
click()
Programmatically triggers a click of this element.react.SignalView<MenuItem>
clicked()
A signal that is emitted when this element is clicked.hideText()
Sets the menu item to only use an icon and no tex.Sets the menu item to show its text when the item is selectedreact.Value<Boolean>
selected()
A value that reflects the current selection state and is updated when said state changes.setPreferredSize
(float wid, float hei) Sets the preferred size of the menu item.showText
(MenuItem.ShowText value) Sets the text display mode for this menu item.react.SignalView<MenuItem>
Gets the signal that dispatches when a menu item is triggered.Methods inherited from class tripleplay.ui.Element
addStyles, addStyles, bindEnabled, bindVisible, bounds, constraint, enabledSlot, hierarchyChanged, isAdded, isEnabled, isShowing, isVisible, location, parent, setConstraint, setEnabled, setStyles, setStyles, setVisible, size, styles, visibleSlot, x, y
-
Field Details
-
text
The text shown. -
icon
The icon shown.
-
-
Constructor Details
-
MenuItem
Creates a new menu item with the given label. -
MenuItem
Creates a new menu item with the given label and icon.
-
-
Method Details
-
showText
Sets the text display mode for this menu item. -
hideTextWhenInactive
Sets the menu item to show its text when the item is selected -
hideText
Sets the menu item to only use an icon and no tex. This is useful for layouts that show the text of the selected item in a central location. -
setPreferredSize
Sets the preferred size of the menu item. -
triggered
Gets the signal that dispatches when a menu item is triggered. Most callers will just connect toMenu.itemTriggered()
. -
selected
Description copied from interface:Togglable
A value that reflects the current selection state and is updated when said state changes. -
clicked
Description copied from interface:Clickable
A signal that is emitted when this element is clicked. -
click
public void click()Description copied from interface:Clickable
Programmatically triggers a click of this element.
-