Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.MenuItem
Description
MenuItem
is an opaque structure type. You must access it using the
functions below.
Since: 2.32
Synopsis
- newtype MenuItem = MenuItem (ManagedPtr MenuItem)
- class (GObject o, IsDescendantOf MenuItem o) => IsMenuItem o
- toMenuItem :: (MonadIO m, IsMenuItem o) => o -> m MenuItem
- type family ResolveMenuItemMethod (t :: Symbol) o where ...
- data MenuItemGetAttributeValueMethodInfo
- menuItemGetAttributeValue :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Text -> Maybe VariantType -> m (Maybe GVariant)
- data MenuItemGetLinkMethodInfo
- menuItemGetLink :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Text -> m (Maybe MenuModel)
- menuItemNew :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe Text -> m MenuItem
- menuItemNewFromModel :: (HasCallStack, MonadIO m, IsMenuModel a) => a -> Int32 -> m MenuItem
- menuItemNewSection :: (HasCallStack, MonadIO m, IsMenuModel a) => Maybe Text -> a -> m MenuItem
- menuItemNewSubmenu :: (HasCallStack, MonadIO m, IsMenuModel a) => Maybe Text -> a -> m MenuItem
- data MenuItemSetActionAndTargetValueMethodInfo
- menuItemSetActionAndTargetValue :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Maybe Text -> Maybe GVariant -> m ()
- data MenuItemSetAttributeValueMethodInfo
- menuItemSetAttributeValue :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Text -> Maybe GVariant -> m ()
- data MenuItemSetDetailedActionMethodInfo
- menuItemSetDetailedAction :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Text -> m ()
- data MenuItemSetIconMethodInfo
- menuItemSetIcon :: (HasCallStack, MonadIO m, IsMenuItem a, IsIcon b) => a -> b -> m ()
- data MenuItemSetLabelMethodInfo
- menuItemSetLabel :: (HasCallStack, MonadIO m, IsMenuItem a) => a -> Maybe Text -> m ()
- data MenuItemSetLinkMethodInfo
- menuItemSetLink :: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) => a -> Text -> Maybe b -> m ()
- data MenuItemSetSectionMethodInfo
- menuItemSetSection :: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) => a -> Maybe b -> m ()
- data MenuItemSetSubmenuMethodInfo
- menuItemSetSubmenu :: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) => a -> Maybe b -> m ()
Exported types
Memory-managed wrapper type.
Constructors
MenuItem (ManagedPtr MenuItem) |
Instances
class (GObject o, IsDescendantOf MenuItem o) => IsMenuItem o Source #
Type class for types which can be safely cast to MenuItem
, for instance with toMenuItem
.
Instances
(GObject o, IsDescendantOf MenuItem o) => IsMenuItem o Source # | |
Defined in GI.Gio.Objects.MenuItem |
toMenuItem :: (MonadIO m, IsMenuItem o) => o -> m MenuItem Source #
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAttributeValue, getData, getLink, getProperty, getQdata.
Setters
setActionAndTargetValue, setAttributeValue, setData, setDataFull, setDetailedAction, setIcon, setLabel, setLink, setProperty, setSection, setSubmenu.
type family ResolveMenuItemMethod (t :: Symbol) o where ... Source #
Equations
getAttributeValue
data MenuItemGetAttributeValueMethodInfo Source #
Instances
(signature ~ (Text -> Maybe VariantType -> m (Maybe GVariant)), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemGetAttributeValueMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemGetAttributeValueMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
menuItemGetAttributeValue Source #
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Text |
|
-> Maybe VariantType |
|
-> m (Maybe GVariant) | Returns: the attribute value, or |
getLink
data MenuItemGetLinkMethodInfo Source #
Instances
(signature ~ (Text -> m (Maybe MenuModel)), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemGetLinkMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemGetLinkMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Text |
|
-> m (Maybe MenuModel) | Returns: the link, or |
Queries the named link
on menuItem
.
Since: 2.34
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Maybe Text |
|
-> m MenuItem | Returns: a new |
Creates a new MenuItem
.
If label
is non-Nothing
it is used to set the "label" attribute of the
new item.
If detailedAction
is non-Nothing
it is used to set the "action" and
possibly the "target" attribute of the new item. See
menuItemSetDetailedAction
for more information.
Since: 2.32
newFromModel
Arguments
:: (HasCallStack, MonadIO m, IsMenuModel a) | |
=> a |
|
-> Int32 |
|
-> m MenuItem | Returns: a new |
Creates a MenuItem
as an exact copy of an existing menu item in a
MenuModel
.
itemIndex
must be valid (ie: be sure to call
menuModelGetNItems
first).
Since: 2.34
newSection
Arguments
:: (HasCallStack, MonadIO m, IsMenuModel a) | |
=> Maybe Text |
|
-> a |
|
-> m MenuItem | Returns: a new |
Creates a new MenuItem
representing a section.
This is a convenience API around menuItemNew
and
menuItemSetSection
.
The effect of having one menu appear as a section of another is
exactly as it sounds: the items from section
become a direct part of
the menu that menuItem
is added to.
Visual separation is typically displayed between two non-empty
sections. If label
is non-Nothing
then it will be incorporated into
this visual indication. This allows for labeled subsections of a
menu.
As a simple example, consider a typical "Edit" menu from a simple program. It probably contains an "Undo" and "Redo" item, followed by a separator, followed by "Cut", "Copy" and "Paste".
This would be accomplished by creating three Menu
instances. The
first would be populated with the "Undo" and "Redo" items, and the
second with the "Cut", "Copy" and "Paste" items. The first and
second menus would then be added as submenus of the third. In XML
format, this would look something like the following:
<menu id='edit-menu'> <section> <item label='Undo'/> <item label='Redo'/> </section> <section> <item label='Cut'/> <item label='Copy'/> <item label='Paste'/> </section> </menu>
The following example is exactly equivalent. It is more illustrative of the exact relationship between the menus and items (keeping in mind that the 'link' element defines a new menu that is linked to the containing one). The style of the second example is more verbose and difficult to read (and therefore not recommended except for the purpose of understanding what is really going on).
<menu id='edit-menu'> <item> <link name='section'> <item label='Undo'/> <item label='Redo'/> </link> </item> <item> <link name='section'> <item label='Cut'/> <item label='Copy'/> <item label='Paste'/> </link> </item> </menu>
Since: 2.32
newSubmenu
Arguments
:: (HasCallStack, MonadIO m, IsMenuModel a) | |
=> Maybe Text |
|
-> a |
|
-> m MenuItem | Returns: a new |
Creates a new MenuItem
representing a submenu.
This is a convenience API around menuItemNew
and
menuItemSetSubmenu
.
Since: 2.32
setActionAndTargetValue
data MenuItemSetActionAndTargetValueMethodInfo Source #
Instances
(signature ~ (Maybe Text -> Maybe GVariant -> m ()), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemSetActionAndTargetValueMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetActionAndTargetValueMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
menuItemSetActionAndTargetValue Source #
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Maybe Text |
|
-> Maybe GVariant |
|
-> m () |
Sets or unsets the "action" and "target" attributes of menuItem
.
If action
is Nothing
then both the "action" and "target" attributes
are unset (and targetValue
is ignored).
If action
is non-Nothing
then the "action" attribute is set. The
"target" attribute is then set to the value of targetValue
if it is
non-Nothing
or unset otherwise.
Normal menu items (ie: not submenu, section or other custom item
types) are expected to have the "action" attribute set to identify
the action that they are associated with. The state type of the
action help to determine the disposition of the menu item. See
Action
and ActionGroup
for an overview of actions.
In general, clicking on the menu item will result in activation of the named action with the "target" attribute given as the parameter to the action invocation. If the "target" attribute is not set then the action is invoked with no parameter.
If the action has no state then the menu item is usually drawn as a plain menu item (ie: with no additional decoration).
If the action has a boolean state then the menu item is usually drawn
as a toggle menu item (ie: with a checkmark or equivalent
indication). The item should be marked as 'toggled' or 'checked'
when the boolean state is True
.
If the action has a string state then the menu item is usually drawn
as a radio menu item (ie: with a radio bullet or equivalent
indication). The item should be marked as 'selected' when the string
state is equal to the value of the target
property.
See g_menu_item_set_action_and_target()
or
menuItemSetDetailedAction
for two equivalent calls that are
probably more convenient for most uses.
Since: 2.32
setAttributeValue
data MenuItemSetAttributeValueMethodInfo Source #
Instances
(signature ~ (Text -> Maybe GVariant -> m ()), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemSetAttributeValueMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetAttributeValueMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
menuItemSetAttributeValue Source #
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Text |
|
-> Maybe GVariant | |
-> m () |
Sets or unsets an attribute on menuItem
.
The attribute to set or unset is specified by attribute
. This
can be one of the standard attribute names MENU_ATTRIBUTE_LABEL
,
MENU_ATTRIBUTE_ACTION
, MENU_ATTRIBUTE_TARGET
, or a custom
attribute name.
Attribute names are restricted to lowercase characters, numbers
and '-'. Furthermore, the names must begin with a lowercase character,
must not end with a '-', and must not contain consecutive dashes.
must consist only of lowercase ASCII characters, digits and '-'.
If value
is non-Nothing
then it is used as the new value for the
attribute. If value
is Nothing
then the attribute is unset. If
the value
GVariant
is floating, it is consumed.
See also g_menu_item_set_attribute()
for a more convenient way to do
the same.
Since: 2.32
setDetailedAction
data MenuItemSetDetailedActionMethodInfo Source #
Instances
(signature ~ (Text -> m ()), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemSetDetailedActionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetDetailedActionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
menuItemSetDetailedAction Source #
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the "action" and possibly the "target" attribute of menuItem
.
The format of detailedAction
is the same format parsed by
actionParseDetailedName
.
See g_menu_item_set_action_and_target()
or
menuItemSetActionAndTargetValue
for more flexible (but
slightly less convenient) alternatives.
See also menuItemSetActionAndTargetValue
for a description of
the semantics of the action and target attributes.
Since: 2.32
setIcon
data MenuItemSetIconMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsMenuItem a, IsIcon b) => OverloadedMethod MenuItemSetIconMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetIconMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a, IsIcon b) | |
=> a |
|
-> b | |
-> m () |
Sets (or unsets) the icon on menuItem
.
This call is the same as calling iconSerialize
and using the
result as the value to menuItemSetAttributeValue
for
MENU_ATTRIBUTE_ICON
.
This API is only intended for use with "noun" menu items; things like bookmarks or applications in an "Open With" menu. Don't use it on menu items corresponding to verbs (eg: stock icons for 'Save' or 'Quit').
If icon
is Nothing
then the icon is unset.
Since: 2.38
setLabel
data MenuItemSetLabelMethodInfo Source #
Instances
(signature ~ (Maybe Text -> m ()), MonadIO m, IsMenuItem a) => OverloadedMethod MenuItemSetLabelMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetLabelMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
setLink
data MenuItemSetLinkMethodInfo Source #
Instances
(signature ~ (Text -> Maybe b -> m ()), MonadIO m, IsMenuItem a, IsMenuModel b) => OverloadedMethod MenuItemSetLinkMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetLinkMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) | |
=> a |
|
-> Text |
|
-> Maybe b | |
-> m () |
Creates a link from menuItem
to model
if non-Nothing
, or unsets it.
Links are used to establish a relationship between a particular menu
item and another menu. For example, MENU_LINK_SUBMENU
is used to
associate a submenu with a particular menu item, and MENU_LINK_SECTION
is used to create a section. Other types of link can be used, but there
is no guarantee that clients will be able to make sense of them.
Link types are restricted to lowercase characters, numbers
and '-'. Furthermore, the names must begin with a lowercase character,
must not end with a '-', and must not contain consecutive dashes.
Since: 2.32
setSection
data MenuItemSetSectionMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsMenuItem a, IsMenuModel b) => OverloadedMethod MenuItemSetSectionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.MenuItem Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo MenuItemSetSectionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.MenuItem Methods |
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) | |
=> a |
|
-> Maybe b | |
-> m () |
Sets or unsets the "section" link of menuItem
to section
.
The effect of having one menu appear as a section of another is
exactly as it sounds: the items from section
become a direct part of
the menu that menuItem
is added to. See menuItemNewSection
for more information about what it means for a menu item to be a
section.
Since: 2.32
setSubmenu
data MenuItemSetSubmenuMethodInfo Source #
Instances
Arguments
:: (HasCallStack, MonadIO m, IsMenuItem a, IsMenuModel b) | |
=> a |
|
-> Maybe b | |
-> m () |