gi-gtk4-4.0.12: Gtk 4.x bindings

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.Gtk.Objects.MenuButton

Contents

- Exported types
- Methods
  - getActive
  - getAlwaysShowArrow
  - getCanShrink
  - getChild
  - getDirection
  - getHasFrame
  - getIconName
  - getLabel
  - getMenuModel
  - getPopover
  - getPrimary
  - getUseUnderline
  - new
  - popdown
  - popup
  - setActive
  - setAlwaysShowArrow
  - setCanShrink
  - setChild
  - setCreatePopupFunc
  - setDirection
  - setHasFrame
  - setIconName
  - setLabel
  - setMenuModel
  - setPopover
  - setPrimary
  - setUseUnderline
- Properties
  - active
  - alwaysShowArrow
  - canShrink
  - child
  - direction
  - hasFrame
  - iconName
  - label
  - menuModel
  - popover
  - primary
  - useUnderline
- Signals
  - activate

Description

Displays a popup when clicked.

<picture> <source srcset="menu-button-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkMenuButton" src="menu-button.png"> </picture>

This popup can be provided either as a `GtkPopover` or as an abstract `GMenuModel`.

The `GtkMenuButton` widget can show either an icon (set with the MenuButton:iconName property) or a label (set with the MenuButton:label property). If neither is explicitly set, a `Image` is automatically created, using an arrow image oriented according to MenuButton:direction or the generic “open-menu-symbolic” icon if the direction is not set.

The positioning of the popup is determined by the MenuButton:direction property of the menu button.

For menus, the Widget:halign and Widget:valign properties of the menu are also taken into account. For example, when the direction is `ArrowTypeDown` and the horizontal alignment is `AlignStart`, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”.

| | start | center | end | | - | --- | --- | --- | | down | | | | | up | | | | | left | | | | | right | | | |

# CSS nodes

    menubutton
    ╰── button.toggle
        ╰── <content>
             ╰── [arrow]

`GtkMenuButton` has a single CSS node with name `menubutton` which contains a `button` node with a `.toggle` style class.

If the button contains an icon, it will have the `.image-button` style class, if it contains text, it will have `.text-button` style class. If an arrow is visible in addition to an icon, text or a custom child, it will also have `.arrow-button` style class.

Inside the toggle button content, there is an `arrow` node for the indicator, which will carry one of the `.none`, `.up`, `.down`, `.left` or `.right` style classes to indicate the direction that the menu will appear in. The CSS is expected to provide a suitable image for each of these cases using the `-gtk-icon-source` property.

Optionally, the `menubutton` node can carry the `.circular` style class to request a round appearance.

# Accessibility

`GtkMenuButton` uses the `AccessibleRoleButton` role.

Synopsis

