Class TextTag

All Implemented Interfaces:
Proxy
Direct Known Subclasses:
Tag

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

Can be applied to text contained in a GtkTextBuffer.

You may wish to begin by reading the text widget conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.

Tags should be in the TextTagTable for a given GtkTextBuffer before using them with that buffer.

TextBuffer.createTag(String, String, Object...) is the best way to create tags. See “gtk4-demo” for numerous examples.

For each property of GtkTextTag, there is a “set” property, e.g. “font-set” corresponds to “font”. These “set” properties reflect whether a property has been set or not.

They are maintained by GTK and you should not set them independently.

  • Constructor Details

    • TextTag

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

      public TextTag(@Nullable String name)
      Creates a GtkTextTag.
      Parameters:
      name - tag name
    • TextTag

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

    • getType

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

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

      protected TextTag 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
    • changed

      public void changed(boolean sizeChanged)

      Emits the Gtk.TextTagTable::tag-changed signal on the GtkTextTagTable where the tag is included.

      The signal is already emitted when setting a GtkTextTag property. This function is useful for a GtkTextTag subclass.

      Parameters:
      sizeChanged - whether the change affects the GtkTextView layout
    • getPriority

      public int getPriority()
      Get the tag priority.
      Returns:
      The tag’s priority.
    • setPriority

      public void setPriority(int priority)

      Sets the priority of a GtkTextTag.

      Valid priorities start at 0 and go to one less than TextTagTable.getSize(). Each tag in a table has a unique priority; setting the priority of one tag shifts the priorities of all the other tags in the table to maintain a unique priority for each tag.

      Higher priority tags “win” if two tags both set the same text attribute. When adding a tag to a tag table, it will be assigned the highest priority in the table by default; so normally the precedence of a set of tags is the order in which they were added to the table, or created with TextBuffer.createTag(String, String, Object...), which adds the tag to the buffer’s table automatically.

      Parameters:
      priority - the new priority
    • builder

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