<?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-pangoattrlist">
  <refnamediv>
    <refname>pango.AttrList</refname>
    <refpurpose>an object holding attributes that apply to a section of
text</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pango.AttrList</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-pangoattrlist">pango.AttrList</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--copy">copy</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--insert">insert</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--insert-before">insert_before</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--change">change</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--splice">splice</link></methodname>
	<methodparam><parameter
		       role="keyword">other</parameter></methodparam>
	<methodparam><parameter role="keyword">pos</parameter></methodparam>
	<methodparam><parameter role="keyword">len</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--get-iterator">get_iterator</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--filter">filter</link></methodname>
	<methodparam><parameter role="keyword">func</parameter></methodparam>
	<methodparam><parameter role="keyword">data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>

    </classsynopsis>

    <programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
	<methodname><link
linkend="function-pango--parse-markup">pango.parse_markup</link></methodname>
	<methodparam><parameter
		       role="keyword">markup_text</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">accel_marker</parameter><initializer>u'\x00'</initializer></methodparam>
      </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object contains a list of attributes that apply to a section of text. The
attributes are, in general, allowed to overlap in an arbitrary fashion,
however, if the attributes are manipulated only through the <link
linkend="method-pangoattrlist--change"><methodname>change</methodname>()</link> 
method, the overlap between properties will meet stricter criteria. Since
the <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object is stored as a linear list, it is not suitable for storing attributes
for large amounts of text. In general, you should not use a single <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
for more than one paragraph of text.</para>

  </refsect1>

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

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

    <para>Creates a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-pangoattrlist--copy">
      <title>pango.AttrList.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>copy</methodname>() method returns
a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object that is a copy of the attribute list </para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--insert">
      <title>pango.AttrList.insert</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>insert</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>insert</methodname>() method
inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by <parameter>attr</parameter> into the attribute list. It will be
inserted after all other attributes with a matching "start_index".</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--insert-before">
      <title>pango.AttrList.insert_before</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>insert_before</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>insert_before</methodname>()
method inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by attr into the attribute list. It will be inserted before all
other attributes with a matching "start_index".</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--change">
      <title>pango.AttrList.change</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>change</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>change</methodname>() method
inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by <parameter>attr</parameter> into the attribute list. It will
replace any attributes of the same type on that segment and be merged with
any adjoining attributes that are identical. This method is slower than the
<link
linkend="method-pangoattrlist--insert"><function>insert()</function></link>
method for creating an attribute list in order (potentially much slower for
large lists). However, the <link
linkend="method-pangoattrlist--insert"><function>insert()</function></link>
method is not suitable for continually changing a set of attributes since it
never removes or combines existing attributes.</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--splice">
      <title>pango.AttrList.splice</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>splice</methodname>
	  <methodparam><parameter role="keyword">other</parameter></methodparam>
	  <methodparam><parameter role="keyword">pos</parameter></methodparam>
	  <methodparam><parameter role="keyword">len</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">other</parameter>&nbsp;:</term>
	  <listitem><simpara>another <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the position in this attribute list to insert
<parameter>other</parameter></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">len</parameter>&nbsp;:</term>
	  <listitem><simpara>the length of the spliced segment. (Note that
this must be specified since the attributes in <parameter>other</parameter>
may only be present at some subsection of this range)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>splice</methodname>() method
splices the <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
specified by <parameter>other</parameter> into this attribute list. This
method stretches each attribute with a range including the position
specified by <parameter>pos</parameter> in the list by the amount specified
by <parameter>len</parameter>, and then calls the <link
linkend="method-pangoattrlist--change"><methodname>change</methodname>()</link> 
method with a copy of each attribute in <parameter>other</parameter> in
sequence (offset in position by <parameter>pos</parameter>).</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--get-iterator">
      <title>pango.AttrList.get_iterator</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_iterator</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-pangoattriterator"><classname>pango.AttrIterator</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_iterator</methodname>() method creates and
returns a <link
linkend="class-pangoattriterator"><classname>pango.AttrIterator</classname></link> 
initialized to the beginning of the attribute list.</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--filter">
      <title>pango.AttrList.filter</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>filter</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 callback function that returns
	  <literal>True</literal> if an attribute should be filtered
	  out.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">data</parameter>&nbsp;:</term>
	  <listitem><simpara>data to be passed to
	  <parameter>func</parameter></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
	  linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
	  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>filter</methodname>() method arranges for the
callback function specified by <parameter>function</parameter> to be called
on each <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
in the attribute list with the optional user data specified by
<literal>data</literal>. The callback function signature is:</para>

      <programlisting>
  def func(attribute, user_data)
</programlisting>

      <para>where <parameter>attribute</parameter> is an attribute of the
attribute list and <parameter>user_data</parameter> is
<parameter>data</parameter>. The callback function returns
<literal>True</literal> if the attribute should be filtered out of the
attribute list. The <methodname>filter</methodname> method returns a new
<link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
containing the attributes that were filtered out (removed from) the
attribute list.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-pango--parse-markup">
      <title>pango.parse_markup</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.parse_markup</methodname>
	  <methodparam><parameter
			 role="keyword">markup_text</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">accel_marker</parameter><initializer>u'\x00'</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">markup_text</parameter>&nbsp;:</term>
	  <listitem><simpara>a string containing the markup to
parse.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">accel_marker</parameter>&nbsp;:</term>
	  <listitem><simpara>the Unicode character that precedes an
accelerator, or u'\x00' for none</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 3-tuple containing a <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>,
the plain text in <parameter>markup_text</parameter>, and the first
accelerator character in the text.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>parse_markup</function>() function parses the text
specified by <parameter>markup_text</parameter> and returns a 3-tuple
containing a <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>,
the plain text from <parameter>markup_text</parameter> and the first
accelerator character that is preceded by the Unicode character specified by
<parameter>accel_marker</parameter>. The returned accelerator character is a
Unicode character that may be u'\x00' if there is no accelerator
character.</para>

      <para>See the <link linkend="pango-markup-language">The Pango Markup
Language</link> reference for more information.</para>

      <para>The GError exception is raised if an error occurs while parsing
the markup text.</para>

    </refsect2>

  </refsect1>

</refentry>
