Class WrapBox.Builder<B extends WrapBox.Builder<B>>

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

public static class WrapBox.Builder<B extends WrapBox.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>, Orientable.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 WrapBox build()
      Finish building the WrapBox object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to WrapBox.
      Overrides:
      build in class Widget.Builder<B extends WrapBox.Builder<B>>
      Returns:
      a new instance of WrapBox with the properties that were set in the Builder object.
    • setAlign

      public B setAlign(float align)

      The alignment of the children within each line.

      0 means the children are placed at the start of the line, 1 means they are placed at the end of the line. 0.5 means they are placed in the middle of the line.

      Alignment is only used when WrapBox:justify is set to Adw.JustifyMode.none, or on the last line when the WrapBox:justify-last-line is FALSE.

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

      public B setChildSpacing(int childSpacing)

      The spacing between widgets on the same line.

      See WrapBox:child-spacing-unit.

      Parameters:
      childSpacing - the value for the child-spacing property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setChildSpacingUnit

      public B setChildSpacingUnit(LengthUnit childSpacingUnit)

      The length unit for child spacing.

      Allows the spacing to vary depending on the text scale factor.

      See WrapBox:child-spacing.

      Parameters:
      childSpacingUnit - the value for the child-spacing-unit property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setJustify

      public B setJustify(JustifyMode justify)

      Determines whether and how each complete line should be stretched to fill the entire widget.

      If set to Adw.JustifyMode.fill, each widget in the line will be stretched, keeping consistent spacing, so that the line fills the entire widget.

      If set to Adw.JustifyMode.spread, the spacing between widgets will be increased, keeping widget sizes intact. The first and last widget will be aligned with the beginning and end of the line. If the line only contains a single widget, it will be stretched regardless.

      If set to Adw.JustifyMode.none, the line will not be stretched and the children will be placed together within the line, according to WrapBox:align.

      By default this doesn't affect the last line, as it will be incomplete. Use WrapBox:justify-last-line to justify it as well.

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

      public B setJustifyLastLine(boolean justifyLastLine)

      Whether the last line should be stretched to fill the entire widget.

      See WrapBox:justify.

      Parameters:
      justifyLastLine - the value for the justify-last-line property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setLineHomogeneous

      public B setLineHomogeneous(boolean lineHomogeneous)
      Whether all lines should take the same amount of space.
      Parameters:
      lineHomogeneous - the value for the line-homogeneous property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setLineSpacing

      public B setLineSpacing(int lineSpacing)

      The spacing between lines.

      See WrapBox:line-spacing-unit.

      Parameters:
      lineSpacing - the value for the line-spacing property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setLineSpacingUnit

      public B setLineSpacingUnit(LengthUnit lineSpacingUnit)

      The length unit for line spacing.

      Allows the spacing to vary depending on the text scale factor.

      See WrapBox:line-spacing.

      Parameters:
      lineSpacingUnit - the value for the line-spacing-unit property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setNaturalLineLength

      public B setNaturalLineLength(int naturalLineLength)

      Determines the natural size for each line.

      It should be used to limit the line lengths, for example when used in popovers.

      See WrapBox:natural-line-length-unit.

      Parameters:
      naturalLineLength - the value for the natural-line-length property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setNaturalLineLengthUnit

      public B setNaturalLineLengthUnit(LengthUnit naturalLineLengthUnit)

      The length unit for natural line length.

      Allows the length to vary depending on the text scale factor.

      See WrapBox:natural-line-length.

      Parameters:
      naturalLineLengthUnit - the value for the natural-line-length-unit property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setPackDirection

      public B setPackDirection(PackDirection packDirection)
      The direction children are packed in each line.
      Parameters:
      packDirection - the value for the pack-direction property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setWrapPolicy

      public B setWrapPolicy(WrapPolicy wrapPolicy)

      The policy for line wrapping.

      • If set to Adw.WrapPolicy.natural, the box will wrap to the next line as soon as the previous line cannot fit any more children without shrinking them past their natural size.

      If set to Adw.WrapPolicy.minimum, the box will try to fit as many children into each line as possible, shrinking them down to their minimum size before wrapping to the next line.

      Parameters:
      wrapPolicy - the value for the wrap-policy property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7
    • setWrapReverse

      public B setWrapReverse(boolean wrapReverse)

      Whether wrap direction should be reversed.

      By default, lines wrap downwards in a horizontal box, and towards the end in a vertical box. If set to TRUE, they wrap upwards or towards the start respectively.

      Parameters:
      wrapReverse - the value for the wrap-reverse property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.7