Class GutterLines

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class GutterLines extends GObject

Collected information about visible lines.

The GtkSourceGutterLines object is used to collect information about visible lines.

Use this from your GutterRenderer::query-data to collect the necessary information on visible lines. Doing so reduces the number of passes through the text btree allowing GtkSourceView to reach more frames-per-second while performing kinetic scrolling.

  • Constructor Details

    • GutterLines

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

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

    • getType

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

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

      protected GutterLines 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 GObject
      Returns:
      the instance as if it were its parent type
    • addClass

      public void addClass(int line, String name)

      Adds the class name to line.

      name will be converted to a GLib.Quark as part of this process. A faster version of this function is available via addQclass(int, Quark) for situations where the GLib.Quark is known ahead of time.

      Parameters:
      line - a line number starting from zero
      name - a class name
    • addQclass

      public void addQclass(int line, Quark qname)

      Adds the class denoted by qname to line.

      You may check if a line has qname by calling hasQclass(int, Quark).

      You can remove qname by calling removeQclass(int, Quark).

      Parameters:
      line - a line number starting from zero
      qname - a class name as a GQuark
    • getBuffer

      public TextBuffer getBuffer()
      Gets the TextBuffer that the GtkSourceGutterLines represents.
      Returns:
      a GtkTextBuffer
    • getFirst

      public int getFirst()
      Gets the line number (starting from 0) for the first line that is user visible.
      Returns:
      a line number starting from 0
    • getIterAtLine

      public void getIterAtLine(TextIter iter, int line)
      Gets a GtkTextIter for the current buffer at line
      Parameters:
      iter - a location for a GtkTextIter
      line - the line number
    • getLast

      public int getLast()
      Gets the line number (starting from 0) for the last line that is user visible.
      Returns:
      a line number starting from 0
    • getLineExtent

      public void getLineExtent(int line, GutterRendererAlignmentMode mode, Out<Double> y, Out<Double> height)

      Gets the Y range for a line based on mode.

      The value for y is relative to the renderers widget coordinates.

      Parameters:
      line - a line number starting from zero
      mode - a GtkSourceGutterRendererAlignmentMode
      y - a location for the Y position in widget coordinates
      height - the line height based on mode
      Since:
      5.18
    • getLineYrange

      public void getLineYrange(int line, GutterRendererAlignmentMode mode, Out<Integer> y, Out<Integer> height)

      Gets the Y range for a line based on mode.

      The value for y is relative to the renderers widget coordinates.

      Parameters:
      line - a line number starting from zero
      mode - a GtkSourceGutterRendererAlignmentMode
      y - a location for the Y position in widget coordinates
      height - the line height based on mode
    • getView

      public TextView getView()
      Gets the TextView that the GtkSourceGutterLines represents.
      Returns:
      a GtkTextView
    • hasAnyClass

      public boolean hasAnyClass(int line)
      Checks to see if the line has any GQuark classes set. This can be used to help renderer implementations avoid work if nothing has been set on the class.
      Parameters:
      line - a line contained within this GutterLines
      Returns:
      true if any quark was set for the line
      Since:
      5.6
    • hasClass

      public boolean hasClass(int line, String name)

      Checks to see if addClass(int, String) was called with the name for line.

      A faster version of this function is provided via hasQclass(int, Quark) for situations where the quark is known ahead of time.

      Parameters:
      line - a line number starting from zero
      name - a class name that may be converted, to a GQuark
      Returns:
      true if line contains name
    • hasQclass

      public boolean hasQclass(int line, Quark qname)
      Checks to see if addQclass(int, Quark) was called with the quark denoted by qname for line.
      Parameters:
      line - a line number starting from zero
      qname - a GQuark containing the class name
      Returns:
      true if line contains qname
    • isCursor

      public boolean isCursor(int line)
      Checks to see if line contains the insertion cursor.
      Parameters:
      line - a line number starting from zero
      Returns:
      true if the insertion cursor is on line
    • isPrelit

      public boolean isPrelit(int line)
      Checks to see if line is marked as prelit. Generally, this means the mouse pointer is over the line within the gutter.
      Parameters:
      line - a line number starting from zero
      Returns:
      true if the line is prelit
    • isSelected

      public boolean isSelected(int line)
      Checks to see if the view had a selection and if that selection overlaps line in some way.
      Parameters:
      line - a line number starting from zero
      Returns:
      true if the line contains a selection
    • removeClass

      public void removeClass(int line, String name)

      Removes the class matching name from line.

      A faster version of this function is available via removeQclass(int, Quark) for situations where the GQuark is known ahead of time.

      Parameters:
      line - a line number starting from zero
      name - a class name
    • removeQclass

      public void removeQclass(int line, Quark qname)
      Reverses a call to addQclass(int, Quark) by removing the GLib.Quark matching qname.
      Parameters:
      line - a line number starting from zero
      qname - a GQuark to remove from line
    • builder

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