Option menu sizes




Here's as problem/bug that somebody might want to work on:

Currently, option menus only recalculate there size when a
menu is added to them, not when the menu items in the menu
change size themselves. (The requested size of a option menu
contains enough space for the largest child)

However, since gtk_option_menu_show_all() also calls
show_all() for the menu, many people are not calling
gtk_widget_show_all() on the menu before adding it to the
option menu, so the option menu calculates its size
incorrectly.

You can find examples of option menus with incorrect
vertical size allocations all over the place in GNOME.

I think the right thing to do is probably to have the
OptionMenu connect_after() to "size_request" on its menu,
and at that point, call gtk_option_menu_calc_size() and
queue a resize if the size changed.

But the problem with this might be that "size_request" won't
get emitted until the resize queue is run, so when the
OptionMenu calculates its size, the queue_resize() it calls
will cause another resize pass. (I'm not sure if this will
happen or not) So a different approach might be needed.

Any takers to look into this? 

                                  Owen

P.S. for testing purposes, gnome-utils/mini-utils/gcolorsel
has a good example of a messed up size allocation for a
option menu.



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