flow layout container possible?



Hi all,

Forgive me if this should be on the app devel list.  I have a need in my application for a "flow container", a concept I first learned about when working with Java (swing, I think).  It also exists in Windows.Forms and QT.  Essentially, it is a container that contains widgets, in order of addition from left to right, similar to an HBox, but once it exhausts all its available horizontal space, it creates another row and continues the same pattern.

Here's some terrible ASCII art:
| [ Button ] [ Button 2 ] [ Button 3 ]  |
| [ Button 4] [ Button 5 ]                  |

The problem I see with implementing such a container in GTK is that on_size_request (I'm a C++ developer, so bear with me on the gtkmm talk) doesn't give any hints as to an idea of the dimensions that I will have to work with.  The flow container is more of a "give me one dimension and i'll give you the other" container, so if I am given an approximate width, I can compute the height.

Does anyone see a way to accomplish this? 

oh, btw, for completeness I tried Murray Cumming's FlowTable [1] in Glom but it's not quite the same idea.  In that implementation, you have to know the number of columns you want to break it into before hand.

thanks, and cheers to those at GUADEC.
dave


[1] http://svn.gnome.org/viewvc/glom/trunk/glom/utility_widgets/flowtable.cc?view=markup


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