Class ShortcutsDialog

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, ShortcutManager, Proxy

@Generated("org.javagi.JavaGI") public final class ShortcutsDialog extends Dialog implements Accessible, Buildable, ConstraintTarget, ShortcutManager

A dialog that displays application's keyboard shortcuts.

shortcuts-dialog

Shortcuts are grouped into sections, represented by ShortcutsSection objects. Each section has one or more items, represented by ShortcutsItem objects.

To add a section to the dialog, use add(ShortcutsSection), or add it as a child when using UI files.

Sections without titles can be used to further subdivide each section into groups.

Example of an AdwShortcutsDialog UI definition:

<object class="AdwShortcutsDialog" id="shortcuts_dialog">
  <child>
    <object class="AdwShortcutsSection">
      <property name="title" translatable="yes">General</property>
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Open Menu</property>
          <property name="accelerator">F10</property>
        </object>
      </child>
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Quit</property>
          <property name="action-name">app.quit</property>
        </object>
      </child>
    </object>
  </child>
  <child>
    <object class="AdwShortcutsSection">
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Move Tab Left</property>
          <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Up</property>
          <property name="direction">ltr</property>
        </object>
      </child>
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Move Tab Right</property>
          <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Down</property>
          <property name="direction">ltr</property>
        </object>
      </child>
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Move Tab Right</property>
          <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Up</property>
          <property name="direction">rtl</property>
        </object>
      </child>
      <child>
        <object class="AdwShortcutsItem">
          <property name="title" translatable="yes">Move Tab Left</property>
          <property name="accelerator">&lt;Shift&gt;&lt;Ctrl&gt;Page_Down</property>
          <property name="direction">rtl</property>
        </object>
      </child>
    </object>
  </child>
</object>

If the app.quit action has the CtrlQ accelerator associated with it, the result will look as follows:

shortcuts-dialog-example

The recommended way to use AdwShortcutsDialog is via Application's automatic resource loading.

See also: ShortcutLabel.

Since:
1.8
  • Constructor Details

    • ShortcutsDialog

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

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

    • getType

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

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

      protected ShortcutsDialog 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 Dialog
      Returns:
      the instance as if it were its parent type
    • add

      public void add(ShortcutsSection section)
      Adds section to self.
      Parameters:
      section - the section to add
      Since:
      1.8
    • builder

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