Patch for GtkTreeView::insert_column_with_data_func

[email protected] (Tobias Schlitt) Tue, 13 Feb 2007 22:45:33 +0100
Newsgroups php.gtk.doc
Message-ID <[email protected]>
Hi all!

Since the comment system of the manual is down, I decided to contribute
some docs directly, for functions I tried out. Find attached a patch for
GtkTreeView::insert_column_with_data_func(). Since I don't have the doc
building environment installed, please recheck before commiting.

Thanks!
Toby
-- 
Tobias Schlitt - Zend Certification Member       GPG Key: 0xC462BC14
a passion for php                            http://www.schlitt.info
Member of the eZ components project          http://components.ez.no
insert_column_with_data_func.patch (text/x-patch, 4.2 KB)
? insert_column_with_data_func.patch
Index: examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw
===================================================================
RCS file: examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw
diff -N examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw	13 Feb 2007 21:33:03 -0000
@@ -0,0 +1,26 @@
+<?php
+//Using GtkTreeView::insert_column_with_data_func()
+
+/*
+* Creating a column with a data function callback
+*/
+$nameRenderer = new GtkCellRendererText();
+$view->insert_column_with_data_func(
+    0,
+    "Test suites",
+    $nameRenderer,
+    "showTestName"
+);
+
+/*
+* This data function column makes the cell renderer display the text from model
+* column 0 in uppercase letters.
+*/
+function showTestName($column, $cell, $model, $iter)
+{
+    $cell->set_property(
+        "text",
+        strtoupper( $model->get_value($iter, 0))
+    );
+}
+?>
Index: manual/en/reference/gtk/gtktreeview.xml
===================================================================
RCS file: /repository/php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml,v
retrieving revision 1.16
diff -u -8 -p -r1.16 gtktreeview.xml
--- manual/en/reference/gtk/gtktreeview.xml	29 Jan 2007 17:58:07 -0000	1.16
+++ manual/en/reference/gtk/gtktreeview.xml	13 Feb 2007 21:33:04 -0000
@@ -735,26 +735,68 @@ $treeview->append_column($column);
 
   
 
   <method id="gtk.gtktreeview.method.insert_column_with_data_func">
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>insert_column_with_data_func</function></funcdef>
      
-     <paramdef><parameter>position</parameter></paramdef>
-     <paramdef><parameter>title</parameter></paramdef>
+     <paramdef>int <parameter>position</parameter></paramdef>
+     <paramdef>string <parameter>title</parameter></paramdef>
      <paramdef><classname>GtkCellRenderer</classname> <parameter>cellrenderer</parameter></paramdef>
-     <paramdef><parameter>callback</parameter></paramdef>
+     <paramdef>callback <parameter>callback</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <shortdesc>
-
+    Inserts a column at the given position with a data function assigned.
    </shortdesc>
    <desc>
+    <para>
+	 This method inserts a new column into a <classname>GtkTreeView</classname>
+	 at the given position with a given name. In contrast to
+	 <function class="GtkTreeView">insert_column</function> and
+	 <function class="GtkTreeView">append_column</function> this method creates
+	 the column object internally and allows you to specify a data function,
+	 which is called everytime a cell in the model for this column changed and
+	 needs to be rendered.
+    </para>
+    <para>
+     The provided callback function receives the following parameters to act on them:
+     <itemizedlist>
+      <listitem>
+	   <classname>GtkTreeViewColumn</classname> The column object created by the
+	   <function class="GtkTreeView">insert_column_with_data_func</function>
+	   call.
+      </listitem>
+      <listitem>
+	   <classname>GtkCellRenderer</classname> The cell renderer used to display
+	   this cell.
+      </listitem>
+      <listitem>
+	   <classname>GtkTreeModel</classname> The model rendered by the tree view.
+	  </listitem>
+      <listitem>
+	   <classname>GtkTreeIter</classname> The tree row affected by the change.
+	  </listitem>
+     </itemizedlist>
+	 Inside the data function you most propably want to change the
+	 <classname>GtkCellRenderer</classname>, which is responsible for
+	 displaying.
+    </para>
+    <example>
+     <title>Using <function class="GtkTreeView">insert_column_with_data_func</function></title>
+     <programlisting role="php">
+      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="&directory.examples;/reference/gtk/gtktreeview/insert_column_with_data_func.phpw" parse="text">
+       <xi:fallback>FIXME:MISSING XINCLUDE CONTENT</xi:fallback>
+      </xi:include>
+     </programlisting>
+    </example>
+   </desc>
+   <desc>
 
    </desc>
   </method>
 
   
 
   <method id="gtk.gtktreeview.method.move_column_after">
    <funcsynopsis>