gi-gtk-3.0.43: Gtk 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.MenuToolButton

Contents

- Exported types
- Methods
  - getMenu
  - new
  - newFromStock
  - setArrowTooltipMarkup
  - setArrowTooltipText
  - setMenu
- Properties
  - menu
- Signals
  - showMenu

Description

A `MenuToolButton` is a `ToolItem` that contains a button and a small additional button with an arrow. When clicked, the arrow button pops up a dropdown menu.

Use `menuToolButtonNew` to create a new `MenuToolButton`.

# GtkMenuToolButton as GtkBuildable

The GtkMenuToolButton implementation of the GtkBuildable interface supports adding a menu by specifying “menu” as the “type” attribute of a `<child>` element.

An example for a UI definition fragment with menus:

### xml code

    <object class="GtkMenuToolButton">
      <child type="menu">
        <object class="GtkMenu"/>
      </child>
    </object>

Synopsis

- newtype MenuToolButton = MenuToolButton (ManagedPtr MenuToolButton)
- class (GObject o, IsDescendantOf MenuToolButton o) => IsMenuToolButton o
- toMenuToolButton :: (MonadIO m, IsMenuToolButton o) => o -> m MenuToolButton
- menuToolButtonGetMenu :: (HasCallStack, MonadIO m, IsMenuToolButton a) => a -> m Widget
- menuToolButtonNew :: (HasCallStack, MonadIO m, IsWidget a) => Maybe a -> Maybe Text -> m MenuToolButton
- menuToolButtonNewFromStock :: (HasCallStack, MonadIO m) => Text -> m MenuToolButton
- menuToolButtonSetArrowTooltipMarkup :: (HasCallStack, MonadIO m, IsMenuToolButton a) => a -> Text -> m ()
- menuToolButtonSetArrowTooltipText :: (HasCallStack, MonadIO m, IsMenuToolButton a) => a -> Text -> m ()
- menuToolButtonSetMenu :: (HasCallStack, MonadIO m, IsMenuToolButton a, IsWidget b) => a -> b -> m ()
- clearMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o) => o -> m ()
- constructMenuToolButtonMenu :: (IsMenuToolButton o, MonadIO m, IsMenu a) => a -> m (GValueConstruct o)
- getMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o) => o -> m (Maybe Menu)
- setMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o, IsMenu a) => o -> a -> m ()
- type MenuToolButtonShowMenuCallback = IO ()
- afterMenuToolButtonShowMenu :: (IsMenuToolButton a, MonadIO m) => a -> ((?self :: a) => MenuToolButtonShowMenuCallback) -> m SignalHandlerId
- onMenuToolButtonShowMenu :: (IsMenuToolButton a, MonadIO m) => a -> ((?self :: a) => MenuToolButtonShowMenuCallback) -> m SignalHandlerId

# Exported types

newtype MenuToolButton Source #

Memory-managed wrapper type.

Constructors

MenuToolButton (ManagedPtr MenuToolButton) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf MenuToolButton o) => IsMenuToolButton o Source #

Type class for types which can be safely cast to `MenuToolButton`, for instance with `toMenuToolButton`.

#### Instances

Instances details

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

toMenuToolButton :: (MonadIO m, IsMenuToolButton o) => o -> m MenuToolButton Source #

Cast to `MenuToolButton`, 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

activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, doSetRelatedAction, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, rebuildMenu, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, retrieveProxyMenuItem, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, syncActionProperties, thawChildNotify, thawNotify, toolbarReconfigured, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.

#### Getters

getAccessible, getActionGroup, getActionName, getActionTargetValue, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEllipsizeMode, getEvents, getExpand, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getHomogeneous, getIconName, getIconSize, getIconWidget, getInternalChild, getIsImportant, getLabel, getLabelWidget, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getMenu, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getOrientation, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getProxyMenuItem, getQdata, getRealized, getReceivesDefault, getRelatedAction, getReliefStyle, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStockId, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTextAlignment, getTextOrientation, getTextSizeGroup, getToolbarStyle, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getUseActionAppearance, getUseDragWindow, getUseUnderline, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisibleHorizontal, getVisibleVertical, getVisual, getWindow.

#### Setters

