Class TextTagTable
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>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TextTagTable.Builder<B extends TextTagTable.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theTagAddedCallback
callback.static interface
Functional interface declaration of theTagChangedCallback
callback.static interface
Functional interface declaration of theTagRemovedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
-
Constructor Summary
ConstructorDescriptionCreates a newGtkTextTagTable
.TextTagTable
(MemorySegment address) Create a TextTagTable proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a tag to the table.protected TextTagTable
asParent()
Returns this instance as if it were its parent type.static TextTagTable.Builder
<? extends TextTagTable.Builder> builder()
ATextTagTable.Builder
object constructs aTextTagTable
with the specified properties.void
emitTagAdded
(TextTag tag) Emits the "tag-added" signal.void
emitTagChanged
(TextTag tag, boolean sizeChanged) Emits the "tag-changed" signal.void
emitTagRemoved
(TextTag tag) Emits the "tag-removed" signal.void
foreach
(TextTagTableForeach func) Callsfunc
on each tag in this TextTagTable, with user datadata
.int
getSize()
Returns the size of the table (number of tags)static Type
getType()
Get the GType of the TextTagTable classLook up a named tag.onTagAdded
(TextTagTable.TagAddedCallback handler) Emitted every time a new tag is added in theGtkTextTagTable
.Emitted every time a tag in theGtkTextTagTable
changes.Emitted every time a tag is removed from theGtkTextTagTable
.void
Remove a tag from the table.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
add
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
- aGtkTextTag
- Returns:
true
on success.
-
foreach
Callsfunc
on each tag in this TextTagTable, with user datadata
.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
-
remove
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
- aGtkTextTag
-
onTagAdded
public SignalConnection<TextTagTable.TagAddedCallback> onTagAdded(TextTagTable.TagAddedCallback handler) Emitted every time a new tag is added in theGtkTextTagTable
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitTagAdded
Emits the "tag-added" signal. SeeonTagAdded(org.gnome.gtk.TextTagTable.TagAddedCallback)
. -
onTagChanged
public SignalConnection<TextTagTable.TagChangedCallback> onTagChanged(TextTagTable.TagChangedCallback handler) Emitted every time a tag in theGtkTextTagTable
changes.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitTagChanged
Emits the "tag-changed" signal. SeeonTagChanged(org.gnome.gtk.TextTagTable.TagChangedCallback)
. -
onTagRemoved
public SignalConnection<TextTagTable.TagRemovedCallback> onTagRemoved(TextTagTable.TagRemovedCallback handler) Emitted every time a tag is removed from theGtkTextTagTable
.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
Emits the "tag-removed" signal. SeeonTagRemoved(org.gnome.gtk.TextTagTable.TagRemovedCallback)
. -
builder
ATextTagTable.Builder
object constructs aTextTagTable
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTextTagTable.Builder.build()
.
-