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.PopoverMenuBar

Contents

- Exported types
- Methods
  - addChild
  - getMenuModel
  - newFromModel
  - removeChild
  - setMenuModel
- Properties
  - menuModel

Description

Presents a horizontal bar of items that pop up menus when clicked.

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

The only way to create instances of `GtkPopoverMenuBar` is from a `GMenuModel`.

# CSS nodes

    menubar
    ├── item[.active]
    ┊   ╰── popover
    ╰── item
        ╰── popover

`GtkPopoverMenuBar` has a single CSS node with name menubar, below which each item has its CSS node, and below that the corresponding popover.

The item whose popover is currently open gets the .active style class.

# Accessibility

`GtkPopoverMenuBar` uses the `AccessibleRoleMenuBar` role, the menu items use the `AccessibleRoleMenuItem` role and the menus use the `AccessibleRoleMenu` role.

Synopsis

- newtype PopoverMenuBar = PopoverMenuBar (ManagedPtr PopoverMenuBar)
- class (GObject o, IsDescendantOf PopoverMenuBar o) => IsPopoverMenuBar o
- toPopoverMenuBar :: (MonadIO m, IsPopoverMenuBar o) => o -> m PopoverMenuBar
- popoverMenuBarAddChild :: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsWidget b) => a -> b -> Text -> m Bool
- popoverMenuBarGetMenuModel :: (HasCallStack, MonadIO m, IsPopoverMenuBar a) => a -> m (Maybe MenuModel)
- popoverMenuBarNewFromModel :: (HasCallStack, MonadIO m, IsMenuModel a) => Maybe a -> m PopoverMenuBar
- popoverMenuBarRemoveChild :: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsWidget b) => a -> b -> m Bool
- popoverMenuBarSetMenuModel :: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsMenuModel b) => a -> Maybe b -> m ()
- clearPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o) => o -> m ()
- constructPopoverMenuBarMenuModel :: (IsPopoverMenuBar o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o)
- getPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o) => o -> m (Maybe MenuModel)
- setPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o, IsMenuModel a) => o -> a -> m ()

# Exported types

newtype PopoverMenuBar Source #

Memory-managed wrapper type.

Constructors

PopoverMenuBar (ManagedPtr PopoverMenuBar) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf PopoverMenuBar o) => IsPopoverMenuBar o Source #

Type class for types which can be safely cast to `PopoverMenuBar`, for instance with `toPopoverMenuBar`.

#### Instances

Instances details

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

toPopoverMenuBar :: (MonadIO m, IsPopoverMenuBar o) => o -> m PopoverMenuBar Source #

Cast to `PopoverMenuBar`, 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, addChild, 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, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeChild, 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, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMenuModel, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMenuModel, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## addChild

popoverMenuBarAddChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsWidget b) |
=> a | `bar`: a `GtkPopoverMenuBar`
-> b | `child`: the `GtkWidget` to add
-> Text | `id`: the ID to insert `child` at
-> m Bool | Returns: `True` if `id` was found and the widget added

Adds a custom widget to a generated menubar.

For this to work, the menu model of `bar` must have an item with a `custom` attribute that matches `id`.

## getMenuModel

popoverMenuBarGetMenuModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopoverMenuBar a) |
=> a | `bar`: a `GtkPopoverMenuBar`
-> m (Maybe MenuModel) | Returns: a `GMenuModel`

Returns the model from which the contents of `bar` are taken.

## newFromModel

popoverMenuBarNewFromModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuModel a) |
=> Maybe a | `model`: a `GMenuModel`
-> m PopoverMenuBar | Returns: a new `GtkPopoverMenuBar`

Creates a `GtkPopoverMenuBar` from a `GMenuModel`.

## removeChild

popoverMenuBarRemoveChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsWidget b) |
=> a | `bar`: a `GtkPopoverMenuBar`
-> b | `child`: the `GtkWidget` to remove
-> m Bool | Returns: `True` if the widget was removed

Removes a widget that has previously been added with `popoverMenuBarAddChild`.

## setMenuModel

popoverMenuBarSetMenuModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopoverMenuBar a, IsMenuModel b) |
=> a | `bar`: a `GtkPopoverMenuBar`
-> Maybe b | `model`: a `GMenuModel`
-> m () |

Sets a menu model from which `bar` should take its contents.

# Properties

## menuModel

The `GMenuModel` from which the menu bar is created.

The model should only contain submenus as toplevel elements.

clearPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o) => o -> m () Source #

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

    clear #menuModel

constructPopoverMenuBarMenuModel :: (IsPopoverMenuBar 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`.

getPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o) => o -> m (Maybe MenuModel) Source #

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

    get popoverMenuBar #menuModel

setPopoverMenuBarMenuModel :: (MonadIO m, IsPopoverMenuBar o, IsMenuModel a) => o -> a -> m () Source #

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

    set popoverMenuBar [ #menuModel := value ]