Re: Conversion GtkCTree in GTK 1.2 to GtkTreeView in GTK 2



On Wed, 2002-07-10 at 15:50, Arno wrote:
Hello,

I made a simple application in GTK 1.2. You can see a screenshot here : 
http://www.arnoraes.freesurf.fr/Forum/tree.png
But now I must convert the application to GTK 2. And I see that in GTK 
2, GtkCTree is deprecated and I must use GtkTreeView.

So I want to do this but I have some probleme. I use this short tutorial 
(http://developer.gnome.org/doc/API/2.0/gtk/treewidget.html) but could 
you help to do these things :

- First I want to have dot line with rounded expansion like in my 
application and not a triangle.

Thankfully, you can't.  If I remember the why correctly, it's because
this kind of thing shouldn't be up to individual apps, but instead the
theme should be in charge of it.  Although, I don't know if it's
modifiable even at that level at this point though.  All in the name of
consistancy my boy.

- I don't know how I could add a pixmap, at the begin of the line like 
in the screenshot. I think to use : gtk_cell_renderer_pixbuf_new(); but 
I create a new colum and not insert a pixmap at the beginning of the line.

first, create the column, then create a renderer, then pack the renderer
into the column.

column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer);

or you can just do the gtk_tree_view_column_new_with_attributes (...);
with the first renderer and pack_start() the second.

- To finish, I see the function : g_object_set to change the color of 
and object, but when I add a line, I use : gtk_tree_store_set and I 
don't know how I could get a cell of the colum.

Thank you.
Arno


I'm not exactly sure what you're asking with the last question here.
gtk_tree_store_set is just about setting the data that will be rendered,
you need to map that to attributes of the cell renderer using
gtk_tree_view_column_add_attribute() or
gtk_tree_view_column_set_attributes()

--Shahms



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