Class: Gtk::TextTagTable
- Inherits:
-
Object
- Object
- Gtk::TextTagTable
- Defined in:
- lib/gtk3/text-tag-table.rb
Overview
The collection of 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>
Instance Method Summary collapse
-
#add(tag) ⇒ Boolean
Add a tag to the table.
-
#add_raw ⇒ Boolean
Add a tag to the table.
-
#foreach(func, data) ⇒ nil
Calls func on each tag in table, with user data data.
-
#initialize ⇒ Gtk::TextTagTable
constructor
Creates a new
GtkTextTagTable. -
#lookup(name) ⇒ Gtk::TextTag
Look up a named tag.
-
#remove(tag) ⇒ nil
Remove a tag from the table.
-
#size ⇒ Integer
Returns the size of the table (number of tags).
Constructor Details
#initialize ⇒ Gtk::TextTagTable
Creates a new GtkTextTagTable.
The table contains no tags by default.
Instance Method Details
#add(tag) ⇒ Boolean
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.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gtk3/text-tag-table.rb', line 20 def add(tag) succeeded = add_raw(tag) # GTK+ 3.12 or older returns nothing. # We assume that it's always succeeded for the case. if succeeded.nil? true else succeeded end end |
#add_raw ⇒ Boolean
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.
|
|
# File 'lib/gtk3/text-tag-table.rb', line 19
|
#foreach(func, data) ⇒ nil
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).
#lookup(name) ⇒ Gtk::TextTag
Look up a named tag.
#remove(tag) ⇒ nil
Remove a tag from the table.
If a GtkTextBuffer 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.
#size ⇒ Integer
Returns the size of the table (number of tags)