Class ShortcutsItem

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class ShortcutsItem extends GObject

An object representing an individual shortcut in ShortcutsSection.

A shortcut has a title, an optional subtitle, and an accelerator.

Accelerator must be specified in the format ShortcutLabel accepts.

Alternatively, the ShortcutsItem:action-name property can be used to automatically get accelerator associated with the specified action, as set via Application#setAccelsForAction.

If both are specified, the accelerator will be used if the action couldn't be found or doesn't have an accelerator associated for it.

If ShortcutsItem:direction is set, the shortcut will only be displayed for the specified text direction. This allows to display different shortcuts for different text directions.

Since:
1.8
  • Constructor Details

    • ShortcutsItem

      public ShortcutsItem(MemorySegment address)
      Create a ShortcutsItem instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ShortcutsItem

      public ShortcutsItem(String title, String accelerator)
      Creates a new AdwShortcutsItem with title and accelerator.
      Parameters:
      title - the shortcut title
      accelerator - the shortcut accelerator
      Since:
      1.8
    • ShortcutsItem

      public ShortcutsItem()
      Create a new ShortcutsItem.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ShortcutsItem class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ShortcutsItem asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • fromAction

      public static ShortcutsItem fromAction(String title, String actionName)
      Creates a new AdwShortcutsItem with title and actionName.
      Parameters:
      title - the shortcut title
      actionName - the shortcut action name
      Returns:
      the newly created AdwShortcutsItem
      Since:
      1.8
    • getAccelerator

      public String getAccelerator()
      Gets the accelerator of self.
      Returns:
      the accelerator
      Since:
      1.8
    • getActionName

      public String getActionName()
      Gets the action name to get the accelerator from.
      Returns:
      the action name
      Since:
      1.8
    • getDirection

      public TextDirection getDirection()
      Gets the direction of self.
      Returns:
      the shortcut direction
      Since:
      1.8
    • getSubtitle

      public String getSubtitle()
      Gets the subtitle of self.
      Returns:
      the subtitle
      Since:
      1.8
    • getTitle

      public String getTitle()
      Gets the title of self.
      Returns:
      the title
      Since:
      1.8
    • setAccelerator

      public void setAccelerator(String accelerator)

      Sets the accelerator of self.

      accelerator must be in the format ShortcutLabel accepts.

      Parameters:
      accelerator - the accelerator to use
      Since:
      1.8
    • setActionName

      public void setActionName(String actionName)
      Sets the action name to get the accelerator from.
      Parameters:
      actionName - the action name to use
      Since:
      1.8
    • setDirection

      public void setDirection(TextDirection direction)

      Sets the direction of self.

      If set to Gtk.TextDirection.ltr or Gtk.TextDirection.rtl, the shortcut will only be displayed for this direction.

      Parameters:
      direction - the shortcut direction
      Since:
      1.8
    • setSubtitle

      public void setSubtitle(String subtitle)
      Sets the subtitle of self.
      Parameters:
      subtitle - the subtitle to use
      Since:
      1.8
    • setTitle

      public void setTitle(String title)
      Sets the title of self.
      Parameters:
      title - the title to use
      Since:
      1.8
    • builder

      public static ShortcutsItem.Builder<? extends ShortcutsItem.Builder> builder()
      A ShortcutsItem.Builder object constructs a ShortcutsItem with the specified properties. Use the various set...() methods to set properties, and finish construction with ShortcutsItem.Builder.build().
      Returns:
      the builder object