Class Toggle.Builder<B extends Toggle.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Toggle

public static class Toggle.Builder<B extends Toggle.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
1.7
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Toggle build()
      Finish building the Toggle object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Toggle.
      Overrides:
      build in class GObject.Builder<B extends Toggle.Builder<B>>
      Returns:
      a new instance of Toggle with the properties that were set in the Builder object.
    • setChild

      public B setChild(Widget child)

      The toggle 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 - the value for the child property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setDescription

      public B setDescription(String description)

      The description of the toggle.

      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 value for the description property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.9
    • setEnabled

      public B setEnabled(boolean enabled)
      Whether this toggle is enabled.
      Parameters:
      enabled - the value for the enabled property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setIconName

      public B setIconName(String iconName)

      The toggle icon name.

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

      Parameters:
      iconName - the value for the icon-name property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setLabel

      public B setLabel(String label)

      The toggle 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 - the value for the label property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setName

      public B setName(String name)

      The toggle name.

      Allows accessing the toggle by its name instead of index.

      See ToggleGroup:active-name.

      Parameters:
      name - the value for the name property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setTooltip

      public B setTooltip(String tooltip)

      The tooltip of the toggle.

      The 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 value for the tooltip property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setUseUnderline

      public B setUseUnderline(boolean useUnderline)

      Whether an embedded underline in the label indicates a mnemonic.

      See Toggle:label.

      Parameters:
      useUnderline - the value for the use-underline property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7