Class Svg.Builder<B extends Svg.Builder<B>>

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

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

    • Builder

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

    • build

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

      public B setFeatures(Set<SvgFeatures> features)

      Enabled features for this paintable.

      Note that features have to be set before loading SVG data to take effect.

      Parameters:
      features - the value for the features property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
    • setPlaying

      public B setPlaying(boolean playing)

      Whether the paintable is currently animating its content.

      To set this property, use the Svg.play() and Svg.pause() functions.

      Parameters:
      playing - the value for the playing property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
    • setResource

      public B setResource(String resource)

      Resource to load SVG data from.

      This property is meant to create a paintable from a resource in ui files.

      Parameters:
      resource - the value for the resource property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
    • setState

      public B setState(int state)

      The current state of the renderer.

      This can be a number between 0 and 63.

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

      public B setWeight(double weight)
      If not set to -1, this value overrides the weight used when rendering the paintable.
      Parameters:
      weight - the value for the weight property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
    • setFeatures

      public B setFeatures(SvgFeatures... features)

      Enabled features for this paintable.

      Note that features have to be set before loading SVG data to take effect.

      Parameters:
      features - the value for the features property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
    • onError

      public B onError(Svg.ErrorCallback handler)

      Signals that an error occurred.

      Errors can occur both during parsing and during rendering.

      The expected error values are in the Gtk.SvgError enumeration, context information about the location of parsing errors can be obtained with the various gtk_svg_error functions.

      Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.

      ::: note This signal is emitted in the middle of parsing or rendering, and if you handle it, you must be careful. Logging the errors you receive is fine, but modifying the widget hierarchy or changing the paintable state definitively isn't.

      If in doubt, defer to an idle.
      
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.22
      See Also: