Re: Conversion GtkCTree in GTK 1.2 to GtkTreeView in GTK 2
- From: "Shahms E. King" <shahms shahms com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Conversion GtkCTree in GTK 1.2 to GtkTreeView in GTK 2
- Date: 11 Jul 2002 10:06:11 -0700
So if I understand good, it's imppossible to have a dot line. I can't
modify the animation with the triangle :(
Yes, from what I remember it's not possible to modify this without a lot
of work and it was, indeed, a design decision.
Here's how it should look (or something similar):
renderer = gtk_cell_renderer_pixbuf_new ();
column = gtk_tree_view_column_new ()
gtk_tree_view_column_set_title (column, "Author");
gtk_tree_view_column_add_attribute (column, renderer, "pixbuf",
PIXBUF_COLUM);
/* the pixbuf_expander_{open|closed} aren't necessary unless you want
them to be different */
gtk_tree_view_column_pack_start (column, renderer, FALSE);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_add_attribute (column, renderer, "text",
AUTHOR_COLUMN);
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
that should do what you want, I'm not certain about the TRUE/FALSE in
there, in theory they control the amount of space allocated to the
CellRenderer, but I haven't actually seen it make a difference.
I have also an other question : Wath type of element must I use in my
model ? Before I use :
store = gtk_tree_store_new (N_COLUMNS,
GDK_TYPE_PIXBUF,
G_TYPE_STRING,
G_TYPE_STRING);
but now, the two colums make only one colum so I don't know the type.
The model and the view are independent of each other. You can have a
tree store with 800 columns of data and a TreeView with 1 or vice versa,
the "columns" from the tree store and typically used to set properties
on the CellRenderers. So the declaration of the GtkTreeStore shouldn't
change.
In fact, I want that all my cell of the TreeView use the "fixed" font
and I want to use differentes color in the first colum (like you can see
in my screenshot : http://www.arnoraes.freesurf.fr/Forum/tree.png).
--Shahms
Thank you
Arno
Well, in this case, if you want all the fonts to be "fixed" (I'm
unfamiliar with fonts myself, but the TreeView I understand ;-))
you need to set the font properties on the GtkCellRendererText when you
declare it that will set the property for all rows using that renderer,
rather than on a per-row basis like you get with the _add_attribute and
new_with_attributes. Something like:
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "font", "fixed", NULL);
I'm not sure about the "fixed" part of that, or the "font" either,
you'll have to figure out how to go about getting the right font in
there, but that is essentially how. As for the color, you can make that
another column in your tree store:
store = gtk_tree_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
...
and then replace add_attribute on the text renderer with this:
gtk_tree_view_column_set_attributes (column, renderer, "text",
AUTHOR_COLUMN, "forground",
COLOR_COLUMN, NULL);
And then just make sure you set "red" or "black" in the color column.
--Shahms
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]