Class Switch.Builder<B extends Switch.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, Actionable.Builder<B>, BuilderInterface
Enclosing class:
Switch

public static class Switch.Builder<B extends Switch.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>, Actionable.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

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

    • build

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

      public B setActive(boolean active)
      Whether the GtkSwitch widget is in its on or off state.
      Parameters:
      active - the value for the active property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setState

      public B setState(boolean state)

      The backend state that is controlled by the switch.

      Applications should usually set the Gtk.Switch:active property, except when indicating a change to the backend state which occurs separately from the user's interaction.

      See Gtk.Switch::state-set for details.

      Parameters:
      state - the value for the state property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(Switch.ActivateCallback handler)

      Emitted to animate the switch.

      Applications should never connect to this signal, but use the Gtk.Switch:active property.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onStateSet

      public B onStateSet(Switch.StateSetCallback handler)

      Emitted to change the underlying state.

      The ::state-set signal is emitted when the user changes the switch position. The default handler calls Switch.setState(boolean) with the value of state.

      To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call Switch.setState(boolean) when the underlying state change is complete. The signal handler should return true to prevent the default handler from running.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: