Class Gutter

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class Gutter extends Widget implements Accessible, Buildable, ConstraintTarget

Gutter object for View.

The GtkSourceGutter object represents the left or right gutter of the text view. It is used by View to draw the line numbers and Marks that might be present on a line. By packing additional GutterRenderer objects in the gutter, you can extend the gutter with your own custom drawings.

To get a GtkSourceGutter, use the View.getGutter(TextWindowType) function.

The gutter works very much the same way as cells rendered in a TreeView. The concept is similar, with the exception that the gutter does not have an underlying TreeModel. The builtin line number renderer is at position ViewGutterPosition.LINES (-30) and the marks renderer is at ViewGutterPosition.MARKS (-20). The gutter sorts the renderers in ascending order, from left to right. So the marks are displayed on the right of the line numbers.

  • Constructor Details

    • Gutter

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

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

    • getType

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

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

      protected Gutter 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 Widget
      Returns:
      the instance as if it were its parent type
    • getView

      public View getView()
    • insert

      public boolean insert(GutterRenderer renderer, int position)
      Insert renderer into the gutter. If renderer is yet unowned then gutter claims its ownership. Otherwise just increases renderer's reference count. renderer cannot be already inserted to another gutter.
      Parameters:
      renderer - a gutter renderer (must inherit from GtkSourceGutterRenderer).
      position - the renderer position.
      Returns:
      true if operation succeeded. Otherwise false.
    • remove

      public void remove(GutterRenderer renderer)
    • reorder

      public void reorder(GutterRenderer renderer, int position)
      Reorders renderer in this Gutter to new position.
      Parameters:
      renderer - a GtkCellRenderer.
      position - the new renderer position.
    • builder

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