CtkTextTagTable

CtkTextTagTable — Collection of tags that can be used together

Functions

Signals

void tag-added Run Last
void tag-changed Run Last
void tag-removed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── CtkTextTagTable

Implemented Interfaces

CtkTextTagTable implements CtkBuildable.

Includes

#include <ctk/ctk.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.

CtkTextTagTables as CtkBuildable

The CtkTextTagTable implementation of the CtkBuildable interface supports adding tags by specifying “tag” as the “type” attribute of a <child> element.

An example of a UI definition fragment specifying tags:

1
2
3
4
5
<object class="CtkTextTagTable">
 <child type="tag">
   <object class="CtkTextTag"/>
 </child>
</object>

Functions

CtkTextTagTableForeach ()

void
(*CtkTextTagTableForeach) (CtkTextTag *tag,
                           gpointer data);

Parameters

tag

the CtkTextTag

 

data

data passed to ctk_text_tag_table_foreach().

[closure]

ctk_text_tag_table_new ()

CtkTextTagTable *
ctk_text_tag_table_new (void);

Creates a new CtkTextTagTable. The table contains no tags by default.

Returns

a new CtkTextTagTable


ctk_text_tag_table_add ()

gboolean
ctk_text_tag_table_add (CtkTextTagTable *table,
                        CtkTextTag *tag);

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

table

a CtkTextTagTable

 

tag

a CtkTextTag

 

Returns

TRUE on success.


ctk_text_tag_table_remove ()

void
ctk_text_tag_table_remove (CtkTextTagTable *table,
                           CtkTextTag *tag);

Remove a tag from the table. If a CtkTextBuffer 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.

Parameters

table

a CtkTextTagTable

 

tag

a CtkTextTag

 

ctk_text_tag_table_lookup ()

CtkTextTag *
ctk_text_tag_table_lookup (CtkTextTagTable *table,
                           const gchar *name);

Look up a named tag.

Parameters

table

a CtkTextTagTable

 

name

name of a tag

 

Returns

The tag, or NULL if none by that name is in the table.

[nullable][transfer none]


ctk_text_tag_table_foreach ()

void
ctk_text_tag_table_foreach (CtkTextTagTable *table,
                            CtkTextTagTableForeach func,
                            gpointer data);

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

Parameters

table

a CtkTextTagTable

 

func

a function to call on each tag.

[scope call]

data

user data

 

ctk_text_tag_table_get_size ()

gint
ctk_text_tag_table_get_size (CtkTextTagTable *table);

Returns the size of the table (number of tags)

Parameters

table

a CtkTextTagTable

 

Returns

number of tags in table

Types and Values

CtkTextTagTable

typedef struct _CtkTextTagTable CtkTextTagTable;

Signal Details

The “tag-added” signal

void
user_function (CtkTextTagTable *texttagtable,
               CtkTextTag      *tag,
               gpointer         user_data)

Parameters

texttagtable

the object which received the signal.

 

tag

the added tag.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “tag-changed” signal

void
user_function (CtkTextTagTable *texttagtable,
               CtkTextTag      *tag,
               gboolean         size_changed,
               gpointer         user_data)

Parameters

texttagtable

the object which received the signal.

 

tag

the changed tag.

 

size_changed

whether the change affects the CtkTextView layout.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “tag-removed” signal

void
user_function (CtkTextTagTable *texttagtable,
               CtkTextTag      *tag,
               gpointer         user_data)

Parameters

texttagtable

the object which received the signal.

 

tag

the removed tag.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last