<?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-gtkeditable">
  <refnamediv>
    <refname>gtk.Editable</refname>
    <refpurpose>an interface for text-editing widgets.</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Editable</classname></ooclass>
      <ooclass><classname>gobject.GInterface</classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--select-region">select_region</link></methodname>
	<methodparam><parameter
		       role="keyword">start</parameter></methodparam>
	<methodparam><parameter role="keyword">end</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--get-selection-bounds">get_selection_bounds</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--insert-text">insert_text</link></methodname>
	<methodparam><parameter
		       role="keyword">text</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">position</parameter><initializer>0</initializer></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--delete-text">delete_text</link></methodname>
	<methodparam><parameter
		       role="keyword">start_pos</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">end_pos</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--get-chars">get_chars</link></methodname>
	<methodparam><parameter
		       role="keyword">start_pos</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">end_pos</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--cut-clipboard">cut_clipboard</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--copy-clipboard">copy_clipboard</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--paste-clipboard">paste_clipboard</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--delete-selection">delete_selection</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--set-position">set_position</link></methodname>
	<methodparam><parameter
		       role="keyword">position</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--get-position">get_position</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--set-editable">set_editable</link></methodname>
	<methodparam><parameter
		       role="keyword">is_editable</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkeditable--get-editable">get_editable</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1 id="signal-prototypes-gtkeditable">
    <title>gtk.Editable Signal Prototypes</title>

    <variablelist>
      <varlistentry>
        <term>"<link
linkend="signal-gtkeditable--changed">changed</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>editable</parameter>
            </methodparam>
            <methodparam><parameter>user_param1</parameter>
            </methodparam>
            <methodparam><parameter>...</parameter>
            </methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>"<link
linkend="signal-gtkeditable--delete-text">delete-text</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>editable</parameter>
            </methodparam>
            <methodparam><parameter>start</parameter>
            </methodparam>
            <methodparam><parameter>end</parameter>
            </methodparam>
            <methodparam><parameter>user_param1</parameter>
            </methodparam>
            <methodparam><parameter>...</parameter>
            </methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>"<link
linkend="signal-gtkeditable--insert-text">insert-text</link>"</term>
        <listitem>
          <methodsynopsis
	    language="python"><methodname>callback</methodname>
            <methodparam><parameter>editable</parameter>
            </methodparam>
            <methodparam><parameter>new_text</parameter>
            </methodparam>
            <methodparam><parameter>new_text_length</parameter>
            </methodparam>
            <methodparam><parameter>position</parameter>
            </methodparam>
            <methodparam><parameter>user_param1</parameter>
            </methodparam>
            <methodparam><parameter>...</parameter>
            </methodparam>
          </methodsynopsis>
        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para><link
    linkend="class-gtkeditable"><classname>gtk.Editable</classname></link>
    is an interface for text editing widgets, such as <link
    linkend="class-gtkentry"><classname>gtk.Entry</classname></link>. The
    editable class contains methods for generically manipulating an editable
    widget, a large number of action signals used for key bindings, and
    several signals that an application can connect to to modify the
    behavior of a widget.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkeditable--select-region">
      <title>gtk.Editable.select_region</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>select_region</methodname>
	  <methodparam><parameter
			 role="keyword">start</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">end</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">start</parameter>&nbsp;:</term>
	  <listitem><simpara>the new start position of the
selection</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">end</parameter>&nbsp;:</term>
	  <listitem><simpara>the new end position of the
selection</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>select_region</methodname>() method selects a
region of text from <parameter>start</parameter> up to, but not including
<parameter>end</parameter>. If <parameter>end</parameter> is negative, then
the selection will run from <parameter>start</parameter> to the end of the
text.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--get-selection-bounds">
      <title>gtk.Editable.get_selection_bounds</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_selection_bounds</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing the start and end positions
of the selection or an empty tuple if there is no
selection</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_selection_bounds</methodname>() method
returns a tuple that contains the start and end positions of the selection
if any or an empty tuple if there is no selection.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--insert-text">
      <title>gtk.Editable.insert_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>insert_text</methodname>
	  <methodparam><parameter
			 role="keyword">text</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">position</parameter><initializer>0</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">text</parameter>&nbsp;:</term>
	  <listitem><simpara>the text to be inserted</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">position</parameter>&nbsp;:</term>
	  <listitem><simpara>the position where the text should be
inserted</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>insert_text</methodname>() method inserts the
string specified by <parameter>text</parameter> at the location specified by
<parameter>position</parameter>.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--delete-text">
      <title>gtk.Editable.delete_text</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>delete_text</methodname>
	  <methodparam><parameter
			 role="keyword">start_pos</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">end_pos</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">start_pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the start position of the text to
delete</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">end_pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the end position of the text to
delete</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>delete_text</methodname>() method deletes a
sequence of characters starting from <parameter>start_pos</parameter> up to,
but not including <parameter>end_pos</parameter>. If
<parameter>end_pos</parameter> is negative, then the characters deleted will
be those characters from <parameter>start_pos</parameter> to the end of the
text.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--get-chars">
      <title>gtk.Editable.get_chars</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_chars</methodname>
	  <methodparam><parameter
			 role="keyword">start_pos</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">end_pos</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">start_pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the start position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">end_pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the end position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a string containing the characters from start
to end</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_chars</methodname>() method retrieves a
string of characters starting from <parameter>start_pos</parameter> up to,
but not including <parameter>end_pos</parameter>. If
<parameter>end_pos</parameter> is negative, then all the characters from
<parameter>start_pos</parameter> to the end of the text are
retrieved.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--cut-clipboard">
      <title>gtk.Editable.cut_clipboard</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>cut_clipboard</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>cut_clipboard</methodname>() method copies the