setAccelPath, setActionName, setActionTargetValue, setAllocation, setAppPaintable, setArrowTooltipMarkup, setArrowTooltipText, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDetailedActionName, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setExpand, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setHomogeneous, setIconName, setIconWidget, setIsImportant, setLabel, setLabelWidget, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setMenu, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setProxyMenuItem, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setRelatedAction, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStockId, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setUseActionAppearance, setUseDragWindow, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible, setVisibleHorizontal, setVisibleVertical, setVisual, setWindow.

## getMenu

menuToolButtonGetMenu Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuToolButton a) |
=> a | `button`: a `MenuToolButton`
-> m Widget | Returns: the `Menu` associated with `MenuToolButton`

Gets the `Menu` associated with `MenuToolButton`.

Since: 2.6

## new

menuToolButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) |
=> Maybe a | `iconWidget`: a widget that will be used as icon widget, or `Nothing`
-> Maybe Text | `label`: a string that will be used as label, or `Nothing`
-> m MenuToolButton | Returns: the new `MenuToolButton`

Creates a new `MenuToolButton` using `iconWidget` as icon and `label` as label.

Since: 2.6

## newFromStock

menuToolButtonNewFromStock Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `stockId`: the name of a stock item
-> m MenuToolButton | Returns: the new `MenuToolButton`

Deprecated: (Since version 3.10)Use `menuToolButtonNew` instead.

Creates a new `MenuToolButton`. The new `MenuToolButton` will contain an icon and label from the stock item indicated by `stockId`.

Since: 2.6

## setArrowTooltipMarkup

menuToolButtonSetArrowTooltipMarkup Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuToolButton a) |
=> a | `button`: a `MenuToolButton`
-> Text | `markup`: markup text to be used as tooltip text for button’s arrow button
-> m () |

Sets the tooltip markup text to be used as tooltip for the arrow button which pops up the menu. See `toolItemSetTooltipText` for setting a tooltip on the whole `MenuToolButton`.

Since: 2.12

## setArrowTooltipText

menuToolButtonSetArrowTooltipText Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuToolButton a) |
=> a | `button`: a `MenuToolButton`
-> Text | `text`: text to be used as tooltip text for button’s arrow button
-> m () |

Sets the tooltip text to be used as tooltip for the arrow button which pops up the menu. See `toolItemSetTooltipText` for setting a tooltip on the whole `MenuToolButton`.

Since: 2.12

## setMenu

menuToolButtonSetMenu Source #

Arguments

:: (HasCallStack, MonadIO m, IsMenuToolButton a, IsWidget b) |
=> a | `button`: a `MenuToolButton`
-> b | `menu`: the `Menu` associated with `MenuToolButton`
-> m () |

Sets the `Menu` that is popped up when the user clicks on the arrow. If `menu` is NULL, the arrow button becomes insensitive.

Since: 2.6

# Properties

## menu

No description available in the introspection data.

clearMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o) => o -> m () Source #

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

    clear #menu

constructMenuToolButtonMenu :: (IsMenuToolButton o, MonadIO m, IsMenu a) => a -> m (GValueConstruct o) Source #

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

getMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o) => o -> m (Maybe Menu) Source #

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

    get menuToolButton #menu

setMenuToolButtonMenu :: (MonadIO m, IsMenuToolButton o, IsMenu a) => o -> a -> m () Source #

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

    set menuToolButton [ #menu := value ]

# Signals

## showMenu

type MenuToolButtonShowMenuCallback = IO () Source #

The showMenu signal is emitted before the menu is shown.

It can be used to populate the menu on demand, using `menuToolButtonSetMenu`.

Note that even if you populate the menu dynamically in this way, you must set an empty menu on the `MenuToolButton` beforehand, since the arrow is made insensitive if the menu is not set.

afterMenuToolButtonShowMenu :: (IsMenuToolButton a, MonadIO m) => a -> ((?self :: a) => MenuToolButtonShowMenuCallback) -> m SignalHandlerId Source #

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

    after menuToolButton #showMenu 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.

onMenuToolButtonShowMenu :: (IsMenuToolButton a, MonadIO m) => a -> ((?self :: a) => MenuToolButtonShowMenuCallback) -> m SignalHandlerId Source #

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

    on menuToolButton #showMenu callback