About all my projects
Gnome::Gtk4::TextTagTable

Gnome::Gtk4::TextTagTable

Description

The collection of tags 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.

GtkTextTagTables as GtkBuildable

The Gnome::Gtk4::TextTagTable implementation of the Gnome::Gtk4::R-Buildable interface supports adding tags by specifying “tag” as the “type” attribute of a `<child>` element.

An example of a UI definition fragment specifying tags:

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-texttagtable

Creates a new Gnome::Gtk4::TextTagTable.

The table contains no tags by default.

method new-texttagtable ( --> Gnome::Gtk4::TextTagTable \)

Methods

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.

method add ( N-Object() $tag --> Bool )
  • $tag; a Gnome::Gtk4::TextTag.

Return value; True on success..

foreach

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).

method foreach ( &func, gpointer $data )
  • &func; a function to call on each tag. Tthe function must be specified with following signature; :( N-Object $tag, gpointer $data ).

  • $data; user data.

get-size

Returns the size of the table (number of tags)

method get-size (--> Int )

Return value; number of tags in $table.

lookup

Look up a named tag.

method lookup ( Str $name --> N-Object )
  • $name; name of a tag.

Return value; The tag.

remove

Remove a tag from the table.

If a Gnome::Gtk4::TextBuffer has $table 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.

method remove ( N-Object() $tag )
  • $tag; a Gnome::Gtk4::TextTag.

Signals

tag-added

Emitted every time a new tag is added in the Gnome::Gtk4::TextTagTable.

method handler (
  N-Object $tag,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextTagTable :$_widget,
  *C<user>-options
)
  • $tag; the added tag..

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextTagTable object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

tag-changed

Emitted every time a tag in the Gnome::Gtk4::TextTagTable changes.

method handler (
  N-Object $tag,
  gboolean $size-changed,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextTagTable :$_widget,
  *C<user>-options
)
  • $tag; the changed tag..

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

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextTagTable object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

tag-removed

Emitted every time a tag is removed from the Gnome::Gtk4::TextTagTable.

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

method handler (
  N-Object $tag,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextTagTable :$_widget,
  *C<user>-options
)
  • $tag; the removed tag..

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextTagTable object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.