Class BoxLayout

All Implemented Interfaces:
Orientable, Proxy

@Generated("org.javagi.JavaGI") public class BoxLayout extends LayoutManager implements Orientable

Arranges children in a single row or column.

Whether it is a row or column depends on the value of its Gtk.Orientable:orientation property. Within the other dimension all children all allocated the same size. The GtkBoxLayout will respect the Gtk.Widget:halign and Gtk.Widget:valign properties of each child widget.

If you want all children to be assigned the same size, you can use the Gtk.BoxLayout:homogeneous property.

If you want to specify the amount of space placed between each child, you can use the Gtk.BoxLayout:spacing property.

  • Constructor Details

    • BoxLayout

      public BoxLayout(MemorySegment address)
      Create a BoxLayout instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • BoxLayout

      public BoxLayout(Orientation orientation)
      Creates a new GtkBoxLayout.
      Parameters:
      orientation - the orientation for the new layout
    • BoxLayout

      public BoxLayout()
      Create a new BoxLayout.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the BoxLayout class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected BoxLayout asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class LayoutManager
      Returns:
      the instance as if it were its parent type
    • getBaselineChild

      public int getBaselineChild()
      Gets the value set by gtk_box_layout_set_baseline_child().
      Returns:
      the index of the child that determines the baseline in vertical layout, or -1
      Since:
      4.12
    • getBaselinePosition

      public BaselinePosition getBaselinePosition()
      Gets the value set by gtk_box_layout_set_baseline_position().
      Returns:
      the baseline position
    • getHomogeneous

      public boolean getHomogeneous()
      Returns whether the layout is set to be homogeneous.
      Returns:
      true if the layout is homogeneous
    • getSpacing

      public int getSpacing()
      Returns the space that this BoxLayout puts between children.
      Returns:
      the spacing of the layout
    • setBaselineChild

      public void setBaselineChild(int child)
      Sets the index of the child that determines the baseline in vertical layout.
      Parameters:
      child - the child position, or -1
      Since:
      4.12
    • setBaselinePosition

      public void setBaselinePosition(BaselinePosition position)

      Sets the baseline position of a box layout.

      The baseline position affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then the given position is used to allocate the baseline within the extra space available.

      Parameters:
      position - a GtkBaselinePosition
    • setHomogeneous

      public void setHomogeneous(boolean homogeneous)
      Sets whether the box layout will allocate the same size to all children.
      Parameters:
      homogeneous - true to set the box layout as homogeneous
    • setSpacing

      public void setSpacing(int spacing)
      Sets how much spacing to put between children.
      Parameters:
      spacing - the spacing to apply between children
    • builder

      public static BoxLayout.Builder<? extends BoxLayout.Builder> builder()
      A BoxLayout.Builder object constructs a BoxLayout with the specified properties. Use the various set...() methods to set properties, and finish construction with BoxLayout.Builder.build().
      Returns:
      the builder object