- newtype MenuButton = MenuButton (ManagedPtr MenuButton)
- class (GObject o, IsDescendantOf MenuButton o) => IsMenuButton o
- toMenuButton :: (MonadIO m, IsMenuButton o) => o -> m MenuButton
- menuButtonGetActive :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonGetAlwaysShowArrow :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonGetCanShrink :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonGetChild :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Widget)
- menuButtonGetDirection :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m ArrowType
- menuButtonGetHasFrame :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonGetIconName :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Text)
- menuButtonGetLabel :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Text)
- menuButtonGetMenuModel :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe MenuModel)
- menuButtonGetPopover :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m (Maybe Popover)
- menuButtonGetPrimary :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonGetUseUnderline :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m Bool
- menuButtonNew :: (HasCallStack, MonadIO m) => m MenuButton
- menuButtonPopdown :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m ()
- menuButtonPopup :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> m ()
- menuButtonSetActive :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- menuButtonSetAlwaysShowArrow :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- menuButtonSetCanShrink :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- menuButtonSetChild :: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) => a -> Maybe b -> m ()
- menuButtonSetCreatePopupFunc :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Maybe MenuButtonCreatePopupFunc -> m ()
- menuButtonSetDirection :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> ArrowType -> m ()
- menuButtonSetHasFrame :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- menuButtonSetIconName :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Text -> m ()
- menuButtonSetLabel :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Text -> m ()
- menuButtonSetMenuModel :: (HasCallStack, MonadIO m, IsMenuButton a, IsMenuModel b) => a -> Maybe b -> m ()
- menuButtonSetPopover :: (HasCallStack, MonadIO m, IsMenuButton a, IsPopover b) => a -> Maybe b -> m ()
- menuButtonSetPrimary :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- menuButtonSetUseUnderline :: (HasCallStack, MonadIO m, IsMenuButton a) => a -> Bool -> m ()
- constructMenuButtonActive :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonActive :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonActive :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- constructMenuButtonAlwaysShowArrow :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonAlwaysShowArrow :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonAlwaysShowArrow :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- constructMenuButtonCanShrink :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonCanShrink :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonCanShrink :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- clearMenuButtonChild :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonChild :: (IsMenuButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getMenuButtonChild :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Widget)
- setMenuButtonChild :: (MonadIO m, IsMenuButton o, IsWidget a) => o -> a -> m ()
- constructMenuButtonDirection :: (IsMenuButton o, MonadIO m) => ArrowType -> m (GValueConstruct o)
- getMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> m ArrowType
- setMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> ArrowType -> m ()
- constructMenuButtonHasFrame :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonHasFrame :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonHasFrame :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- constructMenuButtonIconName :: (IsMenuButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getMenuButtonIconName :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Text)
- setMenuButtonIconName :: (MonadIO m, IsMenuButton o) => o -> Text -> m ()
- constructMenuButtonLabel :: (IsMenuButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getMenuButtonLabel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Text)
- setMenuButtonLabel :: (MonadIO m, IsMenuButton o) => o -> Text -> m ()
- clearMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonMenuModel :: (IsMenuButton o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o)
- getMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe MenuModel)
- setMenuButtonMenuModel :: (MonadIO m, IsMenuButton o, IsMenuModel a) => o -> a -> m ()
- clearMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m ()
- constructMenuButtonPopover :: (IsMenuButton o, MonadIO m, IsPopover a) => a -> m (GValueConstruct o)
- getMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Popover)
- setMenuButtonPopover :: (MonadIO m, IsMenuButton o, IsPopover a) => o -> a -> m ()
- constructMenuButtonPrimary :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonPrimary :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonPrimary :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- constructMenuButtonUseUnderline :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o)
- getMenuButtonUseUnderline :: (MonadIO m, IsMenuButton o) => o -> m Bool
- setMenuButtonUseUnderline :: (MonadIO m, IsMenuButton o) => o -> Bool -> m ()
- type MenuButtonActivateCallback = IO ()
- afterMenuButtonActivate :: (IsMenuButton a, MonadIO m) => a -> ((?self :: a) => MenuButtonActivateCallback) -> m SignalHandlerId
- onMenuButtonActivate :: (IsMenuButton a, MonadIO m) => a -> ((?self :: a) => MenuButtonActivateCallback) -> m SignalHandlerId

# Exported types

newtype MenuButton Source #

Memory-managed wrapper type.

Constructors

MenuButton (ManagedPtr MenuButton) |

#### Instances

Instances details

Eq MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton Methods (==) :: MenuButton -> MenuButton -> Bool Source # (/=) :: MenuButton -> MenuButton -> Bool Source #
GObject MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton
ManagedPtrNewtype MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton Methods toManagedPtr :: MenuButton -> ManagedPtr MenuButton Source #
TypedObject MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton Methods glibType :: IO GType Source #
HasParentTypes MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton
IsGValue (Maybe MenuButton) Source # | Convert `MenuButton` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.MenuButton Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe MenuButton -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe MenuButton) Source #
type ParentTypes MenuButton Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton type ParentTypes MenuButton = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf MenuButton o) => IsMenuButton o Source #

Type class for types which can be safely cast to `MenuButton`, for instance with `toMenuButton`.

#### Instances

Instances details

(GObject o, IsDescendantOf MenuButton o) => IsMenuButton o Source # |
Instance details Defined in GI.Gtk.Objects.MenuButton

toMenuButton :: (MonadIO m, IsMenuButton o) => o -> m MenuButton Source #

Cast to `MenuButton`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, popdown, popup, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getActive, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAlwaysShowArrow, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanShrink, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasFrame, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, getLabel, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMenuModel, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPopover, getPreferredSize, getPrevSibling, getPrimary, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getUseUnderline, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setActive, setAlwaysShowArrow, setCanFocus, setCanShrink, setCanTarget, setChild, setChildVisible, setCreatePopupFunc, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasFrame, setHasTooltip, setHexpand, setHexpandSet, setIconName, setLabel, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMenuModel, setName, setOpacity, setOverflow, setParent, setPopover, setPrimary, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible.

