Re: Why don't GtkMenu have parents?



Damian Ivereigh <damian cisco com> writes:

> Can anyone think of good reason why GtkMenu objects don't have a parent.
> I would expect them to be parented by the Widget that they are attached
> to - e.g. in the case of the menu bar at the top, the drop down menu
> when you hit file is not parented by the "File" menu item.
> 
> If it was it would make tracing up the tree (to find the top level
> window) that much easier.
> 
> Or am I misunderstanding something here.

Parent/child relationships in GTK+ refer to physical containership -
that is, 

 widget->window is always a child of window owned by the parent
 widget->allocation is contained completely within widget->parent->allocation.

Now, there is an ugly exception to that for GtkHandleBox because
of it's reparenting nature, but we don't want to extend that
exception elsewhere.

So, we use GtkMenuShell->parent_menu_shell instead to handle this.

Regards,
                                        Owen



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