Re: Packing a Text and Pixbuf renderer into the same cell of a tree view
- From: Tommi Komulainen <tommi komulainen nokia com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Packing a Text and Pixbuf renderer into the same cell of a tree view
- Date: Mon, 14 Jun 2004 10:27:16 +0300
On Sun, 2004-06-13 at 13:48, ext Darryl Luff wrote:
Does anyone have some sample code for this? I've found lots of text that says
'just pack a pixbuf renderer and a text renderer into the same cell'. But I
don't understand how you set which pixbuf to display in each cell for these
two cases:
Totally untested code follows, but should get the idea across.. There's
lots of example code in gtk-demo and tests, but IMHO there should be
more concrete examples in the API reference.
1. Where a column has the same image displayed next to the text in each cell,
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer, FALSE);
g_object_set (renderer, "pixbuf", the_pixbuf, NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_add_attribute (column, renderer, "text", COL_TEXT);
2. Where a column has a different image displayed next to the text in each
cell.
Replace the g_object_set() above with:
gtk_tree_view_column_add_attribute (column, renderer, "pixbuf", COL_PIXBUF);
--
Tommi Komulainen <tommi komulainen nokia com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]