## getActive

menuButtonGetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m Bool | Returns: TRUE if the button is active

Returns whether the menu button is active.

Since: 4.10

## getAlwaysShowArrow

menuButtonGetAlwaysShowArrow Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m Bool | Returns: whether to show a dropdown arrow even when using an icon or a custom child.

Gets whether to show a dropdown arrow even when using an icon or a custom child.

Since: 4.4

## getCanShrink

menuButtonGetCanShrink Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a button
-> m Bool | Returns: true if the button can shrink, and false otherwise

Retrieves whether the button can be smaller than the natural size of its contents.

Since: 4.12

## getChild

menuButtonGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m (Maybe Widget) | Returns: the child widget of `menuButton`

Gets the child widget of `menuButton`.

Since: 4.6

## getDirection

menuButtonGetDirection Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m ArrowType | Returns: a `GtkArrowType` value

Returns the direction the popup will be pointing at when popped up.

## getHasFrame

menuButtonGetHasFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m Bool | Returns: `True` if the button has a frame

Returns whether the button has a frame.

## getIconName

menuButtonGetIconName Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m (Maybe Text) | Returns: the name of the icon shown in the button

Gets the name of the icon shown in the button.

## getLabel

menuButtonGetLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m (Maybe Text) | Returns: the label shown in the button

Gets the label shown in the button

## getMenuModel

menuButtonGetMenuModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m (Maybe MenuModel) | Returns: a `GMenuModel`

Returns the `GMenuModel` used to generate the popup.

## getPopover

menuButtonGetPopover Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m (Maybe Popover) | Returns: a `GtkPopover` or `Nothing`

Returns the `GtkPopover` that pops out of the button.

If the button is not using a `GtkPopover`, this function returns `Nothing`.

## getPrimary

menuButtonGetPrimary Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m Bool | Returns: `True` if the button is a primary menu

Returns whether the menu button acts as a primary menu.

Since: 4.4

## getUseUnderline

menuButtonGetUseUnderline Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m Bool | Returns: `True` whether an embedded underline in the text indicates the mnemonic accelerator keys.

Returns whether an embedded underline in the text indicates a mnemonic.

## new

menuButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m MenuButton | Returns: The newly created `GtkMenuButton`

Creates a new `GtkMenuButton` widget with downwards-pointing arrow as the only child.

You can replace the child widget with another `GtkWidget` should you wish to.

## popdown

menuButtonPopdown Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m () |

Dismiss the menu.

## popup

menuButtonPopup Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> m () |

Pop up the menu.

## setActive

menuButtonSetActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Bool | `active`: whether the menu button is active
-> m () |

Sets whether the menu button is active.

Since: 4.10

## setAlwaysShowArrow

menuButtonSetAlwaysShowArrow Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Bool | `alwaysShowArrow`: whether to show a dropdown arrow even when using an icon or a custom child
-> m () |

Sets whether to show a dropdown arrow even when using an icon or a custom child.

Since: 4.4

## setCanShrink

menuButtonSetCanShrink Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a menu button
-> Bool | `canShrink`: whether the button can shrink
-> m () |

Sets whether the button size can be smaller than the natural size of its contents.

For text buttons, setting `canShrink` to true will ellipsize the label.

For icon buttons, this function has no effect.

Since: 4.12

## setChild

menuButtonSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a, IsWidget b) |
=> a | `menuButton`: a `GtkMenuButton`
-> Maybe b | `child`: the child widget
-> m () |

Sets the child widget of `menuButton`.

Setting a child resets MenuButton:label and MenuButton:iconName.

If MenuButton:alwaysShowArrow is set to `TRUE` and MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the child.

Since: 4.6

## setCreatePopupFunc

menuButtonSetCreatePopupFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Maybe MenuButtonCreatePopupFunc | `func`: function to call when a popup is about to be shown, but none has been provided via other means, or `Nothing` to reset to default behavior
-> m () |

Sets `func` to be called when a popup is about to be shown.

`func` should use one of

- `menuButtonSetPopover`
- `menuButtonSetMenuModel`

to set a popup for `menuButton`. If `func` is non-`Nothing`, `menuButton` will always be sensitive.

