class Gio::Menu
- Gio::Menu
- Gio::MenuModel
- GObject::Object
- Reference
- Object
Overview
#GMenu is a simple implementation of #GMenuModel. You populate a #GMenu by adding #GMenuItem instances to it.
There are some convenience functions to allow you to directly add items (avoiding #GMenuItem) for the common cases. To add a regular item, use g_menu_insert(). To add a section, use g_menu_insert_section(). To add a submenu, use g_menu_insert_submenu().
Defined in:
lib/gi-crystal/src/auto/gio-2.0/menu.crConstructors
-
.new : self
Creates a new #GMenu.
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#append(label : String | Nil, detailed_action : String | Nil) : Nil
Convenience function for appending a normal menu item to the end of menu.
-
#append_item(item : Gio::MenuItem) : Nil
Appends item to the end of menu.
-
#append_section(label : String | Nil, section : Gio::MenuModel) : Nil
Convenience function for appending a section menu item to the end of menu.
-
#append_submenu(label : String | Nil, submenu : Gio::MenuModel) : Nil
Convenience function for appending a submenu menu item to the end of menu.
-
#freeze : Nil
Marks menu as frozen.
-
#hash(hasher)
See
Object#hash(hasher)
-
#insert(position : Int32, label : String | Nil, detailed_action : String | Nil) : Nil
Convenience function for inserting a normal menu item into menu.
-
#insert_item(position : Int32, item : Gio::MenuItem) : Nil
Inserts item into menu.
-
#insert_section(position : Int32, label : String | Nil, section : Gio::MenuModel) : Nil
Convenience function for inserting a section menu item into menu.
-
#insert_submenu(position : Int32, label : String | Nil, submenu : Gio::MenuModel) : Nil
Convenience function for inserting a submenu menu item into menu.
-
#prepend(label : String | Nil, detailed_action : String | Nil) : Nil
Convenience function for prepending a normal menu item to the start of menu.
-
#prepend_item(item : Gio::MenuItem) : Nil
Prepends item to the start of menu.
-
#prepend_section(label : String | Nil, section : Gio::MenuModel) : Nil
Convenience function for prepending a section menu item to the start of menu.
-
#prepend_submenu(label : String | Nil, submenu : Gio::MenuModel) : Nil
Convenience function for prepending a submenu menu item to the start of menu.
-
#remove(position : Int32) : Nil
Removes an item from the menu.
-
#remove_all : Nil
Removes all items in the menu.
Instance methods inherited from class Gio::MenuModel
==(other : self)
==,
hash(hasher)
hash,
is_mutable : Bool
is_mutable,
item_attribute_value(item_index : Int32, attribute : String, expected_type : GLib::VariantType | Nil) : GLib::Variant | Nil
item_attribute_value,
item_link(item_index : Int32, link : String) : Gio::MenuModel | Nil
item_link,
items_changed(position : Int32, removed : Int32, added : Int32) : Nil
items_changed,
items_changed_signal
items_changed_signal,
iterate_item_attributes(item_index : Int32) : Gio::MenuAttributeIter
iterate_item_attributes,
iterate_item_links(item_index : Int32) : Gio::MenuLinkIter
iterate_item_links,
n_items : Int32
n_items
Constructor methods inherited from class Gio::MenuModel
new
new
Class methods inherited from class Gio::MenuModel
g_type : UInt64
g_type
Instance methods inherited from class GObject::Object
==(other : self)
==,
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void) | Nil
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
hash(hasher)
hash,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void) | Nil
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void) | Nil) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void) | Nil
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void) | Nil
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
cast?(obj : GObject::Object) : self | Nil
cast?,
compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Macros inherited from class GObject::Object
previous_vfunc(*args)
previous_vfunc,
previous_vfunc!(*args)
previous_vfunc!,
signal(signature)
signal
Constructor Detail
Class Method Detail
Returns the type id (GType) registered in GLib type system.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Convenience 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.
Appends item to the end of menu.
See g_menu_insert_item() for more information.
Convenience 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.
Marks 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 inserting a normal menu item into menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.
Inserts 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.
Convenience 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.
Convenience 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.
Prepends item to the start of menu.
See g_menu_insert_item() for more information.
Convenience 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.
Removes 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).