Class Toggle

All Implemented Interfaces:
Proxy

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

A toggle within ToggleGroup.

AdwToggle can optionally have a name, set with Toggle:name. If the name is set, ToggleGroup:active-name can be used to access toggles instead of index.

Since:
1.7
  • Constructor Details

    • Toggle

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

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

    • getType

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

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

      protected Toggle 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
    • getChild

      public @Nullable Widget getChild()
      Gets the child widget of self.
      Returns:
      the toggle child
      Since:
      1.7
    • getDescription

      public String getDescription()
      Gets the description of self.
      Returns:
      the toggle description
      Since:
      1.9
    • getEnabled

      public boolean getEnabled()
      Gets whether this Toggle is enabled.
      Returns:
      whether the toggle is enabled
      Since:
      1.7
    • getIconName

      public @Nullable String getIconName()
      Gets the icon name of self.
      Returns:
      the toggle icon name
      Since:
      1.7
    • getIndex

      public int getIndex()
      Gets the index of this Toggle within its toggle group.
      Returns:
      the index, or Gtk.INVALID_LIST_POSITION if it's not in a group
      Since:
      1.7
    • getLabel

      public @Nullable String getLabel()
      Gets the label of self.
      Returns:
      the toggle label
      Since:
      1.7
    • getName

      public String getName()
      Gets the name of self.
      Returns:
      the toggle name
      Since:
      1.7
    • getTooltip

      public String getTooltip()
      Gets the tooltip of self.
      Returns:
      the toggle tooltip
      Since:
      1.7
    • getUseUnderline

      public boolean getUseUnderline()
      Gets whether this Toggle uses underlines.
      Returns:
      whether the toggle uses underlines
      Since:
      1.7
    • setChild

      public void setChild(@Nullable Widget child)

      Sets the child of this Toggle to child.

      When the child is set, icon and label are not displayed.

      It's recommended to still set the label, as it can still be used by the screen reader.

      Parameters:
      child - a child widget
      Since:
      1.7
    • setDescription

      public void setDescription(String description)

      Sets the description of this Toggle to description.

      The description will be read out when using screen reader. If not set, Toggle:tooltip will be used instead.

      See Gtk.AccessibleProperty.description.

      Parameters:
      description - the description
      Since:
      1.9
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether this Toggle is enabled.
      Parameters:
      enabled - whether the toggle should be enbled
      Since:
      1.7
    • setIconName

      public void setIconName(@Nullable String iconName)

      Sets the icon name of this Toggle to iconName.

      The icon will be displayed alone or next to the label, unless Toggle:child is set.

      Parameters:
      iconName - the icon name
      Since:
      1.7
    • setLabel

      public void setLabel(@Nullable String label)

      Sets the label of this Toggle to label.

      The label will be displayed alone or next to the icon, unless Toggle:child is set, but will still be read out by the screen reader.

      Parameters:
      label - a label
      Since:
      1.7
    • setName

      public void setName(@Nullable String name)

      Sets the name of this Toggle to name.

      Allows accessing this Toggle by its name instead of index.

      See ToggleGroup:active-name.

      Parameters:
      name - a name
      Since:
      1.7
    • setTooltip

      public void setTooltip(String tooltip)

      Sets the tooltip of this Toggle to tooltip.

      tooltip can be marked up with the Pango text markup language.

      Tooltip text will also be used as accessible description. Use Toggle:description to set it separately.

      Parameters:
      tooltip - the tooltip
      Since:
      1.7
    • setUseUnderline

      public void setUseUnderline(boolean useUnderline)

      Sets whether an embedded underline in the label indicates a mnemonic.

      See Toggle:label.

      Parameters:
      useUnderline - whether an underline in the label indicates a mnemonic
      Since:
      1.7
    • builder

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