GtkTextTag

GtkTextTag — A tag that can be applied to text in a GtkTextBuffer

Functions

Types and Values

struct GtkTextTag

Includes

#include <gtk/gtk.h>

Description

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.

Tags should be in the GtkTextTagTable for a given GtkTextBuffer before using them with that buffer.

gtk_text_buffer_create_tag() is the best way to create tags. See “gtk3-demo” for numerous examples.

For each property of GtkTextTag, 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.

Functions

gtk_text_tag_new ()

GtkTextTag *
gtk_text_tag_new (const gchar *name);

Creates a GtkTextTag. Configure the tag using object arguments, i.e. using g_object_set().

Parameters

name

tag name, or NULL.

[allow-none]

Returns

a new GtkTextTag


gtk_text_tag_get_priority ()

gint
gtk_text_tag_get_priority (GtkTextTag *tag);

Get the tag priority.

Parameters

tag

a GtkTextTag

 

Returns

The tag’s priority.


gtk_text_tag_set_priority ()

void
gtk_text_tag_set_priority (GtkTextTag *tag,
                           gint priority);

Sets the priority of a GtkTextTag. Valid priorities start at 0 and go to one less than gtk_text_tag_table_get_size(). 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 gtk_text_buffer_create_tag(), which adds the tag to the buffer’s table automatically.

Parameters

tag

a GtkTextTag

 

priority

the new priority

 

gtk_text_tag_event ()

gboolean
gtk_text_tag_event (GtkTextTag *tag,
                    GObject *event_object,
                    GdkEvent *event,
                    const GtkTextIter *iter);

Emits the “event” signal on the GtkTextTag.

Parameters

tag

a GtkTextTag

 

event_object

object that received the event, such as a widget

 

event

the event

 

iter

location where the event was received

 

Returns

result of signal emission (whether the event was handled)


gtk_text_tag_changed ()

void
gtk_text_tag_changed (GtkTextTag *tag,
                      gboolean size_changed);

Emits the “tag-changed” signal on the GtkTextTagTable where the tag is included.

The signal is already emitted when setting a GtkTextTag property. This function is useful for a GtkTextTag subclass.

Parameters

tag

a GtkTextTag.

 

size_changed

whether the change affects the GtkTextView layout.

 

Since: 3.20

Types and Values

struct GtkTextTag

struct GtkTextTag {
  GObject parent_instance;

  GtkTextTagPrivate *priv;
};