Reputation: 11
I want to display the following effect, but I don't know what to do
Upvotes: 0
Views: 70
Reputation: 2035
As @Brad Lanam wrote, you need to use gtk_cell_renderer_pixbuf_new to tell the column that you will display an image. Read the tutorial provide it to you about GtkTreeView, and try this:
GtkListStore *store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_insert_column_with_attributes (tv, -1, "column title", renderer, 0, "pixbuf", NULL); // 0: liststore position of the first pixbuf
GdkPixbuf * pixbuf = some_pixbuf_new ();
gtk_list_store_set (model, &iter, 0, pixbuf, -1);
This should give you on idea about your goal.Upvotes: 0
Reputation: 5763
Initialize the renderer as a pixbuf.
renderer = gtk_cell_renderer_pixbuf_new ();
And add an attribute for that column as "pixbuf".
gtk_tree_view_column_add_attribute (column, renderer, "pixbuf", colnum);
When setting the value in the storage, pass in a pixbuf argument.
Hope these bits of information point you in the right direction.
Upvotes: 0