Using this function will not reset the menu widget attached to `menuButton`. Instead, this can be done manually in `func`.

## setDirection

menuButtonSetDirection Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> ArrowType | `direction`: a `GtkArrowType`
-> m () |

Sets the direction in which the popup will be popped up.

If the button is automatically populated with an arrow icon, its direction will be changed to match.

If the does not fit in the available space in the given direction, GTK will its best to keep it inside the screen and fully visible.

If you pass `ArrowTypeNone` for a `direction`, the popup will behave as if you passed `ArrowTypeDown` (although you won’t see any arrows).

## setHasFrame

menuButtonSetHasFrame Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Bool | `hasFrame`: whether the button should have a visible frame
-> m () |

Sets the style of the button.

## setIconName

menuButtonSetIconName Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Text | `iconName`: the icon name
-> m () |

Sets the name of an icon to show inside the menu button.

Setting icon name resets MenuButton:label and MenuButton:child.

If MenuButton:alwaysShowArrow is set to `TRUE` and MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the icon.

## setLabel

menuButtonSetLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Text | `label`: the label
-> m () |

Sets the label to show inside the menu button.

Setting a label resets MenuButton:iconName and MenuButton:child.

If MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the label.

## setMenuModel

menuButtonSetMenuModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a, IsMenuModel b) |
=> a | `menuButton`: a `GtkMenuButton`
-> Maybe b | `menuModel`: a `GMenuModel`, or `Nothing` to unset and disable the button
-> m () |

Sets the `GMenuModel` from which the popup will be constructed.

If `menuModel` is `Nothing`, the button is disabled.

A `Popover` will be created from the menu model with `popoverMenuNewFromModel`. Actions will be connected as documented for this function.

If MenuButton:popover is already set, it will be dissociated from the `menuButton`, and the property is set to `Nothing`.

## setPopover

menuButtonSetPopover Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a, IsPopover b) |
=> a | `menuButton`: a `GtkMenuButton`
-> Maybe b | `popover`: a `GtkPopover`, or `Nothing` to unset and disable the button
-> m () |

Sets the `GtkPopover` that will be popped up when the `menuButton` is clicked.

If `popover` is `Nothing`, the button is disabled.

If MenuButton:menuModel is set, the menu model is dissociated from the `menuButton`, and the property is set to `Nothing`.

## setPrimary

menuButtonSetPrimary Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Bool | `primary`: whether the menubutton should act as a primary menu
-> m () |

Sets whether menu button acts as a primary menu.

Primary menus can be opened with the <kbd>F10</kbd> key.

Since: 4.4

## setUseUnderline

menuButtonSetUseUnderline Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuButton a) |
=> a | `menuButton`: a `GtkMenuButton`
-> Bool | `useUnderline`: `True` if underlines in the text indicate mnemonics
-> m () |

If true, an underline in the text indicates a mnemonic.

# Properties

## active

Whether the menu button is active.

Since: 4.10

constructMenuButtonActive :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`active`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonActive :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`active`” property. When overloading is enabled, this is equivalent to

    get menuButton #active

setMenuButtonActive :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`active`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #active := value ]

## alwaysShowArrow

Whether to show a dropdown arrow even when using an icon or a custom child.

Since: 4.4

constructMenuButtonAlwaysShowArrow :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`always-show-arrow`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonAlwaysShowArrow :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`always-show-arrow`” property. When overloading is enabled, this is equivalent to

    get menuButton #alwaysShowArrow

setMenuButtonAlwaysShowArrow :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`always-show-arrow`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #alwaysShowArrow := value ]

## canShrink

Whether the size of the button can be made smaller than the natural size of its contents.

Since: 4.12

constructMenuButtonCanShrink :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`can-shrink`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonCanShrink :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`can-shrink`” property. When overloading is enabled, this is equivalent to

    get menuButton #canShrink

setMenuButtonCanShrink :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`can-shrink`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #canShrink := value ]

## child

The child widget.

Since: 4.6

