Re: Nested Tree View



Typically, you would use two cell renderers for this task. For example, in a file browser, you might not have 1 column for the icon and another for the filename, but instead you could pack the icon renderer AND filename renderer into the column for a single column so that the alignment works.

       col = gtk_tree_view_column_new();
       gtk_tree_view_column_set_title(col, "Filename");
renderer = gtk_cell_renderer_pixbuf_new();
       gtk_tree_view_column_pack_start(col, renderer, FALSE);
       gtk_tree_view_column_set_attributes(col,
                       renderer,
                       "pixbuf",
                       FILE_ICON,
                       NULL);

       renderer = gtk_cell_renderer_text_new();
       gtk_tree_view_column_pack_start(col, renderer, TRUE);
       gtk_tree_view_column_set_attributes(col,
                       renderer,
                       "text",
                       FILE_NAME,
                       NULL);
gtk_tree_view_append_column( GTK_TREE_VIEW (panel->priv->tree_view), col);

- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com



Alejandro Serrano wrote:
Hi,
I'm trying to write a custom widget to represent some data in a way
similar to this image: http://www.threatofchaos.com/imagenes/hsl2.PNG
What I need is to "nest" items in a TreeView, but changing the set of
columns that are represented. I mean, I need to have

- Item 1
- Item 2
   * SubItem 2.1
   * SubItem 2.2
- Item 3
   * SubItem 3.1

All Item 1, 2 and 3 would have the same set of columns. SubItems 2.1 and
2.2 would have another set of columns, and SubItem 3.1 another different
one.

I have been trying to use a combination of Expanders and TreeViews, but
I feel that it's very inefficient, and I haven't found the way to have
all the columns in the same set correctly aligned yet.
Other option I was considering was creating some kind of new Cell
Renderer that would include the SubItems. Is there any way to make a
renderer that spans multiple columns and with a widget inside it?

Thanks very much in advance,
Alejandro Serrano

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]