GNOME Bugzilla – Bug 139582
GtkComboBox should support data from trees as well as lists
Last modified: 2004-12-22 21:47:04 UTC
GtkComboBox currently only accepts data from TreeModels which work in list format i.e. GtkListStore. It would be extremely useful to be able to give GtkComboBox a GtkTreeStore and have it render the data in an expected manner. There is precedent for this kind of functionality, as it is present in Mac OS X's Cocoa widgets, and the tree combo is used in the Add Bookmark sheet in Safari in order to provide a good interface to choosing a folder to put the bookmark in, which is a naturally tree-based structure. It would be useful for similar applications in GTK+.
I also would appreciate such a functionality
What is the "expected manner" here ? Putting an actual tree in the popup, or have multiple popups, like submenus ?
My initial thought was as with Mac OS X, to have the tree render in the popup itself. I'll attach a screenshot after I've written this comment to demonstrate that kind of rendering. That said, doing it in a submenu style may also work very well. If it would be significantly easier to implement in that manner, it would certainly still be useful. Giving the programmer a choice of one or the other might also be good, but then there's the issue of UI consistency to worry about, as some would use it and some wouldn't and it could end up causing confusion among the users, so perhaps it's best to just do one (also less effort of course).
Created attachment 29890 [details] Screenshot of Mac OS X combo box showing tree structure of items Added screenshot of Mac OS X's combo box dropdown rendering items in a tree (this is the one which appears in Camino's 'Add Bookmark' sheet, to select a location for the bookmark to be filed in).
So, do I understand the screenshot correctly, that the tree is always fully expanded on OS X, and expanders are not drawn ?
I believe so; I'm not yet very familiar with the Aqua interface toolkit on OS X, but I've never seen one which can be collapsed or expanded. I think that kind of functionality would be a bit strange in what is effectively a pop-up menu, which is probably why they avoided it.
I have implemented trees in combo boxes in cvs HEAD now.