RE: GtkTreeViewColumn with a Pixmap
- From: martyn 2 russell bt com
- To: o-zone zerozone it, gtk-app-devel-list gnome org
- Subject: RE: GtkTreeViewColumn with a Pixmap
- Date: Tue, 3 Jun 2003 12:42:32 +0100
how i can add the pixmap ? In this mode i only get a GTK
Error to stderr.
First set the column up:
/* cell renderer's */
renderer_image = gtk_cell_renderer_pixbuf_new();
renderer_text = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new();
/* COL_OP_IMAGE */
gtk_tree_view_column_pack_start(column,renderer_image,FALSE);
gtk_tree_view_column_add_attribute(column,
renderer_image,
"pixbuf",COL_IMAGE);
/* COL_TEXT */
gtk_tree_view_column_pack_end(column,renderer_text,TRUE);
gtk_tree_view_column_add_attribute(column,
renderer_text,
"text",COL_TEXT);
/* set sort id */
gtk_tree_view_column_set_title(column, "Name");
gtk_tree_view_column_set_sort_column_id(column, COL_TEXT);
gtk_tree_view_column_set_resizable(column,TRUE);
/* insert column */
gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview),column,-1);
Then add the data:
/* add iter */
gtk_tree_store_append(store, &iter_child, NULL);
pb = (...) /* get pixbuf here */
/* add contact to store */
gtk_tree_store_set(store, &iter_child,
COL_IMAGE, pb,
COL_TEXT, "this is a test",
-1);
/* clean up */
if(pb != NULL) g_object_unref(G_OBJECT(pb));
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]