Emitted when a context menu is about to be displayed to give the application a chance to customize the proposed menu, prevent the menu from being displayed, or build its own context menu.
<itemizedlist> <listitem><para> To customize the proposed menu you can use
prepend, append
or insert to add new
ContextMenuItem<!-- -->s to context_menu
, move_item
to reorder existing items, or remove to remove an existing item. The
signal handler should return false, and the menu represented by context_menu
will be
shown. </para></listitem> <listitem><para> To prevent the menu from being displayed you can just connect to this
signal and return true so that the proposed menu will not be shown. </para></listitem> <
listitem><para> To build your own menu, you can remove all items from the proposed menu with
remove_all, add your own items and return false
so that the menu will be shown. You can also ignore the proposed ContextMenu,
build your own Menu and return true to prevent the proposed menu from being
shown. </para></listitem> <listitem><para> If you just want the default menu to be shown always, simply don't
connect to this signal because showing the proposed context menu is the default behaviour. </para></listitem> <
/itemizedlist>
The event
is expected to be one of the following types: <itemizedlist> <listitem><para> a
EventButton of type gdk_button_press when the context menu was triggered with
mouse. </para></listitem> <listitem><para> a EventKey of type
gdk_key_press if the keyboard was used to show the menu. </para></listitem> <listitem>
<para> a generic Event of type gdk_nothing when the
popup_menu signal was used to show the context menu. </para></listitem> </itemizedlist>
If the signal handler returns false the context menu represented by context_menu
will be
shown, if it return true the context menu will not be shown.
The proposed ContextMenu passed in context_menu
argument is only valid
during the signal emission.
context_menu |
the proposed ContextMenu |
event |
the Event that triggered the context menu |
hit_test_result |
true to stop other handlers from being invoked for the event. false to propagate the event further. |