Package ch.bailu.gtk.gio
Class Menu
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gio.MenuModel
ch.bailu.gtk.gio.Menu
- All Implemented Interfaces:
PointerInterface
#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().
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().
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gio.MenuModel
MenuModel.OnItemsChanged
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gio.MenuModel
SIGNAL_ON_ITEMS_CHANGED
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Convenience function for appending a normal menu item to the end of
@menu.void
Convenience function for appending a normal menu item to the end of
@menu.void
appendItem
(MenuItem item) Appends @item to the end of @menu.void
appendSection
(Str label, MenuModel section) Convenience function for appending a section menu item to the end of
@menu.void
appendSection
(String label, MenuModel section) Convenience function for appending a section menu item to the end of
@menu.void
appendSubmenu
(Str label, MenuModel submenu) Convenience function for appending a submenu menu item to the end of
@menu.void
appendSubmenu
(String label, MenuModel submenu) Convenience function for appending a submenu menu item to the end of
@menu.void
freeze()
Marks @menu as frozen.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
void
Convenience function for inserting a normal menu item into @menu.void
Convenience function for inserting a normal menu item into @menu.void
insertItem
(int position, MenuItem item) Inserts @item into @menu.void
insertSection
(int position, Str label, MenuModel section) Convenience function for inserting a section menu item into @menu.void
insertSection
(int position, String label, MenuModel section) Convenience function for inserting a section menu item into @menu.void
insertSubmenu
(int position, Str label, MenuModel submenu) Convenience function for inserting a submenu menu item into @menu.void
insertSubmenu
(int position, String label, MenuModel submenu) Convenience function for inserting a submenu menu item into @menu.void
Convenience function for prepending a normal menu item to the start
of @menu.void
Convenience function for prepending a normal menu item to the start
of @menu.void
prependItem
(MenuItem item) Prepends @item to the start of @menu.void
prependSection
(Str label, MenuModel section) Convenience function for prepending a section menu item to the start
of @menu.void
prependSection
(String label, MenuModel section) Convenience function for prepending a section menu item to the start
of @menu.void
prependSubmenu
(Str label, MenuModel submenu) Convenience function for prepending a submenu menu item to the start
of @menu.void
prependSubmenu
(String label, MenuModel submenu) Convenience function for prepending a submenu menu item to the start
of @menu.void
remove
(int position) Removes an item from the menu.void
Removes all items in the menu.Methods inherited from class ch.bailu.gtk.gio.MenuModel
getItemAttribute, getItemAttribute, getItemAttributeValue, getItemAttributeValue, getItemLink, getItemLink, getNItems, isMutable, itemsChanged, iterateItemAttributes, iterateItemLinks, onItemsChanged
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Menu
-
Menu
public Menu()Creates a new #GMenu.
The new menu has no items.
-
-
Method Details
-
getClassHandler
-
append
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.- Parameters:
label
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
append
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.- Parameters:
label
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
appendItem
Appends @item to the end of @menu.
See g_menu_insert_item() for more information.- Parameters:
item
- a #GMenuItem to append
-
appendSection
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.- Parameters:
label
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
appendSection
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.- Parameters:
label
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
freeze
public void freeze()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. -
insert
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.- Parameters:
position
- the position at which to insert the itemlabel
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
insert
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.- Parameters:
position
- the position at which to insert the itemlabel
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
insertItem
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.- Parameters:
position
- the position at which to insert the itemitem
- the #GMenuItem to insert
-
insertSection
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.- Parameters:
position
- the position at which to insert the itemlabel
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
insertSection
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.- Parameters:
position
- the position at which to insert the itemlabel
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
prepend
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.- Parameters:
label
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
prepend
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.- Parameters:
label
- the section label, or %NULLdetailed_action
- the detailed action string, or %NULL
-
prependItem
Prepends @item to the start of @menu.
See g_menu_insert_item() for more information.- Parameters:
item
- a #GMenuItem to prepend
-
prependSection
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.- Parameters:
label
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
prependSection
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.- Parameters:
label
- the section label, or %NULLsection
- a #GMenuModel with the items of the section
-
remove
public void remove(int position) 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).- Parameters:
position
- the position of the item to remove
-
removeAll
public void removeAll()Removes all items in the menu. -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-