<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtktexttagtable">
  <refnamediv>
    <refname>gtk.TextTagTable</refname>
    <refpurpose>A collection of <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link> objects
that can be used together</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.TextTagTable</classname></ooclass>
      <ooclass><classname><link
linkend="class-gobject">gobject.GObject</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-gtktexttagtable">gtk.TextTagTable</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktexttagtable--add">add</link></methodname>
	<methodparam><parameter role="keyword">tag</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktexttagtable--remove">remove</link></methodname>
	<methodparam><parameter role="keyword">tag</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktexttagtable--lookup">lookup</link></methodname>
	<methodparam><parameter
		       role="keyword">name</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtktexttagtable--foreach">foreach</link></methodname>
	<methodparam><parameter role="keyword">func</parameter></methodparam>
	<methodparam><parameter role="keyword">data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtktexttagtable--get-size">get_size</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtktexttagtable">gtk.TextTagTable</link>
</synopsis>

  </refsect1>

  <refsect1 id="signal-prototypes-gtktexttagtable">
    <title>gtk.TextTagTable Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>

    <variablelist>
      <varlistentry>
        <term>"<link
linkend="signal-gtktexttagtable--tag-added">tag-added</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>texttagtable</parameter></methodparam>
            <methodparam><parameter>texttag</parameter></methodparam>
            <methodparam><parameter>user_param1</parameter></methodparam>
            <methodparam><parameter>...</parameter></methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>"<link
linkend="signal-gtktexttagtable--tag-changed">tag-changed</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>texttagtable</parameter></methodparam>
            <methodparam><parameter>texttag</parameter></methodparam>
            <methodparam><parameter>size_changed</parameter></methodparam>
            <methodparam><parameter>user_param1</parameter></methodparam>
            <methodparam><parameter>...</parameter></methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>"<link
linkend="signal-gtktexttagtable--tag-removed">tag-removed</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>texttagtable</parameter></methodparam>
            <methodparam><parameter>texttag</parameter></methodparam>
            <methodparam><parameter>user_param1</parameter></methodparam>
            <methodparam><parameter>...</parameter></methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>A <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link> 
object holds a set of <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link> objects
for use with a <link
linkend="class-gtktextbuffer"><classname>gtk.TextBuffer</classname></link>.
Usually a <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link> 
is created automatically when a <link
linkend="class-gtktextbuffer"><classname>gtk.TextBuffer</classname></link>
is created but a standalone <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link> 
can be created using the <link
linkend="constructor-gtktexttagtable">gtk.TextTagTable</link>() constructor.
A <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link> 
can be passed as an argument to the <link
linkend="constructor-gtktextbuffer">gtk.TextBuffer</link>() constructor to
associate an existing <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link> 
rather than creating a new one. This is useful when several textbuffers need
to use the same texttags.</para>

  </refsect1>

  <refsect1 id="constructor-gtktexttagtable">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.TextTagTable</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link></simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-gtktexttagtable"><classname>gtk.TextTagTable</classname></link>. 
The table contains no tags by default.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtktexttagtable--add">
      <title>gtk.TextTagTable.add</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>add</methodname>
	  <methodparam><parameter
			 role="keyword">tag</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">tag</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>add</methodname>() method adds a texttag to the
texttagtable. The texttag is assigned the highest priority in the
texttagtable. A <literal>ValueError</literal> exception is raised if
<parameter>tag</parameter> is in a texttag table already, or has the same
name as another texttag in the texttagtable.</para>

    </refsect2>

    <refsect2 id="method-gtktexttagtable--remove">
      <title>gtk.TextTagTable.remove</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>remove</methodname>
	  <methodparam><parameter
			 role="keyword">tag</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">tag</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>remove</methodname>() method removes a texttag
from the texttagtable.</para>

    </refsect2>

    <refsect2 id="method-gtktexttagtable--lookup">
      <title>gtk.TextTagTable.lookup</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>lookup</methodname>
	  <methodparam><parameter
			 role="keyword">name</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">name</parameter>&nbsp;:</term>
	  <listitem><simpara>the name of a texttag</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>The texttag, or <literal>None</literal> if none
