GtkTreeView::insert_column_with_data_func

int insert_column_with_data_func(int position, string title, GtkCellRenderer cellrenderer, callback callback);

This method inserts a new column into a GtkTreeView at the given position with a given name. In contrast to insert_column() and append_column() 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.

The provided callback function receives the following parameters to act on them:

Inside the data function you most propably want to change the GtkCellRenderer, which is responsible for displaying.

Example 142. Using insert_column_with_data_func()

<?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))
                        );
}
?>