Class Mark

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Mark extends TextMark

Mark object for Buffer.

A GtkSourceMark marks a position in the text where you want to display additional info. It is based on TextMark and thus is still valid after the text has changed though its position may change.

GtkSourceMarks are organized in categories which you have to set when you create the mark. Each category can have a priority, a pixbuf and other associated attributes. See View.setMarkAttributes(String, MarkAttributes, int). The pixbuf will be displayed in the margin at the line where the mark residents if the View:show-line-marks property is set to true. If there are multiple marks in the same line, the pixbufs will be drawn on top of each other. The mark with the highest priority will be drawn on top.

  • Constructor Details

    • Mark

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

      public Mark(@Nullable String name, String category)

      Creates a text mark.

      Add it to a buffer using TextBuffer#addMark. If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using TextBuffer#getMark. Normally marks are created using the utility function Buffer.createSourceMark(String, String, TextIter).

      Parameters:
      name - Name of the GtkSourceMark or null
      category - is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could belong to the "bookmark" category, or all the marks representing a compilation error could belong to "error" category).
    • Mark

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

    • getType

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

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

      protected Mark 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 TextMark
      Returns:
      the instance as if it were its parent type
    • getCategory

      public String getCategory()
      Returns the mark category.
      Returns:
      the category of the GtkSourceMark.
    • next

      public @Nullable Mark next(@Nullable String category)

      Returns the next GtkSourceMark in the buffer or null if the mark was not added to a buffer.

      If there is no next mark, null will be returned.

      If category is null, looks for marks of any category.

      Parameters:
      category - a string specifying the mark category, or null.
      Returns:
      the next GtkSourceMark, or null.
    • prev

      public @Nullable Mark prev(@Nullable String category)

      Returns the previous GtkSourceMark in the buffer or null if the mark was not added to a buffer.

      If there is no previous mark, null is returned.

      If category is null, looks for marks of any category

      Parameters:
      category - a string specifying the mark category, or null.
      Returns:
      the previous GtkSourceMark, or null.
    • builder

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