by that name is in the texttagtable.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>lookup</methodname>() method looks in the
texttagtable for a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link> with
the name specified by <parameter>name</parameter> and returns it if found.
This method returns <literal>None</literal> if <parameter>name</parameter>
does not identify a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link> in the
texttagtable.</para>

    </refsect2>

  <refsect2 id="method-gtktexttagtable--foreach">
    <title>gtk.TextTagTable.foreach</title>

<programlisting><methodsynopsis language="python">
    <methodname>foreach</methodname>
    <methodparam><parameter role="keyword">func</parameter></methodparam>
    <methodparam><parameter role="keyword">data</parameter><initializer>None</initializer></methodparam>
  </methodsynopsis></programlisting>
  <variablelist>
    <varlistentry>
      <term><parameter role="keyword">func</parameter>&nbsp;:</term>
      <listitem><simpara>a function to call on each texttag</simpara></listitem>
    </varlistentry>
    <varlistentry>
      <term><parameter role="keyword">data</parameter>&nbsp;:</term>
	  <listitem><simpara>user data to pass to
	  <parameter>func</parameter> or
	  <literal>None</literal></simpara></listitem>
    </varlistentry>
  </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>foreach</methodname>() method calls the function
specified by <parameter>func</parameter> on each texttag in the text tag
table passing the user data specified by <parameter>data</parameter>. The
signature of <parameter>func</parameter> is:</para>

      <programlisting>
  def func(texttag, user_data):
</programlisting>

      <para>where <parameter>texttag</parameter> is a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link> in the
text tag table and <parameter>user_data</parameter> is
<parameter>data</parameter>.
Note that the table may not be modified while iterating over it (you can't add/remove tags).</para>

    </refsect2>

  <refsect2 id="method-gtktexttagtable--get-size">
      <title>gtk.TextTagTable.get_size</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_size</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the number of texttags in the
texttagtable</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_size</methodname>() method returns the size
of the texttagtable (number of texttags).</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtktexttagtable--tag-added">
      <title>The "tag-added" gtk.TextTagTable Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>texttagtable</parameter></methodparam>
	  <methodparam><parameter>texttag</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>texttagtable</parameter>&nbsp;:</term>
	  <listitem><simpara>the texttagtable that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>texttag</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The "tag-added" signal is emitted when the <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link>
specified by <parameter>texttag</parameter> is added to
<parameter>texttagtable</parameter>.</para>

    </refsect2>

    <refsect2 id="signal-gtktexttagtable--tag-changed">
      <title>The "tag-changed" gtk.TextTagTable Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>texttagtable</parameter></methodparam>
	  <methodparam><parameter>texttag</parameter></methodparam>
	  <methodparam><parameter>size_changed</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>texttagtable</parameter>&nbsp;:</term>
	  <listitem><simpara>the texttagtable that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>texttag</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>size_changed</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal> a
<parameter>texttag</parameter> property has changed that may affect the size
of the text enclosed by the texttag</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The "tag-changed" signal is emitted when a property of the <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link>
specified by <parameter>texttag</parameter> is changed. If
<parameter>size_changed</parameter> is <literal>True</literal> the text
enclosed by <parameter>texttag</parameter> will change size.</para>

    </refsect2>

    <refsect2 id="signal-gtktexttagtable--tag-removed">
      <title>The "tag-removed" gtk.TextTagTable Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>texttagtable</parameter></methodparam>
	  <methodparam><parameter>texttag</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>texttagtable</parameter>&nbsp;:</term>
	  <listitem><simpara>the texttagtable that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>texttag</parameter>&nbsp;:</term>
	  <listitem><simpara>a <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>user_param1</parameter>&nbsp;:</term>
          <listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>...</parameter>&nbsp;:</term>
	  <listitem><simpara>additional user parameters (if
any)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The "tag-removed" signal is emitted when the <link
linkend="class-gtktexttag"><classname>gtk.TextTag</classname></link>
specified by <parameter>texttag</parameter> is removed from
<parameter>texttagtable</parameter></para>

    </refsect2>

  </refsect1>

</refentry>
