cvs: php-gtk-doc /examples/reference/gtk/gtktreeview insert_column_with_data_func.phpw /manual/en/reference/gtk gtktreeview.xml

[email protected] ("Scott Mattocks") Tue, 13 Feb 2007 22:07:12 -0000
Newsgroups php.gtk.doc
Message-ID <cvsscottmattocks1171404432@cvsserver>
scottmattocks		Tue Feb 13 22:07:12 2007 UTC

  Added files:                 
    /php-gtk-doc/examples/reference/gtk/gtktreeview	
                                                   	insert_column_with_data_func.phpw 

  Modified files:              
    /php-gtk-doc/manual/en/reference/gtk	gtktreeview.xml 
  Log:
  GtkTreeView::insert_column_with_data_func. Thanks Tobias Schlitt.
  
http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml?r1=1.16&r2=1.17&diff_format=u
Index: php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml
diff -u php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml:1.16 php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml:1.17
--- php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml:1.16	Mon Jan 29 17:58:07 2007
+++ php-gtk-doc/manual/en/reference/gtk/gtktreeview.xml	Tue Feb 13 22:07:12 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.16 $ -->
+<!-- $Revision: 1.17 $ -->
 <classentry id="gtk.gtktreeview">
  <classmeta>
   <classtitle>GtkTreeView</classtitle>
@@ -740,16 +740,58 @@
     <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>

http://cvs.php.net/viewvc.cgi/php-gtk-doc/examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw?view=markup&rev=1.1
Index: php-gtk-doc/examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw
+++ php-gtk-doc/examples/reference/gtk/gtktreeview/insert_column_with_data_func.phpw
<?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))
                        );
}
?>