Package limn.backend.spi
Record Class MenuRow
java.lang.Object
java.lang.Record
limn.backend.spi.MenuRow
- Record Components:
id- the row's number in this reading; positivekind- what the row islabel- the row's text, as the application wrote it: a backend escapes what its system reads as a marker; empty for a separatorenabled- whether it can be chosen; a submenu with no rows is not enabledchecked- for aMenuRow.Kind.CHECK, whether it is checkedmnemonic- the access letter, uppercased, or 0children- a submenu's rows; empty for any other kindicon- the picture before the label, ornullshortcutKey- the name of the accelerator's key with no modifier, asQorF5; empty for no accelerator. A system shows it beside the label, and where the system runs a menu's keys while the menu is open, it chooses the rowshortcutModifiers- the accelerator'sKeysmodifier bitsedit- the editing command the row is, ornull: such a row is enabled and chosen through the window that has the keyboard, byWindowInput.canEditFocused(limn.scene.EditCommand)andWindowInput.editFocused(limn.scene.EditCommand), andenabledsays only whether the application disabled the itemmnemonicIndex- where inlabelthe access letter is, as the text marked it, or-1for the first occurrence ofmnemonic
public record MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children, @Nullable Icon icon, String shortcutKey, int shortcutModifiers, @Nullable EditCommand edit, int mnemonicIndex)
extends Record
One row of a menu the system draws (a tray's, a menu bar's) as a backend is handed it: what the three systems can draw of a menu's
item, and a number to say back when the user chooses it.
The rows of one reading are numbered from 1 in the order they are read, a submenu's rows after their parent, so the same menu read twice has the same numbers. A number means nothing once the menu has been read again.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children) A row with no picture and no accelerator.MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children, @Nullable Icon icon, String shortcutKey, int shortcutModifiers) A row that is no editing command.MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children, @Nullable Icon icon, String shortcutKey, int shortcutModifiers, @Nullable EditCommand edit, int mnemonicIndex) Creates an instance of aMenuRowrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchecked()Returns the value of thecheckedrecord component.children()Returns the value of thechildrenrecord component.@Nullable EditCommandedit()Returns the value of theeditrecord component.booleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Iconicon()Returns the value of theiconrecord component.intid()Returns the value of theidrecord component.kind()Returns the value of thekindrecord component.label()Returns the value of thelabelrecord component.charmnemonic()Returns the value of themnemonicrecord component.intWhere the access letter goes in the label: the marked place when the text marked one, else the first occurrence of the letter, else-1.intReturns the value of themnemonicIndexrecord component.Returns the value of theshortcutKeyrecord component.intReturns the value of theshortcutModifiersrecord component.final StringtoString()Returns a string representation of this record class.withMnemonicIndex(int index) This row with its access letter where the text marked it:indexinto the label.
-
Constructor Details
-
MenuRow
public MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children, @Nullable Icon icon, String shortcutKey, int shortcutModifiers) A row that is no editing command. -
MenuRow
public MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children) A row with no picture and no accelerator. -
MenuRow
public MenuRow(int id, MenuRow.Kind kind, String label, boolean enabled, boolean checked, char mnemonic, List<MenuRow> children, @Nullable Icon icon, String shortcutKey, int shortcutModifiers, @Nullable EditCommand edit, int mnemonicIndex) Creates an instance of aMenuRowrecord class.- Parameters:
id- the value for theidrecord componentkind- the value for thekindrecord componentlabel- the value for thelabelrecord componentenabled- the value for theenabledrecord componentchecked- the value for thecheckedrecord componentmnemonic- the value for themnemonicrecord componentchildren- the value for thechildrenrecord componenticon- the value for theiconrecord componentshortcutKey- the value for theshortcutKeyrecord componentshortcutModifiers- the value for theshortcutModifiersrecord componentedit- the value for theeditrecord componentmnemonicIndex- the value for themnemonicIndexrecord component
-
-
Method Details
-
withMnemonicIndex
This row with its access letter where the text marked it:indexinto the label. -
mnemonicAt
public int mnemonicAt()Where the access letter goes in the label: the marked place when the text marked one, else the first occurrence of the letter, else-1. The one answer each system's menu reads. -
shortcutText
- Returns:
- the accelerator as the words a menu shows where it shows words,
Ctrl+Shift+S, or""for none
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
checked
public boolean checked()Returns the value of thecheckedrecord component.- Returns:
- the value of the
checkedrecord component
-
mnemonic
public char mnemonic()Returns the value of themnemonicrecord component.- Returns:
- the value of the
mnemonicrecord component
-
children
Returns the value of thechildrenrecord component.- Returns:
- the value of the
childrenrecord component
-
icon
Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-
shortcutKey
Returns the value of theshortcutKeyrecord component.- Returns:
- the value of the
shortcutKeyrecord component
-
shortcutModifiers
public int shortcutModifiers()Returns the value of theshortcutModifiersrecord component.- Returns:
- the value of the
shortcutModifiersrecord component
-
edit
Returns the value of theeditrecord component.- Returns:
- the value of the
editrecord component
-
mnemonicIndex
public int mnemonicIndex()Returns the value of themnemonicIndexrecord component.- Returns:
- the value of the
mnemonicIndexrecord component
-