I have four functions that I would like to see in the gtk library, however I am unclear where would be the best place. The first function returns the top level container (Window) given a widget within that window. The basic guts are that it runs up the widget->parent until it is NULL. However it has to do some monkeying around with the Menu stuff. The code is stolen from support.c that glade produces. Here is the basic code:- for (;;) { if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else parent = widget->parent; if (parent == NULL) break; widget = parent; } My feeling is that this should go in widget.c ----------- The second function given a container pointer will look for the currently focused widget in that container. It just runs down the container->focus_child until it reaches NULL or a non container widget. I believe this function should go in gtkcontainer.c ----------- The third function is that will detect if a given widget is editable - in particular will it receive a paste. It checks if the widget is either GtkEditable or GtkTextView and calls a suitable function to get the result (anything else is presumed to be non-editable right now). Is this the right way to do this - can anyone think of a better way? I would love it if all editable widgets shared a common ancestor somehow that I could easily test for editability. Given that I have to produce a big if/then/else thing for the different widgets (is this maintainable?), which source file should it go in? ----------- Finally I have a fourth function that has a similar problem to the last one - how given a random widget I can tell if there is anything selected. Again right now I am left with an if/then/else statement. Which source file should this go in? ----------- Damian -- Damian Ivereigh CEPS Team Lead http://wwwin-print.cisco.com Desk: +61 2 8446 6344 Mob: +61 418 217 582
Attachment:
pgpjJth8rTzkB.pgp
Description: PGP signature