GtkMenu::set_tearoff_state
void set_tearoff_state(bool torn_off);
set_tearoff_state() when set to
true creates a non-resizeable, decorated, top-level
window, sized to fit the menu contents and iconized in the task bar.
The torn-off menu does not need a further parent window, and can act as
a standalone widget in its own right.
Where the same menu has also been set as a submenu on an existing
GtkMenuItem or as a popup, the menu data is
displayed in the currently-visible menu shell.
Note that the GtkMenu in this form is not and
cannot be made modal. It could be described as a persistent popup.
It is not possible to connect directly to the tearoff window housing the
menu, because it has not been exposed as a property in PHP-GTK - with
good reason, as the reference counting has been juggled in GTK+ to make
the widget possible in the first place. In order to connect the window's
delete event to something meaningful, you will need to do something like
this:
Notice that the
"destroy"
signal must be connected in this instance, and not the window's
"delete-event" signal. This
is because the parent window accessed is not the same window as has the
window decorations, but is capable of accessing the internal destroy
signal triggered by that window if it is given grab beforehand, and can
propagate the event to all its children.
You will also spot that this means the menu needs to be rebuilt any
time it is called.