About all my projects
Gnome::Gtk4::TextTag

Gnome::Gtk4::TextTag

Description

A tag that can be applied to text contained in a Gnome::Gtk4::TextBuffer.

You may wish to begin by reading the [text widget conceptual overview](section-text-widget.html), 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 Gnome::Gtk4::TextTagTable for a given Gnome::Gtk4::TextBuffer before using them with that buffer.

.create-tag() in class Gnome::Gtk4::TextBuffer is the best way to create tags. See “gtk4-demo” for numerous examples.

For each property of Gnome::Gtk4::TextTag, 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.

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-texttag

Creates a Gnome::Gtk4::TextTag.

method new-texttag ( Str $name --> Gnome::Gtk4::TextTag \)
  • $name; tag name.

Methods

changed

Emits the tag-changed defined in TextTagTable signal on the Gnome::Gtk4::TextTagTable where the tag is included.

The signal is already emitted when setting a Gnome::Gtk4::TextTag property. This function is useful for a Gnome::Gtk4::TextTag subclass.

method changed ( Bool() $size-changed )
  • $size-changed; whether the change affects the Gnome::Gtk4::TextView layout.

get-priority

Get the tag priority.

method get-priority (--> Int )

Return value; The tag’s priority..

set-priority

Sets the priority of a Gnome::Gtk4::TextTag.

Valid priorities start at 0 and go to one less than .get-size() in class Gnome::Gtk4::TextTagTable. 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 .create-tag() in class Gnome::Gtk4::TextBuffer, which adds the tag to the buffer’s table automatically.

method set-priority ( Int() $priority )
  • $priority; the new priority.