package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gio/Ocgtk_gio/Gio/Wrappers/Menu/index.html
Module Wrappers.Menu
type t = [ `menu | `menu_model | `object_ ] Gobject.objval new_ : unit -> tCreate a new Menu
val remove_all : t -> unitRemoves all items in the menu.
val remove : t -> int -> unitRemoves an item from the menu.
@position gives the index of the item to remove.
It is an error if position is not in range the range from 0 to one less than the number of items in the menu.
It is not possible to remove items by identity since items are added to the menu simply by copying their links and attributes (ie: identity of the item itself is not preserved).
Convenience function for prepending a submenu menu item to the start of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.
val prepend_section :
t ->
string option ->
[ `menu_model | `object_ ] Gobject.obj ->
unitConvenience function for prepending a section menu item to the start of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.
val prepend_item : t -> [ `menu_item | `object_ ] Gobject.obj -> unitPrepends @item to the start of @menu.
See g_menu_insert_item() for more information.
val prepend : t -> string option -> string option -> unitConvenience function for prepending a normal menu item to the start of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.
Convenience function for inserting a submenu menu item into @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.
val insert_section :
t ->
int ->
string option ->
[ `menu_model | `object_ ] Gobject.obj ->
unitConvenience function for inserting a section menu item into @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.
val insert_item : t -> int -> [ `menu_item | `object_ ] Gobject.obj -> unitInserts @item into @menu.
The "insertion" is actually done by copying all of the attribute and link values of @item and using them to form a new item within @menu. As such, @item itself is not really inserted, but rather, a menu item that is exactly the same as the one presently described by @item.
This means that @item is essentially useless after the insertion occurs. Any changes you make to it are ignored unless it is inserted again (at which point its updated values will be copied).
You should probably just free @item once you're done.
There are many convenience functions to take care of common cases. See g_menu_insert(), g_menu_insert_section() and g_menu_insert_submenu() as well as "prepend" and "append" variants of each of these functions.
val insert : t -> int -> string option -> string option -> unitConvenience function for inserting a normal menu item into @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.
val freeze : t -> unitMarks @menu as frozen.
After the menu is frozen, it is an error to attempt to make any changes to it. In effect this means that the #GMenu API must no longer be used.
This function causes g_menu_model_is_mutable() to begin returning %FALSE, which has some positive performance implications.
Convenience function for appending a submenu menu item to the end of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.
val append_section :
t ->
string option ->
[ `menu_model | `object_ ] Gobject.obj ->
unitConvenience function for appending a section menu item to the end of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.
val append_item : t -> [ `menu_item | `object_ ] Gobject.obj -> unitAppends @item to the end of @menu.
See g_menu_insert_item() for more information.
val append : t -> string option -> string option -> unitConvenience function for appending a normal menu item to the end of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.