clearMenuButtonChild :: (MonadIO m, IsMenuButton o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructMenuButtonChild :: (IsMenuButton o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonChild :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get menuButton #child

setMenuButtonChild :: (MonadIO m, IsMenuButton o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #child := value ]

## direction

The `GtkArrowType` representing the direction in which the menu or popover will be popped out.

constructMenuButtonDirection :: (IsMenuButton o, MonadIO m) => ArrowType -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`direction`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> m ArrowType Source #

Get the value of the “`direction`” property. When overloading is enabled, this is equivalent to

    get menuButton #direction

setMenuButtonDirection :: (MonadIO m, IsMenuButton o) => o -> ArrowType -> m () Source #

Set the value of the “`direction`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #direction := value ]

## hasFrame

Whether the button has a frame.

constructMenuButtonHasFrame :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`has-frame`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonHasFrame :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`has-frame`” property. When overloading is enabled, this is equivalent to

    get menuButton #hasFrame

setMenuButtonHasFrame :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`has-frame`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #hasFrame := value ]

## iconName

The name of the icon used to automatically populate the button.

constructMenuButtonIconName :: (IsMenuButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`icon-name`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonIconName :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Text) Source #

Get the value of the “`icon-name`” property. When overloading is enabled, this is equivalent to

    get menuButton #iconName

setMenuButtonIconName :: (MonadIO m, IsMenuButton o) => o -> Text -> m () Source #

Set the value of the “`icon-name`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #iconName := value ]

## label

The label for the button.

constructMenuButtonLabel :: (IsMenuButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`label`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonLabel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Text) Source #

Get the value of the “`label`” property. When overloading is enabled, this is equivalent to

    get menuButton #label

setMenuButtonLabel :: (MonadIO m, IsMenuButton o) => o -> Text -> m () Source #

Set the value of the “`label`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #label := value ]

## menuModel

The `GMenuModel` from which the popup will be created.

See `menuButtonSetMenuModel` for the interaction with the MenuButton:popover property.

clearMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m () Source #

Set the value of the “`menu-model`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #menuModel

constructMenuButtonMenuModel :: (IsMenuButton o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`menu-model`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonMenuModel :: (MonadIO m, IsMenuButton o) => o -> m (Maybe MenuModel) Source #

Get the value of the “`menu-model`” property. When overloading is enabled, this is equivalent to

    get menuButton #menuModel

setMenuButtonMenuModel :: (MonadIO m, IsMenuButton o, IsMenuModel a) => o -> a -> m () Source #

Set the value of the “`menu-model`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #menuModel := value ]

## popover

The `GtkPopover` that will be popped up when the button is clicked.

clearMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m () Source #

Set the value of the “`popover`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #popover

constructMenuButtonPopover :: (IsMenuButton o, MonadIO m, IsPopover a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`popover`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonPopover :: (MonadIO m, IsMenuButton o) => o -> m (Maybe Popover) Source #

Get the value of the “`popover`” property. When overloading is enabled, this is equivalent to

    get menuButton #popover

setMenuButtonPopover :: (MonadIO m, IsMenuButton o, IsPopover a) => o -> a -> m () Source #

Set the value of the “`popover`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #popover := value ]

## primary

Whether the menu button acts as a primary menu.

Primary menus can be opened using the <kbd>F10</kbd> key

Since: 4.4

constructMenuButtonPrimary :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`primary`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonPrimary :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`primary`” property. When overloading is enabled, this is equivalent to

    get menuButton #primary

setMenuButtonPrimary :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`primary`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #primary := value ]

## useUnderline

If set an underscore in the text indicates a mnemonic.

constructMenuButtonUseUnderline :: (IsMenuButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`use-underline`” property. This is rarely needed directly, but it is used by `new`.

getMenuButtonUseUnderline :: (MonadIO m, IsMenuButton o) => o -> m Bool Source #

Get the value of the “`use-underline`” property. When overloading is enabled, this is equivalent to

    get menuButton #useUnderline

setMenuButtonUseUnderline :: (MonadIO m, IsMenuButton o) => o -> Bool -> m () Source #

Set the value of the “`use-underline`” property. When overloading is enabled, this is equivalent to

    set menuButton [ #useUnderline := value ]

# Signals

## activate

type MenuButtonActivateCallback = IO () Source #

Emitted to when the menu button is activated.

The `::activate` signal on `GtkMenuButton` is an action signal and emitting it causes the button to pop up its menu.

Since: 4.4

afterMenuButtonActivate :: (IsMenuButton a, MonadIO m) => a -> ((?self :: a) => MenuButtonActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after menuButton #activate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onMenuButtonActivate :: (IsMenuButton a, MonadIO m) => a -> ((?self :: a) => MenuButtonActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on menuButton #activate callback