Tree View Cell Size Negotiation

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

 



When GTK+ does its size negotiation to determine layout, it takes a 
top-down approach. It asks the top-level widgets how big they want to 
be, and they ask their sub-widgets, and so on to the bottom.

As part of this process, cell renderers seem to use a "width-for-height" 
approach. It is assumed that the cell renderer will know in advance how 
tall each cell will be (typically, all cells will be the same height), 
and then determine the width for each individual cell based on the cell 
data or whatever.

I need to do something quite different: a "height-for-width" approach, 
as follows:
1. There is a parent window with a fixed width and height.
2. Inside the parent window is a GtkTreeView (with a scroll bar) that is 
as wide as the parent will let it get.
3. The cells inside the tree view contain text, drawn with a custom cell 
renderer I've written. They need to be as wide as the tree view, and as 
tall as is needed to display all their text.

One way to do this is to trigger the size negotiation twice. The first 
pass would set the tree view to its maximum width, and the cell sizes 
would be ignored. The second pass would be used to determine the actual 
cell sizes. But this seems crude.

A more elegant approach would be to set the tree view to its maximum 
width before it asks the cells what size they want to be. But I haven't 
been able to figure out how to do this.

Any suggestions or pointers will be gratefully appreciated!

Thanks,
Bob Murphy
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux