Class Inscription.Builder<B extends Inscription.Builder<B>>

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

public static class Inscription.Builder<B extends Inscription.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
4.8
  • Constructor Details

    • Builder

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

    • build

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

      public B setAttributes(AttrList attributes)
      A list of style attributes to apply to the text of the inscription.
      Parameters:
      attributes - the value for the attributes property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setMarkup

      public B setMarkup(String markup)

      Utility property that sets both the Gtk.Inscription:text and Gtk.Inscription:attributes properties, mainly intended for use in GtkBuilder ui files to ease translation support and bindings.

      This function uses Pango#parseMarkup to parse the markup into text and attributes. The markup must be valid. If you cannot ensure that, consider using Pango#parseMarkup and setting the two properties yourself.

      Parameters:
      markup - the value for the markup property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setMinChars

      public B setMinChars(int minChars)

      The number of characters that should fit into the inscription at minimum.

      This influences the requested width, not the width actually given to the widget, which might turn out to be larger.

      Note that this is an approximate character width, so some characters might be wider and some might be thinner, so do not expect the number of characters to exactly match.

      If you set this property to 0, the inscription will not request any width at all and its width will be determined entirely by its surroundings.

      Parameters:
      minChars - the value for the min-chars property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setMinLines

      public B setMinLines(int minLines)

      The number of lines that should fit into the inscription at minimum.

      This influences the requested height, not the height actually given to the widget, which might turn out to be larger.

      Note that this is an approximate line height, so if the text uses things like fancy Unicode or attribute that influence the height, the text might not fit.

      If you set this property to 0, the inscription will not request any height at all and its height will be determined entirely by its surroundings.

      Parameters:
      minLines - the value for the min-lines property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setNatChars

      public B setNatChars(int natChars)

      The number of characters that should ideally fit into the inscription.

      This influences the requested width, not the width actually given to the widget. The widget might turn out larger as well as smaller.

      If this property is set to a value smaller than Gtk.Inscription:min-chars, that value will be used. In particular, for the default value of 0, this will always be the case.

      Parameters:
      natChars - the value for the nat-chars property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setNatLines

      public B setNatLines(int natLines)

      The number of lines that should ideally fit into the inscription.

      This influences the requested height, not the height actually given to the widget. The widget might turn out larger as well as smaller.

      If this property is set to a value smaller than Gtk.Inscription:min-lines, that value will be used. In particular, for the default value of 0, this will always be the case.

      Parameters:
      natLines - the value for the nat-lines property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setText

      public B setText(String text)
      The displayed text.
      Parameters:
      text - the value for the text property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setTextOverflow

      public B setTextOverflow(InscriptionOverflow textOverflow)
      The overflow method to use for the text.
      Parameters:
      textOverflow - the value for the text-overflow property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setWrapMode

      public B setWrapMode(WrapMode wrapMode)

      Controls how the line wrapping is done.

      Note that unlike GtkLabel, the default here is WrapMode.WORD_CHAR.

      Parameters:
      wrapMode - the value for the wrap-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setXalign

      public B setXalign(float xalign)

      The horizontal alignment of the text inside the allocated size.

      Compare this to Gtk.Widget:halign, which determines how the inscription's size allocation is positioned in the available space.

      Parameters:
      xalign - the value for the xalign property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8
    • setYalign

      public B setYalign(float yalign)

      The vertical alignment of the text inside the allocated size.

      Compare this to Gtk.Widget:valign, which determines how the inscription's size allocation is positioned in the available space.

      Parameters:
      yalign - the value for the yalign property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.8