Class TextTagTable

All Implemented Interfaces:
Buildable, Proxy

@Generated("org.javagi.JavaGI") public class TextTagTable extends GObject implements Buildable

Collects the tags 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.

GtkTextTagTables as GtkBuildable

The GtkTextTagTable implementation of the GtkBuildable interface supports adding tags by specifying “tag” as the “type” attribute of a <child> element.

An example of a UI definition fragment specifying tags:

<object class="GtkTextTagTable">
 <child type="tag">
   <object class="GtkTextTag"/>
 </child>
</object>
  • Constructor Details

    • TextTagTable

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

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

    • getType

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

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

      protected TextTagTable 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
    • add

      public boolean add(TextTag tag)

      Add a tag to the table.

      The tag is assigned the highest priority in the table.

      tag must not be in a tag table already, and may not have the same name as an already-added tag.

      Parameters:
      tag - a GtkTextTag
      Returns:
      true on success.
    • foreach

      public void foreach(@Nullable TextTagTableForeach func)

      Calls func on each tag in table, with user data data.

      Note that the table may not be modified while iterating over it (you can’t add/remove tags).

      Parameters:
      func - a function to call on each tag
    • getSize

      public int getSize()
      Returns the size of the table (number of tags)
      Returns:
      number of tags in this TextTagTable
    • lookup

      public @Nullable TextTag lookup(String name)
      Look up a named tag.
      Parameters:
      name - name of a tag
      Returns:
      The tag
    • remove

      public void remove(TextTag tag)

      Remove a tag from the table.

      If a GtkTextBuffer has this TextTagTable as its tag table, the tag is removed from the buffer. The table’s reference to the tag is removed, so the tag will end up destroyed if you don’t have a reference to it.

      Parameters:
      tag - a GtkTextTag
    • onTagAdded

      Emitted every time a new tag is added in the GtkTextTagTable.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitTagAdded

      public void emitTagAdded(@Nullable TextTag tag)
      Emits the "tag-added" signal. See onTagAdded(TextTagTable.TagAddedCallback).
    • onTagChanged

      Emitted every time a tag in the GtkTextTagTable changes.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitTagChanged

      public void emitTagChanged(@Nullable TextTag tag, boolean sizeChanged)
      Emits the "tag-changed" signal. See onTagChanged(TextTagTable.TagChangedCallback).
    • onTagRemoved

      Emitted every time a tag is removed from the GtkTextTagTable.

      The tag is still valid by the time the signal is emitted, but it is not associated with a tag table any more.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitTagRemoved

      public void emitTagRemoved(@Nullable TextTag tag)
      Emits the "tag-removed" signal. See onTagRemoved(TextTagTable.TagRemovedCallback).
    • builder

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