characters in the current selection to the clipboard and then deletes them
from the widget.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--copy-clipboard">
      <title>gtk.Editable.copy_clipboard</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy_clipboard</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>copy_clipboard</methodname>() method copies the
characters in the current selection to the clipboard</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--paste-clipboard">
      <title>gtk.Editable.paste_clipboard</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>paste_clipboard</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>paste_clipboard</methodname>() method copies the
contents of the clipboard to the widget at the cursor position.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--delete-selection">
      <title>gtk.Editable.delete_selection</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>delete_selection</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>

      <para>The <methodname>delete_selection</methodname>() method deletes
the characters in the selection and releases the selection ownership</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--set-position">
      <title>gtk.Editable.set_position</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_position</methodname>
	  <methodparam><parameter
			 role="keyword">position</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">position</parameter>&nbsp;:</term>
	  <listitem><simpara>the new cursor position</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_position</methodname>() method sets the
cursor position to be just before the character at the location specified by
<parameter>position</parameter>. If <parameter>position</parameter> is less
than 0 or greater than the number of characters in the widget the cursor is
positioned after the last character in the widget. Note
<parameter>position</parameter> is in characters not bytes.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--get-position">
      <title>gtk.Editable.get_position</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_position</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the cursor position</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_position</methodname>() method retrieves the
cursor position as a character index starting from 0. If the cursor is after
the last character the position will equal the number of characters in the
widget. Note <parameter>position</parameter> is in characters not
bytes.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--set-editable">
      <title>gtk.Editable.set_editable</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_editable</methodname>
	  <methodparam><parameter
			 role="keyword">is_editable</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">is_editable</parameter>&nbsp;:</term>
	  <listitem><simpara>if True the text can be
edited</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set_editable</methodname>() method sets the
widget "editable" attribute of the widget to the value specified by
<parameter>is_editable</parameter>. If <parameter>is_editable</parameter> is
<literal>True</literal> the text can be edited; if <literal>False</literal>,
the text cannot be edited.</para>

    </refsect2>

    <refsect2 id="method-gtkeditable--get-editable">
      <title>gtk.Editable.get_editable</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_editable</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara><literal>True</literal> if the text is
editable.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_editable</methodname>() method retrieves the
value of the widget "editable" attribute that specifies whether the text is
editable. See <link
linkend="method-gtkeditable--set-editable"><methodname>set_editable()</methodname></link>.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Signals</title>

    <refsect2 id="signal-gtkeditable--changed">
      <title>The "changed" gtk.Editable Signal</title>

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

      <variablelist>
	<varlistentry>
	  <term><parameter>editable</parameter>&nbsp;:</term>
	  <listitem><simpara>the editable that received the
signal</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 "changed" signal is emitted when the contents of the widget
have changed.</para>

    </refsect2>

    <refsect2 id="signal-gtkeditable--delete-text">
      <title>The "delete-text" gtk.Editable Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>editable</parameter></methodparam>
	  <methodparam><parameter>start</parameter></methodparam>
	  <methodparam><parameter>end</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>editable</parameter>&nbsp;:</term>
	  <listitem><simpara>the editable that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>start</parameter>&nbsp;:</term>
	  <listitem><simpara>the start position</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>end</parameter>&nbsp;:</term>
	  <listitem><simpara>the end position</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 "delete-text" signal is emitted when text is deleted from
the widget by the user. The default handler for this signal will normally be
responsible for deleting the text, so by connecting to this signal and then
stopping the signal with the <link
linkend="method-gobject--stop-emission"><methodname>gobject.stop_emission</methodname>()</link> 
method, it is possible to prevent it from being deleted. The
<parameter>start</parameter> and <parameter>end</parameter> parameters are
interpreted as for <link
linkend="method-gtkeditable--delete-text"><methodname>delete_text</methodname>()</link></para>

    </refsect2>

    <refsect2 id="signal-gtkeditable--insert-text">
      <title>The "insert-text" gtk.Editable Signal</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>callback</methodname>
	  <methodparam><parameter>editable</parameter></methodparam>
	  <methodparam><parameter>new_text</parameter></methodparam>
	  <methodparam><parameter>new_text_length</parameter></methodparam>
	  <methodparam><parameter>position</parameter></methodparam>
	  <methodparam><parameter>user_param1</parameter></methodparam>
	  <methodparam><parameter>...</parameter></methodparam>
	</methodsynopsis></programlisting>

      <variablelist>
	<varlistentry>
	  <term><parameter>editable</parameter>&nbsp;:</term>
	  <listitem><simpara>the editable that received the
signal</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>new_text</parameter>&nbsp;:</term>
	  <listitem><simpara>the string that is being
inserted</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>new_text_length</parameter>&nbsp;:</term>
	  <listitem><simpara>the length of the new text</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter>position</parameter>&nbsp;:</term>
	  <listitem><simpara>a pointer to the location at which the new text
will be inserted</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 "insert-text" signal is emitted when text is inserted into
the widget by the user. The default handler for this signal will normally be
responsible for inserting the text, so by connecting to this signal and then
stopping the signal with the <link
linkend="method-gobject--stop-emission"><methodname>gobject.stop_emission</methodname>()</link>
method, it is possible to prevent it from being inserted entirely. The
<parameter>position</parameter> parameter is a <link
linkend="class-gobjectgpointer"><classname>gobject.GPointer</classname></link>
object containing a pointer to the insertion position - there is no way to
access the position value from <literal>PyGTK</literal>.</para>

    </refsect2>

  </refsect1>

</refentry>
