Class TextTagTable
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>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTextTagTable.Builder<B extends TextTagTable.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theTagAddedCallbackcallback.static interfaceFunctional interface declaration of theTagChangedCallbackcallback.static interfaceFunctional interface declaration of theTagRemovedCallbackcallback.Nested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface Buildable
Buildable.Buildable$Impl, Buildable.BuildableIface -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new TextTagTable.TextTagTable(MemorySegment address) Create a TextTagTable instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a tag to the table.protected TextTagTableasParent()Return this instance as if it were its parent type.static TextTagTable.Builder<? extends TextTagTable.Builder> builder()ATextTagTable.Builderobject constructs aTextTagTablewith the specified properties.voidemitTagAdded(@Nullable TextTag tag) Emits the "tag-added" signal.voidemitTagChanged(@Nullable TextTag tag, boolean sizeChanged) Emits the "tag-changed" signal.voidemitTagRemoved(@Nullable TextTag tag) Emits the "tag-removed" signal.voidforeach(@Nullable TextTagTableForeach func) Callsfuncon each tag intable,with user datadata.static MemoryLayoutThe memory layout of the native struct.intgetSize()Returns the size of the table (number of tags)static @Nullable TypegetType()Get the GType of the TextTagTable class.@Nullable TextTagLook up a named tag.onTagAdded(TextTagTable.TagAddedCallback handler) Emitted every time a new tag is added in theGtkTextTagTable.Emitted every time a tag in theGtkTextTagTablechanges.Emitted every time a tag is removed from theGtkTextTagTable.voidRemove a tag from the table.Methods inherited from class 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, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, 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, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Buildable
getBuildableId
-
Constructor Details
-
TextTagTable
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
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
add
Add a tag to the table.
The tag is assigned the highest priority in the table.
tagmust not be in a tag table already, and may not have the same name as an already-added tag.- Parameters:
tag- aGtkTextTag- Returns:
trueon success.
-
foreach
Calls
funcon each tag intable,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
GtkTextBufferhas 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(TextTagTable.TagAddedCallback). -
onTagChanged
public SignalConnection<TextTagTable.TagChangedCallback> onTagChanged(TextTagTable.TagChangedCallback handler) Emitted every time a tag in theGtkTextTagTablechanges.- 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(TextTagTable.TagChangedCallback). -
onTagRemoved
public SignalConnection<TextTagTable.TagRemovedCallback> onTagRemoved(TextTagTable.TagRemovedCallback handler) Emitted every time a tag is removed from the
GtkTextTagTable.The
tagis 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(TextTagTable.TagRemovedCallback). -
builder
ATextTagTable.Builderobject constructs aTextTagTablewith the specified properties. Use the variousset...()methods to set properties, and finish construction withTextTagTable.Builder.build().- Returns:
- the builder object
-